linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 10/14] dt-bindings: spi: sunxi: document F1C100 controllers
       [not found] <20220307143421.1106209-1-andre.przywara@arm.com>
@ 2022-03-07 14:34 ` Andre Przywara
  2022-03-08 16:10   ` Rob Herring
  2022-03-11  2:19   ` Samuel Holland
  2022-03-07 14:34 ` [PATCH 11/14] ARM: dts: suniv: F1C100: add SPI support Andre Przywara
  2022-03-07 14:34 ` [PATCH 12/14] ARM: dts: suniv: licheepi-nano: add SPI flash Andre Przywara
  2 siblings, 2 replies; 8+ messages in thread
From: Andre Przywara @ 2022-03-07 14:34 UTC (permalink / raw)
  To: Maxime Ripard, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland
  Cc: Rob Herring, Mesih Kilinc, Icenowy Zheng, Jesse Taube,
	Giulio Benetti, George Hilliard, devicetree, linux-arm-kernel,
	linux-sunxi, Mark Brown, linux-spi

The Allwinner F1C100 series contains two SPI controllers, which are
compatible to the IP block used in the Allwinner H3 as well.
The only difference in the integration is the missing mod clock in the
F1C100, but that does not affect the SPI controller binding, as we can
still supply the correct clock (AHB parent) easily.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
 .../devicetree/bindings/spi/allwinner,sun6i-a31-spi.yaml         | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/spi/allwinner,sun6i-a31-spi.yaml b/Documentation/devicetree/bindings/spi/allwinner,sun6i-a31-spi.yaml
index 908248260afa..ca4c95345a49 100644
--- a/Documentation/devicetree/bindings/spi/allwinner,sun6i-a31-spi.yaml
+++ b/Documentation/devicetree/bindings/spi/allwinner,sun6i-a31-spi.yaml
@@ -26,6 +26,7 @@ properties:
               - allwinner,sun8i-r40-spi
               - allwinner,sun50i-h6-spi
               - allwinner,sun50i-h616-spi
+              - allwinner,suniv-f1c100s-spi
           - const: allwinner,sun8i-h3-spi
 
   reg:
-- 
2.25.1


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

* [PATCH 11/14] ARM: dts: suniv: F1C100: add SPI support
       [not found] <20220307143421.1106209-1-andre.przywara@arm.com>
  2022-03-07 14:34 ` [PATCH 10/14] dt-bindings: spi: sunxi: document F1C100 controllers Andre Przywara
