Skip to contentSkip to conversation

ARM: sunxi: Introduce Allwinner H3 support

PATCH Superseded Jens Kuske 8 participants 39 messages Oct 27, 2015 – Nov 23, 2015

Subsystems (7)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Jens Kuske

author
#0 lore raw

v4 cover ARM: sunxi: Introduce Allwinner H3 support

Hi everyone,

This is v4 of my patch series introducing basic kernel support for Allwinner's H3 SoC. It mainly adds basic clocks, resets and pinctrl. It also adds interrupts, timers, watchdog, RTC, dmaengine, MMC and UARTs, which are mostly compatible to those in earlier SoCs like A23 and A31, and can simply be reused.

These patches are based on the sunxi-next branch from
git://github.com/linux-sunxi/linux-sunxi.git

Patch 1 improves the sunxi divs clock to read the name of the base factor clock from devicetree instead of hardcoding it, which allows us to reuse sun6i-pll6 for our pll8.

Patch 2 adds support for the basic clocks.

Patch 3 adds the pin sets for the H3 main PIO.

Patch 4 adds the H3 reset controller

Patch 5 adds the DTSI for the H3.

Patch 6 adds a DTS for the Orange Pi Plus SBC, which these patches were developed and tested with.

Changes since v3:
- add a clock driver specific to the bus gates instead of listing parents in the DTSI
- skip the holes in the reset controller with of_xlate()

Changes since v2:
- add mbus clock
- add Maxime's suggestion to take the substring up to the first "_" as name for the divs base clock
- use A31 pll6 for H3 pll6
- use a clock similar to the new simple gates for H3 bus gates
- drop the pinctrl-as-module patch since pinctrl and gpio don't seem to be ready for removable drivers
- documentation and machine support are merged already

Changes since v1:
- Update sunxi README in Documentation
- Add the multiple parents gates and use them for bus-gates instead of ahb1, ahb2, apb1 and apb2 gates
- Merge the pll8 clock with sun6i pll6
- Merge the ahb12, apb1 and apb2 resets to bus-resets with own compatible
- Add sun6i_timer_init to sun8i machine
- Remove the single SoC names from machine definition, its sun8i family
- Make the pinctrl driver tristate and put its Kconfig entry in the right order
- Rename pinctrl "scr" to "sim" and clock "sim" to "scr" to match user manual
- Remove the address paragraph from GPL in dts and dtsi
- Some style cleanup and line wrapping in dtsi
- Add ARM architected timers
- dmaengine isn't included anymore, it is merged already

Best Regards,
Jens

Jens Kuske (6):
clk: sunxi: Let divs clocks read the base factor clock name from
devicetree
clk: sunxi: Add H3 clocks support
pinctrl: sunxi: Add H3 PIO controller support
reset: sunxi: Add Allwinner H3 bus resets
ARM: dts: sunxi: Add Allwinner H3 DTSI
ARM: dts: sun8i: Add Orange Pi Plus support

 Documentation/devicetree/bindings/clock/sunxi.txt  |   2 +
 .../bindings/pinctrl/allwinner,sunxi-pinctrl.txt   |   1 +
 .../bindings/reset/allwinner,sunxi-clock-reset.txt |   1 +
 arch/arm/boot/dts/Makefile                         |   3 +-
 arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts       |  77 +++
 arch/arm/boot/dts/sun8i-h3.dtsi                    | 482 +++++++++++++++++++
 drivers/clk/sunxi/Makefile                         |   1 +
 drivers/clk/sunxi/clk-sun8i-bus-gates.c            | 111 +++++
 drivers/clk/sunxi/clk-sunxi.c                      |  47 +-
 drivers/pinctrl/sunxi/Kconfig                      |   4 +
 drivers/pinctrl/sunxi/Makefile                     |   1 +
 drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c           | 516 +++++++++++++++++++++
 drivers/reset/reset-sunxi.c                        |  30 +-
 13 files changed, 1260 insertions(+), 16 deletions(-)
 create mode 100644 arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts
 create mode 100644 arch/arm/boot/dts/sun8i-h3.dtsi
 create mode 100644 drivers/clk/sunxi/clk-sun8i-bus-gates.c
 create mode 100644 drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c
Signature · 1 line
2.6.2
author
#1 lore raw

PATCH v4 1/6 clk: sunxi: Let divs clocks read the base factor clock name from devicetree

Currently, the sunxi clock driver gets the name for the base factor clock of divs clocks from the name field in factors_data. This prevents reusing of the factor clock for clocks with same properties, but different name.

This commit makes the divs setup function try to get a name from clock-output-names in the devicetree. It also removes the name field where possible and merges the sun4i PLL5 and PLL6 clocks.

---
 drivers/clk/sunxi/clk-sunxi.c | 38 +++++++++++++++++++++++++++-----------
 1 file changed, 27 insertions(+), 11 deletions(-)
drivers/clk/sunxi/clk-sunxi.c +27 -11
index 9c79af0c..270de42 100644
@@ -704,21 +704,12 @@ static const struct factors_data sun4i_pll5_data __initconst = {
 	.enable = 31,
 	.table = &sun4i_pll5_config,
 	.getter = sun4i_get_pll5_factors,
-	.name = "pll5",
-};
-
-static const struct factors_data sun4i_pll6_data __initconst = {
-	.enable = 31,
-	.table = &sun4i_pll5_config,
-	.getter = sun4i_get_pll5_factors,
-	.name = "pll6",
 };
 
 static const struct factors_data sun6i_a31_pll6_data __initconst = {
 	.enable = 31,
 	.table = &sun6i_a31_pll6_config,
 	.getter = sun6i_a31_get_pll6_factors,
-	.name = "pll6x2",
 };
 
 static const struct factors_data sun5i_a13_ahb_data __initconst = {
@@ -902,6 +893,7 @@ struct gates_data {
 
 #define SUNXI_DIVS_MAX_QTY	4
 #define SUNXI_DIVISOR_WIDTH	2
+#define SUNXI_DIVS_BASE_NAME_MAX_LEN	8
 
 struct divs_data {
 	const struct factors_data *factors; /* data for the factor clock */
@@ -941,7 +933,7 @@ static const struct divs_data pll5_divs_data __initconst = {
 };
 
 static const struct divs_data pll6_divs_data __initconst = {
-	.factors = &sun4i_pll6_data,
+	.factors = &sun4i_pll5_data,
 	.ndivs = 4,
 	.div = {
 		{ .shift = 0, .table = pll6_sata_tbl, .gate = 14 }, /* M, SATA */
@@ -983,6 +975,8 @@ static void __init sunxi_divs_clk_setup(struct device_node *node,
 	struct clk_gate *gate = NULL;
 	struct clk_fixed_factor *fix_factor;
 	struct clk_divider *divider;
+	struct factors_data factors = *data->factors;
+	char base_name[SUNXI_DIVS_BASE_NAME_MAX_LEN];
 	void __iomem *reg;
 	int ndivs = SUNXI_DIVS_MAX_QTY, i = 0;
 	int flags, clkflags;
@@ -991,8 +985,30 @@ static void __init sunxi_divs_clk_setup(struct device_node *node,
 	if (data->ndivs)
 		ndivs = data->ndivs;
 
+	/* Try to find a name for base factor clock */
+	for (i = 0; i < ndivs; i++) {
+		if (data->div[i].self) {
+			of_property_read_string_index(node, "clock-output-names",
+						      i, &factors.name);
+			break;
+		}
+	}
+	/* If we don't have a .self clk use the first output-name up to '_' */
+	if (factors.name == NULL) {
+		of_property_read_string_index(node, "clock-output-names",
+						      0, &clk_name);
+
+		for (i = 0; i < SUNXI_DIVS_BASE_NAME_MAX_LEN - 1 &&
+						clk_name[i] != '_' &&
+						clk_name[i] != '\0'; i++)
+			base_name[i] = clk_name[i];
+
+		base_name[i] = '\0';
+		factors.name = base_name;
+	}
+
 	/* Set up factor clock that we will be dividing */
-	pclk = sunxi_factors_clk_setup(node, data->factors);
+	pclk = sunxi_factors_clk_setup(node, &factors);
 	parent = __clk_get_name(pclk);
 
 	reg = of_iomap(node, 0);
Signature · 1 line
2.6.2
#2 lore raw

Re: [PATCH v4 1/6] clk: sunxi: Let divs clocks read the base factor clock name from devicetree

Quoted 7 lines · Jens Kuske

Currently, the sunxi clock driver gets the name for the base factor clock of divs clocks from the name field in factors_data. This prevents reusing of the factor clock for clocks with same properties, but different name.

This commit makes the divs setup function try to get a name from clock-output-names in the devicetree. It also removes the name field where possible and merges the sun4i PLL5 and PLL6 clocks.

This patch actually removes all static declarations of the name field, which is a good thing!

Quoted 61 lines
---
 drivers/clk/sunxi/clk-sunxi.c | 38 +++++++++++++++++++++++++++-----------
 1 file changed, 27 insertions(+), 11 deletions(-)
drivers/clk/sunxi/clk-sunxi.c +4 -10
index 9c79af0c..270de42 100644
@@ -704,21 +704,12 @@ static const struct factors_data sun4i_pll5_data __initconst = {
        .enable = 31,
        .table = &sun4i_pll5_config,
        .getter = sun4i_get_pll5_factors,
-       .name = "pll5",
-};
-
-static const struct factors_data sun4i_pll6_data __initconst = {
-       .enable = 31,
-       .table = &sun4i_pll5_config,
-       .getter = sun4i_get_pll5_factors,
-       .name = "pll6",
 };
 
 static const struct factors_data sun6i_a31_pll6_data __initconst = {
        .enable = 31,
        .table = &sun6i_a31_pll6_config,
        .getter = sun6i_a31_get_pll6_factors,
-       .name = "pll6x2",
 };
 
 static const struct factors_data sun5i_a13_ahb_data __initconst = {
@@ -902,6 +893,7 @@ struct gates_data {
 
 #define SUNXI_DIVS_MAX_QTY     4
 #define SUNXI_DIVISOR_WIDTH    2
+#define SUNXI_DIVS_BASE_NAME_MAX_LEN   8
 
 struct divs_data {
        const struct factors_data *factors; /* data for the factor clock */
@@ -941,7 +933,7 @@ static const struct divs_data pll5_divs_data __initconst = {
 };
 
 static const struct divs_data pll6_divs_data __initconst = {
-       .factors = &sun4i_pll6_data,
+       .factors = &sun4i_pll5_data,
        .ndivs = 4,
        .div = {
                { .shift = 0, .table = pll6_sata_tbl, .gate = 14 }, /* M, SATA */
@@ -983,6 +975,8 @@ static void __init sunxi_divs_clk_setup(struct device_node *node,
        struct clk_gate *gate = NULL;
        struct clk_fixed_factor *fix_factor;
        struct clk_divider *divider;
+       struct factors_data factors = *data->factors;
+       char base_name[SUNXI_DIVS_BASE_NAME_MAX_LEN];
        void __iomem *reg;
        int ndivs = SUNXI_DIVS_MAX_QTY, i = 0;
        int flags, clkflags;
@@ -991,8 +985,30 @@ static void __init sunxi_divs_clk_setup(struct device_node *node,
        if (data->ndivs)
                ndivs = data->ndivs;

drivers/clk/sunxi/clk-sunxi.c static void __init sunxi_divs_clk_setup(struct device_node *node, · line 996

Quoted 10 lines
drivers/clk/sunxi/clk-sunxi.c +9 -0
 
+       /* Try to find a name for base factor clock */
+       for (i = 0; i < ndivs; i++) {
+               if (data->div[i].self) {
+                       of_property_read_string_index(node, "clock-output-names",
+                                                     i, &factors.name);
+                       break;
+               }
+       }
+       /* If we don't have a .self clk use the first output-name up to '_' */

This actually only works for the sun4i divs clocks. sun6i-a31-pll6 uses a different naming convention. sun4i-a10-pll2 uses yet another, though that's not a divs clock. Maybe we should work on unifying them. Maxime?

Other than these 2 bits of information, this patch looks good.

Regards
ChenYu

Quoted 22 lines
drivers/clk/sunxi/clk-sunxi.c +14 -2
+       if (factors.name == NULL) {
+               of_property_read_string_index(node, "clock-output-names",
+                                                     0, &clk_name);
+
+               for (i = 0; i < SUNXI_DIVS_BASE_NAME_MAX_LEN - 1 &&
+                                               clk_name[i] != '_' &&
+                                               clk_name[i] != '\0'; i++)
+                       base_name[i] = clk_name[i];
+
+               base_name[i] = '\0';
+               factors.name = base_name;
+       }
+
        /* Set up factor clock that we will be dividing */
-       pclk = sunxi_factors_clk_setup(node, data->factors);
+       pclk = sunxi_factors_clk_setup(node, &factors);
        parent = __clk_get_name(pclk);
 
        reg = of_iomap(node, 0);
--

2.6.2

author
#3 lore raw

Re: [PATCH v4 1/6] clk: sunxi: Let divs clocks read the base factor clock name from devicetree

Quoted 1 line · Chen-Yu Tsai

On Wed, Oct 28, 2015 at 12:50 AM, Jens Kuske <[email protected]> wrote:

[..]

Quoted 4 lines
Quoted 4 lines
drivers/clk/sunxi/clk-sunxi.c +0 -0
@@ -991,8 +985,30 @@ static void __init sunxi_divs_clk_setup(struct device_node *node,
        if (data->ndivs)
                ndivs = data->ndivs;
 
Quoted 13 lines

drivers/clk/sunxi/clk-sunxi.c static void __init sunxi_divs_clk_setup(struct device_node *node, · line 996

Quoted 9 lines
drivers/clk/sunxi/clk-sunxi.c +9 -0
+       /* Try to find a name for base factor clock */
+       for (i = 0; i < ndivs; i++) {
+               if (data->div[i].self) {
+                       of_property_read_string_index(node, "clock-output-names",
+                                                     i, &factors.name);
+                       break;
+               }
+       }
+       /* If we don't have a .self clk use the first output-name up to '_' */

This actually only works for the sun4i divs clocks. sun6i-a31-pll6 uses a different naming convention. sun4i-a10-pll2 uses yet another, though that's not a divs clock. Maybe we should work on unifying them. Maxime?

All the divs clocks I could find either have a .self (handled by the first case above) or follow this naming convention, so it should work. But if we find a better way to clean up the divs without breaking devicetree bindings (as far as I understood we must not break them, am I right there?) I'd be happy with that too.

Jens

Quoted 30 lines

Other than these 2 bits of information, this patch looks good.

Regards
ChenYu

Quoted 22 lines
drivers/clk/sunxi/clk-sunxi.c +14 -2
+       if (factors.name == NULL) {
+               of_property_read_string_index(node, "clock-output-names",
+                                                     0, &clk_name);
+
+               for (i = 0; i < SUNXI_DIVS_BASE_NAME_MAX_LEN - 1 &&
+                                               clk_name[i] != '_' &&
+                                               clk_name[i] != '\0'; i++)
+                       base_name[i] = clk_name[i];
+
+               base_name[i] = '\0';
+               factors.name = base_name;
+       }
+
        /* Set up factor clock that we will be dividing */
-       pclk = sunxi_factors_clk_setup(node, data->factors);
+       pclk = sunxi_factors_clk_setup(node, &factors);
        parent = __clk_get_name(pclk);
 
        reg = of_iomap(node, 0);
--

2.6.2

#4 lore raw

PATCH 1/1 clk: sunxi: Refactor A31 PLL6 so that it can be reused

In reply to Jens Kuske

Remove the fixed dividers from the PLL6 driver to be able to have a reusable driver that can be used across several SoCs that share the same controller, but don't have the same set of dividers for this clock, and to also be reused multiple times in the same SoC, since we're droping the clock name.

---
Hi Jens,

Here is an alternative (untested) patch to deal with the PLL6 issue you're experiencing with the H3.

It doesn't rely on parsing clock-output-names that turns out to be pretty fragile.

Let me know what you think,
Maxime

 arch/arm/boot/dts/sun6i-a31.dtsi     | 45 +++++++++++++++++++++---------------
 arch/arm/boot/dts/sun8i-a23-a33.dtsi | 25 +++++++++++++-------
 arch/arm/boot/dts/sun8i-a23.dtsi     |  2 +-
 arch/arm/boot/dts/sun8i-a33.dtsi     |  4 ++--
 drivers/clk/sunxi/clk-sunxi.c        | 12 +---------
 5 files changed, 48 insertions(+), 40 deletions(-)
arch/arm/boot/dts/sun6i-a31.dtsi +27 -18
index b6ad7850fac6..85486797112e 100644
@@ -65,7 +65,7 @@
 			compatible = "allwinner,simple-framebuffer",
 				     "simple-framebuffer";
 			allwinner,pipeline = "de_be0-lcd0-hdmi";
-			clocks = <&pll6 0>;
+			clocks = <&pll6d2>;
 			status = "disabled";
 		};
 
@@ -73,7 +73,7 @@
 			compatible = "allwinner,simple-framebuffer",
 				     "simple-framebuffer";
 			allwinner,pipeline = "de_be0-lcd0";
-			clocks = <&pll6 0>;
+			clocks = <&pll6d2>;
 			status = "disabled";
 		};
 	};
@@ -201,11 +201,20 @@
 		};
 
 		pll6: clk at 01c20028 {
-			#clock-cells = <1>;
+			#clock-cells = <0>;
 			compatible = "allwinner,sun6i-a31-pll6-clk";
 			reg = <0x01c20028 0x4>;
 			clocks = <&osc24M>;
-			clock-output-names = "pll6", "pll6x2";
+			clock-output-names = "pll6";
+		};
+
+                pll6d2: pll6d2_clk {
+			compatible = "fixed-factor-clock";
+			#clock-cells = <0>;
+			clock-div = <2>;
+			clock-mult = <1>;
+			clocks = <&pll6d2>;
+			clock-output-names = "pll6d2";
 		};
 
 		cpu: cpu at 01c20050 {
@@ -235,7 +244,7 @@
 			#clock-cells = <0>;
 			compatible = "allwinner,sun6i-a31-ahb1-clk";
 			reg = <0x01c20054 0x4>;
-			clocks = <&osc32k>, <&osc24M>, <&axi>, <&pll6 0>;
+			clocks = <&osc32k>, <&osc24M>, <&axi>, <&pll6d2>;
 			clock-output-names = "ahb1";
 
 			/*
@@ -244,7 +253,7 @@
 			 * controller requires AHB1 clocked from PLL6.
 			 */
 			assigned-clocks = <&ahb1>;
-			assigned-clock-parents = <&pll6 0>;
+			assigned-clock-parents = <&pll6d2>;
 		};
 
 		ahb1_gates: clk at 01c20060 {
@@ -307,7 +316,7 @@
 			#clock-cells = <0>;
 			compatible = "allwinner,sun4i-a10-apb1-clk";
 			reg = <0x01c20058 0x4>;
-			clocks = <&osc32k>, <&osc24M>, <&pll6 0>, <&pll6 0>;
+			clocks = <&osc32k>, <&osc24M>, <&pll6d2>, <&pll6d2>;
 			clock-output-names = "apb2";
 		};
 
@@ -331,7 +340,7 @@
 			#clock-cells = <1>;
 			compatible = "allwinner,sun4i-a10-mmc-clk";
 			reg = <0x01c20088 0x4>;
-			clocks = <&osc24M>, <&pll6 0>;
+			clocks = <&osc24M>, <&pll6d2>;
 			clock-output-names = "mmc0",
 					     "mmc0_output",
 					     "mmc0_sample";
@@ -341,7 +350,7 @@
 			#clock-cells = <1>;
 			compatible = "allwinner,sun4i-a10-mmc-clk";
 			reg = <0x01c2008c 0x4>;
-			clocks = <&osc24M>, <&pll6 0>;
+			clocks = <&osc24M>, <&pll6d2>;
 			clock-output-names = "mmc1",
 					     "mmc1_output",
 					     "mmc1_sample";
@@ -351,7 +360,7 @@
 			#clock-cells = <1>;
 			compatible = "allwinner,sun4i-a10-mmc-clk";
 			reg = <0x01c20090 0x4>;
-			clocks = <&osc24M>, <&pll6 0>;
+			clocks = <&osc24M>, <&pll6d2>;
 			clock-output-names = "mmc2",
 					     "mmc2_output",
 					     "mmc2_sample";
@@ -361,7 +370,7 @@
 			#clock-cells = <1>;
 			compatible = "allwinner,sun4i-a10-mmc-clk";
 			reg = <0x01c20094 0x4>;
-			clocks = <&osc24M>, <&pll6 0>;
+			clocks = <&osc24M>, <&pll6d2>;
 			clock-output-names = "mmc3",
 					     "mmc3_output",
 					     "mmc3_sample";
@@ -371,7 +380,7 @@
 			#clock-cells = <0>;
 			compatible = "allwinner,sun4i-a10-mod0-clk";
 			reg = <0x01c2009c 0x4>;
-			clocks = <&osc24M>, <&pll6 0>;
+			clocks = <&osc24M>, <&pll6d2>;
 			clock-output-names = "ss";
 		};
 
@@ -379,7 +388,7 @@
 			#clock-cells = <0>;
 			compatible = "allwinner,sun4i-a10-mod0-clk";
 			reg = <0x01c200a0 0x4>;
-			clocks = <&osc24M>, <&pll6 0>;
+			clocks = <&osc24M>, <&pll6d2>;
 			clock-output-names = "spi0";
 		};
 
@@ -387,7 +396,7 @@
 			#clock-cells = <0>;
 			compatible = "allwinner,sun4i-a10-mod0-clk";
 			reg = <0x01c200a4 0x4>;
-			clocks = <&osc24M>, <&pll6 0>;
+			clocks = <&osc24M>, <&pll6d2>;
 			clock-output-names = "spi1";
 		};
 
@@ -395,7 +404,7 @@
 			#clock-cells = <0>;
 			compatible = "allwinner,sun4i-a10-mod0-clk";
 			reg = <0x01c200a8 0x4>;
-			clocks = <&osc24M>, <&pll6 0>;
+			clocks = <&osc24M>, <&pll6d2>;
 			clock-output-names = "spi2";
 		};
 
@@ -403,7 +412,7 @@
 			#clock-cells = <0>;
 			compatible = "allwinner,sun4i-a10-mod0-clk";
 			reg = <0x01c200ac 0x4>;
-			clocks = <&osc24M>, <&pll6 0>;
+			clocks = <&osc24M>, <&pll6d2>;
 			clock-output-names = "spi3";
 		};
 
@@ -1042,8 +1051,8 @@
 			ar100: ar100_clk {
 				compatible = "allwinner,sun6i-a31-ar100-clk";
 				#clock-cells = <0>;
-				clocks = <&osc32k>, <&osc24M>, <&pll6 0>,
-					 <&pll6 0>;
+				clocks = <&osc32k>, <&osc24M>, <&pll6d2>,
+					 <&pll6d2>;
 				clock-output-names = "ar100";
 			};
 
arch/arm/boot/dts/sun8i-a23-a33.dtsi +17 -8
index 0c0964d4fa1f..f325a336a8e1 100644
@@ -60,7 +60,7 @@
 			compatible = "allwinner,simple-framebuffer",
 				     "simple-framebuffer";
 			allwinner,pipeline = "de_be0-lcd0";
-			clocks = <&pll6 0>;
+			clocks = <&pll6d2>;
 			status = "disabled";
 		};
 	};
@@ -129,11 +129,20 @@
 		};
 
 		pll6: clk at 01c20028 {
-			#clock-cells = <1>;
+			#clock-cells = <0>;
 			compatible = "allwinner,sun6i-a31-pll6-clk";
 			reg = <0x01c20028 0x4>;
 			clocks = <&osc24M>;
-			clock-output-names = "pll6", "pll6x2";
+			clock-output-names = "pll6";
+		};
+
+                pll6d2: pll6d2_clk {
+			compatible = "fixed-factor-clock";
+			#clock-cells = <0>;
+			clock-div = <2>;
+			clock-mult = <1>;
+			clocks = <&pll6>;
+			clock-output-names = "pll6d2";
 		};
 
 		cpu: cpu_clk at 01c20050 {
@@ -163,7 +172,7 @@
 			#clock-cells = <0>;
 			compatible = "allwinner,sun6i-a31-ahb1-clk";
 			reg = <0x01c20054 0x4>;
-			clocks = <&osc32k>, <&osc24M>, <&axi>, <&pll6 0>;
+			clocks = <&osc32k>, <&osc24M>, <&axi>, <&pll6d2>;
 			clock-output-names = "ahb1";
 		};
 
@@ -190,7 +199,7 @@
 			#clock-cells = <0>;
 			compatible = "allwinner,sun4i-a10-apb1-clk";
 			reg = <0x01c20058 0x4>;
-			clocks = <&osc32k>, <&osc24M>, <&pll6 0>, <&pll6 0>;
+			clocks = <&osc32k>, <&osc24M>, <&pll6d2>, <&pll6d2>;
 			clock-output-names = "apb2";
 		};
 
@@ -213,7 +222,7 @@
 			#clock-cells = <1>;
 			compatible = "allwinner,sun4i-a10-mmc-clk";
 			reg = <0x01c20088 0x4>;
-			clocks = <&osc24M>, <&pll6 0>;
+			clocks = <&osc24M>, <&pll6d2>;
 			clock-output-names = "mmc0",
 					     "mmc0_output",
 					     "mmc0_sample";
@@ -223,7 +232,7 @@
 			#clock-cells = <1>;
 			compatible = "allwinner,sun4i-a10-mmc-clk";
 			reg = <0x01c2008c 0x4>;
-			clocks = <&osc24M>, <&pll6 0>;
+			clocks = <&osc24M>, <&pll6d2>;
 			clock-output-names = "mmc1",
 					     "mmc1_output",
 					     "mmc1_sample";
@@ -233,7 +242,7 @@
 			#clock-cells = <1>;
 			compatible = "allwinner,sun4i-a10-mmc-clk";
 			reg = <0x01c20090 0x4>;
-			clocks = <&osc24M>, <&pll6 0>;
+			clocks = <&osc24M>, <&pll6d2>;
 			clock-output-names = "mmc2",
 					     "mmc2_output",
 					     "mmc2_sample";
arch/arm/boot/dts/sun8i-a23.dtsi +1 -1
index 92e6616979ea..709d7a833531 100644
@@ -79,7 +79,7 @@
 			#clock-cells = <0>;
 			compatible = "allwinner,sun8i-a23-mbus-clk";
 			reg = <0x01c2015c 0x4>;
-			clocks = <&osc24M>, <&pll6 1>, <&pll5>;
+			clocks = <&osc24M>, <&pll6>, <&pll5>;
 			clock-output-names = "mbus";
 		};
 	};
arch/arm/boot/dts/sun8i-a33.dtsi +2 -2
index 001d8402ca18..a40d458aa81f 100644
@@ -103,7 +103,7 @@
 			#clock-cells = <0>;
 			compatible = "allwinner,sun4i-a10-mod0-clk";
 			reg = <0x01c2009c 0x4>;
-			clocks = <&osc24M>, <&pll6 0>;
+			clocks = <&osc24M>, <&pll6d2>;
 			clock-output-names = "ss";
 		};
 
@@ -111,7 +111,7 @@
 			#clock-cells = <0>;
 			compatible = "allwinner,sun8i-a23-mbus-clk";
 			reg = <0x01c2015c 0x4>;
-			clocks = <&osc24M>, <&pll6 1>, <&pll5>, <&pll11>;
+			clocks = <&osc24M>, <&pll6>, <&pll5>, <&pll11>;
 			clock-output-names = "mbus";
 		};
 	};
