diff options
author | Tony Lindgren <tony@atomide.com> | 2015-03-19 17:10:16 -0700 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2015-03-24 11:36:38 -0500 |
commit | 3e457371f436e89ce9239674828f9729a36b2595 (patch) | |
tree | b0304a33282ac2d4ef4c9dff5b46df3814ffdfaf /drivers/usb/musb/musb_dsps.c | |
parent | 1ea276cbfc0201c9804f38474f3ec2c4488a2fc6 (diff) | |
download | op-kernel-dev-3e457371f436e89ce9239674828f9729a36b2595.zip op-kernel-dev-3e457371f436e89ce9239674828f9729a36b2595.tar.gz |
usb: musb: Fix fifo reads for dm816x with musb_dsps
Looks like dm81xx can only do 32-bit fifo reads like am35x. Let's set
up musb-dsps with a custom read_fifo function based on the compatible
flag.
Otherwise we can get the following errors when starting dhclient on a
asix USB Ethernet adapter:
asix 2-1:1.0 eth2: asix_rx_fixup() Bad Header Length 0xffff003c, offset 4
While at it, let's also remove pointless cast of the driver data.
Cc: Bin Liu <binmlist@gmail.com>
Cc: Brian Hutchinson <b.hutchman@gmail.com>
Cc: George Cherian <george.cherian@ti.com>
Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/musb/musb_dsps.c')
-rw-r--r-- | drivers/usb/musb/musb_dsps.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 09648b4..b23ad15 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -615,6 +615,24 @@ static int dsps_musb_recover(struct musb *musb) return session_restart ? 0 : -EPIPE; } +/* Similar to am35x, dm81xx support only 32-bit read operation */ +static void dsps_read_fifo32(struct musb_hw_ep *hw_ep, u16 len, u8 *dst) +{ + void __iomem *fifo = hw_ep->fifo; + + if (len >= 4) { + readsl(fifo, dst, len >> 2); + dst += len & ~0x03; + len &= 0x03; + } + + /* Read any remaining 1 to 3 bytes */ + if (len > 0) { + u32 val = musb_readl(fifo, 0); + memcpy(dst, &val, len); + } +} + static struct musb_platform_ops dsps_ops = { .quirks = MUSB_INDEXED_EP, .init = dsps_musb_init, @@ -761,6 +779,9 @@ static int dsps_probe(struct platform_device *pdev) } wrp = match->data; + if (of_device_is_compatible(pdev->dev.of_node, "ti,musb-dm816")) + dsps_ops.read_fifo = dsps_read_fifo32; + /* allocate glue */ glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL); if (!glue) @@ -837,7 +858,9 @@ static const struct dsps_musb_wrapper am33xx_driver_data = { static const struct of_device_id musb_dsps_of_match[] = { { .compatible = "ti,musb-am33xx", - .data = (void *) &am33xx_driver_data, }, + .data = &am33xx_driver_data, }, + { .compatible = "ti,musb-dm816", + .data = &am33xx_driver_data, }, { }, }; MODULE_DEVICE_TABLE(of, musb_dsps_of_match); |