Skip to contentSkip to conversation

add support for Mediatek High-Speed DMA controller on MT7622 and MT7623 SoC

PATCH Superseded [email protected] 2 participants 5 messages Mar 7, 2018

Subsystems (4)

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

v6 cover add support for Mediatek High-Speed DMA controller on MT7622 and MT7623 SoC

From: Sean Wang <[email protected]>

Changes since v5:
- use C99 style comments at the first two lines
- remove unused header includes
- use directly KBUILD_MODNAME as a driver name
- use DMA_SLAVE_BUSWIDTH_4_BYTES to reflect the real bus width
- refine comments
- refine code style aligning with 80 chars and wrap
- use GFP_NOWAIT as the flag for memory allocations for DMA
- changing flow for it should be returning 0 instead of -ENOSPC for all successful descriptor issuing either in part or in full
- refine ISR with a fail-safe loop, and having a status check at the start
- remove a few unused code
- refine callback device_terminate_all, which does it should be freeing all descriptors
- refine callback device_free_chan_resources, which does it should be freeing all descriptors before freeing physical channel
- remove unnecessary callback device_synchronize

Changes since v4:
- rebase to 4.16-rc1
- fold back patch 4 and 5 in v4 into the original commit
- add the missing header included
- fix typo and add more explanation in existing comments
- fix the comments with kernel-doc style which uses /** as the begin
- begin the multi-line comments with /*

Changes since v3:
- enhance dt-binding documents based on Rob's comments
- make consistent among all comments
- perfer ordering declarations longest to shortest
- fix warning reported from kbuild test robot
- add patch 4 and 5 to keep Fengguang and Julia's effort

Changes since v2:
- remove extra tasklets and refactor driver for letting descriptors being processed ASAP.
- add more comments stating the relevant logic
- remove unused macro and variables
- change to use the disclaimer with SPDX identifier
- add mt7622 support
- refine hardware initialization sequence
- add tx_status support for DMA_RESIDUE_GRANULARITY_SEGMENT
- refine remove handler with killing vc's tasklet

Changes since v1:
- fix typo in the commit message.
- delete status shown in the dt-binding example.

This patchset introduces support for MediaTek High-Speed DMA controller (MTK-HSDMA) Currently, the driver is already tested successfully with dmatest module on MT7622 and MT7623 SoC.

MTK-HSDMA on MT7622/23 SoC has a single ring which is dedicated for doing memory-to-memory transfer through ring-based descriptor management. Even though there is only a single ring available inside HSDMA, the driver is being extended to the support for multiple virtual channels processing simultaneously by means of DMA_VIRTUAL_CHANNELS.

Sean Wang (3):
dt-bindings: dmaengine: Add MediaTek High-Speed DMA controller
bindings
dmaengine: mediatek: Add MediaTek High-Speed DMA controller for MT7622

    and MT7623 SoC

dmaengine: mediatek: update MAINTAINERS entry with MediaTek DMA driver

 .../devicetree/bindings/dma/mtk-hsdma.txt          |   33 +
 MAINTAINERS                                        |    9 +
 drivers/dma/Kconfig                                |    2 +
 drivers/dma/Makefile                               |    1 +
 drivers/dma/mediatek/Kconfig                       |   13 +
 drivers/dma/mediatek/Makefile                      |    1 +
 drivers/dma/mediatek/mtk-hsdma.c                   | 1056 ++++++++++++++++++++
 7 files changed, 1115 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/dma/mtk-hsdma.txt
 create mode 100644 drivers/dma/mediatek/Kconfig
 create mode 100644 drivers/dma/mediatek/Makefile
 create mode 100644 drivers/dma/mediatek/mtk-hsdma.c
Signature · 1 line
2.7.4
author maintainer
#1 lore raw

PATCH v6 1/3 dt-bindings: dmaengine: Add MediaTek High-Speed DMA controller bindings

From: Sean Wang <[email protected]>

Document the devicetree bindings for MediaTek High-Speed DMA controller which could be found on MT7623 SoC or other similar Mediatek SoCs.

---
 .../devicetree/bindings/dma/mtk-hsdma.txt          | 33 ++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/dma/mtk-hsdma.txt
Documentation/devicetree/bindings/dma/mtk-hsdma.txt new file +33 -0
new file mode 100644
index 0000000..4bb31735
@@ -0,0 +1,33 @@
+MediaTek High-Speed DMA Controller
+==================================
+
+This device follows the generic DMA bindings defined in dma/dma.txt.
+
+Required properties:
+
+- compatible:	Must be one of
+		  "mediatek,mt7622-hsdma": for MT7622 SoC
+		  "mediatek,mt7623-hsdma": for MT7623 SoC
+- reg:		Should contain the register's base address and length.
+- interrupts:	Should contain a reference to the interrupt used by this
+		device.
+- clocks:	Should be the clock specifiers corresponding to the entry in
+		clock-names property.
+- clock-names:	Should contain "hsdma" entries.
+- power-domains: Phandle to the power domain that the device is part of
+- #dma-cells: 	The length of the DMA specifier, must be <1>. This one cell
+		in dmas property of a client device represents the channel
+		number.
+Example:
+
+        hsdma: dma-controller@1b007000 {
+		compatible = "mediatek,mt7623-hsdma";
+		reg = <0 0x1b007000 0 0x1000>;
+		interrupts = <GIC_SPI 98 IRQ_TYPE_LEVEL_LOW>;
+		clocks = <&ethsys CLK_ETHSYS_HSDMA>;
+		clock-names = "hsdma";
+		power-domains = <&scpsys MT2701_POWER_DOMAIN_ETH>;
+		#dma-cells = <1>;
+	};
+
+DMA clients must use the format described in dma/dma.txt file.
maintainer
#2 lore raw

Re: [PATCH v6 1/3] dt-bindings: dmaengine: Add MediaTek High-Speed DMA controller bindings

Quoted 10 lines · On Wed, Mar 07, 2018 at 04:16:26PM +0800, [email protected] wrote:

From: Sean Wang <[email protected]>

Document the devicetree bindings for MediaTek High-Speed DMA controller which could be found on MT7623 SoC or other similar Mediatek SoCs.

---
 .../devicetree/bindings/dma/mtk-hsdma.txt          | 33 ++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/dma/mtk-hsdma.txt

Please add reviewed-by's when posting new versions.

Quoted 43 lines
Documentation/devicetree/bindings/dma/mtk-hsdma.txt new file +33 -0
new file mode 100644
index 0000000..4bb31735
@@ -0,0 +1,33 @@
+MediaTek High-Speed DMA Controller
+==================================
+
+This device follows the generic DMA bindings defined in dma/dma.txt.
+
+Required properties:
+
+- compatible:	Must be one of
+		  "mediatek,mt7622-hsdma": for MT7622 SoC
+		  "mediatek,mt7623-hsdma": for MT7623 SoC
+- reg:		Should contain the register's base address and length.
+- interrupts:	Should contain a reference to the interrupt used by this
+		device.
+- clocks:	Should be the clock specifiers corresponding to the entry in
+		clock-names property.
+- clock-names:	Should contain "hsdma" entries.
+- power-domains: Phandle to the power domain that the device is part of
+- #dma-cells: 	The length of the DMA specifier, must be <1>. This one cell
+		in dmas property of a client device represents the channel
+		number.
+Example:
+
+        hsdma: dma-controller@1b007000 {
+		compatible = "mediatek,mt7623-hsdma";
+		reg = <0 0x1b007000 0 0x1000>;
+		interrupts = <GIC_SPI 98 IRQ_TYPE_LEVEL_LOW>;
+		clocks = <&ethsys CLK_ETHSYS_HSDMA>;
+		clock-names = "hsdma";
+		power-domains = <&scpsys MT2701_POWER_DOMAIN_ETH>;
+		#dma-cells = <1>;
+	};
+
+DMA clients must use the format described in dma/dma.txt file.
Signature · 1 line
2.7.4

---
To unsubscribe from this list: send the line "unsubscribe dmaengine" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author maintainer
#3 lore raw

PATCH v6 2/3 dmaengine: mediatek: Add MediaTek High-Speed DMA controller for MT7622 and MT7623 SoC

In reply to [email protected]

From: Sean Wang <[email protected]>

MediaTek High-Speed DMA controller (HSDMA) on MT7622 and MT7623 SoC has a single ring is dedicated to memory-to-memory transfer through ring based descriptor management.

Even though there is only one physical ring available inside HSDMA, the driver can be easily extended to the support of multiple virtual channels processing simultaneously by means of DMA_VIRTUAL_CHANNELS effort.

Cc Randy Dunlap <[email protected]>
Cc Fengguang Wu <[email protected]>
Cc Julia Lawall <[email protected]>
---
 drivers/dma/Kconfig              |    2 +
 drivers/dma/Makefile             |    1 +
 drivers/dma/mediatek/Kconfig     |   13 +
 drivers/dma/mediatek/Makefile    |    1 +
 drivers/dma/mediatek/mtk-hsdma.c | 1056 ++++++++++++++++++++++++++++++++++++++
 5 files changed, 1073 insertions(+)
 create mode 100644 drivers/dma/mediatek/Kconfig
 create mode 100644 drivers/dma/mediatek/Makefile
 create mode 100644 drivers/dma/mediatek/mtk-hsdma.c
drivers/dma/Kconfig +2 -0
index 27df3e2..86ace76 100644
@@ -633,6 +633,8 @@ config ZX_DMA
 # driver files
 source "drivers/dma/bestcomm/Kconfig"
 
+source "drivers/dma/mediatek/Kconfig"
+
 source "drivers/dma/qcom/Kconfig"
 
 source "drivers/dma/dw/Kconfig"
drivers/dma/Makefile +1 -0
index b9dca8a..7a57b97 100644
@@ -75,5 +75,6 @@ obj-$(CONFIG_XGENE_DMA) += xgene-dma.o
 obj-$(CONFIG_ZX_DMA) += zx_dma.o
 obj-$(CONFIG_ST_FDMA) += st_fdma.o
 
+obj-y += mediatek/
 obj-y += qcom/
 obj-y += xilinx/
drivers/dma/mediatek/Kconfig new file +13 -0
new file mode 100644
index 0000000..27bac0b
@@ -0,0 +1,13 @@
+
+config MTK_HSDMA
+	tristate "MediaTek High-Speed DMA controller support"
+	depends on ARCH_MEDIATEK || COMPILE_TEST
+	select DMA_ENGINE
+	select DMA_VIRTUAL_CHANNELS
+	---help---
+	  Enable support for High-Speed DMA controller on MediaTek
+	  SoCs.
+
+	  This controller provides the channels which is dedicated to
+	  memory-to-memory transfer to offload from CPU through ring-
+	  based descriptor management.
drivers/dma/mediatek/Makefile new file +1 -0
new file mode 100644
index 0000000..6e778f8
@@ -0,0 +1 @@
+obj-$(CONFIG_MTK_HSDMA) += mtk-hsdma.o
drivers/dma/mediatek/mtk-hsdma.c new file +1056 -0

1,056 lines not on this page · raw message

author maintainer
#4 lore raw

PATCH v6 3/3 dmaengine: mediatek: update MAINTAINERS entry with MediaTek DMA driver

In reply to [email protected]

From: Sean Wang <[email protected]>

I work for MediaTek and maintain SoC targeting to home gateway and also will keep extending and testing the function.

---
 MAINTAINERS | 9 +++++++++
 1 file changed, 9 insertions(+)
MAINTAINERS +9 -0
index 3bdc260..d3c33d7 100644
@@ -8785,6 +8785,15 @@ M:	Sean Wang <[email protected]>
 S:	Maintained
 F:	drivers/media/rc/mtk-cir.c
 
+MEDIATEK DMA DRIVER
+M:	Sean Wang <[email protected]>
+L:	[email protected]
+L:	[email protected] (moderated for non-subscribers)
+L:	[email protected] (moderated for non-subscribers)
+S:	Maintained
+F:	Documentation/devicetree/bindings/dma/mtk-*
+F:	drivers/dma/mediatek/
+
 MEDIATEK PMIC LED DRIVER
 M:	Sean Wang <[email protected]>
 S:	Maintained