Skip to contentSkip to conversation

ARM: dts: sun8i: R40: Add SPI controllers nodes and pinmuxes

PATCH Applied Andre Przywara 3 participants 5 messages Jan 6, 2020

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

PATCH v2 1/1 ARM: dts: sun8i: R40: Add SPI controllers nodes and pinmuxes

The Allwinner R40 SoC contains four SPI controllers, using the newer sun6i design (but at the legacy addresses).
The controller seems to be fully compatible to the A64 one, so no driver changes are necessary.
The first three controllers can be used on two sets of pins, but SPI3 is only routed to one set on Port A.
Only the pin groups for SPI0 on PortC and SPI1 on PortI are added here, because those seem to be the only one exposed on the Bananapi boards.

Tested by connecting a SPI flash to a Bananapi M2 Berry SPI0 and SPI1 header pins.

---
Changes from v1 3/3 ... v2:
- Removed most pin groups except SPI0-PC and SPI1-PI
- Split off CS pins
- Add omit-if-no-ref tags

 arch/arm/boot/dts/sun8i-r40.dtsi | 90 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 90 insertions(+)
arch/arm/boot/dts/sun8i-r40.dtsi +90 -0
index 8dcbc4465fbb..c5654fd034be 100644
@@ -418,6 +418,36 @@
 				bias-pull-up;
 			};
 
+			/omit-if-no-ref/
+			spi0_pc_pins: spi0-pc-pins {
+				pins = "PC0", "PC1", "PC2";
+				function = "spi0";
+			};
+
+			/omit-if-no-ref/
+			spi0_cs0_pc_pin: spi0-cs0-pc-pin {
+				pins = "PC23";
+				function = "spi0";
+			};
+
+			/omit-if-no-ref/
+			spi1_pi_pins: spi1-pi-pins {
+				pins = "PI17", "PI18", "PI19";
+				function = "spi1";
+			};
+
+			/omit-if-no-ref/
+			spi1_cs0_pi_pin: spi1-cs0-pi-pin {
+				pins = "PI16";
+				function = "spi1";
+			};
+
+			/omit-if-no-ref/
+			spi1_cs1_pi_pin: spi1-cs1-pi-pin {
+				pins = "PI15";
+				function = "spi1";
+			};
+
 			uart0_pb_pins: uart0-pb-pins {
 				pins = "PB22", "PB23";
 				function = "uart0";
@@ -594,6 +624,66 @@
 			#size-cells = <0>;
 		};
 
