Skip to contentSkip to conversation

dmaengine: cppi41: Add dma support to da8xx

PATCH Superseded Alexandre Bailon 2 participants 6 messages Jan 19, 2017 – Jan 23, 2017 3 messages not in the archive

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover dmaengine: cppi41: Add dma support to da8xx

This series add support of DA8xx to CPPI 4.1 driver.
As the CPPI 4.1 is now generic, we only had to add the glue for DA8xx.

This serie should applied on top of
"[PATCH v3 0/4] dmaengine: cppi41: Make CPPI 4.1 driver more generic".

Changes in v3:
- Removed some useless property from DT bindings.
- Update kconfig in patch 2. Was prevously made in another patchset.

Changes in v2:
- most of patches of v1 has been moved to the series
"[PATCH v2 0/7] dmaengine: cppi41: Make CPPI 4.1 driver more generic".
- some patches of v1 has been removed because they were no required anymore because CPPI 4.1 driver has been made more generic.
- In v1, the driver were managing the clock for DA8xx paltform. This is not needed as CPPI 4.1 will be a child of MUSB DA8xx glue, we can use PM runtime and let the DA8xx glue driver manage it.

Alexandre Bailon (3):
dt/bindings: da8xx-usb: Add binding for the CPPI 4.1 DMA controller
dmaengine: cppi41: Add support of DA8xx to CPPI 4.1
dmaengine: cppi41: Fix teardown warnings

 .../devicetree/bindings/usb/da8xx-usb.txt          | 39 ++++++++++++++++++++++
 drivers/dma/Kconfig                                |  6 ++--
 drivers/dma/cppi41.c                               | 28 ++++++++++++++--
 3 files changed, 68 insertions(+), 5 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
#2 lore raw

PATCH v3 1/3 dt/bindings: da8xx-usb: Add binding for the CPPI 4.1 DMA controller

In reply to a message not in the archive

DT binding for the TI DA8xx/OMAP-L1x/AM17xx/AM18xx CPPI 4.1 DMA controller.

---
 .../devicetree/bindings/usb/da8xx-usb.txt          | 39 ++++++++++++++++++++++
 1 file changed, 39 insertions(+)
Documentation/devicetree/bindings/usb/da8xx-usb.txt +39 -0
index ccb844a..c3944a6 100644
@@ -18,10 +18,26 @@ Required properties:
 
  - phy-names: Should be "usb-phy"
 
+ - dmas: specifies the dma channels
+
+ - dma-names: specifies the names of the channels. Use "rxN" for receive
+   and "txN" for transmit endpoints. N specifies the endpoint number.
+
 Optional properties:
 ~~~~~~~~~~~~~~~~~~~~
  - vbus-supply: Phandle to a regulator providing the USB bus power.
 