drivers/clk/sunxi/clk-sunxi.c +1 -11
index 9c79af0c03b2..e4efc02e4cac 100644
@@ -718,7 +718,6 @@ static const struct factors_data sun6i_a31_pll6_data __initconst = {
 	.enable = 31,
 	.table = &sun6i_a31_pll6_config,
 	.getter = sun6i_a31_get_pll6_factors,
-	.name = "pll6x2",
 };
 
 static const struct factors_data sun5i_a13_ahb_data __initconst = {
@@ -951,15 +950,6 @@ static const struct divs_data pll6_divs_data __initconst = {
 	}
 };
 
-static const struct divs_data sun6i_a31_pll6_divs_data __initconst = {
-	.factors = &sun6i_a31_pll6_data,
-	.ndivs = 2,
-	.div = {
-		{ .fixed = 2 }, /* normal output */
-		{ .self = 1 }, /* base factor clock, 2x */
-	}
-};
-
 /**
  * sunxi_divs_clk_setup() - Setup function for leaf divisors on clocks
  *
@@ -1101,6 +1091,7 @@ free_clkdata:
 static const struct of_device_id clk_factors_match[] __initconst = {
 	{.compatible = "allwinner,sun4i-a10-pll1-clk", .data = &sun4i_pll1_data,},
 	{.compatible = "allwinner,sun6i-a31-pll1-clk", .data = &sun6i_a31_pll1_data,},
+	{.compatible = "allwinner,sun6i-a31-pll6-clk", .data = &sun6i_a31_pll6_data,},
 	{.compatible = "allwinner,sun8i-a23-pll1-clk", .data = &sun8i_a23_pll1_data,},
 	{.compatible = "allwinner,sun7i-a20-pll4-clk", .data = &sun7i_a20_pll4_data,},
 	{.compatible = "allwinner,sun5i-a13-ahb-clk", .data = &sun5i_a13_ahb_data,},
@@ -1122,7 +1113,6 @@ static const struct of_device_id clk_div_match[] __initconst = {
 static const struct of_device_id clk_divs_match[] __initconst = {
 	{.compatible = "allwinner,sun4i-a10-pll5-clk", .data = &pll5_divs_data,},
 	{.compatible = "allwinner,sun4i-a10-pll6-clk", .data = &pll6_divs_data,},
-	{.compatible = "allwinner,sun6i-a31-pll6-clk", .data = &sun6i_a31_pll6_divs_data,},
 	{}
 };
 
Signature · 1 line
2.6.2
#5 lore raw

PATCH 1/1 clk: sunxi: Refactor A31 PLL6 so that it can be reused

Quoted 7 lines · Maxime Ripard

Remove the fixed dividers from the PLL6 driver to be able to have a reusable driver that can be used across several SoCs that share the same controller, but don't have the same set of dividers for this clock, and to also be reused multiple times in the same SoC, since we're droping the clock name.

Quoted 8 lines

---
Hi Jens,

Here is an alternative (untested) patch to deal with the PLL6 issue you're experiencing with the H3.

It doesn't rely on parsing clock-output-names that turns out to be pretty fragile.

A quick look through. I've no problems with changing the design, but I'd like to keep the original names, i.e. pll6x2 for the clock module bits, and pll6 for the fixed divider. It better matches the user manual.

Quoted 1 line

From the PLL6 register description:

In the Clock Control Module, PLL(2X) output = PLL * 2= 24 MHz * N * K.

And all places that use the "normal" output say PLL_PERIPH (that is PLL6), while MBUS on A23/A33 use the 2X output, and say PLL_PERIPH(2X).

On the side, do we want to get rid of all the divs clocks?

Regards
ChenYu

#6 lore raw

PATCH 1/1 clk: sunxi: Refactor A31 PLL6 so that it can be reused

Hi Chen-Yu,

Quoted 22 lines · Chen-Yu Tsai
Quoted 7 lines · Maxime Ripard

Remove the fixed dividers from the PLL6 driver to be able to have a reusable driver that can be used across several SoCs that share the same controller, but don't have the same set of dividers for this clock, and to also be reused multiple times in the same SoC, since we're droping the clock name.

Quoted 8 lines

---
Hi Jens,

Here is an alternative (untested) patch to deal with the PLL6 issue you're experiencing with the H3.

It doesn't rely on parsing clock-output-names that turns out to be pretty fragile.

A quick look through. I've no problems with changing the design, but I'd like to keep the original names, i.e. pll6x2 for the clock module bits, and pll6 for the fixed divider. It better matches the user manual.

Quoted 5 lines

From the PLL6 register description:
In the Clock Control Module, PLL(2X) output = PLL * 2= 24 MHz * N * K.

And all places that use the "normal" output say PLL_PERIPH (that is PLL6), while MBUS on A23/A33 use the 2X output, and say PLL_PERIPH(2X).

Ack, I'll change this.

Quoted 1 line

On the side, do we want to get rid of all the divs clocks?

Eventually, yes. A10's PLL6 is pretty much in the same situation.

PLL5 is a different story though, since it has an extra adjustable divider. It would probably deserve its own driver.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151108/d9730557/attachment.sig>
author
#7 lore raw

PATCH v4 2/6 clk: sunxi: Add H3 clocks support

In reply to Jens Kuske

The H3 clock control unit is similar to the those of other sun8i family members like the A23.

It adds a new bus gates clock similar to the simple gates, but with a different parent clock for each single gate.
Some of the gates use the new AHB2 clock as parent, whose clock source is muxable between AHB1 and PLL6/2. The documentation isn't totally clear about which devices belong to AHB2 now, especially USB EHIC/OHIC, so it is mostly based on Allwinner kernel source code.

---
 Documentation/devicetree/bindings/clock/sunxi.txt |   2 +
 drivers/clk/sunxi/Makefile                        |   1 +
 drivers/clk/sunxi/clk-sun8i-bus-gates.c           | 111 ++++++++++++++++++++++
 drivers/clk/sunxi/clk-sunxi.c                     |   9 +-
 4 files changed, 122 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/sunxi/clk-sun8i-bus-gates.c
Documentation/devicetree/bindings/clock/sunxi.txt +2 -0
index 8a47b77..d303dec 100644
@@ -28,6 +28,7 @@ Required properties:
 	"allwinner,sun7i-a20-ahb-gates-clk" - for the AHB gates on A20
 	"allwinner,sun6i-a31-ar100-clk" - for the AR100 on A31
 	"allwinner,sun6i-a31-ahb1-clk" - for the AHB1 clock on A31
+	"allwinner,sun8i-h3-ahb2-clk" - for the AHB2 clock on H3
 	"allwinner,sun6i-a31-ahb1-gates-clk" - for the AHB1 gates on A31
 	"allwinner,sun8i-a23-ahb1-gates-clk" - for the AHB1 gates on A23
 	"allwinner,sun9i-a80-ahb0-gates-clk" - for the AHB0 gates on A80
@@ -55,6 +56,7 @@ Required properties:
 	"allwinner,sun9i-a80-apb1-gates-clk" - for the APB1 gates on A80
 	"allwinner,sun6i-a31-apb2-gates-clk" - for the APB2 gates on A31
 	"allwinner,sun8i-a23-apb2-gates-clk" - for the APB2 gates on A23
+	"allwinner,sun8i-h3-bus-gates-clk" - for the bus gates on H3
 	"allwinner,sun5i-a13-mbus-clk" - for the MBUS clock on A13
 	"allwinner,sun4i-a10-mmc-clk" - for the MMC clock
 	"allwinner,sun9i-a80-mmc-clk" - for mmc module clocks on A80
drivers/clk/sunxi/Makefile +1 -0
index cb4c299..f520af6 100644
@@ -10,6 +10,7 @@ obj-y += clk-a10-pll2.o
 obj-y += clk-a20-gmac.o
 obj-y += clk-mod0.o
 obj-y += clk-simple-gates.o
+obj-y += clk-sun8i-bus-gates.o
 obj-y += clk-sun8i-mbus.o
 obj-y += clk-sun9i-core.o
 obj-y += clk-sun9i-mmc.o
drivers/clk/sunxi/clk-sun8i-bus-gates.c new file +111 -0

111 lines not on this page · raw message

drivers/clk/sunxi/clk-sunxi.c +8 -1
index 270de42..6293c65 100644
@@ -769,6 +769,10 @@ static const struct mux_data sun6i_a31_ahb1_mux_data __initconst = {
 	.shift = 12,
 };
 
+static const struct mux_data sun8i_h3_ahb2_mux_data __initconst = {
+	.shift = 0,
+};
+
 static void __init sunxi_mux_clk_setup(struct device_node *node,
 				       struct mux_data *data)
 {
@@ -945,10 +949,11 @@ static const struct divs_data pll6_divs_data __initconst = {
 
 static const struct divs_data sun6i_a31_pll6_divs_data __initconst = {
 	.factors = &sun6i_a31_pll6_data,
-	.ndivs = 2,
+	.ndivs = 3,
 	.div = {
 		{ .fixed = 2 }, /* normal output */
 		{ .self = 1 }, /* base factor clock, 2x */
+		{ .fixed = 4 }, /* divided output, /2 */
 	}
 };
 
@@ -1146,6 +1151,7 @@ static const struct of_device_id clk_divs_match[] __initconst = {
 static const struct of_device_id clk_mux_match[] __initconst = {
 	{.compatible = "allwinner,sun4i-a10-cpu-clk", .data = &sun4i_cpu_mux_data,},
 	{.compatible = "allwinner,sun6i-a31-ahb1-mux-clk", .data = &sun6i_a31_ahb1_mux_data,},
+	{.compatible = "allwinner,sun8i-h3-ahb2-clk", .data = &sun8i_h3_ahb2_mux_data,},
 	{}
 };
 
@@ -1228,6 +1234,7 @@ CLK_OF_DECLARE(sun6i_a31_clk_init, "allwinner,sun6i-a31", sun6i_init_clocks);
 CLK_OF_DECLARE(sun6i_a31s_clk_init, "allwinner,sun6i-a31s", sun6i_init_clocks);
 CLK_OF_DECLARE(sun8i_a23_clk_init, "allwinner,sun8i-a23", sun6i_init_clocks);
 CLK_OF_DECLARE(sun8i_a33_clk_init, "allwinner,sun8i-a33", sun6i_init_clocks);
+CLK_OF_DECLARE(sun8i_h3_clk_init, "allwinner,sun8i-h3", sun6i_init_clocks);
 
 static void __init sun9i_init_clocks(struct device_node *node)
 {
Signature · 1 line
2.6.2
#8 lore raw

Re: [linux-sunxi] [PATCH v4 2/6] clk: sunxi: Add H3 clocks support

Hi Jens,

Quoted 126 lines · Jens Kuske

The H3 clock control unit is similar to the those of other sun8i family members like the A23.

It adds a new bus gates clock similar to the simple gates, but with a different parent clock for each single gate.
Some of the gates use the new AHB2 clock as parent, whose clock source is muxable between AHB1 and PLL6/2. The documentation isn't totally clear about which devices belong to AHB2 now, especially USB EHIC/OHIC, so it is mostly based on Allwinner kernel source code.

---
 Documentation/devicetree/bindings/clock/sunxi.txt |   2 +
 drivers/clk/sunxi/Makefile                        |   1 +
 drivers/clk/sunxi/clk-sun8i-bus-gates.c           | 111 ++++++++++++++++++++++
 drivers/clk/sunxi/clk-sunxi.c                     |   9 +-
 4 files changed, 122 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/sunxi/clk-sun8i-bus-gates.c
Documentation/devicetree/bindings/clock/sunxi.txt +2 -0
index 8a47b77..d303dec 100644
@@ -28,6 +28,7 @@ Required properties:
        "allwinner,sun7i-a20-ahb-gates-clk" - for the AHB gates on A20
        "allwinner,sun6i-a31-ar100-clk" - for the AR100 on A31
        "allwinner,sun6i-a31-ahb1-clk" - for the AHB1 clock on A31
+       "allwinner,sun8i-h3-ahb2-clk" - for the AHB2 clock on H3
        "allwinner,sun6i-a31-ahb1-gates-clk" - for the AHB1 gates on A31
        "allwinner,sun8i-a23-ahb1-gates-clk" - for the AHB1 gates on A23
        "allwinner,sun9i-a80-ahb0-gates-clk" - for the AHB0 gates on A80
@@ -55,6 +56,7 @@ Required properties:
        "allwinner,sun9i-a80-apb1-gates-clk" - for the APB1 gates on A80
        "allwinner,sun6i-a31-apb2-gates-clk" - for the APB2 gates on A31
        "allwinner,sun8i-a23-apb2-gates-clk" - for the APB2 gates on A23
+       "allwinner,sun8i-h3-bus-gates-clk" - for the bus gates on H3
        "allwinner,sun5i-a13-mbus-clk" - for the MBUS clock on A13
        "allwinner,sun4i-a10-mmc-clk" - for the MMC clock
        "allwinner,sun9i-a80-mmc-clk" - for mmc module clocks on A80
drivers/clk/sunxi/Makefile +1 -0
index cb4c299..f520af6 100644
@@ -10,6 +10,7 @@ obj-y += clk-a10-pll2.o
 obj-y += clk-a20-gmac.o
 obj-y += clk-mod0.o
 obj-y += clk-simple-gates.o
+obj-y += clk-sun8i-bus-gates.o
 obj-y += clk-sun8i-mbus.o
 obj-y += clk-sun9i-core.o
 obj-y += clk-sun9i-mmc.o
drivers/clk/sunxi/clk-sun8i-bus-gates.c new file +69 -0
new file mode 100644
index 0000000..ad605fa
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2015 Jens Kuske <[email protected]>
+ *
+ * Based on clk-simple-gates.c, which is:
+ * Copyright 2015 Maxime Ripard
+ *
+ * Maxime Ripard <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/clk.h>
+#include <linux/clk-provider.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+
+static DEFINE_SPINLOCK(gates_lock);
+
+static void __init sun8i_h3_bus_gates_init(struct device_node *node)
+{
+       const char *clocks[] = { "ahb1", "ahb2", "apb1", "apb2" };
+       enum { AHB1, AHB2, APB1, APB2 } clk_parent;
+       struct clk_onecell_data *clk_data;
+       const char *clk_name;
+       struct property *prop;
+       struct resource res;
+       void __iomem *clk_reg;
+       void __iomem *reg;
+       const __be32 *p;
+       int number, i;
+       u8 clk_bit;
+       u32 index;
+
+       reg = of_io_request_and_map(node, 0, of_node_full_name(node));
+       if (IS_ERR(reg))
+               return;
+
+       for (i = 0; i < ARRAY_SIZE(clocks); i++) {
+               index = of_property_match_string(node, "clock-names", clocks[i]);
+               if (index < 0)
+                       return;
+
+               clocks[i] = of_clk_get_parent_name(node, index);
+       }
+
+       clk_data = kmalloc(sizeof(struct clk_onecell_data), GFP_KERNEL);
+       if (!clk_data)
+               goto err_unmap;
+
+       number = of_property_count_u32_elems(node, "clock-indices");
+       of_property_read_u32_index(node, "clock-indices", number - 1, &number);
+
+       clk_data->clks = kcalloc(number + 1, sizeof(struct clk *), GFP_KERNEL);
+       if (!clk_data->clks)
+               goto err_free_data;
+
+       i = 0;
+       of_property_for_each_u32(node, "clock-indices", prop, p, index) {
+               of_property_read_string_index(node, "clock-output-names",

drivers/clk/sunxi/clk-sun8i-bus-gates.c line 79

Quoted 10 lines
drivers/clk/sunxi/clk-sun8i-bus-gates.c new file +10 -0
+                                             i, &clk_name);
+
+               if (index == 17 || (index >= 29 && index <= 31))
+                       clk_parent = AHB2;
+               else if (index <= 63 || index >= 128)
+                       clk_parent = AHB1;
+               else if (index >= 64 && index <= 95)
+                       clk_parent = APB1;
+               else if (index >= 96 && index <= 127)
+                       clk_parent = APB2;

A way to make this reusable in the future might be to encode it in a structure like:

static const struct bus_clock_paths sun8i_h3_bus_clock_paths __initdata = {
        {.parent = 2, .min = 17, .max = 17}, /* index 17 is from AHB2 */
        {.parent = 2, .min = 29, .max = 31}, /* AHB2 bank */
        {.parent = 1, .min = 63, .max = 128}, /* AHB1 bank */
...
        {}
};

Then the code here can be reused for other clocks like this in the future without too much bloat. (And this would potentially could be generic enough for other platforms.)

Thanks,

Signature · 4 lines
Julian Calaby

Email: julian.calaby at gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
#9 lore raw

Re: [linux-sunxi] [PATCH v4 2/6] clk: sunxi: Add H3 clocks support

Hi Julian,

Quoted 24 lines · Julian Calaby

drivers/clk/sunxi/clk-sun8i-bus-gates.c line 79

Quoted 12 lines
drivers/clk/sunxi/clk-sun8i-bus-gates.c new file +12 -0
+       of_property_for_each_u32(node, "clock-indices", prop, p, index) {
+               of_property_read_string_index(node, "clock-output-names",
+                                             i, &clk_name);
+
+               if (index == 17 || (index >= 29 && index <= 31))
+                       clk_parent = AHB2;
+               else if (index <= 63 || index >= 128)
+                       clk_parent = AHB1;
+               else if (index >= 64 && index <= 95)
+                       clk_parent = APB1;
+               else if (index >= 96 && index <= 127)
+                       clk_parent = APB2;

A way to make this reusable in the future might be to encode it in a structure like:

static const struct bus_clock_paths sun8i_h3_bus_clock_paths __initdata = {
        {.parent = 2, .min = 17, .max = 17}, /* index 17 is from AHB2 */
        {.parent = 2, .min = 29, .max = 31}, /* AHB2 bank */
        {.parent = 1, .min = 63, .max = 128}, /* AHB1 bank */
...
        {}
};
Quoted 3 lines

Then the code here can be reused for other clocks like this in the future without too much bloat. (And this would potentially could be generic enough for other platforms.)

We don't really need that at the moment. There's not point in writing more complicated code to support a use case we don't have yet.

(However, something along these lines will definitely be needed if we ever have another SoC having the same bus gates madness)

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151104/b4739fa1/attachment.sig>
#10 lore raw

Re: [linux-sunxi] [PATCH v4 2/6] clk: sunxi: Add H3 clocks support

Hi Maxime,

Quoted 31 lines · Maxime Ripard

Hi Julian,

Quoted 24 lines · Julian Calaby

drivers/clk/sunxi/clk-sun8i-bus-gates.c line 79

Quoted 12 lines
drivers/clk/sunxi/clk-sun8i-bus-gates.c new file +12 -0
+       of_property_for_each_u32(node, "clock-indices", prop, p, index) {
+               of_property_read_string_index(node, "clock-output-names",
+                                             i, &clk_name);
+
+               if (index == 17 || (index >= 29 && index <= 31))
+                       clk_parent = AHB2;
+               else if (index <= 63 || index >= 128)
+                       clk_parent = AHB1;
+               else if (index >= 64 && index <= 95)
+                       clk_parent = APB1;
+               else if (index >= 96 && index <= 127)
+                       clk_parent = APB2;

A way to make this reusable in the future might be to encode it in a structure like:

static const struct bus_clock_paths sun8i_h3_bus_clock_paths __initdata = {
        {.parent = 2, .min = 17, .max = 17}, /* index 17 is from AHB2 */
        {.parent = 2, .min = 29, .max = 31}, /* AHB2 bank */
        {.parent = 1, .min = 63, .max = 128}, /* AHB1 bank */
...
        {}
};
Quoted 3 lines

Then the code here can be reused for other clocks like this in the future without too much bloat. (And this would potentially could be generic enough for other platforms.)

Quoted 5 lines

We don't really need that at the moment. There's not point in writing more complicated code to support a use case we don't have yet.

(However, something along these lines will definitely be needed if we ever have another SoC having the same bus gates madness)

This was a suggestion for the future to address Jens' comment about having a bus clock driver instead of encoding it in devicetree.

Thanks,

Signature · 4 lines
Julian Calaby

Email: julian.calaby at gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
maintainer
#11 lore raw

Re: [PATCH v4 2/6] clk: sunxi: Add H3 clocks support

In reply to Jens Kuske
Quoted 4 lines · On Tuesday 27 October 2015 17:50:22 Jens Kuske wrote:
drivers/clk/sunxi/clk-sun8i-bus-gates.c new file +3 -0
+               of_property_read_string_index(node, "clock-output-names",
+                                             i, &clk_name);
+

drivers/clk/sunxi/clk-sun8i-bus-gates.c line 81

Quoted 10 lines
drivers/clk/sunxi/clk-sun8i-bus-gates.c new file +10 -0
+               if (index == 17 || (index >= 29 && index <= 31))
+                       clk_parent = AHB2;
+               else if (index <= 63 || index >= 128)
+                       clk_parent = AHB1;
+               else if (index >= 64 && index <= 95)
+                       clk_parent = APB1;
+               else if (index >= 96 && index <= 127)
+                       clk_parent = APB2;
+
+               clk_reg = reg + 4 * (index / 32);

Same as for the reset driver, this probably means you should have one cell to indicate which bus it is for, and another cell for the index.

Arnd

author
#12 lore raw

Re: [PATCH v4 2/6] clk: sunxi: Add H3 clocks support

Hi,

Quoted 11 lines · Arnd Bergmann
Quoted 10 lines · On Tuesday 27 October 2015 17:50:22 Jens Kuske wrote:
drivers/clk/sunxi/clk-sun8i-bus-gates.c new file +10 -0
+               of_property_read_string_index(node, "clock-output-names",
+                                             i, &clk_name);
+
+               if (index == 17 || (index >= 29 && index <= 31))
+                       clk_parent = AHB2;
+               else if (index <= 63 || index >= 128)
+                       clk_parent = AHB1;
+               else if (index >= 64 && index <= 95)
+                       clk_parent = APB1;
+               else if (index >= 96 && index <= 127)
Quoted 9 lines

drivers/clk/sunxi/clk-sun8i-bus-gates.c line 81

Quoted 4 lines
drivers/clk/sunxi/clk-sun8i-bus-gates.c new file +3 -0
+                       clk_parent = APB2;
+
+               clk_reg = reg + 4 * (index / 32);

Same as for the reset driver, this probably means you should have one cell to indicate which bus it is for, and another cell for the index.

This is what Maxime suggested in an earlier version:
http://lists.infradead.org/pipermail/linux-arm-kernel/2015-May/344213.html

In between I had another version with the parents in DT, but he didn't like that too.

Jens

#13 lore raw

Re: [PATCH v4 2/6] clk: sunxi: Add H3 clocks support

In reply to Arnd Bergmann

Hi Arnd,

Quoted 11 lines · Arnd Bergmann
Quoted 10 lines · On Tuesday 27 October 2015 17:50:22 Jens Kuske wrote:
drivers/clk/sunxi/clk-sun8i-bus-gates.c new file +10 -0
+               of_property_read_string_index(node, "clock-output-names",
+                                             i, &clk_name);
+
+               if (index == 17 || (index >= 29 && index <= 31))
+                       clk_parent = AHB2;
+               else if (index <= 63 || index >= 128)
+                       clk_parent = AHB1;
+               else if (index >= 64 && index <= 95)
+                       clk_parent = APB1;
+               else if (index >= 96 && index <= 127)
Quoted 8 lines

drivers/clk/sunxi/clk-sun8i-bus-gates.c line 81

Quoted 4 lines
drivers/clk/sunxi/clk-sun8i-bus-gates.c new file +3 -0
+                       clk_parent = APB2;
+
+               clk_reg = reg + 4 * (index / 32);

Same as for the reset driver, this probably means you should have one cell to indicate which bus it is for, and another cell for the index.

It's not really comparable to the reset driver.

What's happening here is that we have a single set of (contiguous) registers, controlling gates from different parents.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151104/dd04a757/attachment.sig>
author
#14 lore raw

PATCH v4 3/6 pinctrl: sunxi: Add H3 PIO controller support

In reply to Jens Kuske

The H3 uses the same pin controller as previous SoC's from Allwinner. Add support for the pins controlled by the main PIO controller.

---
 .../bindings/pinctrl/allwinner,sunxi-pinctrl.txt   |   1 +
 drivers/pinctrl/sunxi/Kconfig                      |   4 +
 drivers/pinctrl/sunxi/Makefile                     |   1 +
 drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c           | 516 +++++++++++++++++++++
 4 files changed, 522 insertions(+)
 create mode 100644 drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c
Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt +1 -0
index b321b26..e6ba602 100644
@@ -18,6 +18,7 @@ Required properties:
   "allwinner,sun8i-a23-r-pinctrl"
   "allwinner,sun8i-a33-pinctrl"
   "allwinner,sun8i-a83t-pinctrl"
+  "allwinner,sun8i-h3-pinctrl"
 
 - reg: Should contain the register physical address and length for the
   pin controller.
drivers/pinctrl/sunxi/Kconfig +4 -0
index e68fd95..89ab7f5 100644
@@ -51,6 +51,10 @@ config PINCTRL_SUN8I_A23_R
 	depends on RESET_CONTROLLER
 	select PINCTRL_SUNXI_COMMON
 
+config PINCTRL_SUN8I_H3
+	def_bool MACH_SUN8I
+	select PINCTRL_SUNXI_COMMON
+
 config PINCTRL_SUN9I_A80
 	def_bool MACH_SUN9I
 	select PINCTRL_SUNXI_COMMON
drivers/pinctrl/sunxi/Makefile +1 -0
index e080290..6bd818e 100644
@@ -13,4 +13,5 @@ obj-$(CONFIG_PINCTRL_SUN8I_A23)		+= pinctrl-sun8i-a23.o
 obj-$(CONFIG_PINCTRL_SUN8I_A23_R)	+= pinctrl-sun8i-a23-r.o
 obj-$(CONFIG_PINCTRL_SUN8I_A33)		+= pinctrl-sun8i-a33.o
 obj-$(CONFIG_PINCTRL_SUN8I_A83T)	+= pinctrl-sun8i-a83t.o
+obj-$(CONFIG_PINCTRL_SUN8I_H3)		+= pinctrl-sun8i-h3.o
 obj-$(CONFIG_PINCTRL_SUN9I_A80)		+= pinctrl-sun9i-a80.o
drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c new file +516 -0

516 lines not on this page · raw message

Signature · 1 line
2.6.2
#15 lore raw

Re: [PATCH v4 3/6] pinctrl: sunxi: Add H3 PIO controller support

Hi,

Quoted 79 lines · Jens Kuske

The H3 uses the same pin controller as previous SoC's from Allwinner. Add support for the pins controlled by the main PIO controller.

---
 .../bindings/pinctrl/allwinner,sunxi-pinctrl.txt   |   1 +
 drivers/pinctrl/sunxi/Kconfig                      |   4 +
 drivers/pinctrl/sunxi/Makefile                     |   1 +
 drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c           | 516 +++++++++++++++++++++
 4 files changed, 522 insertions(+)
 create mode 100644 drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c
Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt +1 -0
index b321b26..e6ba602 100644
@@ -18,6 +18,7 @@ Required properties:
   "allwinner,sun8i-a23-r-pinctrl"
   "allwinner,sun8i-a33-pinctrl"
   "allwinner,sun8i-a83t-pinctrl"
+  "allwinner,sun8i-h3-pinctrl"
 
 - reg: Should contain the register physical address and length for the
   pin controller.
drivers/pinctrl/sunxi/Kconfig +4 -0
index e68fd95..89ab7f5 100644
@@ -51,6 +51,10 @@ config PINCTRL_SUN8I_A23_R
        depends on RESET_CONTROLLER
        select PINCTRL_SUNXI_COMMON
 
+config PINCTRL_SUN8I_H3
+       def_bool MACH_SUN8I
+       select PINCTRL_SUNXI_COMMON
+
 config PINCTRL_SUN9I_A80
        def_bool MACH_SUN9I
        select PINCTRL_SUNXI_COMMON
drivers/pinctrl/sunxi/Makefile +1 -0
index e080290..6bd818e 100644
@@ -13,4 +13,5 @@ obj-$(CONFIG_PINCTRL_SUN8I_A23)               += pinctrl-sun8i-a23.o
 obj-$(CONFIG_PINCTRL_SUN8I_A23_R)      += pinctrl-sun8i-a23-r.o
 obj-$(CONFIG_PINCTRL_SUN8I_A33)                += pinctrl-sun8i-a33.o
 obj-$(CONFIG_PINCTRL_SUN8I_A83T)       += pinctrl-sun8i-a83t.o
+obj-$(CONFIG_PINCTRL_SUN8I_H3)         += pinctrl-sun8i-h3.o
 obj-$(CONFIG_PINCTRL_SUN9I_A80)                += pinctrl-sun9i-a80.o
drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c new file +23 -0
new file mode 100644
index 0000000..98d465d
@@ -0,0 +1,516 @@
+/*
+ * Allwinner H3 SoCs pinctrl driver.
+ *
+ * Copyright (C) 2015 Jens Kuske <[email protected]>
+ *
+ * Based on pinctrl-sun8i-a23.c, which is:
+ * Copyright (C) 2014 Chen-Yu Tsai <[email protected]>
+ * Copyright (C) 2014 Maxime Ripard <[email protected]>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/pinctrl/pinctrl.h>
+
+#include "pinctrl-sunxi.h"
+
+static const struct sunxi_desc_pin sun8i_h3_pins[] = {

<snip>

Quoted 14 lines
drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c new file +14 -0
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 0),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "emac")),         /* RXD3 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 1),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "emac")),         /* RXD2 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 2),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "emac")),         /* RXD1 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 3),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),

drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c line 258

Quoted 10 lines
drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c new file +10 -0
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "emac")),         /* RXD0 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 4),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "emac")),         /* RXCK */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 5),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "emac")),         /* RXCTL/RCDV */

RXDV?

drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c line 270

Quoted 12 lines
drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c new file +12 -0
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 6),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "emac")),         /* RXERR */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 7),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "emac")),         /* TXD3 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 8),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "emac")),         /* TXD2L */

