linux-sunxi.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Add missing peripherals to Allwinner V3s/V3 device trees
@ 2021-05-13 19:09 Tobias Schramm
  2021-05-13 19:09 ` [PATCH 1/4] ARM: dts: sun8i: v3s: add DMA controller to v3s dts Tobias Schramm
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Tobias Schramm @ 2021-05-13 19:09 UTC (permalink / raw)
  To: Rob Herring, Maxime Ripard, Chen-Yu Tsai
  Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, Tobias Schramm

The Allwinner V3s/V3 SoCs feature quite a few peripherals that have good
driver support but yet are nowhere to be found in the SoCs dts.
This patchset adds the DMA controller, the relevant DMA properties for all
peripherals supporting DMA, the integrated analog codec and - for the
Allwinner V3 SoC - also the I2S interface.
I've included all of those changes in one patchset since they do all
depend on addition of the DMA controller.
All changes have been tested in a recent project of mine using a Sochip S3
(a rebranded Allwinner V3) and are confirmed working.

Cheers,
Tobias

Tobias Schramm (4):
  ARM: dts: sun8i: v3s: add DMA controller to v3s dts
  ARM: dts: sun8i: v3s: add DMA properties to peripherals supporting DMA
  ARM: dts: sun8i: v3s: add analog codec and frontend to v3s dts
  ARM: dts: sun8i: V3: add I2S interface to V3 dts

 arch/arm/boot/dts/sun8i-v3.dtsi  | 25 ++++++++++++++++++++
 arch/arm/boot/dts/sun8i-v3s.dtsi | 39 ++++++++++++++++++++++++++++++++
 2 files changed, 64 insertions(+)

-- 
2.30.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] ARM: dts: sun8i: v3s: add DMA controller to v3s dts
  2021-05-13 19:09 [PATCH 0/4] Add missing peripherals to Allwinner V3s/V3 device trees Tobias Schramm
@ 2021-05-13 19:09 ` Tobias Schramm
  2021-05-13 19:09 ` [PATCH 2/4] ARM: dts: sun8i: v3s: add DMA properties to peripherals supporting DMA Tobias Schramm
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Tobias Schramm @ 2021-05-13 19:09 UTC (permalink / raw)
  To: Rob Herring, Maxime Ripard, Chen-Yu Tsai
  Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, Tobias Schramm

The Allwinner V3s and V3 feature a DMA controller.
This commit adds it to the V3s dtsi.

Signed-off-by: Tobias Schramm <t.schramm@manjaro.org>
---
 arch/arm/boot/dts/sun8i-v3s.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-v3s.dtsi b/arch/arm/boot/dts/sun8i-v3s.dtsi
index eb4cb63fef13..f0296ab46137 100644
--- a/arch/arm/boot/dts/sun8i-v3s.dtsi
+++ b/arch/arm/boot/dts/sun8i-v3s.dtsi
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2016 Icenowy Zheng <icenowy@aosc.xyz>
+ * Copyright (C) 2021 Tobias Schramm <t.schramm@manjaro.org>
  *
  * This file is dual-licensed: you can use it either under the terms
  * of the GPL or the X11 license, at your option. Note that this dual
@@ -172,6 +173,15 @@ nmi_intc: interrupt-controller@1c000d0 {
 			interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
 		};
 
+		dma: dma-controller@1c02000 {
+			compatible = "allwinner,sun8i-v3s-dma";
+			reg = <0x01c02000 0x1000>;
+			interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_DMA>;
+			resets = <&ccu RST_BUS_DMA>;
+			#dma-cells = <1>;
+		};
+
 		tcon0: lcd-controller@1c0c000 {
 			compatible = "allwinner,sun8i-v3s-tcon";
 			reg = <0x01c0c000 0x1000>;
-- 
2.30.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/4] ARM: dts: sun8i: v3s: add DMA properties to peripherals supporting DMA
  2021-05-13 19:09 [PATCH 0/4] Add missing peripherals to Allwinner V3s/V3 device trees Tobias Schramm
  2021-05-13 19:09 ` [PATCH 1/4] ARM: dts: sun8i: v3s: add DMA controller to v3s dts Tobias Schramm