+		spi0: spi@1c05000 {
+			compatible = "allwinner,sun8i-r40-spi",
+				     "allwinner,sun8i-h3-spi";
+			reg = <0x01c05000 0x1000>;
+			interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_SPI0>, <&ccu CLK_SPI0>;
+			clock-names = "ahb", "mod";
+			dmas = <&dma 24>, <&dma 24>;
+			dma-names = "rx", "tx";
+			resets = <&ccu RST_BUS_SPI0>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
+		spi1: spi@1c06000 {
+			compatible = "allwinner,sun8i-r40-spi",
+				     "allwinner,sun8i-h3-spi";
+			reg = <0x01c06000 0x1000>;
+			interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_SPI1>, <&ccu CLK_SPI1>;
+			clock-names = "ahb", "mod";
+			dmas = <&dma 25>, <&dma 25>;
+			dma-names = "rx", "tx";
+			resets = <&ccu RST_BUS_SPI1>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
+		spi2: spi@1c07000 {
+			compatible = "allwinner,sun8i-r40-spi",
+				     "allwinner,sun8i-h3-spi";
+			reg = <0x01c07000 0x1000>;
+			interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_SPI2>, <&ccu CLK_SPI2>;
+			clock-names = "ahb", "mod";
+			dmas = <&dma 26>, <&dma 26>;
+			dma-names = "rx", "tx";
+			resets = <&ccu RST_BUS_SPI2>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
+		spi3: spi@1c0f000 {
+			compatible = "allwinner,sun8i-r40-spi",
+				     "allwinner,sun8i-h3-spi";
+			reg = <0x01c0f000 0x1000>;
+			interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&ccu CLK_BUS_SPI3>, <&ccu CLK_SPI3>;
+			clock-names = "ahb", "mod";
+			dmas = <&dma 27>, <&dma 27>;
+			dma-names = "rx", "tx";
+			resets = <&ccu RST_BUS_SPI3>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
 		ahci: sata@1c18000 {
 			compatible = "allwinner,sun8i-r40-ahci";
 			reg = <0x01c18000 0x1000>;
Signature · 1 line
2.14.5
#1 lore raw
Quoted 9 lines · Andre Przywara

The Allwinner R40 SoC contains four SPI controllers, using the newer sun6i design (but at the legacy addresses).
The controller seems to be fully compatible to the A64 one, so no driver changes are necessary.
The first three controllers can be used on two sets of pins, but SPI3 is only routed to one set on Port A.
Only the pin groups for SPI0 on PortC and SPI1 on PortI are added here, because those seem to be the only one exposed on the Bananapi boards.

Quoted 4 lines

Tested by connecting a SPI flash to a Bananapi M2 Berry SPI0 and SPI1 header pins.

Applied, thanks!
Maxime

#2 lore raw
Quoted 11 lines · Maxime Ripard
Quoted 9 lines · Andre Przywara

The Allwinner R40 SoC contains four SPI controllers, using the newer sun6i design (but at the legacy addresses).
The controller seems to be fully compatible to the A64 one, so no driver changes are necessary.
The first three controllers can be used on two sets of pins, but SPI3 is only routed to one set on Port A.
Only the pin groups for SPI0 on PortC and SPI1 on PortI are added here, because those seem to be the only one exposed on the Bananapi boards.

Quoted 7 lines
Quoted 4 lines

Tested by connecting a SPI flash to a Bananapi M2 Berry SPI0 and SPI1 header pins.

Applied, thanks!
Maxime

Looks like this patch doesn't build. The SPI device nodes reference a non-existent DMA node.

ChenYu

#3 lore raw

On Mon, 6 Jan 2020 21:37:38 +0800
Chen-Yu Tsai <[email protected]> wrote:

Hi,

Quoted 15 lines · Maxime Ripard
Quoted 14 lines · Andre Przywara
Quoted 12 lines

The Allwinner R40 SoC contains four SPI controllers, using the newer sun6i design (but at the legacy addresses).
The controller seems to be fully compatible to the A64 one, so no driver changes are necessary.
The first three controllers can be used on two sets of pins, but SPI3 is only routed to one set on Port A.
Only the pin groups for SPI0 on PortC and SPI1 on PortI are added here, because those seem to be the only one exposed on the Bananapi boards.

Tested by connecting a SPI flash to a Bananapi M2 Berry SPI0 and SPI1 header pins.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Applied, thanks!
Maxime

Looks like this patch doesn't build. The SPI device nodes reference a non-existent DMA node.

Argh, shoot, sorry for that. Looks like a rebase artefact (I originally had the DMA controller in, but then saw that this is actually not used by the SPI driver, so removed it).

Thanks for testing!

Maxime, shall I send a fixup or redo the patch?

Cheers,
Andre

#4 lore raw
Quoted 28 lines · Andre Przywara

On Mon, 6 Jan 2020 21:37:38 +0800
Chen-Yu Tsai <[email protected]> wrote:

Hi,

Quoted 15 lines · Maxime Ripard
Quoted 14 lines · Andre Przywara
Quoted 12 lines

The Allwinner R40 SoC contains four SPI controllers, using the newer sun6i design (but at the legacy addresses).
The controller seems to be fully compatible to the A64 one, so no driver changes are necessary.
The first three controllers can be used on two sets of pins, but SPI3 is only routed to one set on Port A.
Only the pin groups for SPI0 on PortC and SPI1 on PortI are added here, because those seem to be the only one exposed on the Bananapi boards.

Tested by connecting a SPI flash to a Bananapi M2 Berry SPI0 and SPI1 header pins.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Applied, thanks!
Maxime

Looks like this patch doesn't build. The SPI device nodes reference a non-existent DMA node.

Quoted 7 lines

Argh, shoot, sorry for that. Looks like a rebase artefact (I originally had the DMA controller in, but then saw that this is actually not used by the SPI driver, so removed it).

Thanks for testing!

Maxime, shall I send a fixup or redo the patch?

Send a fixup, I'll squash it with the previous patch, thanks! Maxime