Skip to contentSkip to conversation

ARM: dtsi: suniv: F1c100s add clock and reset macros

PATCH In review Jesse Taube 4 participants 12 messages Jan 30, 2022 – Feb 9, 2022

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

PATCH v2 1/4 ARM: dtsi: suniv: F1c100s add clock and reset macros

Include clock and reset macros and replace magic numbers.

---
 arch/arm/boot/dts/suniv-f1c100s.dtsi | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
arch/arm/boot/dts/suniv-f1c100s.dtsi +10 -7
index 6100d3b75f61..953228cc8d52 100644
@@ -4,6 +4,9 @@
  * Copyright 2018 Mesih Kilinc <[email protected]>
  */
 
+#include <dt-bindings/clock/suniv-ccu-f1c100s.h>
+#include <dt-bindings/reset/suniv-ccu-f1c100s.h>
+
 / {
 	#address-cells = <1>;
 	#size-cells = <1>;
@@ -82,7 +85,7 @@ pio: pinctrl@1c20800 {
 			compatible = "allwinner,suniv-f1c100s-pinctrl";
 			reg = <0x01c20800 0x400>;
 			interrupts = <38>, <39>, <40>;
-			clocks = <&ccu 37>, <&osc24M>, <&osc32k>;
+			clocks = <&ccu CLK_BUS_PIO>, <&osc24M>, <&osc32k>;
 			clock-names = "apb", "hosc", "losc";
 			gpio-controller;
 			interrupt-controller;
@@ -114,8 +117,8 @@ uart0: serial@1c25000 {
 			interrupts = <1>;
 			reg-shift = <2>;
 			reg-io-width = <4>;
-			clocks = <&ccu 38>;
-			resets = <&ccu 24>;
+			clocks = <&ccu CLK_BUS_UART0>;
+			resets = <&ccu RST_BUS_UART0>;
 			status = "disabled";
 		};
 
@@ -125,8 +128,8 @@ uart1: serial@1c25400 {
 			interrupts = <2>;
 			reg-shift = <2>;
 			reg-io-width = <4>;
-			clocks = <&ccu 39>;
-			resets = <&ccu 25>;
+			clocks = <&ccu CLK_BUS_UART1>;
+			resets = <&ccu RST_BUS_UART1>;
 			status = "disabled";
 		};
 
@@ -136,8 +139,8 @@ uart2: serial@1c25800 {
 			interrupts = <3>;
 			reg-shift = <2>;
 			reg-io-width = <4>;
-			clocks = <&ccu 40>;
-			resets = <&ccu 26>;
+			clocks = <&ccu CLK_BUS_UART2>;
+			resets = <&ccu RST_BUS_UART2>;
 			status = "disabled";
 		};
 	};
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 2/4 dt-bindings: mmc: sunxi: Add Allwinner F1c100s compatibles

Add binding for F1c100s's mmc controller.

---
V1 -> V2:
* New commit

---
 .../devicetree/bindings/mmc/allwinner,sun4i-a10-mmc.yaml       | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/mmc/allwinner,sun4i-a10-mmc.yaml +3 -0
index 4f62ad6ce50c..76137132500d 100644
@@ -55,6 +55,9 @@ properties:
       - items:
           - const: allwinner,sun50i-h616-mmc
           - const: allwinner,sun50i-a100-mmc
+      - items:
+          - const: allwinner,suniv-f1c100s-mmc
+          - const: allwinner,sun7i-a20-mmc
 
   reg:
     maxItems: 1
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v2 2/4] dt-bindings: mmc: sunxi: Add Allwinner F1c100s compatibles

Hi,

Quoted 3 lines · Jesse Taube

Add binding for F1c100s's mmc controller.

Some description of why the A20 is a good pick compared to the other variants would be nice.

Maxime

Reviewed-by on v2 2/4
#3 lore raw

Re: [PATCH v2 2/4] dt-bindings: mmc: sunxi: Add Allwinner F1c100s compatibles

In reply to Jesse Taube
Quoted 3 lines · On Sun, 30 Jan 2022 17:03:23 -0500 Jesse Taube <[email protected]> wrote:

Add binding for F1c100s's mmc controller.

Cheers,
Andre

Quoted 21 lines

---
V1 -> V2:
* New commit

---
 .../devicetree/bindings/mmc/allwinner,sun4i-a10-mmc.yaml       | 3 +++
 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/mmc/allwinner,sun4i-a10-mmc.yaml +3 -0
index 4f62ad6ce50c..76137132500d 100644
@@ -55,6 +55,9 @@ properties:
       - items:
           - const: allwinner,sun50i-h616-mmc
           - const: allwinner,sun50i-a100-mmc
+      - items:
+          - const: allwinner,suniv-f1c100s-mmc
+          - const: allwinner,sun7i-a20-mmc
 
   reg:
     maxItems: 1
#5 lore raw

PATCH v2 3/4 ARM: dtsi: suniv: Add mmc to f1c100s dtsi.

In reply to Jesse Taube

Add mmc0 and 1 for f1c100s dtsi.

---
V1 -> V2:
* Split patch

---
 arch/arm/boot/dts/suniv-f1c100s.dtsi | 41 ++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
arch/arm/boot/dts/suniv-f1c100s.dtsi +41 -0
index 953228cc8d52..60fa56c278a8 100644
@@ -96,6 +96,11 @@ uart0_pe_pins: uart0-pe-pins {
 				pins = "PE0", "PE1";
 				function = "uart0";
 			};
