linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 10/12] dt-bindings: spi: sunxi: document F1C100 controllers
       [not found] <20220317162349.739636-1-andre.przywara@arm.com>
@ 2022-03-17 16:23 ` Andre Przywara
  2022-03-17 16:23 ` [PATCH v2 11/12] ARM: dts: suniv: F1C100: add SPI support Andre Przywara
  2022-03-17 16:23 ` [PATCH v2 12/12] ARM: dts: suniv: licheepi-nano: add SPI flash Andre Przywara
  2 siblings, 0 replies; 4+ messages in thread
From: Andre Przywara @ 2022-03-17 16:23 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, Rob Herring

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>
Acked-by: Rob Herring <robh@kernel.org>
---
 .../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] 4+ messages in thread

* [PATCH v2 11/12] ARM: dts: suniv: F1C100: add SPI support
       [not found] <20220317162349.739636-1-andre.przywara@arm.com>
  2022-03-17 16:23 ` [PATCH v2 10/12] dt-bindings: spi: sunxi: document F1C100 controllers Andre Przywara
@ 2022-03-17 16:23 ` Andre Przywara
  2022-03-28  4:20   ` Samuel Holland
  2022-03-17 16:23 ` [PATCH v2 12/12] ARM: dts: suniv: licheepi-nano: add SPI flash Andre Przywara
  2 siblings, 1 reply; 4+ messages in thread
From: Andre Przywara @ 2022-03-17 16:23 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 SPI 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 59e0bd952f50..0edc1724407b 100644
--- a/arch/arm/boot/dts/suniv-f1c100s.dtsi
+++ b/arch/arm/boot/dts/suniv-f1c100s.dtsi
@@ -69,6 +69,34 @@ otg_sram: sram-section@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>;
+		};
+
 		mmc0: mmc@1c0f000 {
 			compatible = "allwinner,suniv-f1c100s-mmc",
 				     "allwinner,sun7i-a20-mmc";
@@ -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] 4+ messages in thread

* [PATCH v2 12/12] ARM: dts: suniv: licheepi-nano: add SPI flash
       [not found] <20220317162349.739636-1-andre.przywara@arm.com>
  2022-03-17 16:23 ` [PATCH v2 10/12] dt-bindings: spi: sunxi: document F1C100 controllers Andre Przywara
  2022-03-17 16:23 ` [PATCH v2 11/12] ARM: dts: suniv: F1C100: add SPI support Andre Przywara
@ 2022-03-17 16:23 ` Andre Przywara
  2 siblings, 0 replies; 4+ messages in thread
From: Andre Przywara @ 2022-03-17 16:23 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>
Acked-by: Samuel Holland <samuel@sholland.org>
---
 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] 4+ messages in thread

* Re: [PATCH v2 11/12] ARM: dts: suniv: F1C100: add SPI support
  2022-03-17 16:23 ` [PATCH v2 11/12] ARM: dts: suniv: F1C100: add SPI support Andre Przywara
@ 2022-03-28  4:20   ` Samuel Holland
  0 siblings, 0 replies; 4+ messages in thread
From: Samuel Holland @ 2022-03-28  4:20 UTC (permalink / raw)
  To: Andre Przywara
  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 3/17/22 11:23 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 SPI driver is not supposed to change the AHB
> frequency anyway.
> 
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>

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

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

end of thread, other threads:[~2022-03-28  4:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20220317162349.739636-1-andre.przywara@arm.com>
2022-03-17 16:23 ` [PATCH v2 10/12] dt-bindings: spi: sunxi: document F1C100 controllers Andre Przywara
2022-03-17 16:23 ` [PATCH v2 11/12] ARM: dts: suniv: F1C100: add SPI support Andre Przywara
2022-03-28  4:20   ` Samuel Holland
2022-03-17 16:23 ` [PATCH v2 12/12] ARM: dts: suniv: licheepi-nano: add SPI flash Andre Przywara

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