diff options
author | Bryan Wu <cooloney@kernel.org> | 2009-12-28 06:40:39 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-02 17:53:47 -0500 |
commit | 1ca9e9ca314c4757409a7f4e9c1f12229a175834 (patch) | |
tree | ebfc9c42212e90c141e5399563ae88a12dd61b51 /drivers/usb/musb/blackfin.c | |
parent | 565969237ab6e73ce7192684d00d5b890ee308fa (diff) |
usb: musb: clean up commit 'workaround Blackfin FIFO anomalies'
The version applied had a few comments which are now
done.
Thanks to Sergei for pointing out.
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Cliff Cai <cliff.cai@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/musb/blackfin.c')
-rw-r--r-- | drivers/usb/musb/blackfin.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c index ad26e6569665..bcee1339d4fd 100644 --- a/drivers/usb/musb/blackfin.c +++ b/drivers/usb/musb/blackfin.c | |||
@@ -30,7 +30,6 @@ void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *src) | |||
30 | void __iomem *fifo = hw_ep->fifo; | 30 | void __iomem *fifo = hw_ep->fifo; |
31 | void __iomem *epio = hw_ep->regs; | 31 | void __iomem *epio = hw_ep->regs; |
32 | u8 epnum = hw_ep->epnum; | 32 | u8 epnum = hw_ep->epnum; |
33 | u16 dma_reg = 0; | ||
34 | 33 | ||
35 | prefetch((u8 *)src); | 34 | prefetch((u8 *)src); |
36 | 35 | ||
@@ -42,15 +41,17 @@ void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *src) | |||
42 | dump_fifo_data(src, len); | 41 | dump_fifo_data(src, len); |
43 | 42 | ||
44 | if (!ANOMALY_05000380 && epnum != 0) { | 43 | if (!ANOMALY_05000380 && epnum != 0) { |
45 | flush_dcache_range((unsigned int)src, | 44 | u16 dma_reg; |
46 | (unsigned int)(src + len)); | 45 | |
46 | flush_dcache_range((unsigned long)src, | ||
47 | (unsigned long)(src + len)); | ||
47 | 48 | ||
48 | /* Setup DMA address register */ | 49 | /* Setup DMA address register */ |
49 | dma_reg = (u16) ((u32) src & 0xFFFF); | 50 | dma_reg = (u32)src; |
50 | bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_LOW), dma_reg); | 51 | bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_LOW), dma_reg); |
51 | SSYNC(); | 52 | SSYNC(); |
52 | 53 | ||
53 | dma_reg = (u16) (((u32) src >> 16) & 0xFFFF); | 54 | dma_reg = (u32)src >> 16; |
54 | bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_HIGH), dma_reg); | 55 | bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_HIGH), dma_reg); |
55 | SSYNC(); | 56 | SSYNC(); |
56 | 57 | ||
@@ -79,12 +80,9 @@ void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *src) | |||
79 | SSYNC(); | 80 | SSYNC(); |
80 | 81 | ||
81 | if (unlikely((unsigned long)src & 0x01)) | 82 | if (unlikely((unsigned long)src & 0x01)) |
82 | outsw_8((unsigned long)fifo, src, | 83 | outsw_8((unsigned long)fifo, src, (len + 1) >> 1); |
83 | len & 0x01 ? (len >> 1) + 1 : len >> 1); | ||
84 | else | 84 | else |
85 | outsw((unsigned long)fifo, src, | 85 | outsw((unsigned long)fifo, src, (len + 1) >> 1); |
86 | len & 0x01 ? (len >> 1) + 1 : len >> 1); | ||
87 | |||
88 | } | 86 | } |
89 | } | 87 | } |
90 | /* | 88 | /* |
@@ -94,19 +92,19 @@ void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst) | |||
94 | { | 92 | { |
95 | void __iomem *fifo = hw_ep->fifo; | 93 | void __iomem *fifo = hw_ep->fifo; |
96 | u8 epnum = hw_ep->epnum; | 94 | u8 epnum = hw_ep->epnum; |
97 | u16 dma_reg = 0; | ||
98 | 95 | ||
99 | if (ANOMALY_05000467 && epnum != 0) { | 96 | if (ANOMALY_05000467 && epnum != 0) { |
97 | u16 dma_reg; | ||
100 | 98 | ||
101 | invalidate_dcache_range((unsigned int)dst, | 99 | invalidate_dcache_range((unsigned long)dst, |
102 | (unsigned int)(dst + len)); | 100 | (unsigned long)(dst + len)); |
103 | 101 | ||
104 | /* Setup DMA address register */ | 102 | /* Setup DMA address register */ |
105 | dma_reg = (u16) ((u32) dst & 0xFFFF); | 103 | dma_reg = (u32)dst; |
106 | bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_LOW), dma_reg); | 104 | bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_LOW), dma_reg); |
107 | SSYNC(); | 105 | SSYNC(); |
108 | 106 | ||
109 | dma_reg = (u16) (((u32) dst >> 16) & 0xFFFF); | 107 | dma_reg = (u32)dst >> 16; |
110 | bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_HIGH), dma_reg); | 108 | bfin_write16(USB_DMA_REG(epnum, USB_DMAx_ADDR_HIGH), dma_reg); |
111 | SSYNC(); | 109 | SSYNC(); |
112 | 110 | ||