@ 2022-03-07 14:34 ` Andre Przywara
  2022-03-11  2:19   ` Samuel Holland
  2022-03-07 14:34 ` [PATCH 12/14] ARM: dts: suniv: licheepi-nano: add SPI flash Andre Przywara
  2 siblings, 1 reply; 8+ messages in thread
From: Andre Przywara @ 2022-03-07 14:34 UTC (permalink / raw)
  To: Maxime Ripard, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland
  Cc: Rob Herring, Mesih Kilinc, Icenowy Zheng, Jesse Taube,
	Giulio Benetti, George Hilliard, devicetree, linux-arm-kernel,
	linux-sunxi, Mark Brown, linux-spi

The F1C100 series contains two SPI controllers, and many boards use SPI0
for a SPI flash, as the BROM is able to boot from that.

Describe the two controllers in the SoC .dtsi, and also add the PortC
pins for SPI0, since this is where BROM looks at when trying to boot
from the commonly used SPI flash.

The SPI controller seems to be the same as in the H3 chips, but it lacks
a separate mod clock. The manual says it's connected to AHB directly.
We don't export that AHB clock directly, but can use the AHB *gate* clock
as a clock source, since the MMC driver is not supposed to change the AHB
frequency anyway.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
 arch/arm/boot/dts/suniv-f1c100s.dtsi | 33 ++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/arch/arm/boot/dts/suniv-f1c100s.dtsi b/arch/arm/boot/dts/suniv-f1c100s.dtsi
index 6f2f97458fe0..f8ec1c7a2ca9 100644
--- a/arch/arm/boot/dts/suniv-f1c100s.dtsi
+++ b/arch/arm/boot/dts/suniv-f1c100s.dtsi
@@ -105,6 +105,34 @@ mmc1: mmc@1c10000 {
 			#size-cells = <0>;
 		};
 
+		spi0: spi@1c05000 {
+			compatible = "allwinner,suniv-f1c100s-spi",
+				     "allwinner,sun8i-h3-spi";
+			reg = <0x01c05000 0x1000>;
+			interrupts = <10>;
+			clocks = <&ccu CLK_BUS_SPI0>, <&ccu CLK_BUS_SPI0>;
+			clock-names = "ahb", "mod";
+			resets = <&ccu RST_BUS_SPI0>;
+			status = "disabled";
+			num-cs = <1>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
+		spi1: spi@1c06000 {
+			compatible = "allwinner,suniv-f1c100s-spi",
+				     "allwinner,sun8i-h3-spi";
+			reg = <0x01c06000 0x1000>;
+			interrupts = <11>;
+			clocks = <&ccu CLK_BUS_SPI1>, <&ccu CLK_BUS_SPI1>;
+			clock-names = "ahb", "mod";
+			resets = <&ccu RST_BUS_SPI1>;
+			status = "disabled";
+			num-cs = <1>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
 		ccu: clock@1c20000 {
 			compatible = "allwinner,suniv-f1c100s-ccu";
 			reg = <0x01c20000 0x400>;
@@ -138,6 +166,11 @@ mmc0_pins: mmc0-pins {
 				drive-strength = <30>;
 			};
 
+			spi0_pc_pins: spi0-pc-pins {
+				pins = "PC0", "PC1", "PC2", "PC3";
+				function = "spi0";
+			};
+
 			uart0_pe_pins: uart0-pe-pins {
 				pins = "PE0", "PE1";
 				function = "uart0";
-- 
2.25.1


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

* [PATCH 12/14] ARM: dts: suniv: licheepi-nano: add SPI flash
       [not found] <20220307143421.1106209-1-andre.przywara@arm.com>
  2022-03-07 14:34 ` [PATCH 10/14] dt-bindings: spi: sunxi: document F1C100 controllers Andre Przywara
  2022-03-07 14:34 ` [PATCH 11/14] ARM: dts: suniv: F1C100: add SPI support Andre Przywara
@ 2022-03-07 14:34 ` Andre Przywara
  2022-03-11  2:20   ` Samuel Holland
  2 siblings, 1 reply; 8+ messages in thread
From: Andre Przywara @ 2022-03-07 14:34 UTC (permalink / raw)
  To: Maxime Ripard, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland
  Cc: Rob Herring, Mesih Kilinc, Icenowy Zheng, Jesse Taube,
	Giulio Benetti, George Hilliard, devicetree, linux-arm-kernel,
	linux-sunxi, Mark Brown, linux-spi

Most LicheePi Nano boards come with soldered SPI flash, so enable SPI0
in the .dts and describe the flash chip. There is evidence of different
flash chips used, also of boards with no flash chip soldered, but the
Winbond 16MiB model is the most common, so use that for the compatible
string.  The actual flash chip model will be auto-detected at runtime
anyway.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
 arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dts | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dts b/arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dts
index 8fa79a1d1d2d..04e59b8381cb 100644
--- a/arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dts
+++ b/arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dts
@@ -13,6 +13,7 @@ / {
 	aliases {
 		mmc0 = &mmc0;
 		serial0 = &uart0;
+		spi0 = &spi0;
 	};
 
 	chosen {
@@ -35,6 +36,20 @@ &mmc0 {
 	vmmc-supply = <&reg_vcc3v3>;
 };
 
+&spi0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&spi0_pc_pins>;
+	status = "okay";
+
+	flash@0 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "winbond,w25q128", "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <40000000>;
+	};
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pe_pins>;
-- 
2.25.1


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

* Re: [PATCH 10/14] dt-bindings: spi: sunxi: document F1C100 controllers
  2022-03-07 14:34 ` [PATCH 10/14] dt-bindings: spi: sunxi: document F1C100 controllers Andre Przywara
@ 2022-03-08 16:10   ` Rob Herring
  2022-03-11  2:19   ` Samuel Holland
  1 sibling, 0 replies; 8+ messages in thread
