linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] ARM: dts: sun8i: R40: Add SPI controllers nodes and pinmuxes
@ 2020-01-06  0:38 Andre Przywara
  2020-01-06  8:56 ` Maxime Ripard
  0 siblings, 1 reply; 5+ messages in thread
From: Andre Przywara @ 2020-01-06  0:38 UTC (permalink / raw)
  To: Maxime Ripard, Chen-Yu Tsai
  Cc: Mark Rutland, Rob Herring, devicetree, linux-arm-kernel,
	linux-kernel, linux-sunxi, Icenowy Zheng

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.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
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(+)

diff --git a/arch/arm/boot/dts/sun8i-r40.dtsi b/arch/arm/boot/dts/sun8i-r40.dtsi
index 8dcbc4465fbb..c5654fd034be 100644
--- a/arch/arm/boot/dts/sun8i-r40.dtsi
+++ b/arch/arm/boot/dts/sun8i-r40.dtsi
@@ -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>;
-- 
2.14.5


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

* Re: [PATCH v2] ARM: dts: sun8i: R40: Add SPI controllers nodes and pinmuxes
  2020-01-06  0:38 [PATCH v2] ARM: dts: sun8i: R40: Add SPI controllers nodes and pinmuxes Andre Przywara
@ 2020-01-06  8:56 ` Maxime Ripard
  2020-01-06 13:37   ` Chen-Yu Tsai
  0 siblings, 1 reply; 5+ messages in thread
From: Maxime Ripard @ 2020-01-06  8:56 UTC (permalink / raw)
  To: Andre Przywara
  Cc: Chen-Yu Tsai, Mark Rutland, Rob Herring, devicetree,
	linux-arm-kernel, linux-kernel, linux-sunxi, Icenowy Zheng

[-- Attachment #1: Type: text/plain, Size: 711 bytes --]

On Mon, Jan 06, 2020 at 12:38:49AM +0000, Andre Przywara wrote:
> 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.
>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>

Applied, thanks!
Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH v2] ARM: dts: sun8i: R40: Add SPI controllers nodes and pinmuxes
  2020-01-06  8:56 ` Maxime Ripard
@ 2020-01-06 13:37   ` Chen-Yu Tsai
  2020-01-06 13:42     ` Andre Przywara
  0 siblings, 1 reply; 5+ messages in thread
From: Chen-Yu Tsai @ 2020-01-06 13:37 UTC (permalink / raw)
  To: Maxime Ripard, Andre Przywara
  Cc: Mark Rutland, Rob Herring, devicetree, linux-arm-kernel,
	linux-kernel, linux-sunxi, Icenowy Zheng

On Mon, Jan 6, 2020 at 4:56 PM Maxime Ripard <mripard@kernel.org> wrote:
>
> On Mon, Jan 06, 2020 at 12:38:49AM +0000, Andre Przywara wrote:
> > 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.
> >
> > Signed-off-by: Andre Przywara <andre.przywara@arm.com>
>
> Applied, thanks!
> Maxime

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

ChenYu

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

* Re: [PATCH v2] ARM: dts: sun8i: R40: Add SPI controllers nodes and pinmuxes
  2020-01-06 13:37   ` Chen-Yu Tsai
@ 2020-01-06 13:42     ` Andre Przywara
  2020-01-06 13:51       ` Maxime Ripard
  0 siblings, 1 reply; 5+ messages in thread
From: Andre Przywara @ 2020-01-06 13:42 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Maxime Ripard, Mark Rutland, Rob Herring, devicetree,
	linux-arm-kernel, linux-kernel, linux-sunxi, Icenowy Zheng

On Mon, 6 Jan 2020 21:37:38 +0800
Chen-Yu Tsai <wens@csie.org> wrote:

Hi,

> On Mon, Jan 6, 2020 at 4:56 PM Maxime Ripard <mripard@kernel.org> wrote:
> >
> > On Mon, Jan 06, 2020 at 12:38:49AM +0000, Andre Przywara wrote:  
> > > 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.
> > >
> > > Signed-off-by: Andre Przywara <andre.przywara@arm.com>  
> >
> > 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

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

* Re: [PATCH v2] ARM: dts: sun8i: R40: Add SPI controllers nodes and pinmuxes
  2020-01-06 13:42     ` Andre Przywara
@ 2020-01-06 13:51       ` Maxime Ripard
  0 siblings, 0 replies; 5+ messages in thread
From: Maxime Ripard @ 2020-01-06 13:51 UTC (permalink / raw)
  To: Andre Przywara
  Cc: Chen-Yu Tsai, Mark Rutland, Rob Herring, devicetree,
	linux-arm-kernel, linux-kernel, linux-sunxi, Icenowy Zheng

[-- Attachment #1: Type: text/plain, Size: 1480 bytes --]

On Mon, Jan 06, 2020 at 01:42:07PM +0000, Andre Przywara wrote:
> On Mon, 6 Jan 2020 21:37:38 +0800
> Chen-Yu Tsai <wens@csie.org> wrote:
>
> Hi,
>
> > On Mon, Jan 6, 2020 at 4:56 PM Maxime Ripard <mripard@kernel.org> wrote:
> > >
> > > On Mon, Jan 06, 2020 at 12:38:49AM +0000, Andre Przywara wrote:
> > > > 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.
> > > >
> > > > Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> > >
> > > 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?

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

end of thread, other threads:[~2020-01-06 13:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-06  0:38 [PATCH v2] ARM: dts: sun8i: R40: Add SPI controllers nodes and pinmuxes Andre Przywara
2020-01-06  8:56 ` Maxime Ripard
2020-01-06 13:37   ` Chen-Yu Tsai
2020-01-06 13:42     ` Andre Przywara
2020-01-06 13:51       ` Maxime Ripard

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).