@ 2021-05-13 19:09 ` Tobias Schramm
  2021-05-13 19:09 ` [PATCH 3/4] ARM: dts: sun8i: v3s: add analog codec and frontend to v3s dts Tobias Schramm
  2021-05-13 19:09 ` [PATCH 4/4] ARM: dts: sun8i: V3: add I2S interface to V3 dts Tobias Schramm
  3 siblings, 0 replies; 6+ messages in thread
From: Tobias Schramm @ 2021-05-13 19:09 UTC (permalink / raw)
  To: Rob Herring, Maxime Ripard, Chen-Yu Tsai
  Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, Tobias Schramm

This commit adds DMA properties to all peripherals supporting DMA on the
Allwinner V3s, enabling accelerated data transfer to them.

Signed-off-by: Tobias Schramm <t.schramm@manjaro.org>
---
 arch/arm/boot/dts/sun8i-v3s.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-v3s.dtsi b/arch/arm/boot/dts/sun8i-v3s.dtsi
index f0296ab46137..3eaa8703e2ac 100644
--- a/arch/arm/boot/dts/sun8i-v3s.dtsi
+++ b/arch/arm/boot/dts/sun8i-v3s.dtsi
@@ -285,6 +285,8 @@ crypto@1c15000 {
 			interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&ccu CLK_BUS_CE>, <&ccu CLK_CE>;
 			clock-names = "ahb", "mod";
+			dmas = <&dma 16>, <&dma 16>;
+			dma-names = "rx", "tx";
 			resets = <&ccu RST_BUS_CE>;
 			reset-names = "ahb";
 		};
@@ -446,6 +448,8 @@ uart0: serial@1c28000 {
 			reg-shift = <2>;
 			reg-io-width = <4>;
 			clocks = <&ccu CLK_BUS_UART0>;
+			dmas = <&dma 6>, <&dma 6>;
+			dma-names = "rx", "tx";
 			resets = <&ccu RST_BUS_UART0>;
 			status = "disabled";
 		};
@@ -457,6 +461,8 @@ uart1: serial@1c28400 {
 			reg-shift = <2>;
 			reg-io-width = <4>;
 			clocks = <&ccu CLK_BUS_UART1>;
+			dmas = <&dma 7>, <&dma 7>;
+			dma-names = "rx", "tx";
 			resets = <&ccu RST_BUS_UART1>;
 			status = "disabled";
 		};
@@ -468,6 +474,8 @@ uart2: serial@1c28800 {
 			reg-shift = <2>;
 			reg-io-width = <4>;
 			clocks = <&ccu CLK_BUS_UART2>;
+			dmas = <&dma 8>, <&dma 8>;
+			dma-names = "rx", "tx";
 			resets = <&ccu RST_BUS_UART2>;
 			pinctrl-0 = <&uart2_pins>;
 			pinctrl-names = "default";
@@ -547,6 +555,8 @@ spi0: spi@1c68000 {
 			interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&ccu CLK_BUS_SPI0>, <&ccu CLK_SPI0>;
 			clock-names = "ahb", "mod";
+			dmas = <&dma 23>, <&dma 23>;
+			dma-names = "rx", "tx";
 			pinctrl-names = "default";
 			pinctrl-0 = <&spi0_pins>;
 			resets = <&ccu RST_BUS_SPI0>;
-- 
2.30.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 3/4] ARM: dts: sun8i: v3s: add analog codec and frontend to v3s dts
  2021-05-13 19:09 [PATCH 0/4] Add missing peripherals to Allwinner V3s/V3 device trees Tobias Schramm
  2021-05-13 19:09 ` [PATCH 1/4] ARM: dts: sun8i: v3s: add DMA controller to v3s dts Tobias Schramm
  2021-05-13 19:09 ` [PATCH 2/4] ARM: dts: sun8i: v3s: add DMA properties to peripherals supporting DMA Tobias Schramm
@ 2021-05-13 19:09 ` Tobias Schramm
  2021-05-13 19:09 ` [PATCH 4/4] ARM: dts: sun8i: V3: add I2S interface to V3 dts Tobias Schramm
  3 siblings, 0 replies; 6+ messages in thread
From: Tobias Schramm @ 2021-05-13 19:09 UTC (permalink / raw)
  To: Rob Herring, Maxime Ripard, Chen-Yu Tsai
  Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, Tobias Schramm

The Allwinner V3s and V3 SoCs feature an integrated analog audio codec.
Additionally both have an analog frontend with mixers and amplifiers for
the codec.
The analog frontend is identical to that on the Allwinner H3 SoC.
This commit adds both, the analog codec and its frontend to the V3s dtsi.

Signed-off-by: Tobias Schramm <t.schramm@manjaro.org>
---
 arch/arm/boot/dts/sun8i-v3s.dtsi | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-v3s.dtsi b/arch/arm/boot/dts/sun8i-v3s.dtsi
index 3eaa8703e2ac..7abc51c79f62 100644
--- a/arch/arm/boot/dts/sun8i-v3s.dtsi
+++ b/arch/arm/boot/dts/sun8i-v3s.dtsi
@@ -441,6 +441,25 @@ lradc: lradc@1c22800 {
 			status = "disabled";
 		};
 
+		codec: codec@1c22c00 {
+			#sound-dai-cells = <0>;
+			compatible = "allwinner,sun8i-v3s-codec";
+			reg = <0x01c22c00 0x400>;
+			interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_CODEC>, <&ccu CLK_AC_DIG>;
+			clock-names = "apb", "codec";
+			resets = <&ccu RST_BUS_CODEC>;
+			dmas = <&dma 15>, <&dma 15>;
+			dma-names = "rx", "tx";
+			allwinner,codec-analog-controls = <&codec_analog>;
+			status = "disabled";
+		};
+
+		codec_analog: codec-analog@1c23000 {
+			compatible = "allwinner,sun8i-h3-codec-analog";
+			reg = <0x01c23000 0x4>;
+		};
+
 		uart0: serial@1c28000 {
 			compatible = "snps,dw-apb-uart";
 			reg = <0x01c28000 0x400>;
-- 
2.30.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 4/4] ARM: dts: sun8i: V3: add I2S interface to V3 dts
  2021-05-13 19:09 [PATCH 0/4] Add missing peripherals to Allwinner V3s/V3 device trees Tobias Schramm
                   ` (2 preceding siblings ...)
  2021-05-13 19:09 ` [PATCH 3/4] ARM: dts: sun8i: v3s: add analog codec and frontend to v3s dts Tobias Schramm
@ 2021-05-13 19:09 ` Tobias Schramm
  2021-05-13 19:25   ` Jernej Škrabec
  3 siblings, 1 reply; 6+ messages in thread
From: Tobias Schramm @ 2021-05-13 19:09 UTC (permalink / raw)
  To: Rob Herring, Maxime Ripard, Chen-Yu Tsai
  Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, Tobias Schramm

The Allwinner V3 SoC features an I2S interface. The I2C peripheral is
identical to that in the Allwinner H3 SoC.
This commit adds it to the Allwinner V3 dts.

Signed-off-by: Tobias Schramm <t.schramm@manjaro.org>
---
 arch/arm/boot/dts/sun8i-v3.dtsi | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/arch/arm/boot/dts/sun8i-v3.dtsi b/arch/arm/boot/dts/sun8i-v3.dtsi
index c279e13583ba..0061c49523f2 100644
--- a/arch/arm/boot/dts/sun8i-v3.dtsi
+++ b/arch/arm/boot/dts/sun8i-v3.dtsi
@@ -1,10 +1,30 @@
 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 /*
  * Copyright (C) 2019 Icenowy Zheng <icenowy@aosc.io>
+ * Copyright (C) 2021 Tobias Schramm <t.schramm@manjaro.org>
  */
 
 #include "sun8i-v3s.dtsi"
 
+/ {
+	soc {
+			i2s0: i2s@1c22000 {
+				#sound-dai-cells = <0>;
+				compatible = "allwinner,sun8i-h3-i2s";
+				reg = <0x01c22000 0x400>;
+				interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
+				clocks = <&ccu CLK_BUS_I2S0>, <&ccu CLK_I2S0>;
+				clock-names = "apb", "mod";
+				dmas = <&dma 3>, <&dma 3>;
+				dma-names = "rx", "tx";
+				pinctrl-names = "default";
+				pinctrl-0 = <&i2s0_pins>;
+				resets = <&ccu RST_BUS_I2S0>;
+				status = "disabled";
+			};
+	};
+};
+
 &ccu {
 	compatible = "allwinner,sun8i-v3-ccu";
 };
@@ -25,6 +45,11 @@ external_mdio: mdio@2 {
 &pio {
 	compatible = "allwinner,sun8i-v3-pinctrl";
 
+	i2s0_pins: i2s0-pins {
+		pins = "PG10", "PG11", "PG12", "PG13";
+		function = "i2s";
+	};
+
 	uart1_pg_pins: uart1-pg-pins {
 		pins = "PG6", "PG7";
 		function = "uart1";
-- 
2.30.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 4/4] ARM: dts: sun8i: V3: add I2S interface to V3 dts
  2021-05-13 19:09 ` [PATCH 4/4] ARM: dts: sun8i: V3: add I2S interface to V3 dts Tobias Schramm