+DMA
+~~~
+- compatible: ti,da830-cppi41
+- reg: offset and length of the following register spaces: CPPI DMA Controller,
+  CPPI DMA Scheduler, Queue Manager
+- reg-names: "controller", "scheduler", "queuemgr"
+- #dma-cells: should be set to 2. The first number represents the
+  channel number (0 … 3 for endpoints 1 … 4).
+  The second number is 0 for RX and 1 for TX transfers.
+- #dma-channels: should be set to 4 representing the 4 endpoints.
+
 Example:
 	usb_phy: usb-phy {
 		compatible = "ti,da830-usb-phy";
@@ -31,6 +47,9 @@ Example:
 	usb0: usb@200000 {
 		compatible = "ti,da830-musb";
 		reg =   <0x00200000 0x10000>;
+		ranges;
+		#address-cells = <1>;
+		#size-cells = <1>;
 		interrupts = <58>;
 		interrupt-names = "mc";
 
@@ -39,5 +58,25 @@ Example:
 		phys = <&usb_phy 0>;
 		phy-names = "usb-phy";
 
+		dmas = <&cppi41dma 0 0 &cppi41dma 1 0
+			&cppi41dma 2 0 &cppi41dma 3 0
+			&cppi41dma 0 1 &cppi41dma 1 1
+			&cppi41dma 2 1 &cppi41dma 3 1>;
+		dma-names =
+			"rx1", "rx2", "rx3", "rx4",
+			"tx1", "tx2", "tx3", "tx4";
+
 		status = "okay";
+
+		cppi41dma: dma-controller@201000 {
+			compatible = "ti,da830-cppi41";
+			reg =  <0x201000 0x1000
+				0x202000 0x1000
+				0x204000 0x4000>;
+			reg-names = "controller", "scheduler", "queuemgr";
+			interrupts = <58>;
+			#dma-cells = <2>;
+			#dma-channels = <4>;
+		};
+
 	};
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 v3 2/3 dmaengine: cppi41: Add support of DA8xx to CPPI 4.1

In reply to a message not in the archive

The DA8xx has a CPPI 4.1 DMA controller.
This is add the glue layer required to make it work on DA8xx.

---
 drivers/dma/Kconfig  |  6 +++---
 drivers/dma/cppi41.c | 24 ++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 3 deletions(-)
drivers/dma/Kconfig +3 -3
index 0d6a96e..03ae2a1 100644
@@ -514,12 +514,12 @@ 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
-	  is currently used by the USB driver on AM335x platforms.
+	  is currently used by the USB driver on AM335x and DA8xx platforms.
 
 config TI_DMA_CROSSBAR
 	bool
drivers/dma/cppi41.c +24 -0
index 9767b97..f6f2d84 100644
@@ -221,6 +221,20 @@ static const struct chan_queues am335x_usb_queues_rx[] = {
 	[29] = { .submit = 30, .complete = 155},
 };
 
+static const struct chan_queues da8xx_usb_queues_tx[] = {
+	[0] = { .submit =  16, .complete = 24},
+	[1] = { .submit =  18, .complete = 24},
+	[2] = { .submit =  20, .complete = 24},
+	[3] = { .submit =  22, .complete = 24},
+};
+
+static const struct chan_queues da8xx_usb_queues_rx[] = {
+	[0] = { .submit =  1, .complete = 26},
+	[1] = { .submit =  3, .complete = 26},
+	[2] = { .submit =  5, .complete = 26},
+	[3] = { .submit =  7, .complete = 26},
+};
+
 struct cppi_glue_infos {
 	irqreturn_t (*isr)(int irq, void *data);
 	const struct chan_queues *queues_rx;
@@ -951,8 +965,18 @@ static const struct cppi_glue_infos am335x_usb_infos = {
 	.qmgr_num_pend = 5,
 };
 
+static const struct cppi_glue_infos da8xx_usb_infos = {
+	.isr = cppi41_irq,
+	.queues_rx = da8xx_usb_queues_rx,
+	.queues_tx = da8xx_usb_queues_tx,
+	.td_queue = { .submit = 31, .complete = 0 },
+	.first_completion_queue = 24,
+	.qmgr_num_pend = 2,
+};
+
 static const struct of_device_id cppi41_dma_ids[] = {
 	{ .compatible = "ti,am3359-cppi41", .data = &am335x_usb_infos},
+	{ .compatible = "ti,da830-cppi41", .data = &da8xx_usb_infos},
 	{},
 };
 MODULE_DEVICE_TABLE(of, cppi41_dma_ids);
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
#8 lore raw

PATCH v3 3/3 dmaengine: cppi41: Fix teardown warnings

In reply to a message not in the archive

During the teardown of a RX channel, because there is only one completion queue available for RX channel, descriptor of another channel may be popped which will cause 2 warnings:
- the first one because we popped a wrong descriptor
(neither the channel's descriptor, nor the teardown descriptor).
- the second one happen during the teardown of another channel, because we can't find the channel descriptor
(that is, the one that caused the first warning).
To avoid that, use one free queue instead of a transmit completion queue.

Note that fix doesn't fix all the teardown warnings:
I still get some when I run some corner case.

---
 drivers/dma/cppi41.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/cppi41.c +2 -2
index f6f2d84..cd30fd3 100644
@@ -630,7 +630,7 @@ static int cppi41_tear_down_chan(struct cppi41_channel *c)
 		if (!c->is_tx) {
 			reg |= GCR_STARV_RETRY;
 			reg |= GCR_DESC_TYPE_HOST;
-			reg |= c->q_comp_num;
+			reg |= cdd->td_queue.complete;
 		}
 		reg |= GCR_TEARDOWN;
 		cppi_writel(reg, c->gcr_reg);
@@ -641,7 +641,7 @@ static int cppi41_tear_down_chan(struct cppi41_channel *c)
 	if (!c->td_seen || !c->td_desc_seen) {
 
 		desc_phys = cppi41_pop_desc(cdd, cdd->td_queue.complete);
-		if (!desc_phys)
+		if (!desc_phys && c->is_tx)
 			desc_phys = cppi41_pop_desc(cdd, c->q_comp_num);
 
 		if (desc_phys == c->desc_phys) {
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
#5 lore raw

Re: [PATCH v3 2/3] dmaengine: cppi41: Add support of DA8xx to CPPI 4.1

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

The DA8xx has a CPPI 4.1 DMA controller.
This is add the glue layer required to make it work on DA8xx.

---
 drivers/dma/Kconfig  |  6 +++---
 drivers/dma/cppi41.c | 24 ++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 3 deletions(-)
drivers/dma/Kconfig +0 -0
index 0d6a96e..03ae2a1 100644

drivers/dma/Kconfig config TIMB_DMA · line 517

Quoted 6 lines
drivers/dma/Kconfig +1 -2
@@ -514,12 +514,12 @@ 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"

Grr... CPPI 4.1, please.

Quoted 13 lines
drivers/dma/Kconfig +2 -1
+	depends on (ARCH_OMAP || ARCH_DAVINCI_DA8XX)
 	select DMA_ENGINE
 	help
 	  The Communications Port Programming Interface (CPPI) 4.1 DMA engine
-	  is currently used by the USB driver on AM335x platforms.
+	  is currently used by the USB driver on AM335x and DA8xx platforms.
 
 config TI_DMA_CROSSBAR
 	bool
drivers/dma/cppi41.c +0 -0
index 9767b97..f6f2d84 100644

[...]

drivers/dma/cppi41.c static const struct cppi_glue_infos am335x_usb_infos = { · line 969

Quoted 6 lines
drivers/dma/cppi41.c +2 -0
@@ -951,8 +965,18 @@ static const struct cppi_glue_infos am335x_usb_infos = {
 	.qmgr_num_pend = 5,
 };
 
+static const struct cppi_glue_infos da8xx_usb_infos = {
+	.isr = cppi41_irq,

Isn't the ISR the same for all glues now?

[...]

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

#7 lore raw

Re: [PATCH v3 2/3] dmaengine: cppi41: Add support of DA8xx to CPPI 4.1

In reply to a message not in the archive
Quoted 45 lines · Sergei Shtylyov
Quoted 14 lines · Alexandre Bailon

The DA8xx has a CPPI 4.1 DMA controller.
This is add the glue layer required to make it work on DA8xx.

---
 drivers/dma/Kconfig  |  6 +++---
 drivers/dma/cppi41.c | 24 ++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 3 deletions(-)
drivers/dma/Kconfig +0 -0
index 0d6a96e..03ae2a1 100644

drivers/dma/Kconfig config TIMB_DMA · line 517

Quoted 6 lines
drivers/dma/Kconfig +1 -2
@@ -514,12 +514,12 @@ 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"
   Grr... CPPI 4.1, please.
Quoted 14 lines
drivers/dma/Kconfig +1 -0
+    depends on (ARCH_OMAP || ARCH_DAVINCI_DA8XX)
     select DMA_ENGINE
     help
       The Communications Port Programming Interface (CPPI) 4.1 DMA

engine

drivers/dma/Kconfig +1 -1
-      is currently used by the USB driver on AM335x platforms.
+      is currently used by the USB driver on AM335x and DA8xx platforms.
 
 config TI_DMA_CROSSBAR
     bool
drivers/dma/cppi41.c +0 -0
index 9767b97..f6f2d84 100644

[...]

Quoted 5 lines
drivers/dma/cppi41.c +0 -0
@@ -951,8 +965,18 @@ static const struct cppi_glue_infos
 am335x_usb_infos = {
     .qmgr_num_pend = 5,
 };
 
Quoted 4 lines

drivers/dma/cppi41.c static const struct cppi_glue_infos am335x_usb_infos = { · line 969

Quoted 2 lines
drivers/dma/cppi41.c +2 -0
+static const struct cppi_glue_infos da8xx_usb_infos = {
+    .isr = cppi41_irq,

Isn't the ISR the same for all glues now?

True. I should remove isr callback.

Quoted 5 lines

[...]

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