Trailing "L" there.

Quoted 4 lines
drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c new file +4 -0
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 9),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "emac")),         /* TXD1 */

<snip>

drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c line 424

Quoted 5 lines
drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c new file +5 -0
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 0),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "mmc1"),          /* CLK */
+                 SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 0)),  /* PG_EINT0 */

Datasheet say EINT is function 0x6. Same for all the other pins in group G.

Quoted 93 lines
drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c new file +92 -1
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 1),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "mmc1"),          /* CMD */
+                 SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 1)),  /* PG_EINT1 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 2),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "mmc1"),          /* D0 */
+                 SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 2)),  /* PG_EINT2 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 3),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "mmc1"),          /* D1 */
+                 SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 3)),  /* PG_EINT3 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 4),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "mmc1"),          /* D2 */
+                 SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 4)),  /* PG_EINT4 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 5),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "mmc1"),          /* D3 */
+                 SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 5)),  /* PG_EINT5 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 6),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "uart1"),         /* TX */
+                 SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 6)),  /* PG_EINT6 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 7),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "uart1"),         /* RX */
+                 SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 7)),  /* PG_EINT7 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 8),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "uart1"),         /* RTS */
+                 SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 8)),  /* PG_EINT8 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 9),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "uart1"),         /* CTS */
+                 SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 9)),  /* PG_EINT9 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 10),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "i2s1"),          /* SYNC */
+                 SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 10)), /* PG_EINT10 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 11),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "i2s1"),          /* CLK */
+                 SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 11)), /* PG_EINT11 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 12),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "i2s1"),          /* DOUT */
+                 SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 12)), /* PG_EINT12 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 13),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "i2s1"),          /* DIN */
+                 SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 13)), /* PG_EINT13 */
+};
+
+static const struct sunxi_pinctrl_desc sun8i_h3_pinctrl_data = {
+       .pins = sun8i_h3_pins,
+       .npins = ARRAY_SIZE(sun8i_h3_pins),
+       .irq_banks = 2,
+};
+
+static int sun8i_h3_pinctrl_probe(struct platform_device *pdev)
+{
+       return sunxi_pinctrl_init(pdev,
+                                 &sun8i_h3_pinctrl_data);
+}
+
+static const struct of_device_id sun8i_h3_pinctrl_match[] = {
+       { .compatible = "allwinner,sun8i-h3-pinctrl", },
+       {}
+};
+
+static struct platform_driver sun8i_h3_pinctrl_driver = {
+       .probe  = sun8i_h3_pinctrl_probe,
+       .driver = {
+               .name           = "sun8i-h3-pinctrl",
+               .of_match_table = sun8i_h3_pinctrl_match,
+       },
+};
+builtin_platform_driver(sun8i_h3_pinctrl_driver);
--
Quoted 2 lines

2.6.2

The rest looks good. Thanks!

Regards
ChenYu

author
#16 lore raw

Re: [PATCH v4 3/6] pinctrl: sunxi: Add H3 PIO controller support

Quoted 134 lines · Chen-Yu Tsai

Hi,

Quoted 79 lines · Jens Kuske

The H3 uses the same pin controller as previous SoC's from Allwinner. Add support for the pins controlled by the main PIO controller.

---
 .../bindings/pinctrl/allwinner,sunxi-pinctrl.txt   |   1 +
 drivers/pinctrl/sunxi/Kconfig                      |   4 +
 drivers/pinctrl/sunxi/Makefile                     |   1 +
 drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c           | 516 +++++++++++++++++++++
 4 files changed, 522 insertions(+)
 create mode 100644 drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c
Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt +1 -0
index b321b26..e6ba602 100644
@@ -18,6 +18,7 @@ Required properties:
   "allwinner,sun8i-a23-r-pinctrl"
   "allwinner,sun8i-a33-pinctrl"
   "allwinner,sun8i-a83t-pinctrl"
+  "allwinner,sun8i-h3-pinctrl"
 
 - reg: Should contain the register physical address and length for the
   pin controller.
drivers/pinctrl/sunxi/Kconfig +4 -0
index e68fd95..89ab7f5 100644
@@ -51,6 +51,10 @@ config PINCTRL_SUN8I_A23_R
        depends on RESET_CONTROLLER
        select PINCTRL_SUNXI_COMMON
 
+config PINCTRL_SUN8I_H3
+       def_bool MACH_SUN8I
+       select PINCTRL_SUNXI_COMMON
+
 config PINCTRL_SUN9I_A80
        def_bool MACH_SUN9I
        select PINCTRL_SUNXI_COMMON
drivers/pinctrl/sunxi/Makefile +1 -0
index e080290..6bd818e 100644
@@ -13,4 +13,5 @@ obj-$(CONFIG_PINCTRL_SUN8I_A23)               += pinctrl-sun8i-a23.o
 obj-$(CONFIG_PINCTRL_SUN8I_A23_R)      += pinctrl-sun8i-a23-r.o
 obj-$(CONFIG_PINCTRL_SUN8I_A33)                += pinctrl-sun8i-a33.o
 obj-$(CONFIG_PINCTRL_SUN8I_A83T)       += pinctrl-sun8i-a83t.o
+obj-$(CONFIG_PINCTRL_SUN8I_H3)         += pinctrl-sun8i-h3.o
 obj-$(CONFIG_PINCTRL_SUN9I_A80)                += pinctrl-sun9i-a80.o
drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c new file +23 -0
new file mode 100644
index 0000000..98d465d
@@ -0,0 +1,516 @@
+/*
+ * Allwinner H3 SoCs pinctrl driver.
+ *
+ * Copyright (C) 2015 Jens Kuske <[email protected]>
+ *
+ * Based on pinctrl-sun8i-a23.c, which is:
+ * Copyright (C) 2014 Chen-Yu Tsai <[email protected]>
+ * Copyright (C) 2014 Maxime Ripard <[email protected]>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/pinctrl/pinctrl.h>
+
+#include "pinctrl-sunxi.h"
+
+static const struct sunxi_desc_pin sun8i_h3_pins[] = {

<snip>

Quoted 14 lines
drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c new file +14 -0
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 0),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "emac")),         /* RXD3 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 1),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "emac")),         /* RXD2 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 2),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "emac")),         /* RXD1 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 3),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),

drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c line 258

Quoted 10 lines
drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c new file +10 -0
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "emac")),         /* RXD0 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 4),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "emac")),         /* RXCK */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 5),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "emac")),         /* RXCTL/RCDV */

RXDV?

drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c line 270

Quoted 12 lines
drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c new file +12 -0
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 6),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "emac")),         /* RXERR */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 7),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "emac")),         /* TXD3 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 8),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "emac")),         /* TXD2L */

Trailing "L" there.

Quoted 4 lines
drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c new file +4 -0
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 9),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "emac")),         /* TXD1 */

<snip>

Quoted 7 lines

drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c line 424

Quoted 5 lines
drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c new file +5 -0
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 0),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "mmc1"),          /* CLK */
+                 SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 0)),  /* PG_EINT0 */

Datasheet say EINT is function 0x6. Same for all the other pins in group G.

Thanks. I had checked the whole list at least three times, but one always overlooks something it seems.

Quoted 103 lines
Quoted 94 lines
drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c new file +92 -1
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 1),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "mmc1"),          /* CMD */
+                 SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 1)),  /* PG_EINT1 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 2),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "mmc1"),          /* D0 */
+                 SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 2)),  /* PG_EINT2 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 3),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "mmc1"),          /* D1 */
+                 SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 3)),  /* PG_EINT3 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 4),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "mmc1"),          /* D2 */
+                 SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 4)),  /* PG_EINT4 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 5),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "mmc1"),          /* D3 */
+                 SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 5)),  /* PG_EINT5 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 6),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "uart1"),         /* TX */
+                 SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 6)),  /* PG_EINT6 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 7),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "uart1"),         /* RX */
+                 SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 7)),  /* PG_EINT7 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 8),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "uart1"),         /* RTS */
+                 SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 8)),  /* PG_EINT8 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 9),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "uart1"),         /* CTS */
+                 SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 9)),  /* PG_EINT9 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 10),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "i2s1"),          /* SYNC */
+                 SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 10)), /* PG_EINT10 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 11),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "i2s1"),          /* CLK */
+                 SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 11)), /* PG_EINT11 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 12),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "i2s1"),          /* DOUT */
+                 SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 12)), /* PG_EINT12 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 13),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "i2s1"),          /* DIN */
+                 SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 13)), /* PG_EINT13 */
+};
+
+static const struct sunxi_pinctrl_desc sun8i_h3_pinctrl_data = {
+       .pins = sun8i_h3_pins,
+       .npins = ARRAY_SIZE(sun8i_h3_pins),
+       .irq_banks = 2,
+};
+
+static int sun8i_h3_pinctrl_probe(struct platform_device *pdev)
+{
+       return sunxi_pinctrl_init(pdev,
+                                 &sun8i_h3_pinctrl_data);
+}
+
+static const struct of_device_id sun8i_h3_pinctrl_match[] = {
+       { .compatible = "allwinner,sun8i-h3-pinctrl", },
+       {}
+};
+
+static struct platform_driver sun8i_h3_pinctrl_driver = {
+       .probe  = sun8i_h3_pinctrl_probe,
+       .driver = {
+               .name           = "sun8i-h3-pinctrl",
+               .of_match_table = sun8i_h3_pinctrl_match,
+       },
+};
+builtin_platform_driver(sun8i_h3_pinctrl_driver);
--
Quoted 2 lines

2.6.2

The rest looks good. Thanks!

Regards
ChenYu

#17 lore raw

Re: [linux-sunxi] Re: [PATCH v4 3/6] pinctrl: sunxi: Add H3 PIO controller support

Quoted 141 lines · Jens Kuske
Quoted 140 lines · Chen-Yu Tsai

Hi,

Quoted 79 lines · Jens Kuske

The H3 uses the same pin controller as previous SoC's from Allwinner. Add support for the pins controlled by the main PIO controller.

---
 .../bindings/pinctrl/allwinner,sunxi-pinctrl.txt   |   1 +
 drivers/pinctrl/sunxi/Kconfig                      |   4 +
 drivers/pinctrl/sunxi/Makefile                     |   1 +
 drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c           | 516 +++++++++++++++++++++
 4 files changed, 522 insertions(+)
 create mode 100644 drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c
Documentation/devicetree/bindings/pinctrl/allwinner,sunxi-pinctrl.txt +1 -0
index b321b26..e6ba602 100644
@@ -18,6 +18,7 @@ Required properties:
   "allwinner,sun8i-a23-r-pinctrl"
   "allwinner,sun8i-a33-pinctrl"
   "allwinner,sun8i-a83t-pinctrl"
+  "allwinner,sun8i-h3-pinctrl"
 
 - reg: Should contain the register physical address and length for the
   pin controller.
drivers/pinctrl/sunxi/Kconfig +4 -0
index e68fd95..89ab7f5 100644
@@ -51,6 +51,10 @@ config PINCTRL_SUN8I_A23_R
        depends on RESET_CONTROLLER
        select PINCTRL_SUNXI_COMMON
 
+config PINCTRL_SUN8I_H3
+       def_bool MACH_SUN8I
+       select PINCTRL_SUNXI_COMMON
+
 config PINCTRL_SUN9I_A80
        def_bool MACH_SUN9I
        select PINCTRL_SUNXI_COMMON
drivers/pinctrl/sunxi/Makefile +1 -0
index e080290..6bd818e 100644
@@ -13,4 +13,5 @@ obj-$(CONFIG_PINCTRL_SUN8I_A23)               += pinctrl-sun8i-a23.o
 obj-$(CONFIG_PINCTRL_SUN8I_A23_R)      += pinctrl-sun8i-a23-r.o
 obj-$(CONFIG_PINCTRL_SUN8I_A33)                += pinctrl-sun8i-a33.o
 obj-$(CONFIG_PINCTRL_SUN8I_A83T)       += pinctrl-sun8i-a83t.o
+obj-$(CONFIG_PINCTRL_SUN8I_H3)         += pinctrl-sun8i-h3.o
 obj-$(CONFIG_PINCTRL_SUN9I_A80)                += pinctrl-sun9i-a80.o
drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c new file +23 -0
new file mode 100644
index 0000000..98d465d
@@ -0,0 +1,516 @@
+/*
+ * Allwinner H3 SoCs pinctrl driver.
+ *
+ * Copyright (C) 2015 Jens Kuske <[email protected]>
+ *
+ * Based on pinctrl-sun8i-a23.c, which is:
+ * Copyright (C) 2014 Chen-Yu Tsai <[email protected]>
+ * Copyright (C) 2014 Maxime Ripard <[email protected]>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/pinctrl/pinctrl.h>
+
+#include "pinctrl-sunxi.h"
+
+static const struct sunxi_desc_pin sun8i_h3_pins[] = {

<snip>

Quoted 14 lines
drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c new file +14 -0
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 0),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "emac")),         /* RXD3 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 1),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "emac")),         /* RXD2 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 2),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "emac")),         /* RXD1 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 3),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),

drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c line 258

Quoted 10 lines
drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c new file +10 -0
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "emac")),         /* RXD0 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 4),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "emac")),         /* RXCK */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 5),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "emac")),         /* RXCTL/RCDV */

RXDV?

drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c line 270

Quoted 12 lines
drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c new file +12 -0
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 6),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "emac")),         /* RXERR */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 7),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "emac")),         /* TXD3 */
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 8),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "emac")),         /* TXD2L */

Trailing "L" there.

Quoted 4 lines
drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c new file +4 -0
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(D, 9),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "emac")),         /* TXD1 */

<snip>

Quoted 5 lines
drivers/pinctrl/sunxi/pinctrl-sun8i-h3.c new file +5 -0
+       SUNXI_PIN(SUNXI_PINCTRL_PIN(G, 0),
+                 SUNXI_FUNCTION(0x0, "gpio_in"),
+                 SUNXI_FUNCTION(0x1, "gpio_out"),
+                 SUNXI_FUNCTION(0x2, "mmc1"),          /* CLK */
+                 SUNXI_FUNCTION_IRQ_BANK(0x4, 1, 0)),  /* PG_EINT0 */
Quoted 4 lines
Quoted 1 line

