Skip to contentSkip to conversation

usb: musb: da8xx: Add DMA support

PATCH In review Alexandre Bailon 2 participants 8 messages Mar 29, 2017 – Apr 17, 2017 2 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v7 cover usb: musb: da8xx: Add DMA support

This series update MUSB driver to add DMA support to DA8xx. It should be applied on top of:
"[PATCH v4 0/3] dmaengine: cppi41: Add dma support to da8xx" and "[PATCH] ARM: davinci: Add the clock for the CPPI 4.1 DMA engine"

Changes in v7:
- Remove the patch that was adding runtime PM.
It was breaking system suspend.
- Use of_dev_auxdata to map the DT node name to the name expected by the clock.

Changes in v6:
- Rebased on linux-next. Some patches were conflicting with a series adding suspend and resume support.

Changes in v5:
- Fix a typo in commit message of patch 4

Changes in v4:
- Update and clarify the commit message of patch 5
- Fix the typo in patch 3

Changes in v3:
- Remove PM runtime callbacks.
I have update arch/arm/mach-davinci/pm_domain.c to let PM runtime control the usb20 clock.
- Only use PM runtime sync operation.

Changes in v2:
- Clock and IRQ management has been moved to MUSB DA8xx glue (was in CPPI 4.1 driver)
- I have added a partial support PM runtime. The goal was to use PM runtime to manage clock of MUSB and CPPI 4.1 (they use the same clock).
- CPPI 4.1 is now achild of MUSB DA8xx glue.

Alexandre Bailon (3):
usb: musb: Use shared irq
usb: musb: Add support of CPPI 4.1 DMA controller to DA8xx
usb: musb: musb_cppi41: Workaround DMA stall issue during teardown

 drivers/usb/musb/Kconfig       |  4 ++--
 drivers/usb/musb/da8xx.c       | 43 +++++++++++++++++++++++++++++++++++++++++-
 drivers/usb/musb/musb_core.c   |  2 +-
 drivers/usb/musb/musb_core.h   |  1 +
 drivers/usb/musb/musb_cppi41.c |  4 ++++
 5 files changed, 50 insertions(+), 4 deletions(-)
Signature · 6 lines
2.10.2

--
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): 20170329162432.27299-1-abailon-rdvid1DuHRBWk0Htik3J/[email protected]

#2 lore raw

PATCH v7 1/3 usb: musb: Use shared irq

In the DA8xx, USB and CPPI 4.1 are sharing the same interrupt line. Update the driver to request a shared irq.

---
 drivers/usb/musb/musb_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/musb/musb_core.c +1 -1
index 0c3664a..870da18 100644
@@ -2332,7 +2332,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
 	setup_timer(&musb->otg_timer, musb_otg_timer_func, (unsigned long) musb);
 
 	/* attach to the IRQ */
