Commit 705e63d2 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Felipe Balbi

usb: musb: core: fix order of arguments to ulpi write callback

There is a bit of a mess in the order of arguments to the ulpi write
callback. There is

	int ulpi_write(struct ulpi *ulpi, u8 addr, u8 val)

in drivers/usb/common/ulpi.c;

	struct usb_phy_io_ops {
		...
		int (*write)(struct usb_phy *x, u32 val, u32 reg);
	}

in include/linux/usb/phy.h.

The callback registered by the musb driver has to comply to the latter,
but up to now had "offset" first which effectively made the function
broken for correct users. So flip the order and while at it also
switch to the parameter names of struct usb_phy_io_ops's write.

Fixes: ffb865b1 ("usb: musb: add ulpi access operations")
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent b4c580a4
...@@ -132,7 +132,7 @@ static inline struct musb *dev_to_musb(struct device *dev) ...@@ -132,7 +132,7 @@ static inline struct musb *dev_to_musb(struct device *dev)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
#ifndef CONFIG_BLACKFIN #ifndef CONFIG_BLACKFIN
static int musb_ulpi_read(struct usb_phy *phy, u32 offset) static int musb_ulpi_read(struct usb_phy *phy, u32 reg)
{ {
void __iomem *addr = phy->io_priv; void __iomem *addr = phy->io_priv;
int i = 0; int i = 0;
...@@ -151,7 +151,7 @@ static int musb_ulpi_read(struct usb_phy *phy, u32 offset) ...@@ -151,7 +151,7 @@ static int musb_ulpi_read(struct usb_phy *phy, u32 offset)
* ULPICarKitControlDisableUTMI after clearing POWER_SUSPENDM. * ULPICarKitControlDisableUTMI after clearing POWER_SUSPENDM.
*/ */
musb_writeb(addr, MUSB_ULPI_REG_ADDR, (u8)offset); musb_writeb(addr, MUSB_ULPI_REG_ADDR, (u8)reg);
musb_writeb(addr, MUSB_ULPI_REG_CONTROL, musb_writeb(addr, MUSB_ULPI_REG_CONTROL,
MUSB_ULPI_REG_REQ | MUSB_ULPI_RDN_WR); MUSB_ULPI_REG_REQ | MUSB_ULPI_RDN_WR);
...@@ -176,7 +176,7 @@ static int musb_ulpi_read(struct usb_phy *phy, u32 offset) ...@@ -176,7 +176,7 @@ static int musb_ulpi_read(struct usb_phy *phy, u32 offset)
return ret; return ret;
} }
static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data) static int musb_ulpi_write(struct usb_phy *phy, u32 val, u32 reg)
{ {
void __iomem *addr = phy->io_priv; void __iomem *addr = phy->io_priv;
int i = 0; int i = 0;
...@@ -191,8 +191,8 @@ static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data) ...@@ -191,8 +191,8 @@ static int musb_ulpi_write(struct usb_phy *phy, u32 offset, u32 data)
power &= ~MUSB_POWER_SUSPENDM; power &= ~MUSB_POWER_SUSPENDM;
musb_writeb(addr, MUSB_POWER, power); musb_writeb(addr, MUSB_POWER, power);
musb_writeb(addr, MUSB_ULPI_REG_ADDR, (u8)offset); musb_writeb(addr, MUSB_ULPI_REG_ADDR, (u8)reg);
musb_writeb(addr, MUSB_ULPI_REG_DATA, (u8)data); musb_writeb(addr, MUSB_ULPI_REG_DATA, (u8)val);
musb_writeb(addr, MUSB_ULPI_REG_CONTROL, MUSB_ULPI_REG_REQ); musb_writeb(addr, MUSB_ULPI_REG_CONTROL, MUSB_ULPI_REG_REQ);
while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL) while (!(musb_readb(addr, MUSB_ULPI_REG_CONTROL)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment