USB: musb: tweak musb_read_fifo() to avoid unused warnings
Subsystems (2)
PATCH 1/11 USB: musb: tweak musb_read_fifo() to avoid unused warnings
Otherwise gcc will whine about epnum/dma_reg being unused when building for BF54x parts.
--- drivers/usb/musb/blackfin.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-)
drivers/usb/musb/blackfin.c +5 -4
@@ -54,13 +54,11 @@ void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *src)void musb_read_fifo (struct musb_hw_ep *hw_ep,u16 len,u8 *dst) {void __iomem *fifo = hw_ep->fifo; + +#ifdef CONFIG_BF52xu8 epnum = hw_ep->epnum;u16 dma_reg =0 ; -DBG (4 ,"%cX ep%d fifo %p count %d buf %p\n" , -'R' , hw_ep->epnum, fifo, len, dst); - -#ifdef CONFIG_BF52xinvalidate_dcache_range ((unsigned int )dst, (unsigned int )(dst + len));
@@ -103,6 +101,9 @@ void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst) len & 0x01 ? (len >> 1) + 1 : len >> 1);#endif +DBG (4 ,"%cX ep%d fifo %p count %d buf %p\n" , +'R' , hw_ep->epnum, fifo, len, dst); +dump_fifo_data (dst, len); }
Signature · 1 line
1.6.5.rc1
PATCH 2/11 USB: musb: kill compile warning for Blackfin systems
From: Bryan Wu <[email protected]>
The Blackfin version of musb_read_target_reg_base() returns a u16 when the common code expects a (void __iomem *), so update the Blackfin function to return the right value. This fixes the compile warning:
drivers/usb/musb/musb_core.c: In function 'musb_core_init':drivers/usb/musb/musb_core.c:1448: warning: assignment makes pointer from
integer without a cast
--- drivers/usb/musb/musb_regs.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/usb/musb/musb_regs.h +2 -2
@@ -474,9 +474,9 @@ static inline u16 musb_read_hwvers(void __iomem *mbase)return 0 ; } -static inline u16 musb_read_target_reg_base (u8 i,void __iomem *mbase) +static inline void __iomem *musb_read_target_reg_base (u8 i,void __iomem *mbase) { -return 0 ; +return NULL ; } static inline void musb_write_rxfunaddr(void __iomem *ep_target_regs,
Signature · 1 line
1.6.5.rc1
PATCH 3/11 USB: musb: kill some useless comments in Blackfin driver
In reply to Mike FrysingerFrom: Bryan Wu <[email protected]>
--- drivers/usb/musb/blackfin.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
drivers/usb/musb/blackfin.c +0 -4
@@ -263,10 +263,6 @@ int __init musb_platform_init(struct musb *musb)SSYNC (); } -/* TODO -* Set SIC-IVG register -*/ -/* Configure PLL oscillator register */ bfin_write_USB_PLLOSC_CTRL (0x30a8 );SSYNC ();
Signature · 1 line
1.6.5.rc1
PATCH 4/11 USB: musb: update Blackfin processor dependency
In reply to Mike FrysingerFrom: Sonic Zhang <[email protected]>
Do not allow MUSB driver to be selected on derivatives that don't have the MUSB controller on them.
--- drivers/usb/musb/Kconfig | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/usb/musb/Kconfig +1 -0
@@ -10,6 +10,7 @@ comment "Enable Host or Gadget support to see Inventra options" config USB_MUSB_HDRC depends on (USB || USB_GADGET) && HAVE_CLK depends on !SUPERH + depends on !BLACKFIN || (BF54x && !BF544) || (BF52x && !BF522 && !BF523) select NOP_USB_XCEIV if ARCH_DAVINCI select TWL4030_USB if MACH_OMAP_3430SDP select NOP_USB_XCEIV if MACH_OMAP3EVM
Signature · 1 line
1.6.5.rc1
PATCH 5/11 USB: musb: add notes for Blackfin anomalies
In reply to Mike FrysingerFrom: Sonic Zhang <[email protected]>
Add some helpful notes about how the driver works around different anomalies that exist in the on-chip host controller.
--- drivers/usb/musb/blackfin.h | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+), 0 deletions(-)
drivers/usb/musb/blackfin.h +29 -0
@@ -14,6 +14,35 @@* Blackfin specific definitions */ +/* Anomalies notes: +* +* 05000450 - USB DMA Mode 1 Short Packet Data Corruption: +* MUSB driver is designed to transfer buffer of N * maxpacket size +* in DMA mode 1 and leave rest data to the next transfer in DMA +* mode 0, so we never transmit a short packet in DMA mode 1. +* +* 05000463 - This anomaly doesn't affect this driver,Since it +* never uses L1 or L2 memory as data destination. +* +* 05000464 - This anomaly doesn't affect this driver,Since it +* never uses L1 or L2 memory as data source. +* +* 05000465 - Actually,the anomaly still can be seen when SCLK +* is over 100 MHz,and there is no way to workaround +* for bulk endpoints,because the wMaxPackSize of bulk +* is less than or equal to 512,while the fifo size of +* endpoint 5,6,7 is 1024,the double buffer mode is +* enabled automatically when these endpoints are used +* for bulk OUT. +* +* 05000466 - This anomaly doesn't affect this driver,Since it +* never mixs concurrent DMA and core accesses to the +* TX endpoint FIFOs. +* +* 05000467 - The workaround for this anomaly will introduce another +* anomaly - 05000465. +*/ +#undef DUMP_FIFO_DATA#ifdef DUMP_FIFO_DATA static void dump_fifo_data (u8 *buf,u16 len)
Signature · 1 line
1.6.5.rc1
Re: [PATCH 05/11] USB: musb: add notes for Blackfin anomalies
Hello.
Quoted 8 lines · Mike Frysinger
From: Sonic Zhang <[email protected]>
Add some helpful notes about how the driver works around different anomalies that exist in the on-chip host controller.
Signed-off-by Sonic Zhang <[email protected]>Signed-off-by Cliff Cai <[email protected]>Signed-off-by Mike Frysinger <[email protected]>
Grammar and style nipicking follows... :-)
Quoted 6 lines
drivers/usb/musb/blackfin.h +0
-0@@ -14,6 +14,35 @@* Blackfin specific definitions
drivers/usb/musb/blackfin.h line 24
Quoted 10 lines
drivers/usb/musb/blackfin.h +8
-0*/ +/* Anomalies notes: +* +* 05000450 - USB DMA Mode 1 Short Packet Data Corruption: +* MUSB driver is designed to transfer buffer of N * maxpacket size +* in DMA mode 1 and leave rest data to the next transfer in DMA +* mode 0, so we never transmit a short packet in DMA mode 1. +* +* 05000463 - This anomaly doesn't affect this driver,Since it
No comma needed here, and why capitalize "since"?
drivers/usb/musb/blackfin.h line 27
Quoted 3 lines
drivers/usb/musb/blackfin.h +3
-0+* never uses L1 or L2 memory as data destination. +* +* 05000464 - This anomaly doesn't affect this driver,Since it
Same here...
drivers/usb/musb/blackfin.h line 33
Quoted 6 lines
drivers/usb/musb/blackfin.h +6
-0+* never uses L1 or L2 memory as data source. +* +* 05000465 - Actually,the anomaly still can be seen when SCLK +* is over 100 MHz,and there is no way to workaround +* for bulk endpoints,because the wMaxPackSize of bulk +* is less than or equal to 512,while the fifo size of
Shouldn't there be spaces after commas?
drivers/usb/musb/blackfin.h line 34
Quoted 1 line
drivers/usb/musb/blackfin.h +1
-0+* endpoint 5,6,7 is 1024,the double buffer mode is
Either comma doesn't fit here, or "so" is needed after it...
drivers/usb/musb/blackfin.h line 38
Quoted 4 lines
drivers/usb/musb/blackfin.h +4
-0+* enabled automatically when these endpoints are used +* for bulk OUT. +* +* 05000466 - This anomaly doesn't affect this driver,Since it
No comma or uppercase needed...
drivers/usb/musb/blackfin.h line 39
Quoted 1 line
drivers/usb/musb/blackfin.h +1
-0+* never mixs concurrent DMA and core accesses to the
"Mixes"...
drivers/usb/musb/blackfin.h line 40
Quoted 1 line
drivers/usb/musb/blackfin.h +1
-0+* TX endpoint FIFOs.
WBR, Sergei
PATCH v2 5/12 USB: musb: add notes for Blackfin anomalies
From: Sonic Zhang <[email protected]>
Add some helpful notes about how the driver works around different anomalies that exist in the on-chip host controller.
---
v2
- clean up grammar pointed out by Sergei Shtylyov
drivers/usb/musb/blackfin.h | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-)
drivers/usb/musb/blackfin.h +27 -0
@@ -14,6 +14,33 @@* Blackfin specific definitions */ +/* Anomalies notes: +* +* 05000450 - USB DMA Mode 1 Short Packet Data Corruption: +* MUSB driver is designed to transfer buffer of N * maxpacket size +* in DMA mode 1 and leave the rest of the data to the next +* transfer in DMA mode 0, so we never transmit a short packet in +* DMA mode 1. +* +* 05000463 - This anomaly doesn't affect this driver since it +* never uses L1 or L2 memory as data destination. +* +* 05000464 - This anomaly doesn't affect this driver since it +* never uses L1 or L2 memory as data source. +* +* 05000465 - The anomaly can be seen when SCLK is over 100 MHz, and there is +* no way to workaround for bulk endpoints. Since the wMaxPackSize +* of bulk is less than or equal to 512, while the fifo size of +* endpoint 5, 6, 7 is 1024, the double buffer mode is enabled +* automatically when these endpoints are used for bulk OUT. +* +* 05000466 - This anomaly doesn't affect this driver since it never mixes +* concurrent DMA and core accesses to the TX endpoint FIFOs. +* +* 05000467 - The workaround for this anomaly will introduce another +* anomaly - 05000465. +*/ +#undef DUMP_FIFO_DATA#ifdef DUMP_FIFO_DATA static void dump_fifo_data (u8 *buf,u16 len)
Signature · 1 line
1.6.5.rc1
PATCH 6/11 USB: musb: add work around for Blackfin anomaly 05000456
In reply to Mike FrysingerFrom: Sonic Zhang <[email protected]>
Only allow USE_MODE1 when the Blackfin part is not affected by anomaly 05000456 (USB Receive Interrupt Is Not Generated in DMA Mode 1) since we can't support the mode in that case.
--- drivers/usb/musb/musb_dma.h | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
drivers/usb/musb/musb_dma.h +11 -0
@@ -80,6 +80,17 @@ struct musb_hw_ep;#define tusb_dma_omap () 0#endif +/* Anomaly 05000456 - USB Receive Interrupt Is Not Generated in DMA Mode 1 +* Only allow DMA mode 1 to be used when the USB will actually generate the +* interrupts we expect. +*/ +#ifdef CONFIG_BLACKFIN +# undef USE_MODE1 +# if !ANOMALY_05000456 +# define USE_MODE1 +# endif +#endif +/* * DMA channel status ... updated by the dma controller driver whenever that * status changes, and protected by the overall controller spinlock.
Signature · 1 line
1.6.5.rc1
PATCH 7/11 USB: musb: fix musb_platform_set_mode() definition
In reply to Mike FrysingerFrom: Bryan Wu <[email protected]>
Update function definition to match latest MUSB framework.
--- drivers/usb/musb/blackfin.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/usb/musb/blackfin.c +2 -1
@@ -227,8 +227,9 @@ int musb_platform_get_vbus_status(struct musb *musb)return 0 ; } -void musb_platform_set_mode (struct musb *musb,u8 musb_mode) +int musb_platform_set_mode (struct musb *musb,u8 musb_mode) { +return -EIO ; }int __init musb_platform_init (struct musb *musb)
Signature · 1 line
1.6.5.rc1
PATCH 8/11 USB: musb: clear the Blackfin interrupt pending bits early in the ISR
In reply to Mike FrysingerFrom: Cliff Cai <[email protected]>
If we clear the interrupt pending bits at the end, we sometimes return too fast and have the same interrupt assert itself. There is no way in a Blackfin system to force a sync of this state, so the hardware manual instructs people to clear interrupt flags early in their ISR.
--- drivers/usb/musb/musbhsdma.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/usb/musb/musbhsdma.c +5 -5
@@ -259,6 +259,11 @@ static irqreturn_t dma_controller_irq(int irq, void *private_data)if (!int_hsdma) goto done; +#ifdef CONFIG_BLACKFIN +/* Clear DMA interrupt flags */ +musb_writeb (mbase,MUSB_HSDMA_INTR , int_hsdma); +#endif +for (bchannel =0 ; bchannel <MUSB_HSDMA_CHANNELS ; bchannel++) {if (int_hsdma & (1 << bchannel)) { musb_channel = (struct musb_dma_channel *)
@@ -324,11 +329,6 @@ static irqreturn_t dma_controller_irq(int irq, void *private_data) } } -#ifdef CONFIG_BLACKFIN -/* Clear DMA interrup flags */ -musb_writeb (mbase,MUSB_HSDMA_INTR , int_hsdma); -#endif - retval =IRQ_HANDLED ; done:spin_unlock_irqrestore (&musb->lock, flags);
Signature · 1 line
1.6.5.rc1
PATCH 9/11 USB: musb: error out when anomaly 05000380 is applicable
In reply to Mike FrysingerFrom: Sonic Zhang <[email protected]>
Since we can't work around anomaly 05000380, throw a build error up and instruct the user to use a different mode.
--- drivers/usb/musb/blackfin.h | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
drivers/usb/musb/blackfin.h +10 -0
@@ -43,6 +43,16 @@* anomaly - 05000465. */ +/* The Mentor USB DMA engine on BF52x (silicon v0.0 and v0.1) seems to be +* unstable in host mode. This may be caused by Anomaly 05000380. After +* digging out the root cause, we will change this number accordingly. +* So, need to either use silicon v0.2+ or disable DMA mode in MUSB. +*/ +#if ANOMALY_05000380 && defined(CONFIG_BF52x) && \ + defined(CONFIG_USB_MUSB_HDRC ) && !defined(CONFIG_MUSB_PIO_ONLY ) +# error "Please use PIO mode in MUSB driver on bf52x chip v0.0 and v0.1" +#endif +#undef DUMP_FIFO_DATA#ifdef DUMP_FIFO_DATA static void dump_fifo_data (u8 *buf,u16 len)
Signature · 1 line
1.6.5.rc1
PATCH 10/11 USB: musb: Blackfin code needs NOP_USB_XCEIV too
In reply to Mike FrysingerFrom: Cliff Cai <[email protected]>
Otherwise we get the link failure:drivers/built-in.o: In function 'musb_platform_init':drivers/usb/musb/blackfin.c:300: undefined reference to 'usb_nop_xceiv_register'
make: *** [.tmp_vmlinux1] Error 1
--- drivers/usb/musb/Kconfig | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/usb/musb/Kconfig +1 -2
@@ -11,9 +11,8 @@ config USB_MUSB_HDRC depends on (USB || USB_GADGET) && HAVE_CLK depends on !SUPERH depends on !BLACKFIN || (BF54x && !BF544) || (BF52x && !BF522 && !BF523) - select NOP_USB_XCEIV if ARCH_DAVINCI + select NOP_USB_XCEIV if (ARCH_DAVINCI || MACH_OMAP3EVM || BLACKFIN) select TWL4030_USB if MACH_OMAP_3430SDP - select NOP_USB_XCEIV if MACH_OMAP3EVM select USB_OTG_UTILS tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)' help
Signature · 1 line
1.6.5.rc1
PATCH 11/11 USB: musb: fix printf warning in debug code
In reply to Mike FrysingerThe debug code in the DMA ISR uses a %d for a size_t when it should be using %zu. Otherwise gcc whines with:
drivers/usb/musb/musbhsdma.c: In function 'dma_controller_irq':drivers/usb/musb/musbhsdma.c:288: warning: format '%d' expects type 'int',
but argument 7 has type 'size_t'
--- drivers/usb/musb/musbhsdma.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/usb/musb/musbhsdma.c +1 -1
@@ -285,7 +285,7 @@ static irqreturn_t dma_controller_irq(int irq, void *private_data) channel->actual_len = addr - musb_channel->start_addr; - DBG(2, "ch %p, 0x%x -> 0x%x (%d / %d) %s\n", + DBG(2, "ch %p, 0x%x -> 0x%x (%zu / %d) %s\n", channel, musb_channel->start_addr, addr, channel->actual_len, musb_channel->len,
Signature · 1 line
1.6.5.rc1