-	if (request_irq(nIrq, musb->isr, 0, dev_name(dev), musb)) {
+	if (request_irq(nIrq, musb->isr, IRQF_SHARED, dev_name(dev), musb)) {
 		dev_err(dev, "request_irq %d failed!\n", nIrq);
 		status = -ENODEV;
 		goto fail3;
Signature · 6 lines
2.10.2

--
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
#3 lore raw

PATCH v7 2/3 usb: musb: Add support of CPPI 4.1 DMA controller to DA8xx

In reply to a message not in the archive

Currently, only the PIO mode is supported. This add support of CPPI 4.1 to DA8xx.
As the In DA8xx the CPPI 4.1 DMA is a part of the USB. Create the CPPI 4.1 device as a child of USB.

---
 drivers/usb/musb/Kconfig |  4 ++--
 drivers/usb/musb/da8xx.c | 43 ++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 44 insertions(+), 3 deletions(-)
drivers/usb/musb/Kconfig +2 -2
index 72a2a50..5506a9c 100644
@@ -160,8 +160,8 @@ config USB_TI_CPPI_DMA
 	  Enable DMA transfers when TI CPPI DMA is available.
 
 config USB_TI_CPPI41_DMA
-	bool 'TI CPPI 4.1 (AM335x)'
-	depends on ARCH_OMAP && DMADEVICES
+	bool 'TI CPPI 4.1'
+	depends on (ARCH_OMAP || ARCH_DAVINCI_DA8XX) && DMADEVICES
 	select TI_CPPI41
 
 config USB_TUSB_OMAP_DMA
drivers/usb/musb/da8xx.c +42 -1

72 lines not on this page · raw message

Signature · 6 lines
2.10.2

--
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): 20170329162432.27299-3-abailon-rdvid1DuHRBWk0Htik3J/[email protected]

#5 lore raw

Re: [PATCH v7 2/3] usb: musb: Add support of CPPI 4.1 DMA controller to DA8xx

Quoted 4 lines · Alexandre Bailon

Currently, only the PIO mode is supported. This add support of CPPI 4.1 to DA8xx.
As the In DA8xx the CPPI 4.1 DMA is a part of the USB. Create the CPPI 4.1 device as a child of USB.

As in DA8xx the CPPI 4.1 DMA is a part of the USBSS, create the CPPI 4.1 device as a child of USB.

Regards,
-Bin.

Quoted 1 line

--
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

#6 lore raw

Re: [PATCH v7 2/3] usb: musb: Add support of CPPI 4.1 DMA controller to DA8xx

In reply to a message not in the archive
Quoted 16 lines · Alexandre Bailon

Currently, only the PIO mode is supported. This add support of CPPI 4.1 to DA8xx.
As the In DA8xx the CPPI 4.1 DMA is a part of the USB. Create the CPPI 4.1 device as a child of USB.

---
 drivers/usb/musb/Kconfig |  4 ++--
 drivers/usb/musb/da8xx.c | 43 ++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 44 insertions(+), 3 deletions(-)
drivers/usb/musb/Kconfig +0 -0
index 72a2a50..5506a9c 100644

drivers/usb/musb/Kconfig config USB_TI_CPPI_DMA · line 165

Quoted 8 lines
drivers/usb/musb/Kconfig +2 -2
@@ -160,8 +160,8 @@ config USB_TI_CPPI_DMA
 	  Enable DMA transfers when TI CPPI DMA is available.
 
 config USB_TI_CPPI41_DMA
-	bool 'TI CPPI 4.1 (AM335x)'
-	depends on ARCH_OMAP && DMADEVICES
+	bool 'TI CPPI 4.1'
+	depends on (ARCH_OMAP || ARCH_DAVINCI_DA8XX) && DMADEVICES
 	select TI_CPPI41

TI_CPPI41 also should depend on ARCH_DAVINCI_DA8XX due to this patch. You might need the following change for dma Kconfig as well.

drivers/dma/Kconfig +2 -2
index d01d59812cf3..15e31bfae9f9 100644
@@ -514,8 +514,8 @@ config TIMB_DMA
          Enable support for the Timberdale FPGA DMA engine.
 
 config TI_CPPI41
-       tristate "AM33xx CPPI41 DMA support"
-       depends on ARCH_OMAP
+       tristate "CPPI41 DMA support"
+       depends on ARCH_OMAP || ARCH_DAVINCI_DA8XX
        select DMA_ENGINE
        help
          The Communications Port Programming Interface (CPPI) 4.1 DMA engine

Regards,
-Bin.
--
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

#7 lore raw

Re: [PATCH v7 2/3] usb: musb: Add support of CPPI 4.1 DMA controller to DA8xx

Quoted 19 lines · Bin Liu
Quoted 18 lines · Alexandre Bailon

Currently, only the PIO mode is supported. This add support of CPPI 4.1 to DA8xx.
As the In DA8xx the CPPI 4.1 DMA is a part of the USB. Create the CPPI 4.1 device as a child of USB.

---
  drivers/usb/musb/Kconfig |  4 ++--
  drivers/usb/musb/da8xx.c | 43 ++++++++++++++++++++++++++++++++++++++++++-
  2 files changed, 44 insertions(+), 3 deletions(-)
drivers/usb/musb/Kconfig +0 -0
index 72a2a50..5506a9c 100644
@@ -160,8 +160,8 @@ config USB_TI_CPPI_DMA
  	  Enable DMA transfers when TI CPPI DMA is available.
 
Quoted 8 lines

drivers/usb/musb/Kconfig config USB_TI_CPPI_DMA · line 165

Quoted 6 lines
drivers/usb/musb/Kconfig +2 -2
  config USB_TI_CPPI41_DMA
-	bool 'TI CPPI 4.1 (AM335x)'
-	depends on ARCH_OMAP && DMADEVICES
+	bool 'TI CPPI 4.1'
+	depends on (ARCH_OMAP || ARCH_DAVINCI_DA8XX) && DMADEVICES
  	select TI_CPPI41

TI_CPPI41 also should depend on ARCH_DAVINCI_DA8XX due to this patch. You might need the following change for dma Kconfig as well.

This change has been done in the series "dmaengine: cppi41: Add dma support to da8xx".

Quoted 17 lines
drivers/dma/Kconfig +2 -2
index d01d59812cf3..15e31bfae9f9 100644
@@ -514,8 +514,8 @@ config TIMB_DMA
           Enable support for the Timberdale FPGA DMA engine.
 
  config TI_CPPI41
-       tristate "AM33xx CPPI41 DMA support"
-       depends on ARCH_OMAP
+       tristate "CPPI41 DMA support"
+       depends on ARCH_OMAP || ARCH_DAVINCI_DA8XX
         select DMA_ENGINE
         help
           The Communications Port Programming Interface (CPPI) 4.1 DMA engine
Quoted 2 lines

Regards,
-Bin.

Regards,
Alexandre
--
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

#8 lore raw

PATCH v7 3/3 usb: musb: musb_cppi41: Workaround DMA stall issue during teardown

In reply to a message not in the archive

The DMA may hang up if a teardown is initiated while an endpoint is still active (Advisory 2.3.27 of DA8xx errata).
To workaround this issue, add a delay before to initiate the teardown.

---
 drivers/usb/musb/da8xx.c       | 2 +-
 drivers/usb/musb/musb_core.h   | 1 +
 drivers/usb/musb/musb_cppi41.c | 4 ++++
 3 files changed, 6 insertions(+), 1 deletion(-)
drivers/usb/musb/da8xx.c +1 -1
index 7b9a44d..5a8a031 100644
@@ -483,7 +483,7 @@ da8xx_dma_controller_create(struct musb *musb, void __iomem *base)
 
 static const struct musb_platform_ops da8xx_ops = {
 	.quirks		= MUSB_INDEXED_EP | MUSB_PRESERVE_SESSION |
-			  MUSB_DMA_CPPI41,
+			  MUSB_DMA_CPPI41 | MUSB_DA8XX,
 	.init		= da8xx_musb_init,
 	.exit		= da8xx_musb_exit,
 
drivers/usb/musb/musb_core.h +1 -0
index 5b708be..3e98d42 100644
@@ -172,6 +172,7 @@ struct musb_io;
  */
 struct musb_platform_ops {
 
+#define MUSB_DA8XX		BIT(8)
 #define MUSB_PRESERVE_SESSION	BIT(7)
 #define MUSB_DMA_UX500		BIT(6)
 #define MUSB_DMA_CPPI41		BIT(5)
drivers/usb/musb/musb_cppi41.c +4 -0
index 355655f..e7c8b1b 100644
@@ -571,6 +571,10 @@ static int cppi41_dma_channel_abort(struct dma_channel *channel)
 		}
 	}
 
+	/* DA8xx Advisory 2.3.27: wait 250 ms before to start the teardown */
+	if (musb->io.quirks & MUSB_DA8XX)
+		mdelay(250);
+
 	tdbit = 1 << cppi41_channel->port_num;
 	if (is_tx)
 		tdbit <<= 16;
Signature · 6 lines
2.10.2

--
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
#9 lore raw
In reply to a message not in the archive
Quoted 4 lines · Alexandre Bailon

This series update MUSB driver to add DMA support to DA8xx. It should be applied on top of:
"[PATCH v4 0/3] dmaengine: cppi41: Add dma support to da8xx" and "[PATCH] ARM: davinci: Add the clock for the CPPI 4.1 DMA engine"

Applied and sent for v4.12-rc1 merge window.

Regards,
-Bin.

Quoted 35 lines

Changes in v7:
- Remove the patch that was adding runtime PM.
It was breaking system suspend.
- Use of_dev_auxdata to map the DT node name to the name expected by the clock.

Changes in v6:
- Rebased on linux-next. Some patches were conflicting with a series adding suspend and resume support.

Changes in v5:
- Fix a typo in commit message of patch 4

Changes in v4:
- Update and clarify the commit message of patch 5
- Fix the typo in patch 3

Changes in v3:
- Remove PM runtime callbacks.
I have update arch/arm/mach-davinci/pm_domain.c to let PM runtime control the usb20 clock.
- Only use PM runtime sync operation.

Changes in v2:
- Clock and IRQ management has been moved to MUSB DA8xx glue (was in CPPI 4.1 driver)
- I have added a partial support PM runtime. The goal was to use PM runtime to manage clock of MUSB and CPPI 4.1 (they use the same clock).
- CPPI 4.1 is now achild of MUSB DA8xx glue.

Alexandre Bailon (3):
usb: musb: Use shared irq
usb: musb: Add support of CPPI 4.1 DMA controller to DA8xx
usb: musb: musb_cppi41: Workaround DMA stall issue during teardown

Quoted 10 lines
 drivers/usb/musb/Kconfig       |  4 ++--
 drivers/usb/musb/da8xx.c       | 43 +++++++++++++++++++++++++++++++++++++++++-
 drivers/usb/musb/musb_core.c   |  2 +-
 drivers/usb/musb/musb_core.h   |  1 +
 drivers/usb/musb/musb_cppi41.c |  4 ++++
 5 files changed, 50 insertions(+), 4 deletions(-)
Signature · 1 line
2.10.2

--
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