+
+			mmc0_pins: mmc0-pins {
+				pins = "PF0", "PF1", "PF2", "PF3", "PF4", "PF5";
+				function = "mmc0";
+			};
 		};
 
 		timer@1c20c00 {
@@ -111,6 +116,42 @@ wdt: watchdog@1c20ca0 {
 			reg = <0x01c20ca0 0x20>;
 		};
 
+		mmc0: mmc@1c0f000 {
+			compatible = "allwinner,suniv-f1c100s-mmc",
+				     "allwinner,sun7i-a20-mmc";
+			reg = <0x01c0f000 0x1000>;
+			clocks = <&ccu CLK_BUS_MMC0>,
+				 <&ccu CLK_MMC0>,
+				 <&ccu CLK_MMC0_OUTPUT>,
+				 <&ccu CLK_MMC0_SAMPLE>;
+			clock-names = "ahb", "mmc", "output", "sample";
+			resets = <&ccu RST_BUS_MMC0>;
+			reset-names = "ahb";
+			interrupts = <23>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&mmc0_pins>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
+		mmc1: mmc@1c10000 {
+			compatible = "allwinner,suniv-f1c100s-mmc",
+				     "allwinner,sun7i-a20-mmc";
+			reg = <0x01c10000 0x1000>;
+			clocks = <&ccu CLK_BUS_MMC1>,
+				 <&ccu CLK_MMC1>,
+				 <&ccu CLK_MMC1_OUTPUT>,
+				 <&ccu CLK_MMC1_SAMPLE>;
+			clock-names = "ahb", "mmc", "output", "sample";
+			resets = <&ccu RST_BUS_MMC1>;
+			reset-names = "ahb";
+			interrupts = <24>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
 		uart0: serial@1c25000 {
 			compatible = "snps,dw-apb-uart";
 			reg = <0x01c25000 0x400>;
Signature · 1 line
2.34.1
#6 lore raw

Re: [PATCH v2 3/4] ARM: dtsi: suniv: Add mmc to f1c100s dtsi.

Hi,

Quoted 15 lines · Jesse Taube

Add mmc0 and 1 for f1c100s dtsi.

---
V1 -> V2:
* Split patch

---
 arch/arm/boot/dts/suniv-f1c100s.dtsi | 41 ++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
arch/arm/boot/dts/suniv-f1c100s.dtsi +0 -0
index 953228cc8d52..60fa56c278a8 100644

arch/arm/boot/dts/suniv-f1c100s.dtsi uart0_pe_pins: uart0-pe-pins { · line 103

Quoted 8 lines
arch/arm/boot/dts/suniv-f1c100s.dtsi +5 -0
@@ -96,6 +96,11 @@ uart0_pe_pins: uart0-pe-pins {
 				pins = "PE0", "PE1";
 				function = "uart0";
 			};
+
+			mmc0_pins: mmc0-pins {
+				pins = "PF0", "PF1", "PF2", "PF3", "PF4", "PF5";
+				function = "mmc0";
+			};

Pinctrl nodes are ordered alphabetically

Also, you need to have a drive-strength of 30mA

Quoted 32 lines
arch/arm/boot/dts/suniv-f1c100s.dtsi +25 -0
 		};
 
 		timer@1c20c00 {
@@ -111,6 +116,42 @@ wdt: watchdog@1c20ca0 {
 			reg = <0x01c20ca0 0x20>;
 		};
 
+		mmc0: mmc@1c0f000 {
+			compatible = "allwinner,suniv-f1c100s-mmc",
+				     "allwinner,sun7i-a20-mmc";
+			reg = <0x01c0f000 0x1000>;
+			clocks = <&ccu CLK_BUS_MMC0>,
+				 <&ccu CLK_MMC0>,
+				 <&ccu CLK_MMC0_OUTPUT>,
+				 <&ccu CLK_MMC0_SAMPLE>;
+			clock-names = "ahb", "mmc", "output", "sample";
+			resets = <&ccu RST_BUS_MMC0>;
+			reset-names = "ahb";
+			interrupts = <23>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&mmc0_pins>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
+		mmc1: mmc@1c10000 {
+			compatible = "allwinner,suniv-f1c100s-mmc",
+				     "allwinner,sun7i-a20-mmc";
+			reg = <0x01c10000 0x1000>;
+			clocks = <&ccu CLK_BUS_MMC1>,
+				 <&ccu CLK_MMC1>,

arch/arm/boot/dts/suniv-f1c100s.dtsi wdt: watchdog@1c20ca0 { · line 153

Quoted 10 lines
arch/arm/boot/dts/suniv-f1c100s.dtsi +10 -0
+				 <&ccu CLK_MMC1_OUTPUT>,
+				 <&ccu CLK_MMC1_SAMPLE>;
+			clock-names = "ahb", "mmc", "output", "sample";
+			resets = <&ccu RST_BUS_MMC1>;
+			reset-names = "ahb";
+			interrupts = <24>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};

And here, the nodes are ordered by register base address

Maxime

#7 lore raw

Re: [PATCH v2 3/4] ARM: dtsi: suniv: Add mmc to f1c100s dtsi.

In reply to Jesse Taube
Quoted 3 lines · On Sun, 30 Jan 2022 17:03:24 -0500 Jesse Taube <[email protected]> wrote:

Add mmc0 and 1 for f1c100s dtsi.

The numbers looks alright, just one thing below:

Quoted 28 lines

---
V1 -> V2:
* Split patch

---
 arch/arm/boot/dts/suniv-f1c100s.dtsi | 41 ++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
arch/arm/boot/dts/suniv-f1c100s.dtsi +6 -0
index 953228cc8d52..60fa56c278a8 100644
@@ -96,6 +96,11 @@ uart0_pe_pins: uart0-pe-pins {
 				pins = "PE0", "PE1";
 				function = "uart0";
 			};
+
+			mmc0_pins: mmc0-pins {
+				pins = "PF0", "PF1", "PF2", "PF3", "PF4", "PF5";
+				function = "mmc0";
+			};
 		};
 
 		timer@1c20c00 {
@@ -111,6 +116,42 @@ wdt: watchdog@1c20ca0 {
 			reg = <0x01c20ca0 0x20>;
 		};
 
+		mmc0: mmc@1c0f000 {

arch/arm/boot/dts/suniv-f1c100s.dtsi wdt: watchdog@1c20ca0 { · line 129

Quoted 10 lines
arch/arm/boot/dts/suniv-f1c100s.dtsi +10 -0
+			compatible = "allwinner,suniv-f1c100s-mmc",
+				     "allwinner,sun7i-a20-mmc";
+			reg = <0x01c0f000 0x1000>;
+			clocks = <&ccu CLK_BUS_MMC0>,
+				 <&ccu CLK_MMC0>,
+				 <&ccu CLK_MMC0_OUTPUT>,
+				 <&ccu CLK_MMC0_SAMPLE>;
+			clock-names = "ahb", "mmc", "output", "sample";
+			resets = <&ccu RST_BUS_MMC0>;
+			reset-names = "ahb";

The A20 does not have a reset control for the MMC controllers. It looks like the Linux driver is fine with this (it always tries to get a reset control, but treats it as optional), and the binding makes it optional for all compatibles.
I just wonder if that would need to be strengthened in the binding? At the cost of dropping the sun7i-a20-mmc fallback here? Or do we keep at least the A20 supporting both, so that existing kernel can support this device? Or do we not care and just keep the reset control deliberately optional for all SoCs?

The other bits check out when compared to the manual, though the full compatibility to the A20 is more a less an assumption at this point. At least the clock story seems to match (non-calibrate, extra sample clocks).

Cheers,
Andre

Quoted 28 lines
arch/arm/boot/dts/suniv-f1c100s.dtsi +25 -0
+			interrupts = <23>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&mmc0_pins>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
+		mmc1: mmc@1c10000 {
+			compatible = "allwinner,suniv-f1c100s-mmc",
+				     "allwinner,sun7i-a20-mmc";
+			reg = <0x01c10000 0x1000>;
+			clocks = <&ccu CLK_BUS_MMC1>,
+				 <&ccu CLK_MMC1>,
+				 <&ccu CLK_MMC1_OUTPUT>,
+				 <&ccu CLK_MMC1_SAMPLE>;
+			clock-names = "ahb", "mmc", "output", "sample";
+			resets = <&ccu RST_BUS_MMC1>;
+			reset-names = "ahb";
+			interrupts = <24>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
 		uart0: serial@1c25000 {
 			compatible = "snps,dw-apb-uart";
 			reg = <0x01c25000 0x400>;
#8 lore raw

PATCH v2 4/4 ARM: dts: suniv: Enable mmc for f1c100s.

In reply to Jesse Taube

Enable mmc0 in f1c100s-licheepi-nano device tree.

---
V1 -> V2:
* New patch

---
 arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dts | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dts +6 -0
index a1154e6c7cb5..c856a6a20dc8 100644
@@ -24,3 +24,9 @@ &uart0 {
 	pinctrl-0 = <&uart0_pe_pins>;
 	status = "okay";
 };
+
+&mmc0 {
+	bus-width = <4>;
+	broken-cd;
+	status = "okay";
+};
Signature · 1 line
2.34.1
#9 lore raw

Re: [PATCH v2 4/4] ARM: dts: suniv: Enable mmc for f1c100s.

Quoted 15 lines · Jesse Taube

Enable mmc0 in f1c100s-licheepi-nano device tree.

---
V1 -> V2:
* New patch

---
 arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dts | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dts +0 -0
index a1154e6c7cb5..c856a6a20dc8 100644

arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dts &uart0 { · line 32

Quoted 9 lines
arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dts +6 -0
@@ -24,3 +24,9 @@ &uart0 {
 	pinctrl-0 = <&uart0_pe_pins>;
 	status = "okay";
 };
+
+&mmc0 {
+	bus-width = <4>;
+	broken-cd;
+	status = "okay";
+};

The labels are ordered alphabetically

Maxime

#10 lore raw

Re: [PATCH v2 4/4] ARM: dts: suniv: Enable mmc for f1c100s.

In reply to Jesse Taube
Quoted 15 lines · On Sun, 30 Jan 2022 17:03:25 -0500 Jesse Taube <[email protected]> wrote:

Enable mmc0 in f1c100s-licheepi-nano device tree.

---
V1 -> V2:
* New patch

---
 arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dts | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dts +0 -0
index a1154e6c7cb5..c856a6a20dc8 100644

arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dts &uart0 { · line 31

Quoted 8 lines
arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dts +5 -0
@@ -24,3 +24,9 @@ &uart0 {
 	pinctrl-0 = <&uart0_pe_pins>;
 	status = "okay";
 };
+
+&mmc0 {
+	bus-width = <4>;
+	broken-cd;
+	status = "okay";

Do we need a vmmc-supply?
Otherwise looks alright.

Cheers,
Andre

Quoted 1 line
arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dts +1 -0
+};
Reviewed-by on v2 1/4
#11 lore raw
In reply to Jesse Taube
Quoted 3 lines · On Sun, 30 Jan 2022 17:03:22 -0500 Jesse Taube <[email protected]> wrote:

Include clock and reset macros and replace magic numbers.

Checked that the numbers match the definitions in the header file, also the generated .dtb files are identical.

Cheers,
Andre

Quoted 60 lines
---
 arch/arm/boot/dts/suniv-f1c100s.dtsi | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
arch/arm/boot/dts/suniv-f1c100s.dtsi +10 -7
index 6100d3b75f61..953228cc8d52 100644
@@ -4,6 +4,9 @@
  * Copyright 2018 Mesih Kilinc <[email protected]>
  */
 
+#include <dt-bindings/clock/suniv-ccu-f1c100s.h>
+#include <dt-bindings/reset/suniv-ccu-f1c100s.h>
+
 / {
 	#address-cells = <1>;
 	#size-cells = <1>;
@@ -82,7 +85,7 @@ pio: pinctrl@1c20800 {
 			compatible = "allwinner,suniv-f1c100s-pinctrl";
 			reg = <0x01c20800 0x400>;
 			interrupts = <38>, <39>, <40>;
-			clocks = <&ccu 37>, <&osc24M>, <&osc32k>;
+			clocks = <&ccu CLK_BUS_PIO>, <&osc24M>, <&osc32k>;
 			clock-names = "apb", "hosc", "losc";
 			gpio-controller;
 			interrupt-controller;
@@ -114,8 +117,8 @@ uart0: serial@1c25000 {
 			interrupts = <1>;
 			reg-shift = <2>;
 			reg-io-width = <4>;
-			clocks = <&ccu 38>;
-			resets = <&ccu 24>;
+			clocks = <&ccu CLK_BUS_UART0>;
+			resets = <&ccu RST_BUS_UART0>;
 			status = "disabled";
 		};
 
@@ -125,8 +128,8 @@ uart1: serial@1c25400 {
 			interrupts = <2>;
 			reg-shift = <2>;
 			reg-io-width = <4>;
-			clocks = <&ccu 39>;
-			resets = <&ccu 25>;
+			clocks = <&ccu CLK_BUS_UART1>;
+			resets = <&ccu RST_BUS_UART1>;
 			status = "disabled";
 		};
 
@@ -136,8 +139,8 @@ uart2: serial@1c25800 {
 			interrupts = <3>;
 			reg-shift = <2>;
 			reg-io-width = <4>;
-			clocks = <&ccu 40>;
-			resets = <&ccu 26>;
+			clocks = <&ccu CLK_BUS_UART2>;
+			resets = <&ccu RST_BUS_UART2>;
 			status = "disabled";
 		};
 	};