Datasheet say EINT is function 0x6. Same for all the other pins in group G.

Thanks. I had checked the whole list at least three times, but one always overlooks something it seems.

As someone who's done this a few times, I can say that it all starts to look the same after a few rounds. :)

ChenYu

author
#18 lore raw

PATCH v4 4/6 reset: sunxi: Add Allwinner H3 bus resets

In reply to Jens Kuske

The H3 bus resets have some holes between the registers, so we add an of_xlate() function to skip them according to the datasheet.

---
 .../bindings/reset/allwinner,sunxi-clock-reset.txt |  1 +
 drivers/reset/reset-sunxi.c                        | 30 +++++++++++++++++++---
 2 files changed, 28 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/reset/allwinner,sunxi-clock-reset.txt +1 -0
index c8f7757..e11f023 100644
@@ -8,6 +8,7 @@ Required properties:
 - compatible: Should be one of the following:
   "allwinner,sun6i-a31-ahb1-reset"
   "allwinner,sun6i-a31-clock-reset"
+  "allwinner,sun8i-h3-bus-reset"
 - reg: should be register base and length as documented in the
   datasheet
 - #reset-cells: 1, see below
drivers/reset/reset-sunxi.c +27 -3
index 3d95c87..c91e146 100644
@@ -75,7 +75,9 @@ static struct reset_control_ops sunxi_reset_ops = {
 	.deassert	= sunxi_reset_deassert,
 };
 
-static int sunxi_reset_init(struct device_node *np)
+static int sunxi_reset_init(struct device_node *np,
+			    int (*of_xlate)(struct reset_controller_dev *rcdev,
+				    const struct of_phandle_args *reset_spec))
 {
 	struct sunxi_reset_data *data;
 	struct resource res;
@@ -108,6 +110,7 @@ static int sunxi_reset_init(struct device_node *np)
 	data->rcdev.nr_resets = size * 32;
 	data->rcdev.ops = &sunxi_reset_ops;
 	data->rcdev.of_node = np;
+	data->rcdev.of_xlate = of_xlate;
 	reset_controller_register(&data->rcdev);
 
 	return 0;
@@ -117,6 +120,21 @@ err_alloc:
 	return ret;
 };
 
+static int sun8i_h3_bus_reset_xlate(struct reset_controller_dev *rcdev,
+				    const struct of_phandle_args *reset_spec)
+{
+	unsigned int index = reset_spec->args[0];
+
+	if (index < 96)
+		return index;
+	else if (index < 128)
+		return index + 32;
+	else if (index < 160)
+		return index + 64;
+	else
+		return -EINVAL;
+}
+
 /*
  * These are the reset controller we need to initialize early on in
  * our system, before we can even think of using a regular device
@@ -124,15 +142,21 @@ err_alloc:
  */
 static const struct of_device_id sunxi_early_reset_dt_ids[] __initdata = {
 	{ .compatible = "allwinner,sun6i-a31-ahb1-reset", },
+	{ .compatible = "allwinner,sun8i-h3-bus-reset", .data = sun8i_h3_bus_reset_xlate, },
 	{ /* sentinel */ },
 };
 
 void __init sun6i_reset_init(void)
 {
 	struct device_node *np;
+	const struct of_device_id *match;
+	int (*of_xlate)(struct reset_controller_dev *rcdev,
+			const struct of_phandle_args *reset_spec);
 
-	for_each_matching_node(np, sunxi_early_reset_dt_ids)
-		sunxi_reset_init(np);
+	for_each_matching_node_and_match(np, sunxi_early_reset_dt_ids, &match) {
+		of_xlate = match->data;
+		sunxi_reset_init(np, of_xlate);
+	}
 }
 
 /*
Signature · 1 line
2.6.2
maintainer
#19 lore raw

Re: [PATCH v4 4/6] reset: sunxi: Add Allwinner H3 bus resets

Hi Jens,

Am Dienstag, den 27.10.2015, 17:50 +0100 schrieb Jens Kuske:
[...]

drivers/reset/reset-sunxi.c static struct reset_control_ops sunxi_reset_ops = { · line 80

Quoted 10 lines
drivers/reset/reset-sunxi.c +3 -1
@@ -75,7 +75,9 @@ static struct reset_control_ops sunxi_reset_ops = {
 	.deassert	= sunxi_reset_deassert,
 };
 
-static int sunxi_reset_init(struct device_node *np)
+static int sunxi_reset_init(struct device_node *np,
+			    int (*of_xlate)(struct reset_controller_dev *rcdev,
+				    const struct of_phandle_args *reset_spec))

I'd add a tab to the indentation and drop the of_xlate parameter names. If you agree to this change, I'll fix it up when I apply it.

best regards
Philipp

maintainer
#20 lore raw

Re: [PATCH v4 4/6] reset: sunxi: Add Allwinner H3 bus resets

In reply to Jens Kuske
Quoted 7 lines · On Tuesday 27 October 2015 17:50:24 Jens Kuske wrote:
drivers/reset/reset-sunxi.c +5 -0
+static int sun8i_h3_bus_reset_xlate(struct reset_controller_dev *rcdev,
+                                   const struct of_phandle_args *reset_spec)
+{
+       unsigned int index = reset_spec->args[0];
+

drivers/reset/reset-sunxi.c err_alloc: · line 137

Quoted 10 lines
drivers/reset/reset-sunxi.c +10 -0
+       if (index < 96)
+               return index;
+       else if (index < 128)
+               return index + 32;
+       else if (index < 160)
+               return index + 64;
+       else
+               return -EINVAL;
+}
+

This looks like you are doing something wrong and should either put the actual number into DT, or use a two-cell representation, with the first cell indicating the block (0, 1 or 2), and the second cell the index.

Arnd

author
#21 lore raw

Re: [PATCH v4 4/6] reset: sunxi: Add Allwinner H3 bus resets

Hi,

Quoted 15 lines · Arnd Bergmann
Quoted 14 lines · On Tuesday 27 October 2015 17:50:24 Jens Kuske wrote:
drivers/reset/reset-sunxi.c +13 -0
+static int sun8i_h3_bus_reset_xlate(struct reset_controller_dev *rcdev,
+                                   const struct of_phandle_args *reset_spec)
+{
+       unsigned int index = reset_spec->args[0];
+
+       if (index < 96)
+               return index;
+       else if (index < 128)
+               return index + 32;
+       else if (index < 160)
+               return index + 64;
+       else
+               return -EINVAL;
Quoted 9 lines

drivers/reset/reset-sunxi.c err_alloc: · line 137

Quoted 3 lines
drivers/reset/reset-sunxi.c +2 -0
+}
+

This looks like you are doing something wrong and should either put the actual number into DT, or use a two-cell representation, with the first cell indicating the block (0, 1 or 2), and the second cell the index.

I tried to fix up the somewhat strange register layout here.

Quoted 1 line

From the datasheet:

BUS_SOFT_RST_REG0 0x02C0 Bus Software Reset Register 0
BUS_SOFT_RST_REG1 0x02C4 Bus Software Reset Register 1
BUS_SOFT_RST_REG2 0x02C8 Bus Software Reset Register 2
BUS_SOFT_RST_REG3 0x02D0 Bus Software Reset Register 3
BUS_SOFT_RST_REG4 0x02D8 Bus Software Reset Register 4

0x2cc and 0x2d4 are unused for some reason, but the regs are named 0-4, so it lead to some confusion with the actual numbers in DT. If we shouldn't do this I would be ok with putting the actual number into DT too.

Jens

#22 lore raw

Re: [PATCH v4 4/6] reset: sunxi: Add Allwinner H3 bus resets

In reply to Arnd Bergmann

Hi Arnd,

Quoted 13 lines · Arnd Bergmann
Quoted 12 lines · On Tuesday 27 October 2015 17:50:24 Jens Kuske wrote:
drivers/reset/reset-sunxi.c +11 -0
+static int sun8i_h3_bus_reset_xlate(struct reset_controller_dev *rcdev,
+                                   const struct of_phandle_args *reset_spec)
+{
+       unsigned int index = reset_spec->args[0];
+
+       if (index < 96)
+               return index;
+       else if (index < 128)
+               return index + 32;
+       else if (index < 160)
+               return index + 64;
Quoted 8 lines

drivers/reset/reset-sunxi.c err_alloc: · line 137

Quoted 5 lines
drivers/reset/reset-sunxi.c +4 -0
+       else
+               return -EINVAL;
+}
+

This looks like you are doing something wrong and should either put the actual number into DT,

This is the actual number, except that there's some useless registers in between. Allwinner documents it like that:

0x0 Reset 0
0x4 Reset 1
0xc Reset 2

So we have to adjust the offset to account with the blank register in between (0x8).

Quoted 2 lines

or use a two-cell representation, with the first cell indicating the block (0, 1 or 2), and the second cell the index.

And the missing register is not a block either.

That would also imply either changing the bindings of that driver (and all the current DTS that are using it), or introducing a whole new driver just to deal with some extraordinary offset calculation.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151104/d0581121/attachment.sig>
#23 lore raw

Re: [PATCH v4 4/6] reset: sunxi: Add Allwinner H3 bus resets

Quoted 35 lines · On Wed, 4 Nov 2015 08:30:14 -0800 Maxime Ripard…

Hi Arnd,

Quoted 13 lines · Arnd Bergmann
Quoted 12 lines · On Tuesday 27 October 2015 17:50:24 Jens Kuske wrote:
drivers/reset/reset-sunxi.c +11 -0
+static int sun8i_h3_bus_reset_xlate(struct reset_controller_dev *rcdev,
+                                   const struct of_phandle_args *reset_spec)
+{
+       unsigned int index = reset_spec->args[0];
+
+       if (index < 96)
+               return index;
+       else if (index < 128)
+               return index + 32;
+       else if (index < 160)
+               return index + 64;
Quoted 8 lines

drivers/reset/reset-sunxi.c err_alloc: · line 137

Quoted 5 lines
drivers/reset/reset-sunxi.c +4 -0
+       else
+               return -EINVAL;
+}
+

This looks like you are doing something wrong and should either put the actual number into DT,

This is the actual number, except that there's some useless registers in between. Allwinner documents it like that:

0x0 Reset 0
0x4 Reset 1
0xc Reset 2

So we have to adjust the offset to account with the blank register in between (0x8).

Quoted 8 lines
Quoted 2 lines

or use a two-cell representation, with the first cell indicating the block (0, 1 or 2), and the second cell the index.

And the missing register is not a block either.

That would also imply either changing the bindings of that driver (and all the current DTS that are using it), or introducing a whole new driver just to deal with some extraordinary offset calculation.

In the H3, the holes are not used, but what would occur if these holes would be used for some other purpose in future SoCs? Double mapping?

Signature · 2 lines
Ken ar c'henta?	|	      ** Breizh ha Linux atav! **
Jef		|		http://moinejf.free.fr/
#24 lore raw

Re: [linux-sunxi] Re: [PATCH v4 4/6] reset: sunxi: Add Allwinner H3 bus resets

Quoted 41 lines · Jean-Francois Moine
Quoted 38 lines · On Wed, 4 Nov 2015 08:30:14 -0800 Maxime Ripard…

Hi Arnd,

Quoted 13 lines · Arnd Bergmann
Quoted 12 lines · On Tuesday 27 October 2015 17:50:24 Jens Kuske wrote:
drivers/reset/reset-sunxi.c +11 -0
+static int sun8i_h3_bus_reset_xlate(struct reset_controller_dev *rcdev,
+                                   const struct of_phandle_args *reset_spec)
+{
+       unsigned int index = reset_spec->args[0];
+
+       if (index < 96)
+               return index;
+       else if (index < 128)
+               return index + 32;
+       else if (index < 160)
+               return index + 64;
Quoted 8 lines

drivers/reset/reset-sunxi.c err_alloc: · line 137

Quoted 5 lines
drivers/reset/reset-sunxi.c +4 -0
+       else
+               return -EINVAL;
+}
+

This looks like you are doing something wrong and should either put the actual number into DT,

This is the actual number, except that there's some useless registers in between. Allwinner documents it like that:

0x0   Reset 0
0x4   Reset 1
0xc   Reset 2

So we have to adjust the offset to account with the blank register in between (0x8).

Quoted 2 lines

or use a two-cell representation, with the first cell indicating the block (0, 1 or 2), and the second cell the index.

Quoted 8 lines
Quoted 5 lines

And the missing register is not a block either.

That would also imply either changing the bindings of that driver (and all the current DTS that are using it), or introducing a whole new driver just to deal with some extraordinary offset calculation.

In the H3, the holes are not used, but what would occur if these holes would be used for some other purpose in future SoCs? Double mapping?

We'd have a different compatible string for it.

My suggestion for the resets is to just split them into 3 nodes: AHB (since AHB1 and AHB2 devices are mixed together in the bunch), APB1, and APB2 reset controls.

This follows what we have for existing SoCs, and gets rid of the unused hole. We can use the existing "allwinner,sun6i-a31-clock-reset" and "allwinner,sun6i-a31-ahb1-reset" compatibles.

Regards
ChenYu

#25 lore raw

Re: [linux-sunxi] Re: [PATCH v4 4/6] reset: sunxi: Add Allwinner H3 bus resets

Hi,

Quoted 53 lines · Chen-Yu Tsai
Quoted 41 lines · Jean-Francois Moine
Quoted 38 lines · On Wed, 4 Nov 2015 08:30:14 -0800 Maxime Ripard…

Hi Arnd,

Quoted 13 lines · Arnd Bergmann
Quoted 12 lines · On Tuesday 27 October 2015 17:50:24 Jens Kuske wrote:
drivers/reset/reset-sunxi.c +11 -0
+static int sun8i_h3_bus_reset_xlate(struct reset_controller_dev *rcdev,
+                                   const struct of_phandle_args *reset_spec)
+{
+       unsigned int index = reset_spec->args[0];
+
+       if (index < 96)
+               return index;
+       else if (index < 128)
+               return index + 32;
+       else if (index < 160)
+               return index + 64;
Quoted 8 lines

drivers/reset/reset-sunxi.c err_alloc: · line 137

Quoted 5 lines
drivers/reset/reset-sunxi.c +4 -0
+       else
+               return -EINVAL;
+}
+

This looks like you are doing something wrong and should either put the actual number into DT,

This is the actual number, except that there's some useless registers in between. Allwinner documents it like that:

0x0   Reset 0
0x4   Reset 1
0xc   Reset 2

So we have to adjust the offset to account with the blank register in between (0x8).

Quoted 2 lines

or use a two-cell representation, with the first cell indicating the block (0, 1 or 2), and the second cell the index.

Quoted 8 lines
Quoted 5 lines

And the missing register is not a block either.

That would also imply either changing the bindings of that driver (and all the current DTS that are using it), or introducing a whole new driver just to deal with some extraordinary offset calculation.

In the H3, the holes are not used, but what would occur if these holes would be used for some other purpose in future SoCs? Double mapping?

We'd have a different compatible string for it.

Quoted 7 lines

My suggestion for the resets is to just split them into 3 nodes: AHB (since AHB1 and AHB2 devices are mixed together in the bunch), APB1, and APB2 reset controls.

This follows what we have for existing SoCs, and gets rid of the unused hole. We can use the existing "allwinner,sun6i-a31-clock-reset" and "allwinner,sun6i-a31-ahb1-reset" compatibles.

That seems a bit weird to have a single clock and split resets, but as long as they are not mixed, and you can compute easily the id from the datasheet, ok.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151123/0f5b4408/attachment.sig>
author
#26 lore raw

PATCH v4 5/6 ARM: dts: sunxi: Add Allwinner H3 DTSI

In reply to Jens Kuske

The Allwinner H3 is a home entertainment system oriented SoC with four Cortex-A7 cores and a Mali-400MP2 GPU.

---
 arch/arm/boot/dts/sun8i-h3.dtsi | 482 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 482 insertions(+)
 create mode 100644 arch/arm/boot/dts/sun8i-h3.dtsi
arch/arm/boot/dts/sun8i-h3.dtsi new file +482 -0
new file mode 100644
index 0000000..c18b5f7
@@ -0,0 +1,482 @@
+/*
+ * Copyright (C) 2015 Jens Kuske <[email protected]>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This file is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "skeleton.dtsi"
+
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/pinctrl/sun4i-a10.h>
+
+/ {
+	interrupt-parent = <&gic>;
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu at 0 {
+			compatible = "arm,cortex-a7";
+			device_type = "cpu";
+			reg = <0>;
+		};
+
+		cpu at 1 {
+			compatible = "arm,cortex-a7";
+			device_type = "cpu";
+			reg = <1>;
+		};
+
+		cpu at 2 {
+			compatible = "arm,cortex-a7";
+			device_type = "cpu";
+			reg = <2>;
+		};
+
+		cpu at 3 {
+			compatible = "arm,cortex-a7";
+			device_type = "cpu";
+			reg = <3>;
+		};
+	};
+
+	timer {
+		compatible = "arm,armv7-timer";
+		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
+		clock-frequency = <24000000>;
+		arm,cpu-registers-not-fw-configured;
+	};
+
+	memory {
+		reg = <0x40000000 0x80000000>;
+	};
+
+	clocks {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		osc24M: osc24M_clk {
+			#clock-cells = <0>;
+			compatible = "fixed-clock";
+			clock-frequency = <24000000>;
+			clock-output-names = "osc24M";
+		};
+
+		osc32k: osc32k_clk {
+			#clock-cells = <0>;
+			compatible = "fixed-clock";
+			clock-frequency = <32768>;
+			clock-output-names = "osc32k";
+		};
+
+		pll1: clk at 01c20000 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun8i-a23-pll1-clk";
+			reg = <0x01c20000 0x4>;
+			clocks = <&osc24M>;
+			clock-output-names = "pll1";
+		};
+
+		/* dummy clock until actually implemented */
+		pll5: pll5_clk {
+			#clock-cells = <0>;
+			compatible = "fixed-clock";
+			clock-frequency = <0>;
+			clock-output-names = "pll5";
+		};
+
+		pll6: clk at 01c20028 {
+			#clock-cells = <1>;
+			compatible = "allwinner,sun6i-a31-pll6-clk";
+			reg = <0x01c20028 0x4>;
+			clocks = <&osc24M>;
+			clock-output-names = "pll6", "pll6x2", "pll6d2";
+		};
+
+		pll8: clk at 01c20044 {
+			#clock-cells = <1>;
+			compatible = "allwinner,sun6i-a31-pll6-clk";
+			reg = <0x01c20044 0x4>;
+			clocks = <&osc24M>;
+			clock-output-names = "pll8", "pll8x2";
+		};
+
+		cpu: cpu_clk at 01c20050 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun4i-a10-cpu-clk";
+			reg = <0x01c20050 0x4>;
+			clocks = <&osc32k>, <&osc24M>, <&pll1>, <&pll1>;
+			clock-output-names = "cpu";
+		};
+
+		axi: axi_clk at 01c20050 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun4i-a10-axi-clk";
+			reg = <0x01c20050 0x4>;
+			clocks = <&cpu>;
+			clock-output-names = "axi";
+		};
+
+		ahb1: ahb1_clk at 01c20054 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun6i-a31-ahb1-clk";
+			reg = <0x01c20054 0x4>;
+			clocks = <&osc32k>, <&osc24M>, <&axi>, <&pll6 0>;
+			clock-output-names = "ahb1";
+		};
+
+		ahb2: ahb2_clk at 01c2005c {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun8i-h3-ahb2-clk";
+			reg = <0x01c2005c 0x4>;
+			clocks = <&ahb1>, <&pll6 2>;
+			clock-output-names = "ahb2";
+		};
+
+		apb1: apb1_clk at 01c20054 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun4i-a10-apb0-clk";
+			reg = <0x01c20054 0x4>;
+			clocks = <&ahb1>;
+			clock-output-names = "apb1";
+		};
+
+		apb2: apb2_clk at 01c20058 {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun4i-a10-apb1-clk";
+			reg = <0x01c20058 0x4>;
+			clocks = <&osc32k>, <&osc24M>, <&pll6 0>, <&pll6 0>;
+			clock-output-names = "apb2";
+		};
+
+		bus_gates: clk at 01c20060 {
+			#clock-cells = <1>;
+			compatible = "allwinner,sun8i-h3-bus-gates-clk";
+			reg = <0x01c20060 0x14>;
+			clocks = <&ahb1>, <&ahb2>, <&apb1>, <&apb2>;
+			clock-names = "ahb1", "ahb2", "apb1", "apb2";
+			clock-indices = <5>, <6>, <8>,
+					<9>, <10>, <13>,
+					<14>, <17>, <18>,
+					<19>, <20>,
+					<21>, <23>,
+					<24>, <25>,
+					<26>, <27>,
+					<28>, <29>,
+					<30>, <31>, <32>,
+					<35>, <36>, <37>,
+					<40>, <41>, <43>,
+					<44>, <52>, <53>,
+					<54>, <64>,
+					<65>, <69>, <72>,
+					<76>, <77>, <78>,
+					<96>, <97>, <98>,
+					<112>, <113>,
+					<114>, <115>, <116>,
+					<128>, <135>;
+			clock-output-names = "ahb1_ce", "ahb1_dma", "ahb1_mmc0",
+					"ahb1_mmc1", "ahb1_mmc2", "ahb1_nand",
+					"ahb1_sdram", "ahb2_gmac", "ahb1_ts",
+					"ahb1_hstimer", "ahb1_spi0",
+					"ahb1_spi1", "ahb1_otg",
+					"ahb1_otg_ehci0", "ahb1_ehic1",
+					"ahb1_ehic2", "ahb1_ehic3",
+					"ahb1_otg_ohci0", "ahb2_ohic1",
+					"ahb2_ohic2", "ahb2_ohic3", "ahb1_ve",
+					"ahb1_lcd0", "ahb1_lcd1", "ahb1_deint",
+					"ahb1_csi", "ahb1_tve", "ahb1_hdmi",
+					"ahb1_de", "ahb1_gpu", "ahb1_msgbox",
+					"ahb1_spinlock", "apb1_codec",
+					"apb1_spdif", "apb1_pio", "apb1_ths",
+					"apb1_i2s0", "apb1_i2s1", "apb1_i2s2",
+					"apb2_i2c0", "apb2_i2c1", "apb2_i2c2",
+					"apb2_uart0", "apb2_uart1",
+					"apb2_uart2", "apb2_uart3", "apb2_scr",
+					"ahb1_ephy", "ahb1_dbg";
+		};
+
+		mmc0_clk: clk at 01c20088 {
+			#clock-cells = <1>;
+			compatible = "allwinner,sun4i-a10-mmc-clk";
+			reg = <0x01c20088 0x4>;
+			clocks = <&osc24M>, <&pll6 0>, <&pll8 0>;
+			clock-output-names = "mmc0",
+					     "mmc0_output",
+					     "mmc0_sample";
+		};
+
+		mmc1_clk: clk at 01c2008c {
+			#clock-cells = <1>;
+			compatible = "allwinner,sun4i-a10-mmc-clk";
+			reg = <0x01c2008c 0x4>;
+			clocks = <&osc24M>, <&pll6 0>, <&pll8 0>;
+			clock-output-names = "mmc1",
+					     "mmc1_output",
+					     "mmc1_sample";
+		};
+
+		mmc2_clk: clk at 01c20090 {
+			#clock-cells = <1>;
+			compatible = "allwinner,sun4i-a10-mmc-clk";
+			reg = <0x01c20090 0x4>;
+			clocks = <&osc24M>, <&pll6 0>, <&pll8 0>;
+			clock-output-names = "mmc2",
+					     "mmc2_output",
+					     "mmc2_sample";
+		};
+
+		mbus_clk: clk at 01c2015c {
+			#clock-cells = <0>;
+			compatible = "allwinner,sun8i-a23-mbus-clk";
+			reg = <0x01c2015c 0x4>;
+			clocks = <&osc24M>, <&pll6 1>, <&pll5>;
+			clock-output-names = "mbus";
+		};
+	};
+
+	soc {
+		compatible = "simple-bus";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		dma: dma-controller at 01c02000 {
+			compatible = "allwinner,sun8i-h3-dma";
+			reg = <0x01c02000 0x1000>;
+			interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&bus_gates 6>;
+			resets = <&bus_rst 6>;
+			#dma-cells = <1>;
+		};
+
+		mmc0: mmc at 01c0f000 {
+			compatible = "allwinner,sun5i-a13-mmc";
+			reg = <0x01c0f000 0x1000>;
+			clocks = <&bus_gates 8>,
+				 <&mmc0_clk 0>,
+				 <&mmc0_clk 1>,
+				 <&mmc0_clk 2>;
+			clock-names = "ahb",
+				      "mmc",
+				      "output",
+				      "sample";
+			resets = <&bus_rst 8>;
+			reset-names = "ahb";
+			interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
+		mmc1: mmc at 01c10000 {
+			compatible = "allwinner,sun5i-a13-mmc";
+			reg = <0x01c10000 0x1000>;
+			clocks = <&bus_gates 9>,
+				 <&mmc1_clk 0>,
+				 <&mmc1_clk 1>,
+				 <&mmc1_clk 2>;
+			clock-names = "ahb",
+				      "mmc",
+				      "output",
+				      "sample";
+			resets = <&bus_rst 9>;
+			reset-names = "ahb";
+			interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
+		mmc2: mmc at 01c11000 {
+			compatible = "allwinner,sun5i-a13-mmc";
+			reg = <0x01c11000 0x1000>;
+			clocks = <&bus_gates 10>,
+				 <&mmc2_clk 0>,
+				 <&mmc2_clk 1>,
+				 <&mmc2_clk 2>;
+			clock-names = "ahb",
+				      "mmc",
+				      "output",
+				      "sample";
+			resets = <&bus_rst 10>;
+			reset-names = "ahb";
+			interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
+			status = "disabled";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
+		pio: pinctrl at 01c20800 {
+			compatible = "allwinner,sun8i-h3-pinctrl";
+			reg = <0x01c20800 0x400>;
+			interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&bus_gates 69>;
+			gpio-controller;
+			#gpio-cells = <3>;
+			interrupt-controller;
+			#interrupt-cells = <2>;
+
+			uart0_pins_a: uart0 at 0 {
+				allwinner,pins = "PA4", "PA5";
+				allwinner,function = "uart0";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
+			mmc0_pins_a: mmc0 at 0 {
+				allwinner,pins = "PF0", "PF1", "PF2", "PF3",
+						 "PF4", "PF5";
+				allwinner,function = "mmc0";
+				allwinner,drive = <SUN4I_PINCTRL_30_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+
+			mmc0_cd_pin: mmc0_cd_pin at 0 {
+				allwinner,pins = "PF6";
+				allwinner,function = "gpio_in";
+				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
+			};
+
+			mmc1_pins_a: mmc1 at 0 {
+				allwinner,pins = "PG0", "PG1", "PG2", "PG3",
+						 "PG4", "PG5";
+				allwinner,function = "mmc1";
+				allwinner,drive = <SUN4I_PINCTRL_30_MA>;
+				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+			};
+		};
+
+		bus_rst: reset at 01c202c0 {
+			#reset-cells = <1>;
+			compatible = "allwinner,sun8i-h3-bus-reset";
+			reg = <0x01c202c0 0x1c>;
+		};
+
+		timer at 01c20c00 {
+			compatible = "allwinner,sun4i-a10-timer";
+			reg = <0x01c20c00 0xa0>;
+			interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&osc24M>;
+		};
+
+		wdt0: watchdog at 01c20ca0 {
+			compatible = "allwinner,sun6i-a31-wdt";
+			reg = <0x01c20ca0 0x20>;
+			interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>;
+		};
+
+		uart0: serial at 01c28000 {
+			compatible = "snps,dw-apb-uart";
+			reg = <0x01c28000 0x400>;
+			interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
+			reg-shift = <2>;
+			reg-io-width = <4>;
+			clocks = <&bus_gates 112>;
+			resets = <&bus_rst 144>;
+			dmas = <&dma 6>, <&dma 6>;
+			dma-names = "rx", "tx";
+			status = "disabled";
+		};
+
+		uart1: serial at 01c28400 {
+			compatible = "snps,dw-apb-uart";
+			reg = <0x01c28400 0x400>;
+			interrupts = <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>;
+			reg-shift = <2>;
+			reg-io-width = <4>;
+			clocks = <&bus_gates 113>;
+			resets = <&bus_rst 145>;
+			dmas = <&dma 7>, <&dma 7>;
+			dma-names = "rx", "tx";
+			status = "disabled";
+		};
+
+		uart2: serial at 01c28800 {
+			compatible = "snps,dw-apb-uart";
+			reg = <0x01c28800 0x400>;
+			interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
+			reg-shift = <2>;
+			reg-io-width = <4>;
+			clocks = <&bus_gates 114>;
+			resets = <&bus_rst 146>;
+			dmas = <&dma 8>, <&dma 8>;
+			dma-names = "rx", "tx";
+			status = "disabled";
+		};
+
+		uart3: serial at 01c28c00 {
+			compatible = "snps,dw-apb-uart";
+			reg = <0x01c28c00 0x400>;
+			interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
+			reg-shift = <2>;
+			reg-io-width = <4>;
+			clocks = <&bus_gates 115>;
+			resets = <&bus_rst 147>;
+			dmas = <&dma 9>, <&dma 9>;
+			dma-names = "rx", "tx";
+			status = "disabled";
+		};
+
+		gic: interrupt-controller at 01c81000 {
+			compatible = "arm,cortex-a7-gic", "arm,cortex-a15-gic";
+			reg = <0x01c81000 0x1000>,
+			      <0x01c82000 0x1000>,
+			      <0x01c84000 0x2000>,
+			      <0x01c86000 0x2000>;
+			interrupt-controller;
+			#interrupt-cells = <3>;
+			interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
+		};
+
+		rtc: rtc at 01f00000 {
+			compatible = "allwinner,sun6i-a31-rtc";
+			reg = <0x01f00000 0x54>;
+			interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
+		};
+	};
+};
Signature · 1 line
2.6.2
#27 lore raw

Re: [PATCH v4 5/6] ARM: dts: sunxi: Add Allwinner H3 DTSI

Hi,

Quoted 139 lines · Jens Kuske

The Allwinner H3 is a home entertainment system oriented SoC with four Cortex-A7 cores and a Mali-400MP2 GPU.

---
 arch/arm/boot/dts/sun8i-h3.dtsi | 482 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 482 insertions(+)
 create mode 100644 arch/arm/boot/dts/sun8i-h3.dtsi
arch/arm/boot/dts/sun8i-h3.dtsi new file +124 -0
new file mode 100644
index 0000000..c18b5f7
@@ -0,0 +1,482 @@
+/*
+ * Copyright (C) 2015 Jens Kuske <[email protected]>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This file is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "skeleton.dtsi"
+
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/pinctrl/sun4i-a10.h>
+
+/ {
+       interrupt-parent = <&gic>;
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               cpu at 0 {
+                       compatible = "arm,cortex-a7";
+                       device_type = "cpu";
+                       reg = <0>;
+               };
+
+               cpu at 1 {
+                       compatible = "arm,cortex-a7";
+                       device_type = "cpu";
+                       reg = <1>;
+               };
+
+               cpu at 2 {
+                       compatible = "arm,cortex-a7";
+                       device_type = "cpu";
+                       reg = <2>;
+               };
+
+               cpu at 3 {
+                       compatible = "arm,cortex-a7";
+                       device_type = "cpu";
+                       reg = <3>;
+               };
+       };
+
+       timer {
+               compatible = "arm,armv7-timer";
+               interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+                            <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+                            <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+                            <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
+               clock-frequency = <24000000>;
+               arm,cpu-registers-not-fw-configured;
+       };
+
+       memory {
+               reg = <0x40000000 0x80000000>;
+       };
+
+       clocks {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+
+               osc24M: osc24M_clk {
+                       #clock-cells = <0>;
+                       compatible = "fixed-clock";
+                       clock-frequency = <24000000>;
+                       clock-output-names = "osc24M";
+               };
+
+               osc32k: osc32k_clk {
+                       #clock-cells = <0>;
+                       compatible = "fixed-clock";
+                       clock-frequency = <32768>;
+                       clock-output-names = "osc32k";
+               };
+
+               pll1: clk at 01c20000 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun8i-a23-pll1-clk";
+                       reg = <0x01c20000 0x4>;
+                       clocks = <&osc24M>;
+                       clock-output-names = "pll1";
+               };
+
+               /* dummy clock until actually implemented */
+               pll5: pll5_clk {
+                       #clock-cells = <0>;
+                       compatible = "fixed-clock";

arch/arm/boot/dts/sun8i-h3.dtsi line 134

Quoted 10 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +10 -0
+                       clock-frequency = <0>;
+                       clock-output-names = "pll5";
+               };
+
+               pll6: clk at 01c20028 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun6i-a31-pll6-clk";
+                       reg = <0x01c20028 0x4>;
+                       clocks = <&osc24M>;
+                       clock-output-names = "pll6", "pll6x2", "pll6d2";

What's the extra "pll6d2"? If you have an extra output, it's not compatible with "allwinner,sun6i-a31-pll6-clk".

Quoted 29 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +29 -0
+               };
+
+               pll8: clk at 01c20044 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun6i-a31-pll6-clk";
+                       reg = <0x01c20044 0x4>;
+                       clocks = <&osc24M>;
+                       clock-output-names = "pll8", "pll8x2";
+               };
+
+               cpu: cpu_clk at 01c20050 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-a10-cpu-clk";
+                       reg = <0x01c20050 0x4>;
+                       clocks = <&osc32k>, <&osc24M>, <&pll1>, <&pll1>;
+                       clock-output-names = "cpu";
+               };
+
+               axi: axi_clk at 01c20050 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-a10-axi-clk";
+                       reg = <0x01c20050 0x4>;
+                       clocks = <&cpu>;
+                       clock-output-names = "axi";
+               };
+
+               ahb1: ahb1_clk at 01c20054 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun6i-a31-ahb1-clk";