@ 2021-05-13 19:25   ` Jernej Škrabec
  0 siblings, 0 replies; 6+ messages in thread
From: Jernej Škrabec @ 2021-05-13 19:25 UTC (permalink / raw)
  To: Rob Herring, Maxime Ripard, Chen-Yu Tsai, Tobias Schramm
  Cc: devicetree, linux-arm-kernel, linux-sunxi, linux-kernel, Tobias Schramm

Dne četrtek, 13. maj 2021 ob 21:09:49 CEST je Tobias Schramm napisal(a):
> The Allwinner V3 SoC features an I2S interface. The I2C peripheral is

I2C -> I2S

> identical to that in the Allwinner H3 SoC.
> This commit adds it to the Allwinner V3 dts.
> 
> Signed-off-by: Tobias Schramm <t.schramm@manjaro.org>
> ---
>  arch/arm/boot/dts/sun8i-v3.dtsi | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/sun8i-v3.dtsi b/arch/arm/boot/dts/sun8i-
v3.dtsi
> index c279e13583ba..0061c49523f2 100644
> --- a/arch/arm/boot/dts/sun8i-v3.dtsi
> +++ b/arch/arm/boot/dts/sun8i-v3.dtsi
> @@ -1,10 +1,30 @@
>  // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
>  /*
>   * Copyright (C) 2019 Icenowy Zheng <icenowy@aosc.io>
> + * Copyright (C) 2021 Tobias Schramm <t.schramm@manjaro.org>

It's uncommon to add additional copyrights just for one node, but ok.

>   */
>  
>  #include "sun8i-v3s.dtsi"
>  
> +/ {
> +	soc {
> +			i2s0: i2s@1c22000 {
> +				#sound-dai-cells = <0>;
> +				compatible = "allwinner,sun8i-h3-
i2s";

You have to add v3s compatible as a fallback (and document it in devicetree 
documentation).

Best regards,
Jernej

> +				reg = <0x01c22000 0x400>;
> +				interrupts = <GIC_SPI 13 
IRQ_TYPE_LEVEL_HIGH>;
> +				clocks = <&ccu CLK_BUS_I2S0>, 
<&ccu CLK_I2S0>;
> +				clock-names = "apb", "mod";
> +				dmas = <&dma 3>, <&dma 3>;
> +				dma-names = "rx", "tx";
> +				pinctrl-names = "default";
> +				pinctrl-0 = <&i2s0_pins>;
> +				resets = <&ccu RST_BUS_I2S0>;
> +				status = "disabled";
> +			};
> +	};
> +};
> +
>  &ccu {
>  	compatible = "allwinner,sun8i-v3-ccu";
>  };
> @@ -25,6 +45,11 @@ external_mdio: mdio@2 {
>  &pio {
>  	compatible = "allwinner,sun8i-v3-pinctrl";
>  
> +	i2s0_pins: i2s0-pins {
> +		pins = "PG10", "PG11", "PG12", "PG13";
> +		function = "i2s";
> +	};
> +
>  	uart1_pg_pins: uart1-pg-pins {
>  		pins = "PG6", "PG7";
>  		function = "uart1";
> -- 
> 2.30.1
> 
> 
> 



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-05-13 19:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-13 19:09 [PATCH 0/4] Add missing peripherals to Allwinner V3s/V3 device trees Tobias Schramm
2021-05-13 19:09 ` [PATCH 1/4] ARM: dts: sun8i: v3s: add DMA controller to v3s dts Tobias Schramm
2021-05-13 19:09 ` [PATCH 2/4] ARM: dts: sun8i: v3s: add DMA properties to peripherals supporting DMA Tobias Schramm
2021-05-13 19:09 ` [PATCH 3/4] ARM: dts: sun8i: v3s: add analog codec and frontend to v3s dts Tobias Schramm
2021-05-13 19:09 ` [PATCH 4/4] ARM: dts: sun8i: V3: add I2S interface to V3 dts Tobias Schramm
2021-05-13 19:25   ` Jernej Škrabec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).