diff options
| author | Ajay Kumar Gupta <ajay.gupta@ti.com> | 2010-10-19 03:08:13 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-10-22 13:22:17 -0400 |
| commit | 843bb1d0ff29b96eeb184988223ba55e3e8c2f57 (patch) | |
| tree | cfddfb6141e53f86a107803ebddfcc18996737de | |
| parent | eb83092c2b24587719c917a1d6a5b682eeaa03df (diff) | |
USB: musb: AM35x: Workaround for fifo read issue
AM35x supports only 32bit read operations so we need to have
workaround for 8bit and 16bit read operations.
Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
| -rw-r--r-- | drivers/usb/musb/am35x.c | 30 | ||||
| -rw-r--r-- | drivers/usb/musb/musb_core.c | 2 |
2 files changed, 32 insertions, 0 deletions
diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c index 53962a0389eb..b0aabf3a606f 100644 --- a/drivers/usb/musb/am35x.c +++ b/drivers/usb/musb/am35x.c | |||
| @@ -492,3 +492,33 @@ void musb_platform_restore_context(struct musb *musb, | |||
| 492 | phy_on(); | 492 | phy_on(); |
| 493 | } | 493 | } |
| 494 | #endif | 494 | #endif |
| 495 | |||
| 496 | /* AM35x supports only 32bit read operation */ | ||
| 497 | void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst) | ||
| 498 | { | ||
| 499 | void __iomem *fifo = hw_ep->fifo; | ||
| 500 | u32 val; | ||
| 501 | int i; | ||
| 502 | |||
| 503 | /* Read for 32bit-aligned destination address */ | ||
| 504 | if (likely((0x03 & (unsigned long) dst) == 0) && len >= 4) { | ||
| 505 | readsl(fifo, dst, len >> 2); | ||
| 506 | dst += len & ~0x03; | ||
| 507 | len &= 0x03; | ||
| 508 | } | ||
| 509 | /* | ||
| 510 | * Now read the remaining 1 to 3 byte or complete length if | ||
| 511 | * unaligned address. | ||
| 512 | */ | ||
| 513 | if (len > 4) { | ||
| 514 | for (i = 0; i < (len >> 2); i++) { | ||
| 515 | *(u32 *) dst = musb_readl(fifo, 0); | ||
| 516 | dst += 4; | ||
| 517 | } | ||
| 518 | len &= 0x03; | ||
| 519 | } | ||
| 520 | if (len > 0) { | ||
| 521 | val = musb_readl(fifo, 0); | ||
| 522 | memcpy(dst, &val, len); | ||
| 523 | } | ||
| 524 | } | ||
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 7e2c353755d2..c9f9024c5515 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
| @@ -272,6 +272,7 @@ void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *src) | |||
| 272 | } | 272 | } |
| 273 | } | 273 | } |
| 274 | 274 | ||
| 275 | #if !defined(CONFIG_USB_MUSB_AM35X) | ||
| 275 | /* | 276 | /* |
| 276 | * Unload an endpoint's FIFO | 277 | * Unload an endpoint's FIFO |
| 277 | */ | 278 | */ |
| @@ -309,6 +310,7 @@ void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst) | |||
| 309 | readsb(fifo, dst, len); | 310 | readsb(fifo, dst, len); |
| 310 | } | 311 | } |
| 311 | } | 312 | } |
| 313 | #endif | ||
| 312 | 314 | ||
| 313 | #endif /* normal PIO */ | 315 | #endif /* normal PIO */ |
| 314 | 316 | ||