arch/arm/boot/dts/sun8i-h3.dtsi line 173

Quoted 10 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +10 -0
+                       reg = <0x01c20054 0x4>;
+                       clocks = <&osc32k>, <&osc24M>, <&axi>, <&pll6 0>;
+                       clock-output-names = "ahb1";
+               };
+
+               ahb2: ahb2_clk at 01c2005c {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun8i-h3-ahb2-clk";
+                       reg = <0x01c2005c 0x4>;
+                       clocks = <&ahb1>, <&pll6 2>;

And this would be wrong if you don't update the pll6 compatible or driver. There's no output on n = 2.

You could also chain a fixed divider directly in the driver.

Quoted 40 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +40 -0
+                       clock-output-names = "ahb2";
+               };
+
+               apb1: apb1_clk at 01c20054 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-a10-apb0-clk";
+                       reg = <0x01c20054 0x4>;
+                       clocks = <&ahb1>;
+                       clock-output-names = "apb1";
+               };
+
+               apb2: apb2_clk at 01c20058 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-a10-apb1-clk";
+                       reg = <0x01c20058 0x4>;
+                       clocks = <&osc32k>, <&osc24M>, <&pll6 0>, <&pll6 0>;
+                       clock-output-names = "apb2";
+               };
+
+               bus_gates: clk at 01c20060 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun8i-h3-bus-gates-clk";
+                       reg = <0x01c20060 0x14>;
+                       clocks = <&ahb1>, <&ahb2>, <&apb1>, <&apb2>;
+                       clock-names = "ahb1", "ahb2", "apb1", "apb2";
+                       clock-indices = <5>, <6>, <8>,
+                                       <9>, <10>, <13>,
+                                       <14>, <17>, <18>,
+                                       <19>, <20>,
+                                       <21>, <23>,
+                                       <24>, <25>,
+                                       <26>, <27>,
+                                       <28>, <29>,
+                                       <30>, <31>, <32>,
+                                       <35>, <36>, <37>,
+                                       <40>, <41>, <43>,
+                                       <44>, <52>, <53>,
+                                       <54>, <64>,
+                                       <65>, <69>, <72>,
+                                       <76>, <77>, <78>,

arch/arm/boot/dts/sun8i-h3.dtsi line 223

Quoted 10 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +10 -0
+                                       <96>, <97>, <98>,
+                                       <112>, <113>,
+                                       <114>, <115>, <116>,
+                                       <128>, <135>;
+                       clock-output-names = "ahb1_ce", "ahb1_dma", "ahb1_mmc0",
+                                       "ahb1_mmc1", "ahb1_mmc2", "ahb1_nand",
+                                       "ahb1_sdram", "ahb2_gmac", "ahb1_ts",
+                                       "ahb1_hstimer", "ahb1_spi0",
+                                       "ahb1_spi1", "ahb1_otg",
+                                       "ahb1_otg_ehci0", "ahb1_ehic1",

ahb1_ehci1? Same for the following 3 lines.

arch/arm/boot/dts/sun8i-h3.dtsi line 236

Quoted 13 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +13 -0
+                                       "ahb1_ehic2", "ahb1_ehic3",
+                                       "ahb1_otg_ohci0", "ahb2_ohic1",
+                                       "ahb2_ohic2", "ahb2_ohic3", "ahb1_ve",
+                                       "ahb1_lcd0", "ahb1_lcd1", "ahb1_deint",
+                                       "ahb1_csi", "ahb1_tve", "ahb1_hdmi",
+                                       "ahb1_de", "ahb1_gpu", "ahb1_msgbox",
+                                       "ahb1_spinlock", "apb1_codec",
+                                       "apb1_spdif", "apb1_pio", "apb1_ths",
+                                       "apb1_i2s0", "apb1_i2s1", "apb1_i2s2",
+                                       "apb2_i2c0", "apb2_i2c1", "apb2_i2c2",
+                                       "apb2_uart0", "apb2_uart1",
+                                       "apb2_uart2", "apb2_uart3", "apb2_scr",
+                                       "ahb1_ephy", "ahb1_dbg";

If it weren't for the last 2 clocks, we could cleanly split out apb1 and apb2 gates. Having a separate AHB clock gate taking 2 addresses seems messy as well. :(

Quoted 135 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +135 -0
+               };
+
+               mmc0_clk: clk at 01c20088 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun4i-a10-mmc-clk";
+                       reg = <0x01c20088 0x4>;
+                       clocks = <&osc24M>, <&pll6 0>, <&pll8 0>;
+                       clock-output-names = "mmc0",
+                                            "mmc0_output",
+                                            "mmc0_sample";
+               };
+
+               mmc1_clk: clk at 01c2008c {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun4i-a10-mmc-clk";
+                       reg = <0x01c2008c 0x4>;
+                       clocks = <&osc24M>, <&pll6 0>, <&pll8 0>;
+                       clock-output-names = "mmc1",
+                                            "mmc1_output",
+                                            "mmc1_sample";
+               };
+
+               mmc2_clk: clk at 01c20090 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun4i-a10-mmc-clk";
+                       reg = <0x01c20090 0x4>;
+                       clocks = <&osc24M>, <&pll6 0>, <&pll8 0>;
+                       clock-output-names = "mmc2",
+                                            "mmc2_output",
+                                            "mmc2_sample";
+               };
+
+               mbus_clk: clk at 01c2015c {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun8i-a23-mbus-clk";
+                       reg = <0x01c2015c 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5>;
+                       clock-output-names = "mbus";
+               };
+       };
+
+       soc {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+
+               dma: dma-controller at 01c02000 {
+                       compatible = "allwinner,sun8i-h3-dma";
+                       reg = <0x01c02000 0x1000>;
+                       interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&bus_gates 6>;
+                       resets = <&bus_rst 6>;
+                       #dma-cells = <1>;
+               };
+
+               mmc0: mmc at 01c0f000 {
+                       compatible = "allwinner,sun5i-a13-mmc";
+                       reg = <0x01c0f000 0x1000>;
+                       clocks = <&bus_gates 8>,
+                                <&mmc0_clk 0>,
+                                <&mmc0_clk 1>,
+                                <&mmc0_clk 2>;
+                       clock-names = "ahb",
+                                     "mmc",
+                                     "output",
+                                     "sample";
+                       resets = <&bus_rst 8>;
+                       reset-names = "ahb";
+                       interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+
+               mmc1: mmc at 01c10000 {
+                       compatible = "allwinner,sun5i-a13-mmc";
+                       reg = <0x01c10000 0x1000>;
+                       clocks = <&bus_gates 9>,
+                                <&mmc1_clk 0>,
+                                <&mmc1_clk 1>,
+                                <&mmc1_clk 2>;
+                       clock-names = "ahb",
+                                     "mmc",
+                                     "output",
+                                     "sample";
+                       resets = <&bus_rst 9>;
+                       reset-names = "ahb";
+                       interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+
+               mmc2: mmc at 01c11000 {
+                       compatible = "allwinner,sun5i-a13-mmc";
+                       reg = <0x01c11000 0x1000>;
+                       clocks = <&bus_gates 10>,
+                                <&mmc2_clk 0>,
+                                <&mmc2_clk 1>,
+                                <&mmc2_clk 2>;
+                       clock-names = "ahb",
+                                     "mmc",
+                                     "output",
+                                     "sample";
+                       resets = <&bus_rst 10>;
+                       reset-names = "ahb";
+                       interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+
+               pio: pinctrl at 01c20800 {
+                       compatible = "allwinner,sun8i-h3-pinctrl";
+                       reg = <0x01c20800 0x400>;
+                       interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&bus_gates 69>;
+                       gpio-controller;
+                       #gpio-cells = <3>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+
+                       uart0_pins_a: uart0 at 0 {
+                               allwinner,pins = "PA4", "PA5";
+                               allwinner,function = "uart0";
+                               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+                       };
+
+                       mmc0_pins_a: mmc0 at 0 {
+                               allwinner,pins = "PF0", "PF1", "PF2", "PF3",
+                                                "PF4", "PF5";
+                               allwinner,function = "mmc0";

arch/arm/boot/dts/sun8i-h3.dtsi line 381

Quoted 10 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +10 -0
+                               allwinner,drive = <SUN4I_PINCTRL_30_MA>;
+                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+                       };
+
+                       mmc0_cd_pin: mmc0_cd_pin at 0 {
+                               allwinner,pins = "PF6";
+                               allwinner,function = "gpio_in";
+                               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+                               allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
+                       };

This should be in the board DTS, unless this is the reference design, in which case you should name the label like "mmc0_cd_pin_reference_design".

Quoted 28 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +28 -0
+
+                       mmc1_pins_a: mmc1 at 0 {
+                               allwinner,pins = "PG0", "PG1", "PG2", "PG3",
+                                                "PG4", "PG5";
+                               allwinner,function = "mmc1";
+                               allwinner,drive = <SUN4I_PINCTRL_30_MA>;
+                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+                       };
+               };
+
+               bus_rst: reset at 01c202c0 {
+                       #reset-cells = <1>;
+                       compatible = "allwinner,sun8i-h3-bus-reset";
+                       reg = <0x01c202c0 0x1c>;
+               };
+
+               timer at 01c20c00 {
+                       compatible = "allwinner,sun4i-a10-timer";
+                       reg = <0x01c20c00 0xa0>;
+                       interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&osc24M>;
+               };
+
+               wdt0: watchdog at 01c20ca0 {
+                       compatible = "allwinner,sun6i-a31-wdt";
+                       reg = <0x01c20ca0 0x20>;
+                       interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>;

arch/arm/boot/dts/sun8i-h3.dtsi line 419

Quoted 10 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +10 -0
+               };
+
+               uart0: serial at 01c28000 {
+                       compatible = "snps,dw-apb-uart";
+                       reg = <0x01c28000 0x400>;
+                       interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
+                       reg-shift = <2>;
+                       reg-io-width = <4>;
+                       clocks = <&bus_gates 112>;
+                       resets = <&bus_rst 144>;

Aren't you handling the holes in the bus_rst driver? If so, isn't it supposed to align both bus_gates and bus_rst indexes?

Same for the other UARTs.

Thanks

Regards
ChenYu

Quoted 66 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +63 -1
+                       dmas = <&dma 6>, <&dma 6>;
+                       dma-names = "rx", "tx";
+                       status = "disabled";
+               };
+
+               uart1: serial at 01c28400 {
+                       compatible = "snps,dw-apb-uart";
+                       reg = <0x01c28400 0x400>;
+                       interrupts = <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>;
+                       reg-shift = <2>;
+                       reg-io-width = <4>;
+                       clocks = <&bus_gates 113>;
+                       resets = <&bus_rst 145>;
+                       dmas = <&dma 7>, <&dma 7>;
+                       dma-names = "rx", "tx";
+                       status = "disabled";
+               };
+
+               uart2: serial at 01c28800 {
+                       compatible = "snps,dw-apb-uart";
+                       reg = <0x01c28800 0x400>;
+                       interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
+                       reg-shift = <2>;
+                       reg-io-width = <4>;
+                       clocks = <&bus_gates 114>;
+                       resets = <&bus_rst 146>;
+                       dmas = <&dma 8>, <&dma 8>;
+                       dma-names = "rx", "tx";
+                       status = "disabled";
+               };
+
+               uart3: serial at 01c28c00 {
+                       compatible = "snps,dw-apb-uart";
+                       reg = <0x01c28c00 0x400>;
+                       interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
+                       reg-shift = <2>;
+                       reg-io-width = <4>;
+                       clocks = <&bus_gates 115>;
+                       resets = <&bus_rst 147>;
+                       dmas = <&dma 9>, <&dma 9>;
+                       dma-names = "rx", "tx";
+                       status = "disabled";
+               };
+
+               gic: interrupt-controller at 01c81000 {
+                       compatible = "arm,cortex-a7-gic", "arm,cortex-a15-gic";
+                       reg = <0x01c81000 0x1000>,
+                             <0x01c82000 0x1000>,
+                             <0x01c84000 0x2000>,
+                             <0x01c86000 0x2000>;
+                       interrupt-controller;
+                       #interrupt-cells = <3>;
+                       interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
+               };
+
+               rtc: rtc at 01f00000 {
+                       compatible = "allwinner,sun6i-a31-rtc";
+                       reg = <0x01f00000 0x54>;
+                       interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
+               };
+       };
+};
--

2.6.2

#28 lore raw

Re: [PATCH v4 5/6] ARM: dts: sunxi: Add Allwinner H3 DTSI

Hi,

Quoted 9 lines · Chen-Yu Tsai

arch/arm/boot/dts/sun8i-h3.dtsi line 134

Quoted 6 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +6 -0
+               pll6: clk at 01c20028 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun6i-a31-pll6-clk";
+                       reg = <0x01c20028 0x4>;
+                       clocks = <&osc24M>;
+                       clock-output-names = "pll6", "pll6x2", "pll6d2";

What's the extra "pll6d2"? If you have an extra output, it's not compatible with "allwinner,sun6i-a31-pll6-clk".

[...]

Quoted 11 lines

arch/arm/boot/dts/sun8i-h3.dtsi line 173

Quoted 6 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +6 -0
+
+               ahb2: ahb2_clk at 01c2005c {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun8i-h3-ahb2-clk";
+                       reg = <0x01c2005c 0x4>;
+                       clocks = <&ahb1>, <&pll6 2>;

And this would be wrong if you don't update the pll6 compatible or driver. There's no output on n = 2.

You could also chain a fixed divider directly in the driver.

Or in the DT directly.

I'd really like to move away from the various fixed dividers output that prevents to reuse the clock drivers when it's the only difference, like what's done here.

Quoted 263 lines
Quoted 41 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +40 -0
+                       clock-output-names = "ahb2";
+               };
+
+               apb1: apb1_clk at 01c20054 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-a10-apb0-clk";
+                       reg = <0x01c20054 0x4>;
+                       clocks = <&ahb1>;
+                       clock-output-names = "apb1";
+               };
+
+               apb2: apb2_clk at 01c20058 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-a10-apb1-clk";
+                       reg = <0x01c20058 0x4>;
+                       clocks = <&osc32k>, <&osc24M>, <&pll6 0>, <&pll6 0>;
+                       clock-output-names = "apb2";
+               };
+
+               bus_gates: clk at 01c20060 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun8i-h3-bus-gates-clk";
+                       reg = <0x01c20060 0x14>;
+                       clocks = <&ahb1>, <&ahb2>, <&apb1>, <&apb2>;
+                       clock-names = "ahb1", "ahb2", "apb1", "apb2";
+                       clock-indices = <5>, <6>, <8>,
+                                       <9>, <10>, <13>,
+                                       <14>, <17>, <18>,
+                                       <19>, <20>,
+                                       <21>, <23>,
+                                       <24>, <25>,
+                                       <26>, <27>,
+                                       <28>, <29>,
+                                       <30>, <31>, <32>,
+                                       <35>, <36>, <37>,
+                                       <40>, <41>, <43>,
+                                       <44>, <52>, <53>,
+                                       <54>, <64>,
+                                       <65>, <69>, <72>,
+                                       <76>, <77>, <78>,

