musb: save OTG base physical address
Subsystems (2)
PATCH 1/6 musb: save OTG base physical address
OTG base physical address is required in calculating physical address of endpoint FIFO which is needed by system dma.
---
Patch created against linus'tree + all musb patches in Greg's queue
drivers/usb/musb/musb_core.c | 6 ++++-- drivers/usb/musb/musb_core.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/usb/musb/musb_core.c +4 -2
@@ -1867,7 +1867,8 @@ static void musb_free(struct musb *musb)* not yet corrected for platform-specific offsets */ static int __init -musb_init_controller (struct device *dev,int nIrq,void __iomem *ctrl) +musb_init_controller (struct device *dev,int nIrq,void __iomem *ctrl, +phys_addr_t ctrl_phys_addr) {int status;struct musb *musb;
@@ -1919,6 +1920,7 @@ bad_config: musb->board_set_power = plat->set_power; musb->set_clock = plat->set_clock; musb->min_power = plat->min_power; + musb->ctrl_phys_base = ctrl_phys_addr;/* Clock usage is chip-specific ... functional clock (DaVinci, * OMAP2430), or PHY ref (some TUSB6010 boards). All this core
@@ -2136,7 +2138,7 @@ static int __init musb_probe(struct platform_device *pdev)/* clobbered by use_dma=n */ orig_dma_mask = dev->dma_mask;#endif - status =musb_init_controller (dev, irq, base); + status =musb_init_controller (dev, irq, base, iomem->start);if (status <0 )iounmap (base);
drivers/usb/musb/musb_core.h +1 -0
@@ -367,6 +367,7 @@ struct musb {struct device *controller;void __iomem *ctrl_base; +phys_addr_t ctrl_phys_base;void __iomem *mregs;#ifdef CONFIG_USB_TUSB6010
Signature · 6 lines
1.6.2.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 2/6 musb: use system DMA to fix Inventra DMA issue on RTL-1.4
MUSB RTL version 1.4 has a hardware issue when TX and RX DMA channels are simultaneously enabled which results in DMA lockup.
Use system DMA for all RX channels as a workaround of this issue as this will have minimal throughput overhead based on the fact that Rx transfers are done in DMA mode-0 on OMAP34x/35x platforms. Also added stub functions for non OMAP platforms so that there is no compilation failure.
Another approach to use PIO mode in opposite direction would increase the cpu loading and thus using system DMA is preferred workaround.
---
Patch created against linus'tree + all musb patches in Greg's queue Changes from v1:
- Added wrapper function to make it compilable for BlackFins
drivers/usb/musb/Kconfig | 9 +++ drivers/usb/musb/musbhsdma.c | 132 ++++++++++++++++++++++++++++++++++++++++++ drivers/usb/musb/musbhsdma.h | 10 +++ 3 files changed, 151 insertions(+), 0 deletions(-)
drivers/usb/musb/Kconfig +9 -0
@@ -157,6 +157,15 @@ config USB_INVENTRA_DMA help Enable DMA transfers using Mentor's engine. +config MUSB_USE_SYSTEM_DMA_WORKAROUND + bool 'Use System DMA for Mentor DMA workaround' + depends on USB_MUSB_HDRC && USB_INVENTRA_DMA && ARCH_OMAP + default y + help + MUSB RTL version 1.4 (OMAP34x/35x) has a hardware issue when TX and RX + DMA channels are simultaneously enabled. To work around this issue, + you can choose to use System DMA for RX channels. + config USB_TI_CPPI_DMA bool depends on USB_MUSB_HDRC && !MUSB_PIO_ONLY
drivers/usb/musb/musbhsdma.c +132 -0
180 lines not on this page · raw message
drivers/usb/musb/musbhsdma.h +10 -0
@@ -142,6 +142,15 @@ static inline void musb_write_hsdma_count(void __iomem *mbase,#define MUSB_HSDMA_CHANNELS 8 +#define MUSB_FIFO_ADDRESS (base, epnum) \ + ((unsigned long) (base + MUSB_FIFO_OFFSET(epnum))) + +#ifdef CONFIG_MUSB_USE_SYSTEM_DMA_WORKAROUND +#define use_sdma_workaround () 1 +#else +#define use_sdma_workaround () 0 +#endif +struct musb_dma_controller ;struct musb_dma_channel {
@@ -153,6 +162,7 @@ struct musb_dma_channel {u8 idx;u8 epnum;u8 transmit; +int sysdma_channel; };struct musb_dma_controller {
Signature · 1 line
1.6.2.4
A message that is not in the archive (sent off-list or not yet received): 1274094488-15925-2-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org
PATCH 3/6 musb: add function to check if Inventra DMA used
Added is_inventra_dma_enabled() funtion which would be required for adding workaround for Inventra DMA issues. It can also be used at other places instead of #ifdefs.
--- drivers/usb/musb/musb_dma.h | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/usb/musb/musb_dma.h +6 -0
@@ -80,6 +80,12 @@ struct musb_hw_ep;#define tusb_dma_omap () 0#endif +#ifdef CONFIG_USB_INVENTRA_DMA +#define is_inventra_dma_enabled () 1 +#else +#define is_inventra_dma_enabled () 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.
Signature · 6 lines
1.6.2.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 4/6 musb: use system DMA for unaligned buffers on RTL >= 1.8
MUSB RTL version 1.8 onward (OMAP3630, AM/DM37x, OMAP4) DMA requires the buffers to be aligned on a four byte boundary. This affects USB CDC/RNDIS class application where buffers are always unaligned.
Use system DMA for unaligned buffers as a workaround of this issue.
Current patch set supports device side CDC/RNDIS. Host side would require change in Tx programming path for mode-0 operation when transfer length is more than packet size.
---
Patch created against linus'tree + all musb patches in Greg's queue Changes from v1:
- Added wrapper function to make it compilable for BlackFins
drivers/usb/musb/Kconfig | 6 +++ drivers/usb/musb/musbhsdma.c | 103 ++++++++++++++++++++++++++++++++--------- 2 files changed, 86 insertions(+), 23 deletions(-)
drivers/usb/musb/Kconfig +6 -0
@@ -166,6 +166,12 @@ config MUSB_USE_SYSTEM_DMA_WORKAROUND DMA channels are simultaneously enabled. To work around this issue, you can choose to use System DMA for RX channels. + Also on Mentor DMA in MUSB RTL version 1.8 (OMAP3630, AM/DM37x) + requires buffers to be aligned on a four byte boundary. This affects + USB CDC/RNDIS class application where buffers are always unaligned. + To work around this issue, you can choose to use System DMA for + unaligned buffers. + config USB_TI_CPPI_DMA bool depends on USB_MUSB_HDRC && !MUSB_PIO_ONLY
drivers/usb/musb/musbhsdma.c +80 -23
161 lines not on this page · raw message
Signature · 1 line
1.6.2.4
A message that is not in the archive (sent off-list or not yet received): 1274094488-15925-4-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org
PATCH 5/6 musb: gadget: fix tx transfer path for mode0 operation
Current gadget Tx path always programs DMA in mode-1 if request length is more than packet size. As system DMA can work only in mode-0 so updating the DMA mode and transfer length for it.
Also fixed an issue in device Tx completion path where 'is_dma' is getting set unconditionally. This would fail the io if Tx transfer is done in mode-0. Fixed it by updating it based on 'request->actual' length.
--- drivers/usb/musb/musb_gadget.c | 21 ++++++++++++++++++++- 1 files changed, 20 insertions(+), 1 deletions(-)
drivers/usb/musb/musb_gadget.c +20 -1
@@ -317,6 +317,22 @@ static void txstate(struct musb *musb, struct musb_request *req)else musb_ep->dma->desired_mode =1 ; +/* +* Use system dma for unaligned buffers on RTL >= 1.8 +* for Inventra DMA. As system DMA can work only in +* mode-0 so update the desired_mode and request_size. +*/ +if (is_inventra_dma_enabled () && + ((request->dma + request->actual) &0x3 ) && + (musb->hwvers >=MUSB_HWVERS_1800 )) { + + request_size =min_t (size_t, + musb_ep->hw_ep->max_packet_sz_tx, + request->length - request->actual); + + musb_ep->dma->desired_mode =0 ; + } + use_dma = use_dma && c->channel_program( musb_ep->dma, musb_ep->packet_sz, musb_ep->dma->desired_mode,
@@ -463,7 +479,6 @@ void musb_g_tx(struct musb *musb, u8 epnum)u8 is_dma =0 ;if (dma && (csr &MUSB_TXCSR_DMAENAB )) { - is_dma =1 ; csr |=MUSB_TXCSR_P_WZC_BITS ; csr &= ~(MUSB_TXCSR_DMAENAB |MUSB_TXCSR_P_UNDERRUN |MUSB_TXCSR_TXPKTRDY );
@@ -471,6 +486,10 @@ void musb_g_tx(struct musb *musb, u8 epnum)/* Ensure writebuffer is empty. */ csr =musb_readw (epio,MUSB_TXCSR ); request->actual += musb_ep->dma->actual_len; + +if (request->actual == request->length) + is_dma =1 ; +DBG (4 ,"TXCSR%d %04x, DMA off, len %zu, req %p\n" , epnum, csr, musb_ep->dma->actual_len, request); }
Signature · 6 lines
1.6.2.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1274094488-15925-5-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org
PATCH 6/6 musb: dma: use optimal transfer element for sdma
Use optimal values of transfer element based on buffer address in system DMA programming. This would improve the performance.
--- drivers/usb/musb/musbhsdma.c | 29 ++++++++++++++++++++++++++--- 1 files changed, 26 insertions(+), 3 deletions(-)
drivers/usb/musb/musbhsdma.c +26 -3
@@ -52,11 +52,34 @@ static void musb_sdma_channel_program(struct musb *musb,struct musb_dma_channel *musb_channel, dma_addr_t dma_addr, u32 len) { + u16 frame = len; +int data_type =OMAP_DMA_DATA_TYPE_S8 ; + +switch (dma_addr &0x3 ) { +case 0 : +if ((len %4 ) ==0 ) { + data_type =OMAP_DMA_DATA_TYPE_S32 ; + frame = len /4 ; +break ; + } +case 2 : +if ((len %2 ) ==0 ) { + data_type =OMAP_DMA_DATA_TYPE_S16 ; + frame = len /2 ; +break ; + } +case 1 : +case 3 : +default : + data_type =OMAP_DMA_DATA_TYPE_S8 ; + frame = len; +break ; + }/* set transfer parameters */ omap_set_dma_transfer_params (musb_channel->sysdma_channel, -OMAP_DMA_DATA_TYPE_S8 , - len ? len : 1, 1, /* One frame */ -OMAP_DMA_SYNC_ELEMENT , + data_type, + len ? frame :1 ,1 ,/* One frame */ +OMAP_DMA_SYNC_FRAME ,OMAP24XX_DMA_NO_DEVICE ,0 );/* Src Sync */
Signature · 6 lines
1.6.2.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1274094488-15925-6-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org
Re: [PATCH 6/6] musb: dma: use optimal transfer element for sdma
Hello.
Quoted 28 lines · Ajay Kumar Gupta
Use optimal values of transfer element based on buffer address in system DMA programming. This would improve the performance.
Signed-off-by Ajay Kumar Gupta <[email protected]>--- drivers/usb/musb/musbhsdma.c | 29 ++++++++++++++++++++++++++--- 1 files changed, 26 insertions(+), 3 deletions(-)drivers/usb/musb/musbhsdma.c +12
-0@@ -52,11 +52,34 @@ static void musb_sdma_channel_program(struct musb *musb,struct musb_dma_channel *musb_channel, dma_addr_t dma_addr, u32 len) { + u16 frame = len; +int data_type =OMAP_DMA_DATA_TYPE_S8 ; + +switch (dma_addr &0x3 ) { +case 0 : +if ((len %4 ) ==0 ) { + data_type =OMAP_DMA_DATA_TYPE_S32 ; + frame = len /4 ; +break ; + } +case 2 : +if ((len %2 ) ==0 ) {
drivers/usb/musb/musbhsdma.c static void musb_sdma_channel_program(struct musb *musb, · line 76
Quoted 10 lines
drivers/usb/musb/musbhsdma.c +10
-0+ data_type =OMAP_DMA_DATA_TYPE_S16 ; + frame = len /2 ; +break ; + } +case 1 : +case 3 : +default : + data_type =OMAP_DMA_DATA_TYPE_S8 ; + frame = len; +break ;
The *break* is overindented.
WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 6/6] musb: dma: use optimal transfer element for sdma
Hi,
Quoted 35 lines
drivers/usb/musb/musbhsdma.c static void musb_sdma_channel_program(struct musb
Quoted 13 lines · Ajay Kumar Gupta
Use optimal values of transfer element based on buffer address in system DMA programming. This would improve the performance.
Signed-off-by Ajay Kumar Gupta <[email protected]>--- drivers/usb/musb/musbhsdma.c | 29 ++++++++++++++++++++++++++--- 1 files changed, 26 insertions(+), 3 deletions(-)drivers/usb/musb/musbhsdma.c +0
-0@@ -52,11 +52,34 @@ static void musb_sdma_channel_program(struct musb*musb,
Quoted 19 lines
drivers/usb/musb/musbhsdma.c +16
-0struct musb_dma_channel *musb_channel, dma_addr_t dma_addr, u32 len) { + u16 frame = len; +int data_type =OMAP_DMA_DATA_TYPE_S8 ; + +switch (dma_addr &0x3 ) { +case 0 : +if ((len %4 ) ==0 ) { + data_type =OMAP_DMA_DATA_TYPE_S32 ; + frame = len /4 ; +break ; + } +case 2 : +if ((len %2 ) ==0 ) { + data_type =OMAP_DMA_DATA_TYPE_S16 ; + frame = len /2 ; +break ; + }
Quoted 8 lines
drivers/usb/musb/musbhsdma.c static void musb_sdma_channel_program(struct musb *musb, · line 76
Quoted 6 lines
drivers/usb/musb/musbhsdma.c +6
-0+case 1 : +case 3 : +default : + data_type =OMAP_DMA_DATA_TYPE_S8 ; + frame = len; +break ;The *break* is overindented.
Ok.
-Ajay
Quoted 2 lines
WBR, Sergei