From: Rob Herring @ 2022-03-08 16:10 UTC (permalink / raw)
  To: Andre Przywara
  Cc: Rob Herring, Mesih Kilinc, devicetree, Samuel Holland,
	Mark Brown, Chen-Yu Tsai, Giulio Benetti, linux-spi,
	George Hilliard, Icenowy Zheng, linux-sunxi, Maxime Ripard,
	Jesse Taube, linux-arm-kernel, Jernej Skrabec

On Mon, 07 Mar 2022 14:34:17 +0000, Andre Przywara wrote:
> The Allwinner F1C100 series contains two SPI controllers, which are
> compatible to the IP block used in the Allwinner H3 as well.
> The only difference in the integration is the missing mod clock in the
> F1C100, but that does not affect the SPI controller binding, as we can
> still supply the correct clock (AHB parent) easily.
> 
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> ---
>  .../devicetree/bindings/spi/allwinner,sun6i-a31-spi.yaml         | 1 +
>  1 file changed, 1 insertion(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH 10/14] dt-bindings: spi: sunxi: document F1C100 controllers
  2022-03-07 14:34 ` [PATCH 10/14] dt-bindings: spi: sunxi: document F1C100 controllers Andre Przywara
  2022-03-08 16:10   ` Rob Herring
@ 2022-03-11  2:19   ` Samuel Holland
  1 sibling, 0 replies; 8+ messages in thread
From: Samuel Holland @ 2022-03-11  2:19 UTC (permalink / raw)
  To: Andre Przywara, Maxime Ripard, Chen-Yu Tsai, Jernej Skrabec
  Cc: Rob Herring, Mesih Kilinc, Icenowy Zheng, Jesse Taube,
	Giulio Benetti, George Hilliard, devicetree, linux-arm-kernel,
	linux-sunxi, Mark Brown, linux-spi

On 3/7/22 8:34 AM, Andre Przywara wrote:
> The Allwinner F1C100 series contains two SPI controllers, which are
> compatible to the IP block used in the Allwinner H3 as well.
> The only difference in the integration is the missing mod clock in the
> F1C100, but that does not affect the SPI controller binding, as we can
> still supply the correct clock (AHB parent) easily.
> 
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>

Acked-by: Samuel Holland <samuel@sholland.org>

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

* Re: [PATCH 11/14] ARM: dts: suniv: F1C100: add SPI support
  2022-03-07 14:34 ` [PATCH 11/14] ARM: dts: suniv: F1C100: add SPI support Andre Przywara
@ 2022-03-11  2:19   ` Samuel Holland
  2022-03-11 13:33     ` Andre Przywara
  0 siblings, 1 reply; 8+ messages in thread
From: Samuel Holland @ 2022-03-11  2:19 UTC (permalink / raw)
  To: Andre Przywara, Maxime Ripard, Chen-Yu Tsai, Jernej Skrabec
  Cc: Rob Herring, Mesih Kilinc, Icenowy Zheng, Jesse Taube,
	Giulio Benetti, George Hilliard, devicetree, linux-arm-kernel,
	linux-sunxi, Mark Brown, linux-spi

On 3/7/22 8:34 AM, Andre Przywara wrote:
> The F1C100 series contains two SPI controllers, and many boards use SPI0
> for a SPI flash, as the BROM is able to boot from that.
> 
> Describe the two controllers in the SoC .dtsi, and also add the PortC
> pins for SPI0, since this is where BROM looks at when trying to boot
> from the commonly used SPI flash.
> 
> The SPI controller seems to be the same as in the H3 chips, but it lacks
> a separate mod clock. The manual says it's connected to AHB directly.
> We don't export that AHB clock directly, but can use the AHB *gate* clock
> as a clock source, since the MMC driver is not supposed to change the AHB

Do you mean the SPI driver here?