arch/arm/boot/dts/sun8i-h3.dtsi line 223

Quoted 10 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +10 -0
+                                       <96>, <97>, <98>,
+                                       <112>, <113>,
+                                       <114>, <115>, <116>,
+                                       <128>, <135>;
+                       clock-output-names = "ahb1_ce", "ahb1_dma", "ahb1_mmc0",
+                                       "ahb1_mmc1", "ahb1_mmc2", "ahb1_nand",
+                                       "ahb1_sdram", "ahb2_gmac", "ahb1_ts",
+                                       "ahb1_hstimer", "ahb1_spi0",
+                                       "ahb1_spi1", "ahb1_otg",
+                                       "ahb1_otg_ehci0", "ahb1_ehic1",

ahb1_ehci1? Same for the following 3 lines.

arch/arm/boot/dts/sun8i-h3.dtsi line 236

Quoted 13 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +13 -0
+                                       "ahb1_ehic2", "ahb1_ehic3",
+                                       "ahb1_otg_ohci0", "ahb2_ohic1",
+                                       "ahb2_ohic2", "ahb2_ohic3", "ahb1_ve",
+                                       "ahb1_lcd0", "ahb1_lcd1", "ahb1_deint",
+                                       "ahb1_csi", "ahb1_tve", "ahb1_hdmi",
+                                       "ahb1_de", "ahb1_gpu", "ahb1_msgbox",
+                                       "ahb1_spinlock", "apb1_codec",
+                                       "apb1_spdif", "apb1_pio", "apb1_ths",
+                                       "apb1_i2s0", "apb1_i2s1", "apb1_i2s2",
+                                       "apb2_i2c0", "apb2_i2c1", "apb2_i2c2",
+                                       "apb2_uart0", "apb2_uart1",
+                                       "apb2_uart2", "apb2_uart3", "apb2_scr",
+                                       "ahb1_ephy", "ahb1_dbg";

If it weren't for the last 2 clocks, we could cleanly split out apb1 and apb2 gates. Having a separate AHB clock gate taking 2 addresses seems messy as well. :(

Quoted 135 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +135 -0
+               };
+
+               mmc0_clk: clk at 01c20088 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun4i-a10-mmc-clk";
+                       reg = <0x01c20088 0x4>;
+                       clocks = <&osc24M>, <&pll6 0>, <&pll8 0>;
+                       clock-output-names = "mmc0",
+                                            "mmc0_output",
+                                            "mmc0_sample";
+               };
+
+               mmc1_clk: clk at 01c2008c {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun4i-a10-mmc-clk";
+                       reg = <0x01c2008c 0x4>;
+                       clocks = <&osc24M>, <&pll6 0>, <&pll8 0>;
+                       clock-output-names = "mmc1",
+                                            "mmc1_output",
+                                            "mmc1_sample";
+               };
+
+               mmc2_clk: clk at 01c20090 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun4i-a10-mmc-clk";
+                       reg = <0x01c20090 0x4>;
+                       clocks = <&osc24M>, <&pll6 0>, <&pll8 0>;
+                       clock-output-names = "mmc2",
+                                            "mmc2_output",
+                                            "mmc2_sample";
+               };
+
+               mbus_clk: clk at 01c2015c {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun8i-a23-mbus-clk";
+                       reg = <0x01c2015c 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5>;
+                       clock-output-names = "mbus";
+               };
+       };
+
+       soc {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+
+               dma: dma-controller at 01c02000 {
+                       compatible = "allwinner,sun8i-h3-dma";
+                       reg = <0x01c02000 0x1000>;
+                       interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&bus_gates 6>;
+                       resets = <&bus_rst 6>;
+                       #dma-cells = <1>;
+               };
+
+               mmc0: mmc at 01c0f000 {
+                       compatible = "allwinner,sun5i-a13-mmc";
+                       reg = <0x01c0f000 0x1000>;
+                       clocks = <&bus_gates 8>,
+                                <&mmc0_clk 0>,
+                                <&mmc0_clk 1>,
+                                <&mmc0_clk 2>;
+                       clock-names = "ahb",
+                                     "mmc",
+                                     "output",
+                                     "sample";
+                       resets = <&bus_rst 8>;
+                       reset-names = "ahb";
+                       interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+
+               mmc1: mmc at 01c10000 {
+                       compatible = "allwinner,sun5i-a13-mmc";
+                       reg = <0x01c10000 0x1000>;
+                       clocks = <&bus_gates 9>,
+                                <&mmc1_clk 0>,
+                                <&mmc1_clk 1>,
+                                <&mmc1_clk 2>;
+                       clock-names = "ahb",
+                                     "mmc",
+                                     "output",
+                                     "sample";
+                       resets = <&bus_rst 9>;
+                       reset-names = "ahb";
+                       interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+
+               mmc2: mmc at 01c11000 {
+                       compatible = "allwinner,sun5i-a13-mmc";
+                       reg = <0x01c11000 0x1000>;
+                       clocks = <&bus_gates 10>,
+                                <&mmc2_clk 0>,
+                                <&mmc2_clk 1>,
+                                <&mmc2_clk 2>;
+                       clock-names = "ahb",
+                                     "mmc",
+                                     "output",
+                                     "sample";
+                       resets = <&bus_rst 10>;
+                       reset-names = "ahb";
+                       interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+
+               pio: pinctrl at 01c20800 {
+                       compatible = "allwinner,sun8i-h3-pinctrl";
+                       reg = <0x01c20800 0x400>;
+                       interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&bus_gates 69>;
+                       gpio-controller;
+                       #gpio-cells = <3>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+
+                       uart0_pins_a: uart0 at 0 {
+                               allwinner,pins = "PA4", "PA5";
+                               allwinner,function = "uart0";
+                               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+                       };
+
+                       mmc0_pins_a: mmc0 at 0 {
+                               allwinner,pins = "PF0", "PF1", "PF2", "PF3",
+                                                "PF4", "PF5";
+                               allwinner,function = "mmc0";

arch/arm/boot/dts/sun8i-h3.dtsi line 381

Quoted 10 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +10 -0
+                               allwinner,drive = <SUN4I_PINCTRL_30_MA>;
+                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+                       };
+
+                       mmc0_cd_pin: mmc0_cd_pin at 0 {
+                               allwinner,pins = "PF6";
+                               allwinner,function = "gpio_in";
+                               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+                               allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
+                       };

This should be in the board DTS, unless this is the reference design, in which case you should name the label like "mmc0_cd_pin_reference_design".

Quoted 28 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +28 -0
+
+                       mmc1_pins_a: mmc1 at 0 {
+                               allwinner,pins = "PG0", "PG1", "PG2", "PG3",
+                                                "PG4", "PG5";
+                               allwinner,function = "mmc1";
+                               allwinner,drive = <SUN4I_PINCTRL_30_MA>;
+                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+                       };
+               };
+
+               bus_rst: reset at 01c202c0 {
+                       #reset-cells = <1>;
+                       compatible = "allwinner,sun8i-h3-bus-reset";
+                       reg = <0x01c202c0 0x1c>;
+               };
+
+               timer at 01c20c00 {
+                       compatible = "allwinner,sun4i-a10-timer";
+                       reg = <0x01c20c00 0xa0>;
+                       interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&osc24M>;
+               };
+
+               wdt0: watchdog at 01c20ca0 {
+                       compatible = "allwinner,sun6i-a31-wdt";
+                       reg = <0x01c20ca0 0x20>;
+                       interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>;

arch/arm/boot/dts/sun8i-h3.dtsi line 419

Quoted 10 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +10 -0
+               };
+
+               uart0: serial at 01c28000 {
+                       compatible = "snps,dw-apb-uart";
+                       reg = <0x01c28000 0x400>;
+                       interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
+                       reg-shift = <2>;
+                       reg-io-width = <4>;
+                       clocks = <&bus_gates 112>;
+                       resets = <&bus_rst 144>;

Aren't you handling the holes in the bus_rst driver? If so, isn't it supposed to align both bus_gates and bus_rst indexes?

Quoted 1 line

Same for the other UARTs.

Not really, the last reset registers don't have the same organization than the bus clocks :/

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151101/8c48e0ad/attachment.sig>
author
#29 lore raw

Re: [PATCH v4 5/6] ARM: dts: sunxi: Add Allwinner H3 DTSI

In reply to Chen-Yu Tsai

Hi,

Quoted 245 lines · Chen-Yu Tsai

Hi,

Quoted 139 lines · Jens Kuske

The Allwinner H3 is a home entertainment system oriented SoC with four Cortex-A7 cores and a Mali-400MP2 GPU.

---
 arch/arm/boot/dts/sun8i-h3.dtsi | 482 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 482 insertions(+)
 create mode 100644 arch/arm/boot/dts/sun8i-h3.dtsi
arch/arm/boot/dts/sun8i-h3.dtsi new file +124 -0
new file mode 100644
index 0000000..c18b5f7
@@ -0,0 +1,482 @@
+/*
+ * Copyright (C) 2015 Jens Kuske <[email protected]>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This file is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#include "skeleton.dtsi"
+
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/pinctrl/sun4i-a10.h>
+
+/ {
+       interrupt-parent = <&gic>;
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               cpu at 0 {
+                       compatible = "arm,cortex-a7";
+                       device_type = "cpu";
+                       reg = <0>;
+               };
+
+               cpu at 1 {
+                       compatible = "arm,cortex-a7";
+                       device_type = "cpu";
+                       reg = <1>;
+               };
+
+               cpu at 2 {
+                       compatible = "arm,cortex-a7";
+                       device_type = "cpu";
+                       reg = <2>;
+               };
+
+               cpu at 3 {
+                       compatible = "arm,cortex-a7";
+                       device_type = "cpu";
+                       reg = <3>;
+               };
+       };
+
+       timer {
+               compatible = "arm,armv7-timer";
+               interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+                            <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+                            <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+                            <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
+               clock-frequency = <24000000>;
+               arm,cpu-registers-not-fw-configured;
+       };
+
+       memory {
+               reg = <0x40000000 0x80000000>;
+       };
+
+       clocks {
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+
+               osc24M: osc24M_clk {
+                       #clock-cells = <0>;
+                       compatible = "fixed-clock";
+                       clock-frequency = <24000000>;
+                       clock-output-names = "osc24M";
+               };
+
+               osc32k: osc32k_clk {
+                       #clock-cells = <0>;
+                       compatible = "fixed-clock";
+                       clock-frequency = <32768>;
+                       clock-output-names = "osc32k";
+               };
+
+               pll1: clk at 01c20000 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun8i-a23-pll1-clk";
+                       reg = <0x01c20000 0x4>;
+                       clocks = <&osc24M>;
+                       clock-output-names = "pll1";
+               };
+
+               /* dummy clock until actually implemented */
+               pll5: pll5_clk {
+                       #clock-cells = <0>;
+                       compatible = "fixed-clock";

arch/arm/boot/dts/sun8i-h3.dtsi line 134

Quoted 10 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +10 -0
+                       clock-frequency = <0>;
+                       clock-output-names = "pll5";
+               };
+
+               pll6: clk at 01c20028 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun6i-a31-pll6-clk";
+                       reg = <0x01c20028 0x4>;
+                       clocks = <&osc24M>;
+                       clock-output-names = "pll6", "pll6x2", "pll6d2";

What's the extra "pll6d2"? If you have an extra output, it's not compatible with "allwinner,sun6i-a31-pll6-clk".

Quoted 29 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +29 -0
+               };
+
+               pll8: clk at 01c20044 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun6i-a31-pll6-clk";
+                       reg = <0x01c20044 0x4>;
+                       clocks = <&osc24M>;
+                       clock-output-names = "pll8", "pll8x2";
+               };
+
+               cpu: cpu_clk at 01c20050 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-a10-cpu-clk";
+                       reg = <0x01c20050 0x4>;
+                       clocks = <&osc32k>, <&osc24M>, <&pll1>, <&pll1>;
+                       clock-output-names = "cpu";
+               };
+
+               axi: axi_clk at 01c20050 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-a10-axi-clk";
+                       reg = <0x01c20050 0x4>;
+                       clocks = <&cpu>;
+                       clock-output-names = "axi";
+               };
+
+               ahb1: ahb1_clk at 01c20054 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun6i-a31-ahb1-clk";

arch/arm/boot/dts/sun8i-h3.dtsi line 173

Quoted 10 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +10 -0
+                       reg = <0x01c20054 0x4>;
+                       clocks = <&osc32k>, <&osc24M>, <&axi>, <&pll6 0>;
+                       clock-output-names = "ahb1";
+               };
+
+               ahb2: ahb2_clk at 01c2005c {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun8i-h3-ahb2-clk";
+                       reg = <0x01c2005c 0x4>;
+                       clocks = <&ahb1>, <&pll6 2>;

And this would be wrong if you don't update the pll6 compatible or driver. There's no output on n = 2.

You could also chain a fixed divider directly in the driver.

Quoted 44 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +44 -0
+                       clock-output-names = "ahb2";
+               };
+
+               apb1: apb1_clk at 01c20054 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-a10-apb0-clk";
+                       reg = <0x01c20054 0x4>;
+                       clocks = <&ahb1>;
+                       clock-output-names = "apb1";
+               };
+
+               apb2: apb2_clk at 01c20058 {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun4i-a10-apb1-clk";
+                       reg = <0x01c20058 0x4>;
+                       clocks = <&osc32k>, <&osc24M>, <&pll6 0>, <&pll6 0>;
+                       clock-output-names = "apb2";
+               };
+
+               bus_gates: clk at 01c20060 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun8i-h3-bus-gates-clk";
+                       reg = <0x01c20060 0x14>;
+                       clocks = <&ahb1>, <&ahb2>, <&apb1>, <&apb2>;
+                       clock-names = "ahb1", "ahb2", "apb1", "apb2";
+                       clock-indices = <5>, <6>, <8>,
+                                       <9>, <10>, <13>,
+                                       <14>, <17>, <18>,
+                                       <19>, <20>,
+                                       <21>, <23>,
+                                       <24>, <25>,
+                                       <26>, <27>,
+                                       <28>, <29>,
+                                       <30>, <31>, <32>,
+                                       <35>, <36>, <37>,
+                                       <40>, <41>, <43>,
+                                       <44>, <52>, <53>,
+                                       <54>, <64>,
+                                       <65>, <69>, <72>,
+                                       <76>, <77>, <78>,
+                                       <96>, <97>, <98>,
+                                       <112>, <113>,
+                                       <114>, <115>, <116>,
+                                       <128>, <135>;
Quoted 8 lines

arch/arm/boot/dts/sun8i-h3.dtsi line 223

Quoted 6 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +6 -0
+                       clock-output-names = "ahb1_ce", "ahb1_dma", "ahb1_mmc0",
+                                       "ahb1_mmc1", "ahb1_mmc2", "ahb1_nand",
+                                       "ahb1_sdram", "ahb2_gmac", "ahb1_ts",
+                                       "ahb1_hstimer", "ahb1_spi0",
+                                       "ahb1_spi1", "ahb1_otg",
+                                       "ahb1_otg_ehci0", "ahb1_ehic1",

ahb1_ehci1? Same for the following 3 lines.

I'll fix them...

Quoted 15 lines
Quoted 4 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +3 -0
+                                       "ahb1_ehic2", "ahb1_ehic3",
+                                       "ahb1_otg_ohci0", "ahb2_ohic1",
+                                       "ahb2_ohic2", "ahb2_ohic3", "ahb1_ve",

arch/arm/boot/dts/sun8i-h3.dtsi line 236

Quoted 10 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +10 -0
+                                       "ahb1_lcd0", "ahb1_lcd1", "ahb1_deint",
+                                       "ahb1_csi", "ahb1_tve", "ahb1_hdmi",
+                                       "ahb1_de", "ahb1_gpu", "ahb1_msgbox",
+                                       "ahb1_spinlock", "apb1_codec",
+                                       "apb1_spdif", "apb1_pio", "apb1_ths",
+                                       "apb1_i2s0", "apb1_i2s1", "apb1_i2s2",
+                                       "apb2_i2c0", "apb2_i2c1", "apb2_i2c2",
+                                       "apb2_uart0", "apb2_uart1",
+                                       "apb2_uart2", "apb2_uart3", "apb2_scr",
+                                       "ahb1_ephy", "ahb1_dbg";
Quoted 3 lines

If it weren't for the last 2 clocks, we could cleanly split out apb1 and apb2 gates. Having a separate AHB clock gate taking 2 addresses seems messy as well. :(

Well, maybe we still should do that, if we split the resets too at least apb[12] would line up again.

I don't know what to do with these bus things any more, all variants I sent had issues somewhere...

