dmaengine: cppi41: Add dma support to da8xx
Subsystems (3)
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/7] dmaengine: cppi41: Make CPPI 4.1 driver more generic".
Changes in v3:
- Fix few typos
- Don't use a wildcard for the compatible property
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 | 27 +++++++++++++-- 3 files changed, 67 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
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 archiveDT 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
@@ -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 devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 2/3 dmaengine: cppi41: Add support of DA8xx to CPPI 4.1
In reply to a message not in the archiveThe 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 | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-)
drivers/dma/Kconfig +3 -3
@@ -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 "CPPI 4.1 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 +23 -0
@@ -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 {const struct chan_queues *queues_rx;const struct chan_queues *queues_tx;
@@ -949,8 +963,17 @@ static const struct cppi_glue_infos am335x_usb_infos = { .qmgr_num_pend = 5, }; +static const struct cppi_glue_infos da8xx_usb_infos = { + .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 devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 3/3 dmaengine: cppi41: Fix teardown warnings
In reply to a message not in the archiveDuring 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
@@ -629,7 +629,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);
@@ -640,7 +640,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 devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Rob Herring
Acked-byRe: [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 archiveQuoted 57 lines · Alexandre Bailon
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 +24
-0@@ -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 =
Documentation/devicetree/bindings/usb/da8xx-usb.txt Example: · line 75
Quoted 10 lines
Documentation/devicetree/bindings/usb/da8xx-usb.txt +9
-0+ "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>;
This is creating overlapping addresses which we want to avoid. The parent's ranges should be filled in and reg set to only those addresses the parent will touch (0x200000-0x201000?). With that,
Quoted 10 lines
Documentation/devicetree/bindings/usb/da8xx-usb.txt +6
-0+ reg-names = "controller", "scheduler", "queuemgr"; + interrupts = <58>; + #dma-cells = <2>; + #dma-channels = <4>; + }; + };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