> frequency anyway.
> 
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> ---
>  arch/arm/boot/dts/suniv-f1c100s.dtsi | 33 ++++++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/suniv-f1c100s.dtsi b/arch/arm/boot/dts/suniv-f1c100s.dtsi
> index 6f2f97458fe0..f8ec1c7a2ca9 100644
> --- a/arch/arm/boot/dts/suniv-f1c100s.dtsi
> +++ b/arch/arm/boot/dts/suniv-f1c100s.dtsi
> @@ -105,6 +105,34 @@ mmc1: mmc@1c10000 {
>  			#size-cells = <0>;
>  		};
>  
> +		spi0: spi@1c05000 {
> +			compatible = "allwinner,suniv-f1c100s-spi",
> +				     "allwinner,sun8i-h3-spi";
> +			reg = <0x01c05000 0x1000>;
> +			interrupts = <10>;
> +			clocks = <&ccu CLK_BUS_SPI0>, <&ccu CLK_BUS_SPI0>;
> +			clock-names = "ahb", "mod";
> +			resets = <&ccu RST_BUS_SPI0>;
> +			status = "disabled";
> +			num-cs = <1>;
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +		};
> +
> +		spi1: spi@1c06000 {
> +			compatible = "allwinner,suniv-f1c100s-spi",
> +				     "allwinner,sun8i-h3-spi";
> +			reg = <0x01c06000 0x1000>;
> +			interrupts = <11>;
> +			clocks = <&ccu CLK_BUS_SPI1>, <&ccu CLK_BUS_SPI1>;
> +			clock-names = "ahb", "mod";
> +			resets = <&ccu RST_BUS_SPI1>;
> +			status = "disabled";
> +			num-cs = <1>;
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +		};
> +

Please keep the nodes sorted by address. These should come before the MMC
controllers.