Quoted 141 lines
Quoted 141 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +140 -0
+               };
+
+               mmc0_clk: clk at 01c20088 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun4i-a10-mmc-clk";
+                       reg = <0x01c20088 0x4>;
+                       clocks = <&osc24M>, <&pll6 0>, <&pll8 0>;
+                       clock-output-names = "mmc0",
+                                            "mmc0_output",
+                                            "mmc0_sample";
+               };
+
+               mmc1_clk: clk at 01c2008c {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun4i-a10-mmc-clk";
+                       reg = <0x01c2008c 0x4>;
+                       clocks = <&osc24M>, <&pll6 0>, <&pll8 0>;
+                       clock-output-names = "mmc1",
+                                            "mmc1_output",
+                                            "mmc1_sample";
+               };
+
+               mmc2_clk: clk at 01c20090 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun4i-a10-mmc-clk";
+                       reg = <0x01c20090 0x4>;
+                       clocks = <&osc24M>, <&pll6 0>, <&pll8 0>;
+                       clock-output-names = "mmc2",
+                                            "mmc2_output",
+                                            "mmc2_sample";
+               };
+
+               mbus_clk: clk at 01c2015c {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun8i-a23-mbus-clk";
+                       reg = <0x01c2015c 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5>;
+                       clock-output-names = "mbus";
+               };
+       };
+
+       soc {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+
+               dma: dma-controller at 01c02000 {
+                       compatible = "allwinner,sun8i-h3-dma";
+                       reg = <0x01c02000 0x1000>;
+                       interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&bus_gates 6>;
+                       resets = <&bus_rst 6>;
+                       #dma-cells = <1>;
+               };
+
+               mmc0: mmc at 01c0f000 {
+                       compatible = "allwinner,sun5i-a13-mmc";
+                       reg = <0x01c0f000 0x1000>;
+                       clocks = <&bus_gates 8>,
+                                <&mmc0_clk 0>,
+                                <&mmc0_clk 1>,
+                                <&mmc0_clk 2>;
+                       clock-names = "ahb",
+                                     "mmc",
+                                     "output",
+                                     "sample";
+                       resets = <&bus_rst 8>;
+                       reset-names = "ahb";
+                       interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+
+               mmc1: mmc at 01c10000 {
+                       compatible = "allwinner,sun5i-a13-mmc";
+                       reg = <0x01c10000 0x1000>;
+                       clocks = <&bus_gates 9>,
+                                <&mmc1_clk 0>,
+                                <&mmc1_clk 1>,
+                                <&mmc1_clk 2>;
+                       clock-names = "ahb",
+                                     "mmc",
+                                     "output",
+                                     "sample";
+                       resets = <&bus_rst 9>;
+                       reset-names = "ahb";
+                       interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+
+               mmc2: mmc at 01c11000 {
+                       compatible = "allwinner,sun5i-a13-mmc";
+                       reg = <0x01c11000 0x1000>;
+                       clocks = <&bus_gates 10>,
+                                <&mmc2_clk 0>,
+                                <&mmc2_clk 1>,
+                                <&mmc2_clk 2>;
+                       clock-names = "ahb",
+                                     "mmc",
+                                     "output",
+                                     "sample";
+                       resets = <&bus_rst 10>;
+                       reset-names = "ahb";
+                       interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+
+               pio: pinctrl at 01c20800 {
+                       compatible = "allwinner,sun8i-h3-pinctrl";
+                       reg = <0x01c20800 0x400>;
+                       interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&bus_gates 69>;
+                       gpio-controller;
+                       #gpio-cells = <3>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+
+                       uart0_pins_a: uart0 at 0 {
+                               allwinner,pins = "PA4", "PA5";
+                               allwinner,function = "uart0";
+                               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+                       };
+
+                       mmc0_pins_a: mmc0 at 0 {
+                               allwinner,pins = "PF0", "PF1", "PF2", "PF3",
+                                                "PF4", "PF5";
+                               allwinner,function = "mmc0";
+                               allwinner,drive = <SUN4I_PINCTRL_30_MA>;
+                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+                       };
+
+                       mmc0_cd_pin: mmc0_cd_pin at 0 {
Quoted 9 lines

arch/arm/boot/dts/sun8i-h3.dtsi line 381

Quoted 5 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +5 -0
+                               allwinner,pins = "PF6";
+                               allwinner,function = "gpio_in";
+                               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+                               allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
+                       };

This should be in the board DTS, unless this is the reference design, in which case you should name the label like "mmc0_cd_pin_reference_design".

The datasheet mentions SDC0_DET function on PF6, so I thought this is sort of fixed to this pin now. All designs I've seen use this pin.

Jens

Quoted 116 lines
Quoted 28 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +28 -0
+
+                       mmc1_pins_a: mmc1 at 0 {
+                               allwinner,pins = "PG0", "PG1", "PG2", "PG3",
+                                                "PG4", "PG5";
+                               allwinner,function = "mmc1";
+                               allwinner,drive = <SUN4I_PINCTRL_30_MA>;
+                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+                       };
+               };
+
+               bus_rst: reset at 01c202c0 {
+                       #reset-cells = <1>;
+                       compatible = "allwinner,sun8i-h3-bus-reset";
+                       reg = <0x01c202c0 0x1c>;
+               };
+
+               timer at 01c20c00 {
+                       compatible = "allwinner,sun4i-a10-timer";
+                       reg = <0x01c20c00 0xa0>;
+                       interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&osc24M>;
+               };
+
+               wdt0: watchdog at 01c20ca0 {
+                       compatible = "allwinner,sun6i-a31-wdt";
+                       reg = <0x01c20ca0 0x20>;
+                       interrupts = <GIC_SPI 25 IRQ_TYPE_LEVEL_HIGH>;

arch/arm/boot/dts/sun8i-h3.dtsi line 419

Quoted 10 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +10 -0
+               };
+
+               uart0: serial at 01c28000 {
+                       compatible = "snps,dw-apb-uart";
+                       reg = <0x01c28000 0x400>;
+                       interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
+                       reg-shift = <2>;
+                       reg-io-width = <4>;
+                       clocks = <&bus_gates 112>;
+                       resets = <&bus_rst 144>;

Aren't you handling the holes in the bus_rst driver? If so, isn't it supposed to align both bus_gates and bus_rst indexes?

Same for the other UARTs.

Thanks

Regards
ChenYu

Quoted 66 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +63 -1
+                       dmas = <&dma 6>, <&dma 6>;
+                       dma-names = "rx", "tx";
+                       status = "disabled";
+               };
+
+               uart1: serial at 01c28400 {
+                       compatible = "snps,dw-apb-uart";
+                       reg = <0x01c28400 0x400>;
+                       interrupts = <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>;
+                       reg-shift = <2>;
+                       reg-io-width = <4>;
+                       clocks = <&bus_gates 113>;
+                       resets = <&bus_rst 145>;
+                       dmas = <&dma 7>, <&dma 7>;
+                       dma-names = "rx", "tx";
+                       status = "disabled";
+               };
+
+               uart2: serial at 01c28800 {
+                       compatible = "snps,dw-apb-uart";
+                       reg = <0x01c28800 0x400>;
+                       interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>;
+                       reg-shift = <2>;
+                       reg-io-width = <4>;
+                       clocks = <&bus_gates 114>;
+                       resets = <&bus_rst 146>;
+                       dmas = <&dma 8>, <&dma 8>;
+                       dma-names = "rx", "tx";
+                       status = "disabled";
+               };
+
+               uart3: serial at 01c28c00 {
+                       compatible = "snps,dw-apb-uart";
+                       reg = <0x01c28c00 0x400>;
+                       interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
+                       reg-shift = <2>;
+                       reg-io-width = <4>;
+                       clocks = <&bus_gates 115>;
+                       resets = <&bus_rst 147>;
+                       dmas = <&dma 9>, <&dma 9>;
+                       dma-names = "rx", "tx";
+                       status = "disabled";
+               };
+
+               gic: interrupt-controller at 01c81000 {
+                       compatible = "arm,cortex-a7-gic", "arm,cortex-a15-gic";
+                       reg = <0x01c81000 0x1000>,
+                             <0x01c82000 0x1000>,
+                             <0x01c84000 0x2000>,
+                             <0x01c86000 0x2000>;
+                       interrupt-controller;
+                       #interrupt-cells = <3>;
+                       interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
+               };
+
+               rtc: rtc at 01f00000 {
+                       compatible = "allwinner,sun6i-a31-rtc";
+                       reg = <0x01f00000 0x54>;
+                       interrupts = <GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
+               };
+       };
+};
--

2.6.2

#30 lore raw

Re: [PATCH v4 5/6] ARM: dts: sunxi: Add Allwinner H3 DTSI

Hi,

Quoted 53 lines · Jens Kuske
Quoted 32 lines
Quoted 21 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +21 -0
+               bus_gates: clk at 01c20060 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun8i-h3-bus-gates-clk";
+                       reg = <0x01c20060 0x14>;
+                       clocks = <&ahb1>, <&ahb2>, <&apb1>, <&apb2>;
+                       clock-names = "ahb1", "ahb2", "apb1", "apb2";
+                       clock-indices = <5>, <6>, <8>,
+                                       <9>, <10>, <13>,
+                                       <14>, <17>, <18>,
+                                       <19>, <20>,
+                                       <21>, <23>,
+                                       <24>, <25>,
+                                       <26>, <27>,
+                                       <28>, <29>,
+                                       <30>, <31>, <32>,
+                                       <35>, <36>, <37>,
+                                       <40>, <41>, <43>,
+                                       <44>, <52>, <53>,
+                                       <54>, <64>,
+                                       <65>, <69>, <72>,
+                                       <76>, <77>, <78>,

arch/arm/boot/dts/sun8i-h3.dtsi line 223

Quoted 10 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +10 -0
+                                       <96>, <97>, <98>,
+                                       <112>, <113>,
+                                       <114>, <115>, <116>,
+                                       <128>, <135>;
+                       clock-output-names = "ahb1_ce", "ahb1_dma", "ahb1_mmc0",
+                                       "ahb1_mmc1", "ahb1_mmc2", "ahb1_nand",
+                                       "ahb1_sdram", "ahb2_gmac", "ahb1_ts",
+                                       "ahb1_hstimer", "ahb1_spi0",
+                                       "ahb1_spi1", "ahb1_otg",
+                                       "ahb1_otg_ehci0", "ahb1_ehic1",
Quoted 1 line

ahb1_ehci1? Same for the following 3 lines.

I'll fix them...

Quoted 15 lines
Quoted 4 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +3 -0
+                                       "ahb1_ehic2", "ahb1_ehic3",
+                                       "ahb1_otg_ohci0", "ahb2_ohic1",
+                                       "ahb2_ohic2", "ahb2_ohic3", "ahb1_ve",

arch/arm/boot/dts/sun8i-h3.dtsi line 236

Quoted 10 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +10 -0
+                                       "ahb1_lcd0", "ahb1_lcd1", "ahb1_deint",
+                                       "ahb1_csi", "ahb1_tve", "ahb1_hdmi",
+                                       "ahb1_de", "ahb1_gpu", "ahb1_msgbox",
+                                       "ahb1_spinlock", "apb1_codec",
+                                       "apb1_spdif", "apb1_pio", "apb1_ths",
+                                       "apb1_i2s0", "apb1_i2s1", "apb1_i2s2",
+                                       "apb2_i2c0", "apb2_i2c1", "apb2_i2c2",
+                                       "apb2_uart0", "apb2_uart1",
+                                       "apb2_uart2", "apb2_uart3", "apb2_scr",
+                                       "ahb1_ephy", "ahb1_dbg";
Quoted 3 lines

If it weren't for the last 2 clocks, we could cleanly split out apb1 and apb2 gates. Having a separate AHB clock gate taking 2 addresses seems messy as well. :(

Quoted 5 lines

Well, maybe we still should do that, if we split the resets too at least apb[12] would line up again.

I don't know what to do with these bus things any more, all variants I sent had issues somewhere...

AFAIK, Arnd had some objections, but he never got back to us when we explained how the hardware was laid out, so I don't know if they still apply.

Quoted 150 lines
Quoted 140 lines
Quoted 140 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +140 -0
+               };
+
+               mmc0_clk: clk at 01c20088 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun4i-a10-mmc-clk";
+                       reg = <0x01c20088 0x4>;
+                       clocks = <&osc24M>, <&pll6 0>, <&pll8 0>;
+                       clock-output-names = "mmc0",
+                                            "mmc0_output",
+                                            "mmc0_sample";
+               };
+
+               mmc1_clk: clk at 01c2008c {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun4i-a10-mmc-clk";
+                       reg = <0x01c2008c 0x4>;
+                       clocks = <&osc24M>, <&pll6 0>, <&pll8 0>;
+                       clock-output-names = "mmc1",
+                                            "mmc1_output",
+                                            "mmc1_sample";
+               };
+
+               mmc2_clk: clk at 01c20090 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun4i-a10-mmc-clk";
+                       reg = <0x01c20090 0x4>;
+                       clocks = <&osc24M>, <&pll6 0>, <&pll8 0>;
+                       clock-output-names = "mmc2",
+                                            "mmc2_output",
+                                            "mmc2_sample";
+               };
+
+               mbus_clk: clk at 01c2015c {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun8i-a23-mbus-clk";
+                       reg = <0x01c2015c 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5>;
+                       clock-output-names = "mbus";
+               };
+       };
+
+       soc {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+
+               dma: dma-controller at 01c02000 {
+                       compatible = "allwinner,sun8i-h3-dma";
+                       reg = <0x01c02000 0x1000>;
+                       interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&bus_gates 6>;
+                       resets = <&bus_rst 6>;
+                       #dma-cells = <1>;
+               };
+
+               mmc0: mmc at 01c0f000 {
+                       compatible = "allwinner,sun5i-a13-mmc";
+                       reg = <0x01c0f000 0x1000>;
+                       clocks = <&bus_gates 8>,
+                                <&mmc0_clk 0>,
+                                <&mmc0_clk 1>,
+                                <&mmc0_clk 2>;
+                       clock-names = "ahb",
+                                     "mmc",
+                                     "output",
+                                     "sample";
+                       resets = <&bus_rst 8>;
+                       reset-names = "ahb";
+                       interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+
+               mmc1: mmc at 01c10000 {
+                       compatible = "allwinner,sun5i-a13-mmc";
+                       reg = <0x01c10000 0x1000>;
+                       clocks = <&bus_gates 9>,
+                                <&mmc1_clk 0>,
+                                <&mmc1_clk 1>,
+                                <&mmc1_clk 2>;
+                       clock-names = "ahb",
+                                     "mmc",
+                                     "output",
+                                     "sample";
+                       resets = <&bus_rst 9>;
+                       reset-names = "ahb";
+                       interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+
+               mmc2: mmc at 01c11000 {
+                       compatible = "allwinner,sun5i-a13-mmc";
+                       reg = <0x01c11000 0x1000>;
+                       clocks = <&bus_gates 10>,
+                                <&mmc2_clk 0>,
+                                <&mmc2_clk 1>,
+                                <&mmc2_clk 2>;
+                       clock-names = "ahb",
+                                     "mmc",
+                                     "output",
+                                     "sample";
+                       resets = <&bus_rst 10>;
+                       reset-names = "ahb";
+                       interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+
+               pio: pinctrl at 01c20800 {
+                       compatible = "allwinner,sun8i-h3-pinctrl";
+                       reg = <0x01c20800 0x400>;
+                       interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&bus_gates 69>;
+                       gpio-controller;
+                       #gpio-cells = <3>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+
+                       uart0_pins_a: uart0 at 0 {
+                               allwinner,pins = "PA4", "PA5";
+                               allwinner,function = "uart0";
+                               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+                       };
+
+                       mmc0_pins_a: mmc0 at 0 {
+                               allwinner,pins = "PF0", "PF1", "PF2", "PF3",
+                                                "PF4", "PF5";
+                               allwinner,function = "mmc0";
+                               allwinner,drive = <SUN4I_PINCTRL_30_MA>;
+                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+                       };
+
+                       mmc0_cd_pin: mmc0_cd_pin at 0 {
Quoted 9 lines

arch/arm/boot/dts/sun8i-h3.dtsi line 381

Quoted 5 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +5 -0
+                               allwinner,pins = "PF6";
+                               allwinner,function = "gpio_in";
+                               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+                               allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
+                       };

This should be in the board DTS, unless this is the reference design, in which case you should name the label like "mmc0_cd_pin_reference_design".

Quoted 2 lines

The datasheet mentions SDC0_DET function on PF6, so I thought this is sort of fixed to this pin now. All designs I've seen use this pin.

Why is it set as a gpio then if it is a separate function?

Thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151123/d4e680a9/attachment-0001.sig>
#31 lore raw

Re: [linux-sunxi] Re: [PATCH v4 5/6] ARM: dts: sunxi: Add Allwinner H3 DTSI

HI,

Quoted 59 lines · Maxime Ripard

Hi,

Quoted 56 lines · Jens Kuske
Quoted 32 lines
Quoted 21 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +21 -0
+               bus_gates: clk at 01c20060 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun8i-h3-bus-gates-clk";
+                       reg = <0x01c20060 0x14>;
+                       clocks = <&ahb1>, <&ahb2>, <&apb1>, <&apb2>;
+                       clock-names = "ahb1", "ahb2", "apb1", "apb2";
+                       clock-indices = <5>, <6>, <8>,
+                                       <9>, <10>, <13>,
+                                       <14>, <17>, <18>,
+                                       <19>, <20>,
+                                       <21>, <23>,
+                                       <24>, <25>,
+                                       <26>, <27>,
+                                       <28>, <29>,
+                                       <30>, <31>, <32>,
+                                       <35>, <36>, <37>,
+                                       <40>, <41>, <43>,
+                                       <44>, <52>, <53>,
+                                       <54>, <64>,
+                                       <65>, <69>, <72>,
+                                       <76>, <77>, <78>,

arch/arm/boot/dts/sun8i-h3.dtsi line 223

Quoted 10 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +10 -0
+                                       <96>, <97>, <98>,
+                                       <112>, <113>,
+                                       <114>, <115>, <116>,
+                                       <128>, <135>;
+                       clock-output-names = "ahb1_ce", "ahb1_dma", "ahb1_mmc0",
+                                       "ahb1_mmc1", "ahb1_mmc2", "ahb1_nand",
+                                       "ahb1_sdram", "ahb2_gmac", "ahb1_ts",
+                                       "ahb1_hstimer", "ahb1_spi0",
+                                       "ahb1_spi1", "ahb1_otg",
+                                       "ahb1_otg_ehci0", "ahb1_ehic1",
Quoted 1 line

ahb1_ehci1? Same for the following 3 lines.

I'll fix them...

Quoted 15 lines
Quoted 4 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +3 -0
+                                       "ahb1_ehic2", "ahb1_ehic3",
+                                       "ahb1_otg_ohci0", "ahb2_ohic1",
+                                       "ahb2_ohic2", "ahb2_ohic3", "ahb1_ve",

arch/arm/boot/dts/sun8i-h3.dtsi line 236

Quoted 10 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +10 -0
+                                       "ahb1_lcd0", "ahb1_lcd1", "ahb1_deint",
+                                       "ahb1_csi", "ahb1_tve", "ahb1_hdmi",
+                                       "ahb1_de", "ahb1_gpu", "ahb1_msgbox",
+                                       "ahb1_spinlock", "apb1_codec",
+                                       "apb1_spdif", "apb1_pio", "apb1_ths",
+                                       "apb1_i2s0", "apb1_i2s1", "apb1_i2s2",
+                                       "apb2_i2c0", "apb2_i2c1", "apb2_i2c2",
+                                       "apb2_uart0", "apb2_uart1",
+                                       "apb2_uart2", "apb2_uart3", "apb2_scr",
+                                       "ahb1_ephy", "ahb1_dbg";
Quoted 3 lines

If it weren't for the last 2 clocks, we could cleanly split out apb1 and apb2 gates. Having a separate AHB clock gate taking 2 addresses seems messy as well. :(

Well, maybe we still should do that, if we split the resets too at least apb[12] would line up again.

Quoted 158 lines
Quoted 2 lines

I don't know what to do with these bus things any more, all variants I sent had issues somewhere...

AFAIK, Arnd had some objections, but he never got back to us when we explained how the hardware was laid out, so I don't know if they still apply.

Quoted 151 lines
Quoted 140 lines
Quoted 140 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +140 -0
+               };
+
+               mmc0_clk: clk at 01c20088 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun4i-a10-mmc-clk";
+                       reg = <0x01c20088 0x4>;
+                       clocks = <&osc24M>, <&pll6 0>, <&pll8 0>;
+                       clock-output-names = "mmc0",
+                                            "mmc0_output",
+                                            "mmc0_sample";
+               };
+
+               mmc1_clk: clk at 01c2008c {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun4i-a10-mmc-clk";
+                       reg = <0x01c2008c 0x4>;
+                       clocks = <&osc24M>, <&pll6 0>, <&pll8 0>;
+                       clock-output-names = "mmc1",
+                                            "mmc1_output",
+                                            "mmc1_sample";
+               };
+
+               mmc2_clk: clk at 01c20090 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun4i-a10-mmc-clk";
+                       reg = <0x01c20090 0x4>;
+                       clocks = <&osc24M>, <&pll6 0>, <&pll8 0>;
+                       clock-output-names = "mmc2",
+                                            "mmc2_output",
+                                            "mmc2_sample";
+               };
+
+               mbus_clk: clk at 01c2015c {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun8i-a23-mbus-clk";
+                       reg = <0x01c2015c 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5>;
+                       clock-output-names = "mbus";
+               };
+       };
+
+       soc {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+
+               dma: dma-controller at 01c02000 {
+                       compatible = "allwinner,sun8i-h3-dma";
+                       reg = <0x01c02000 0x1000>;
+                       interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&bus_gates 6>;
+                       resets = <&bus_rst 6>;
+                       #dma-cells = <1>;
+               };
+
+               mmc0: mmc at 01c0f000 {
+                       compatible = "allwinner,sun5i-a13-mmc";
+                       reg = <0x01c0f000 0x1000>;
+                       clocks = <&bus_gates 8>,
+                                <&mmc0_clk 0>,
+                                <&mmc0_clk 1>,
+                                <&mmc0_clk 2>;
+                       clock-names = "ahb",
+                                     "mmc",
+                                     "output",
+                                     "sample";
+                       resets = <&bus_rst 8>;
+                       reset-names = "ahb";
+                       interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+
+               mmc1: mmc at 01c10000 {
+                       compatible = "allwinner,sun5i-a13-mmc";
+                       reg = <0x01c10000 0x1000>;
+                       clocks = <&bus_gates 9>,
+                                <&mmc1_clk 0>,
+                                <&mmc1_clk 1>,
+                                <&mmc1_clk 2>;
+                       clock-names = "ahb",
+                                     "mmc",
+                                     "output",
+                                     "sample";
+                       resets = <&bus_rst 9>;
+                       reset-names = "ahb";
+                       interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+
+               mmc2: mmc at 01c11000 {
+                       compatible = "allwinner,sun5i-a13-mmc";
+                       reg = <0x01c11000 0x1000>;
+                       clocks = <&bus_gates 10>,
+                                <&mmc2_clk 0>,
+                                <&mmc2_clk 1>,
+                                <&mmc2_clk 2>;
+                       clock-names = "ahb",
+                                     "mmc",
+                                     "output",
+                                     "sample";
+                       resets = <&bus_rst 10>;
+                       reset-names = "ahb";
+                       interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+
+               pio: pinctrl at 01c20800 {
+                       compatible = "allwinner,sun8i-h3-pinctrl";
+                       reg = <0x01c20800 0x400>;
+                       interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&bus_gates 69>;
+                       gpio-controller;
+                       #gpio-cells = <3>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+
+                       uart0_pins_a: uart0 at 0 {
+                               allwinner,pins = "PA4", "PA5";
+                               allwinner,function = "uart0";
+                               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+                       };
+
+                       mmc0_pins_a: mmc0 at 0 {
+                               allwinner,pins = "PF0", "PF1", "PF2", "PF3",
+                                                "PF4", "PF5";
+                               allwinner,function = "mmc0";
+                               allwinner,drive = <SUN4I_PINCTRL_30_MA>;
+                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+                       };
+
+                       mmc0_cd_pin: mmc0_cd_pin at 0 {
Quoted 9 lines

arch/arm/boot/dts/sun8i-h3.dtsi line 381

Quoted 5 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +5 -0
+                               allwinner,pins = "PF6";
+                               allwinner,function = "gpio_in";
+                               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+                               allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
+                       };

This should be in the board DTS, unless this is the reference design, in which case you should name the label like "mmc0_cd_pin_reference_design".

The datasheet mentions SDC0_DET function on PF6

Hmm, not in my version, I've "Allwinner_H3_Datasheet_V1.0.pdf" and there PF6 only has generic input / output functionality.

Quoted 4 lines
Quoted 2 lines

so I thought this is
sort of fixed to this pin now. All designs I've seen use this pin.

Why is it set as a gpio then if it is a separate function?

I guess because we do not support this in the mmc driver yet. Also on older devices the mmc controller has build-in card-detection features (using the data lines in that case) but we've never supported this since none of the boards sofar have been using it.

For now we can just treat PF6 as a gpio, until someone figures out how to do this inside the mmc driver.

Regards,

Hans

author
#32 lore raw

Re: [linux-sunxi] Re: [PATCH v4 5/6] ARM: dts: sunxi: Add Allwinner H3 DTSI

Quoted 219 lines · Hans de Goede

HI,

Quoted 216 lines · Maxime Ripard

Hi,

Quoted 53 lines · Jens Kuske
Quoted 32 lines
Quoted 21 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +21 -0
+               bus_gates: clk at 01c20060 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun8i-h3-bus-gates-clk";
+                       reg = <0x01c20060 0x14>;
+                       clocks = <&ahb1>, <&ahb2>, <&apb1>, <&apb2>;
+                       clock-names = "ahb1", "ahb2", "apb1", "apb2";
+                       clock-indices = <5>, <6>, <8>,
+                                       <9>, <10>, <13>,
+                                       <14>, <17>, <18>,
+                                       <19>, <20>,
+                                       <21>, <23>,
+                                       <24>, <25>,
+                                       <26>, <27>,
+                                       <28>, <29>,
+                                       <30>, <31>, <32>,
+                                       <35>, <36>, <37>,
+                                       <40>, <41>, <43>,
+                                       <44>, <52>, <53>,
+                                       <54>, <64>,
+                                       <65>, <69>, <72>,
+                                       <76>, <77>, <78>,

arch/arm/boot/dts/sun8i-h3.dtsi line 223

Quoted 10 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +10 -0
+                                       <96>, <97>, <98>,
+                                       <112>, <113>,
+                                       <114>, <115>, <116>,
+                                       <128>, <135>;
+                       clock-output-names = "ahb1_ce", "ahb1_dma", "ahb1_mmc0",
+                                       "ahb1_mmc1", "ahb1_mmc2", "ahb1_nand",
+                                       "ahb1_sdram", "ahb2_gmac", "ahb1_ts",
+                                       "ahb1_hstimer", "ahb1_spi0",
+                                       "ahb1_spi1", "ahb1_otg",
+                                       "ahb1_otg_ehci0", "ahb1_ehic1",
Quoted 1 line

ahb1_ehci1? Same for the following 3 lines.

I'll fix them...

Quoted 15 lines
Quoted 4 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +3 -0
+                                       "ahb1_ehic2", "ahb1_ehic3",
+                                       "ahb1_otg_ohci0", "ahb2_ohic1",
+                                       "ahb2_ohic2", "ahb2_ohic3", "ahb1_ve",

arch/arm/boot/dts/sun8i-h3.dtsi line 236

Quoted 10 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +10 -0
+                                       "ahb1_lcd0", "ahb1_lcd1", "ahb1_deint",
+                                       "ahb1_csi", "ahb1_tve", "ahb1_hdmi",
+                                       "ahb1_de", "ahb1_gpu", "ahb1_msgbox",
+                                       "ahb1_spinlock", "apb1_codec",
+                                       "apb1_spdif", "apb1_pio", "apb1_ths",
+                                       "apb1_i2s0", "apb1_i2s1", "apb1_i2s2",
+                                       "apb2_i2c0", "apb2_i2c1", "apb2_i2c2",
+                                       "apb2_uart0", "apb2_uart1",
+                                       "apb2_uart2", "apb2_uart3", "apb2_scr",
+                                       "ahb1_ephy", "ahb1_dbg";
Quoted 3 lines

If it weren't for the last 2 clocks, we could cleanly split out apb1 and apb2 gates. Having a separate AHB clock gate taking 2 addresses seems messy as well. :(

Quoted 5 lines

Well, maybe we still should do that, if we split the resets too at least apb[12] would line up again.

I don't know what to do with these bus things any more, all variants I sent had issues somewhere...

AFAIK, Arnd had some objections, but he never got back to us when we explained how the hardware was laid out, so I don't know if they still apply.

Quoted 150 lines
Quoted 149 lines
Quoted 135 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +135 -0
+               };
+
+               mmc0_clk: clk at 01c20088 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun4i-a10-mmc-clk";
+                       reg = <0x01c20088 0x4>;
+                       clocks = <&osc24M>, <&pll6 0>, <&pll8 0>;
+                       clock-output-names = "mmc0",
+                                            "mmc0_output",
+                                            "mmc0_sample";
+               };
+
+               mmc1_clk: clk at 01c2008c {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun4i-a10-mmc-clk";
+                       reg = <0x01c2008c 0x4>;
+                       clocks = <&osc24M>, <&pll6 0>, <&pll8 0>;
+                       clock-output-names = "mmc1",
+                                            "mmc1_output",
+                                            "mmc1_sample";
+               };
+
+               mmc2_clk: clk at 01c20090 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun4i-a10-mmc-clk";
+                       reg = <0x01c20090 0x4>;
+                       clocks = <&osc24M>, <&pll6 0>, <&pll8 0>;
+                       clock-output-names = "mmc2",
+                                            "mmc2_output",
+                                            "mmc2_sample";
+               };
+
+               mbus_clk: clk at 01c2015c {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun8i-a23-mbus-clk";
+                       reg = <0x01c2015c 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5>;
+                       clock-output-names = "mbus";
+               };
+       };
+
+       soc {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+
+               dma: dma-controller at 01c02000 {
+                       compatible = "allwinner,sun8i-h3-dma";
+                       reg = <0x01c02000 0x1000>;
+                       interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&bus_gates 6>;
+                       resets = <&bus_rst 6>;
+                       #dma-cells = <1>;
+               };
+
+               mmc0: mmc at 01c0f000 {
+                       compatible = "allwinner,sun5i-a13-mmc";
+                       reg = <0x01c0f000 0x1000>;
+                       clocks = <&bus_gates 8>,
+                                <&mmc0_clk 0>,
+                                <&mmc0_clk 1>,
+                                <&mmc0_clk 2>;
+                       clock-names = "ahb",
+                                     "mmc",
+                                     "output",
+                                     "sample";
+                       resets = <&bus_rst 8>;
+                       reset-names = "ahb";
+                       interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+
+               mmc1: mmc at 01c10000 {
+                       compatible = "allwinner,sun5i-a13-mmc";
+                       reg = <0x01c10000 0x1000>;
+                       clocks = <&bus_gates 9>,
+                                <&mmc1_clk 0>,
+                                <&mmc1_clk 1>,
+                                <&mmc1_clk 2>;
+                       clock-names = "ahb",
+                                     "mmc",
+                                     "output",
+                                     "sample";
+                       resets = <&bus_rst 9>;
+                       reset-names = "ahb";
+                       interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+
+               mmc2: mmc at 01c11000 {
+                       compatible = "allwinner,sun5i-a13-mmc";
+                       reg = <0x01c11000 0x1000>;
+                       clocks = <&bus_gates 10>,
+                                <&mmc2_clk 0>,
+                                <&mmc2_clk 1>,
+                                <&mmc2_clk 2>;
+                       clock-names = "ahb",
+                                     "mmc",
+                                     "output",
+                                     "sample";
+                       resets = <&bus_rst 10>;
+                       reset-names = "ahb";
+                       interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+
+               pio: pinctrl at 01c20800 {
+                       compatible = "allwinner,sun8i-h3-pinctrl";
+                       reg = <0x01c20800 0x400>;
+                       interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&bus_gates 69>;
+                       gpio-controller;
+                       #gpio-cells = <3>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+
+                       uart0_pins_a: uart0 at 0 {
+                               allwinner,pins = "PA4", "PA5";
+                               allwinner,function = "uart0";
+                               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+                       };
+
+                       mmc0_pins_a: mmc0 at 0 {
+                               allwinner,pins = "PF0", "PF1", "PF2", "PF3",
+                                                "PF4", "PF5";
+                               allwinner,function = "mmc0";

arch/arm/boot/dts/sun8i-h3.dtsi line 381

Quoted 10 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +10 -0
+                               allwinner,drive = <SUN4I_PINCTRL_30_MA>;
+                               allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
+                       };
+
+                       mmc0_cd_pin: mmc0_cd_pin at 0 {
+                               allwinner,pins = "PF6";
+                               allwinner,function = "gpio_in";
+                               allwinner,drive = <SUN4I_PINCTRL_10_MA>;
+                               allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
+                       };

This should be in the board DTS, unless this is the reference design, in which case you should name the label like "mmc0_cd_pin_reference_design".

Quoted 4 lines
Quoted 1 line
Quoted 1 line

The datasheet mentions SDC0_DET function on PF6

Hmm, not in my version, I've "Allwinner_H3_Datasheet_V1.0.pdf" and there PF6 only has generic input / output functionality.

Hm, indeed, it isn't mentioned in the Port Controller documentation, but the table on page 76 (3.2. GPIO Multiplexing Functions) has it.

Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

so I thought this is
sort of fixed to this pin now. All designs I've seen use this pin.

Why is it set as a gpio then if it is a separate function?

Quoted 7 lines

I guess because we do not support this in the mmc driver yet. Also on older devices the mmc controller has build-in card-detection features (using the data lines in that case) but we've never supported this since none of the boards sofar have been using it.

For now we can just treat PF6 as a gpio, until someone figures out how to do this inside the mmc driver.

I could not find any documentation or reference how to use it, probably because it doesn't exist...

Jens

#33 lore raw

Re: [linux-sunxi] Re: [PATCH v4 5/6] ARM: dts: sunxi: Add Allwinner H3 DTSI

In reply to Hans de Goede
Quoted 250 lines · Hans de Goede

HI,

Quoted 246 lines · Maxime Ripard

Hi,

Quoted 72 lines · Jens Kuske
Quoted 38 lines
Quoted 33 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +3 -0
+               bus_gates: clk at 01c20060 {
+                       #clock-cells = <1>;
+                       compatible =

"allwinner,sun8i-h3-bus-gates-clk";

arch/arm/boot/dts/sun8i-h3.dtsi new file +23 -0
+                       reg = <0x01c20060 0x14>;
+                       clocks = <&ahb1>, <&ahb2>, <&apb1>, <&apb2>;
+                       clock-names = "ahb1", "ahb2", "apb1", "apb2";
+                       clock-indices = <5>, <6>, <8>,
+                                       <9>, <10>, <13>,
+                                       <14>, <17>, <18>,
+                                       <19>, <20>,
+                                       <21>, <23>,
+                                       <24>, <25>,
+                                       <26>, <27>,
+                                       <28>, <29>,
+                                       <30>, <31>, <32>,
+                                       <35>, <36>, <37>,
+                                       <40>, <41>, <43>,
+                                       <44>, <52>, <53>,
+                                       <54>, <64>,
+                                       <65>, <69>, <72>,
+                                       <76>, <77>, <78>,
+                                       <96>, <97>, <98>,
+                                       <112>, <113>,
+                                       <114>, <115>, <116>,
+                                       <128>, <135>;
+                       clock-output-names = "ahb1_ce", "ahb1_dma",

"ahb1_mmc0",
+ "ahb1_mmc1", "ahb1_mmc2",
"ahb1_nand",
+ "ahb1_sdram", "ahb2_gmac",
"ahb1_ts",

arch/arm/boot/dts/sun8i-h3.dtsi line 223

Quoted 3 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +3 -0
+                                       "ahb1_hstimer", "ahb1_spi0",
+                                       "ahb1_spi1", "ahb1_otg",
+                                       "ahb1_otg_ehci0", "ahb1_ehic1",
Quoted 1 line

ahb1_ehci1? Same for the following 3 lines.

I'll fix them...

Quoted 25 lines
Quoted 21 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +3 -0
+                                       "ahb1_ehic2", "ahb1_ehic3",
+                                       "ahb1_otg_ohci0", "ahb2_ohic1",
+                                       "ahb2_ohic2", "ahb2_ohic3",

"ahb1_ve",
+ "ahb1_lcd0", "ahb1_lcd1",
"ahb1_deint",
+ "ahb1_csi", "ahb1_tve",
"ahb1_hdmi",
+ "ahb1_de", "ahb1_gpu",
"ahb1_msgbox",

(quoted diff) +2 -0
+                                       "ahb1_spinlock", "apb1_codec",
+                                       "apb1_spdif", "apb1_pio",

"apb1_ths",
+ "apb1_i2s0", "apb1_i2s1",
"apb1_i2s2",
+ "apb2_i2c0", "apb2_i2c1",
"apb2_i2c2",

(quoted diff) +2 -0
+                                       "apb2_uart0", "apb2_uart1",
+                                       "apb2_uart2", "apb2_uart3",
Quoted 2 lines

"apb2_scr",
+ "ahb1_ephy", "ahb1_dbg";

Quoted 4 lines

If it weren't for the last 2 clocks, we could cleanly split out apb1 and apb2
gates. Having a separate AHB clock gate taking 2 addresses seems messy as well. :(

Quoted 5 lines

Well, maybe we still should do that, if we split the resets too at least apb[12] would line up again.

I don't know what to do with these bus things any more, all variants I sent had issues somewhere...

AFAIK, Arnd had some objections, but he never got back to us when we explained how the hardware was laid out, so I don't know if they still apply.

Quoted 159 lines
Quoted 158 lines
Quoted 148 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +128 -0
+               };
+
+               mmc0_clk: clk at 01c20088 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun4i-a10-mmc-clk";
+                       reg = <0x01c20088 0x4>;
+                       clocks = <&osc24M>, <&pll6 0>, <&pll8 0>;
+                       clock-output-names = "mmc0",
+                                            "mmc0_output",
+                                            "mmc0_sample";
+               };
+
+               mmc1_clk: clk at 01c2008c {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun4i-a10-mmc-clk";
+                       reg = <0x01c2008c 0x4>;
+                       clocks = <&osc24M>, <&pll6 0>, <&pll8 0>;
+                       clock-output-names = "mmc1",
+                                            "mmc1_output",
+                                            "mmc1_sample";
+               };
+
+               mmc2_clk: clk at 01c20090 {
+                       #clock-cells = <1>;
+                       compatible = "allwinner,sun4i-a10-mmc-clk";
+                       reg = <0x01c20090 0x4>;
+                       clocks = <&osc24M>, <&pll6 0>, <&pll8 0>;
+                       clock-output-names = "mmc2",
+                                            "mmc2_output",
+                                            "mmc2_sample";
+               };
+
+               mbus_clk: clk at 01c2015c {
+                       #clock-cells = <0>;
+                       compatible = "allwinner,sun8i-a23-mbus-clk";
+                       reg = <0x01c2015c 0x4>;
+                       clocks = <&osc24M>, <&pll6 1>, <&pll5>;
+                       clock-output-names = "mbus";
+               };
+       };
+
+       soc {
+               compatible = "simple-bus";
+               #address-cells = <1>;
+               #size-cells = <1>;
+               ranges;
+
+               dma: dma-controller at 01c02000 {
+                       compatible = "allwinner,sun8i-h3-dma";
+                       reg = <0x01c02000 0x1000>;
+                       interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&bus_gates 6>;
+                       resets = <&bus_rst 6>;
+                       #dma-cells = <1>;
+               };
+
+               mmc0: mmc at 01c0f000 {
+                       compatible = "allwinner,sun5i-a13-mmc";
+                       reg = <0x01c0f000 0x1000>;
+                       clocks = <&bus_gates 8>,
+                                <&mmc0_clk 0>,
+                                <&mmc0_clk 1>,
+                                <&mmc0_clk 2>;
+                       clock-names = "ahb",
+                                     "mmc",
+                                     "output",
+                                     "sample";
+                       resets = <&bus_rst 8>;
+                       reset-names = "ahb";
+                       interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+
+               mmc1: mmc at 01c10000 {
+                       compatible = "allwinner,sun5i-a13-mmc";
+                       reg = <0x01c10000 0x1000>;
+                       clocks = <&bus_gates 9>,
+                                <&mmc1_clk 0>,
+                                <&mmc1_clk 1>,
+                                <&mmc1_clk 2>;
+                       clock-names = "ahb",
+                                     "mmc",
+                                     "output",
+                                     "sample";
+                       resets = <&bus_rst 9>;
+                       reset-names = "ahb";
+                       interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+
+               mmc2: mmc at 01c11000 {
+                       compatible = "allwinner,sun5i-a13-mmc";
+                       reg = <0x01c11000 0x1000>;
+                       clocks = <&bus_gates 10>,
+                                <&mmc2_clk 0>,
+                                <&mmc2_clk 1>,
+                                <&mmc2_clk 2>;
+                       clock-names = "ahb",
+                                     "mmc",
+                                     "output",
+                                     "sample";
+                       resets = <&bus_rst 10>;
+                       reset-names = "ahb";
+                       interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
+                       status = "disabled";
+                       #address-cells = <1>;
+                       #size-cells = <0>;
+               };
+
+               pio: pinctrl at 01c20800 {
+                       compatible = "allwinner,sun8i-h3-pinctrl";
+                       reg = <0x01c20800 0x400>;
+                       interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>,
+                                    <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&bus_gates 69>;
+                       gpio-controller;
+                       #gpio-cells = <3>;
+                       interrupt-controller;
+                       #interrupt-cells = <2>;
+
+                       uart0_pins_a: uart0 at 0 {
+                               allwinner,pins = "PA4", "PA5";
+                               allwinner,function = "uart0";
+                               allwinner,drive =

<SUN4I_PINCTRL_10_MA>;
+ allwinner,pull =
<SUN4I_PINCTRL_NO_PULL>;

arch/arm/boot/dts/sun8i-h3.dtsi new file +4 -0
+                       };
+
+                       mmc0_pins_a: mmc0 at 0 {
+                               allwinner,pins = "PF0", "PF1", "PF2",

"PF3",

arch/arm/boot/dts/sun8i-h3.dtsi new file +3 -0
+                                                "PF4", "PF5";
+                               allwinner,function = "mmc0";
+                               allwinner,drive =

<SUN4I_PINCTRL_30_MA>;
+ allwinner,pull =
<SUN4I_PINCTRL_NO_PULL>;

arch/arm/boot/dts/sun8i-h3.dtsi new file +6 -0
+                       };
+
+                       mmc0_cd_pin: mmc0_cd_pin at 0 {
+                               allwinner,pins = "PF6";
+                               allwinner,function = "gpio_in";
+                               allwinner,drive =
Quoted 4 lines

<SUN4I_PINCTRL_10_MA>;
+ allwinner,pull =
<SUN4I_PINCTRL_PULL_UP>;
+ };

This should be in the board DTS, unless this is the reference design, in which case you should name the label like "mmc0_cd_pin_reference_design".

Quoted 5 lines
Quoted 1 line
Quoted 1 line

The datasheet mentions SDC0_DET function on PF6

Hmm, not in my version, I've "Allwinner_H3_Datasheet_V1.0.pdf" and there PF6 only has generic input / output functionality.

v1.1 has an "SDC0_DET" function for PF6 in the GPIO mux functions table.

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

so I thought this is

sort of fixed to this pin now. All designs I've seen use this pin.

Quoted 7 lines
Quoted 1 line

Why is it set as a gpio then if it is a separate function?

I guess because we do not support this in the mmc driver yet. Also on older devices the mmc controller has build-in card-detection features (using the data lines in that case) but we've never supported this since none of the boards sofar have been using it.

Unfortunately the H3 datasheet does not include a section for MMC. I've requested the datasheet be publicly released with MMC and PRCM sections included:

https://github.com/allwinner-zh/documents/issues/9

ChenYu

Quoted 6 lines

For now we can just treat PF6 as a gpio, until someone figures out how to do this inside the mmc driver.

Regards,

Hans

#34 lore raw

Re: [PATCH v4 5/6] ARM: dts: sunxi: Add Allwinner H3 DTSI

In reply to Jens Kuske

arch/arm/boot/dts/sun8i-h3.dtsi

Quoted 14 lines · On Tue, 27 Oct 2015 17:50:25 +0100 Jens Kuske <[email protected]> wrote:

The Allwinner H3 is a home entertainment system oriented SoC with four Cortex-A7 cores and a Mali-400MP2 GPU.

---
 arch/arm/boot/dts/sun8i-h3.dtsi | 482 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 482 insertions(+)
 create mode 100644 arch/arm/boot/dts/sun8i-h3.dtsi
arch/arm/boot/dts/sun8i-h3.dtsi new file +0 -0
new file mode 100644
index 0000000..c18b5f7
	[snip]
Quoted 4 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +4 -0
+	soc {
+		compatible = "simple-bus";
+		#address-cells = <1>;
+		#size-cells = <1>;

arch/arm/boot/dts/sun8i-h3.dtsi line 291

Quoted 10 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +10 -0
+		ranges;
+
+		dma: dma-controller at 01c02000 {
+			compatible = "allwinner,sun8i-h3-dma";
+			reg = <0x01c02000 0x1000>;
+			interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&bus_gates 6>;
+			resets = <&bus_rst 6>;
+			#dma-cells = <1>;
+		};
	[snip]

arch/arm/boot/dts/sun8i-h3.dtsi line 397

Quoted 7 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +7 -0
+
+		bus_rst: reset at 01c202c0 {
+			#reset-cells = <1>;
+			compatible = "allwinner,sun8i-h3-bus-reset";
+			reg = <0x01c202c0 0x1c>;
+		};
+
	[snip]

arch/arm/boot/dts/sun8i-h3.dtsi line 423

Quoted 12 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +12 -0
+		uart0: serial at 01c28000 {
+			compatible = "snps,dw-apb-uart";
+			reg = <0x01c28000 0x400>;
+			interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
+			reg-shift = <2>;
+			reg-io-width = <4>;
+			clocks = <&bus_gates 112>;
+			resets = <&bus_rst 144>;
+			dmas = <&dma 6>, <&dma 6>;
+			dma-names = "rx", "tx";
+			status = "disabled";
+		};

The reset definitions would be clearer with declarations as the other Allwinner SoCs and without driver hack:

soc {
	compatible = "simple-bus";
	#address-cells = <1>;
	#size-cells = <1>;
	ranges;

		dma: dma-controller at 01c02000 {
		compatible = "allwinner,sun8i-h3-dma";
		reg = <0x01c02000 0x1000>;
		interrupts = <GIC_SPI 50 IRQ_TYPE_LEVEL_HIGH>;
		clocks = <&bus_gates 6>;
		resets = <&rst_reg0 6>;
		#dma-cells = <1>;
	};
    ...
	rst_reg0: reset at 01c202c0 {
		#reset-cells = <1>;
		compatible = "allwinner,sun6i-a31-clock-reset";
		reg = <0x01c202c0 0x04>;
	};
	...
 	rst_reg4: reset at 01c202d8 {
		#reset-cells = <1>;
		compatible = "allwinner,sun6i-a31-clock-reset";
		reg = <0x01c202d8 0x04>;
	};
   ...
	uart0: serial at 01c28000 {
		compatible = "snps,dw-apb-uart";
		reg = <0x01c28000 0x400>;
		interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
		reg-shift = <2>;
		reg-io-width = <4>;
		clocks = <&bus_gates 112>;
		resets = <&rst_reg4 16>;
		dmas = <&dma 6>, <&dma 6>;
		dma-names = "rx", "tx";
		status = "disabled";
	};
Signature · 2 lines
Ken ar c'henta?	|	      ** Breizh ha Linux atav! **
Jef		|		http://moinejf.free.fr/
#35 lore raw

Re: [PATCH v4 5/6] ARM: dts: sunxi: Add Allwinner H3 DTSI

In reply to Jens Kuske

Hi,

Quoted 35 lines · Jens Kuske
arch/arm/boot/dts/sun8i-h3.dtsi new file +35 -0
+		bus_gates: clk at 01c20060 {
+			#clock-cells = <1>;
+			compatible = "allwinner,sun8i-h3-bus-gates-clk";
+			reg = <0x01c20060 0x14>;
+			clocks = <&ahb1>, <&ahb2>, <&apb1>, <&apb2>;
+			clock-names = "ahb1", "ahb2", "apb1", "apb2";
+			clock-indices = <5>, <6>, <8>,
+					<9>, <10>, <13>,
+					<14>, <17>, <18>,
+					<19>, <20>,
+					<21>, <23>,
+					<24>, <25>,
+					<26>, <27>,
+					<28>, <29>,
+					<30>, <31>, <32>,
+					<35>, <36>, <37>,
+					<40>, <41>, <43>,
+					<44>, <52>, <53>,
+					<54>, <64>,
+					<65>, <69>, <72>,
+					<76>, <77>, <78>,
+					<96>, <97>, <98>,
+					<112>, <113>,
+					<114>, <115>, <116>,
+					<128>, <135>;
+			clock-output-names = "ahb1_ce", "ahb1_dma", "ahb1_mmc0",
+					"ahb1_mmc1", "ahb1_mmc2", "ahb1_nand",
+					"ahb1_sdram", "ahb2_gmac", "ahb1_ts",
+					"ahb1_hstimer", "ahb1_spi0",
+					"ahb1_spi1", "ahb1_otg",
+					"ahb1_otg_ehci0", "ahb1_ehic1",
+					"ahb1_ehic2", "ahb1_ehic3",
+					"ahb1_otg_ohci0", "ahb2_ohic1",
+					"ahb2_ohic2", "ahb2_ohic3", "ahb1_ve",
+					"ahb1_lcd0", "ahb1_lcd1", "ahb1_deint",

arch/arm/boot/dts/sun8i-h3.dtsi line 237

Quoted 10 lines
arch/arm/boot/dts/sun8i-h3.dtsi new file +10 -0
+					"ahb1_csi", "ahb1_tve", "ahb1_hdmi",
+					"ahb1_de", "ahb1_gpu", "ahb1_msgbox",
+					"ahb1_spinlock", "apb1_codec",
+					"apb1_spdif", "apb1_pio", "apb1_ths",
+					"apb1_i2s0", "apb1_i2s1", "apb1_i2s2",
+					"apb2_i2c0", "apb2_i2c1", "apb2_i2c2",
+					"apb2_uart0", "apb2_uart1",
+					"apb2_uart2", "apb2_uart3", "apb2_scr",
+					"ahb1_ephy", "ahb1_dbg";
+		};

Having the bus clocks called bus_* would make more sense I guess, or at least it would match the datasheet names (as obscure as they are).

Thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151101/c74dc351/attachment.sig>
#36 lore raw

Re: [PATCH v4 5/6] ARM: dts: sunxi: Add Allwinner H3 DTSI

In reply to Jens Kuske

arch/arm/boot/dts/sun8i-h3.dtsi line 92

Quoted 13 lines · Jens Kuske
arch/arm/boot/dts/sun8i-h3.dtsi new file +13 -0
+	timer {
+		compatible = "arm,armv7-timer";
+		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
+		clock-frequency = <24000000>;
+		arm,cpu-registers-not-fw-configured;
+	};
+
+	memory {
+		reg = <0x40000000 0x80000000>;
+	};

What's the u-boot support like these days?

If it's ready, or at least some patches have been sent, you shouldn't set both the memory node (that will be overriden anyway) and the clock-frequency and arm,cpu-registers-not-fw-configured properties in the timer node, that will prevent the kernel from booting there.

Thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151101/5a99fcd9/attachment.sig>
author
#37 lore raw

PATCH v4 6/6 ARM: dts: sun8i: Add Orange Pi Plus support

In reply to Jens Kuske

The Orange Pi Plus is a SBC based on the Allwinner H3 SoC with 8GB eMMC, multiple USB ports through a USB hub chip, SATA through a USB-SATA bridge, one uSD slot, a 10/100/1000M ethernet port, WiFi, HDMI, headphone jack, IR receiver, a microphone, a CSI connector and a 40-pin GPIO header.

---
 arch/arm/boot/dts/Makefile                   |  3 +-
 arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts | 77 ++++++++++++++++++++++++++++
 2 files changed, 79 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts
arch/arm/boot/dts/Makefile +2 -1
index 78ade1a..476658d 100644
@@ -645,7 +645,8 @@ dtb-$(CONFIG_MACH_SUN8I) += \
 	sun8i-a33-ga10h-v1.1.dtb \
 	sun8i-a33-ippo-q8h-v1.2.dtb \
 	sun8i-a33-q8-tablet.dtb \
-	sun8i-a33-sinlinx-sina33.dtb
+	sun8i-a33-sinlinx-sina33.dtb \
+	sun8i-h3-orangepi-plus.dtb
 dtb-$(CONFIG_MACH_SUN9I) += \
 	sun9i-a80-optimus.dtb \
 	sun9i-a80-cubieboard4.dtb
arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts new file +77 -0

77 lines not on this page · raw message

Signature · 1 line
2.6.2
#38 lore raw
In reply to Jens Kuske
Quoted 4 lines · On Tue, 27 Oct 2015 17:50:20 +0100 Jens Kuske <[email protected]> wrote:

Changes since v3:
- add a clock driver specific to the bus gates instead of listing parents in the DTSI
- skip the holes in the reset controller with of_xlate()

Hi, Maxime, there we are :(. The H3 description is hardcoded and the next SoCs will ask for more and more code. I wonder what is the use of a DT...

Signature · 2 lines
Ken ar c'henta?	|	      ** Breizh ha Linux atav! **
Jef		|		http://moinejf.free.fr/