>  		ccu: clock@1c20000 {
>  			compatible = "allwinner,suniv-f1c100s-ccu";
>  			reg = <0x01c20000 0x400>;
> @@ -138,6 +166,11 @@ mmc0_pins: mmc0-pins {
>  				drive-strength = <30>;
>  			};
>  
> +			spi0_pc_pins: spi0-pc-pins {
> +				pins = "PC0", "PC1", "PC2", "PC3";
> +				function = "spi0";
> +			};
> +
>  			uart0_pe_pins: uart0-pe-pins {
>  				pins = "PE0", "PE1";
>  				function = "uart0";
> 


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

* Re: [PATCH 12/14] ARM: dts: suniv: licheepi-nano: add SPI flash
  2022-03-07 14:34 ` [PATCH 12/14] ARM: dts: suniv: licheepi-nano: add SPI flash Andre Przywara
@ 2022-03-11  2:20   ` Samuel Holland
  0 siblings, 0 replies; 8+ messages in thread
From: Samuel Holland @ 2022-03-11  2:20 UTC (permalink / raw)
  To: Andre Przywara, Maxime Ripard, Chen-Yu Tsai, Jernej Skrabec
  Cc: Rob Herring, Mesih Kilinc, Icenowy Zheng, Jesse Taube,
	Giulio Benetti, George Hilliard, devicetree, linux-arm-kernel,
	linux-sunxi, Mark Brown, linux-spi

On 3/7/22 8:34 AM, Andre Przywara wrote:
> Most LicheePi Nano boards come with soldered SPI flash, so enable SPI0
> in the .dts and describe the flash chip. There is evidence of different
> flash chips used, also of boards with no flash chip soldered, but the
> Winbond 16MiB model is the most common, so use that for the compatible
> string.  The actual flash chip model will be auto-detected at runtime
> anyway.
> 
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>

Acked-by: Samuel Holland <samuel@sholland.org>

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

* Re: [PATCH 11/14] ARM: dts: suniv: F1C100: add SPI support
  2022-03-11  2:19   ` Samuel Holland
@ 2022-03-11 13:33     ` Andre Przywara
  0 siblings, 0 replies; 8+ messages in thread
From: Andre Przywara @ 2022-03-11 13:33 UTC (permalink / raw)
  To: Samuel Holland
  Cc: Maxime Ripard, Chen-Yu Tsai, Jernej Skrabec, Rob Herring,
	Mesih Kilinc, Icenowy Zheng, Jesse Taube, Giulio Benetti,
	George Hilliard, devicetree, linux-arm-kernel, linux-sunxi,
	Mark Brown, linux-spi

On Thu, 10 Mar 2022 20:19:57 -0600
Samuel Holland <samuel@sholland.org> wrote:

Hi Samuel,

many thanks for having a look!

> On 3/7/22 8:34 AM, Andre Przywara wrote:
> > The F1C100 series contains two SPI controllers, and many boards use SPI0
> > for a SPI flash, as the BROM is able to boot from that.
> > 
> > Describe the two controllers in the SoC .dtsi, and also add the PortC
> > pins for SPI0, since this is where BROM looks at when trying to boot
> > from the commonly used SPI flash.
> > 
> > The SPI controller seems to be the same as in the H3 chips, but it lacks
> > a separate mod clock. The manual says it's connected to AHB directly.
> > We don't export that AHB clock directly, but can use the AHB *gate* clock
> > as a clock source, since the MMC driver is not supposed to change the AHB  
> 
> Do you mean the SPI driver here?

Yes, indeed.

> 
> > frequency anyway.
> > 
> > Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> > ---
> >  arch/arm/boot/dts/suniv-f1c100s.dtsi | 33 ++++++++++++++++++++++++++++
> >  1 file changed, 33 insertions(+)
> > 
> > diff --git a/arch/arm/boot/dts/suniv-f1c100s.dtsi b/arch/arm/boot/dts/suniv-f1c100s.dtsi
> > index 6f2f97458fe0..f8ec1c7a2ca9 100644
> > --- a/arch/arm/boot/dts/suniv-f1c100s.dtsi
> > +++ b/arch/arm/boot/dts/suniv-f1c100s.dtsi
> > @@ -105,6 +105,34 @@ mmc1: mmc@1c10000 {
> >  			#size-cells = <0>;
> >  		};
> >  
> > +		spi0: spi@1c05000 {
> > +			compatible = "allwinner,suniv-f1c100s-spi",
> > +				     "allwinner,sun8i-h3-spi";
> > +			reg = <0x01c05000 0x1000>;
> > +			interrupts = <10>;
> > +			clocks = <&ccu CLK_BUS_SPI0>, <&ccu CLK_BUS_SPI0>;
> > +			clock-names = "ahb", "mod";
> > +			resets = <&ccu RST_BUS_SPI0>;
> > +			status = "disabled";
> > +			num-cs = <1>;
> > +			#address-cells = <1>;
> > +			#size-cells = <0>;
> > +		};
> > +
> > +		spi1: spi@1c06000 {
> > +			compatible = "allwinner,suniv-f1c100s-spi",
> > +				     "allwinner,sun8i-h3-spi";
> > +			reg = <0x01c06000 0x1000>;
> > +			interrupts = <11>;
> > +			clocks = <&ccu CLK_BUS_SPI1>, <&ccu CLK_BUS_SPI1>;
> > +			clock-names = "ahb", "mod";
> > +			resets = <&ccu RST_BUS_SPI1>;
> > +			status = "disabled";
> > +			num-cs = <1>;
> > +			#address-cells = <1>;
> > +			#size-cells = <0>;
> > +		};
> > +  
> 
> Please keep the nodes sorted by address. These should come before the MMC
> controllers.

Argh, sorry, I thought I fixed that up, but it must have messed that
up after a rebase.

Will send a fixed version.

Cheers,
Andre

> 
> >  		ccu: clock@1c20000 {
> >  			compatible = "allwinner,suniv-f1c100s-ccu";
> >  			reg = <0x01c20000 0x400>;
> > @@ -138,6 +166,11 @@ mmc0_pins: mmc0-pins {
> >  				drive-strength = <30>;
> >  			};
> >  
> > +			spi0_pc_pins: spi0-pc-pins {
> > +				pins = "PC0", "PC1", "PC2", "PC3";
> > +				function = "spi0";
> > +			};
> > +
> >  			uart0_pe_pins: uart0-pe-pins {
> >  				pins = "PE0", "PE1";
> >  				function = "uart0";
> >   
> 


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

end of thread, other threads:[~2022-03-11 13:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20220307143421.1106209-1-andre.przywara@arm.com>
2022-03-07 14:34 ` [PATCH 10/14] dt-bindings: spi: sunxi: document F1C100 controllers Andre Przywara
2022-03-08 16:10   ` Rob Herring
2022-03-11  2:19   ` Samuel Holland
2022-03-07 14:34 ` [PATCH 11/14] ARM: dts: suniv: F1C100: add SPI support Andre Przywara
2022-03-11  2:19   ` Samuel Holland
2022-03-11 13:33     ` Andre Przywara
2022-03-07 14:34 ` [PATCH 12/14] ARM: dts: suniv: licheepi-nano: add SPI flash Andre Przywara
2022-03-11  2:20   ` Samuel Holland

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