Skip to contentSkip to conversation

sun50i device tree changes

PATCH New Samuel Holland 4 participants 22 messages Jan 23, 2018 – Jan 25, 2018

Subsystems (2)
lore
Share & tools
lore

Samuel Holland

author maintainer
#0 lore raw

cover sun50i device tree changes

These patches fix one general build issue, improve support for two existing boards, and add support for the Orange Pi Zero Plus.

author maintainer
#1 lore raw

PATCH 1/7 sunxi: binman: Fix U-Boot binary size check

If raw mode is disabled, CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR is not defined, which breaks compiling the device trees. Only enable the size check when it actually matters--that is, when MMC raw mode is enabled.

---
 arch/arm/dts/sunxi-u-boot.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/dts/sunxi-u-boot.dtsi +1 -1
index 72e95afd78..996f391030 100644
@@ -17,7 +17,7 @@
 			filename = "spl/sunxi-spl.bin";
 		};
 		u-boot-img {
-#ifdef CONFIG_MMC
+#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
 			size = <UBOOT_MMC_MAX_SIZE>;
 #endif
 			pos = <CONFIG_SPL_PAD_TO>;
Signature · 1 line
2.13.6
#2 lore raw

PATCH 1/7 sunxi: binman: Fix U-Boot binary size check

Hi!

Quoted 14 lines · Samuel Holland

If raw mode is disabled, CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR is not defined, which breaks compiling the device trees. Only enable the size check when it actually matters--that is, when MMC raw mode is enabled.

---
 arch/arm/dts/sunxi-u-boot.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/dts/sunxi-u-boot.dtsi +0 -0
index 72e95afd78..996f391030 100644

arch/arm/dts/sunxi-u-boot.dtsi line 20

Quoted 5 lines
arch/arm/dts/sunxi-u-boot.dtsi +1 -1
@@ -17,7 +17,7 @@
 			filename = "spl/sunxi-spl.bin";
 		};
 		u-boot-img {
-#ifdef CONFIG_MMC
+#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR

Why don't you change for ENV_IS_IN_MMC like your commit log would suggest?

Thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180124/d62480c2/attachment.sig>
author maintainer
#3 lore raw

PATCH 1/7 sunxi: binman: Fix U-Boot binary size check

Quoted 12 lines · Maxime Ripard

Hi!

Quoted 9 lines · Samuel Holland

If raw mode is disabled, CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR is not defined, which breaks compiling the device trees. Only enable the size check when it actually matters--that is, when MMC raw mode is enabled.

---
 arch/arm/dts/sunxi-u-boot.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines

arch/arm/dts/sunxi-u-boot.dtsi line 20

Quoted 10 lines
arch/arm/dts/sunxi-u-boot.dtsi +1 -1
index 72e95afd78..996f391030 100644
@@ -17,7 +17,7 @@
 			filename = "spl/sunxi-spl.bin";
 		};
 		u-boot-img {
-#ifdef CONFIG_MMC
+#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR

Why don't you change for ENV_IS_IN_MMC like your commit log would suggest?

Because if the environment is in MMC but U-Boot isn't (e.g. it's in SPI), or CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION is in effect and the U-Boot image is stored after the environment in MMC, then there's no chance of overlap and the size doesn't matter.

Quoted 2 lines

Thanks!
Maxime

Thanks,
Samuel

#4 lore raw

PATCH 1/7 sunxi: binman: Fix U-Boot binary size check

Quoted 27 lines · Samuel Holland
Quoted 12 lines · Maxime Ripard

Hi!

Quoted 9 lines · Samuel Holland

If raw mode is disabled, CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR is not defined, which breaks compiling the device trees. Only enable the size check when it actually matters--that is, when MMC raw mode is enabled.

---
 arch/arm/dts/sunxi-u-boot.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines

arch/arm/dts/sunxi-u-boot.dtsi line 20

Quoted 10 lines
arch/arm/dts/sunxi-u-boot.dtsi +1 -1
index 72e95afd78..996f391030 100644
@@ -17,7 +17,7 @@
 			filename = "spl/sunxi-spl.bin";
 		};
 		u-boot-img {
-#ifdef CONFIG_MMC
+#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR

Why don't you change for ENV_IS_IN_MMC like your commit log would suggest?

Quoted 4 lines

Because if the environment is in MMC but U-Boot isn't (e.g. it's in SPI), or CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION is in effect and the U-Boot image is stored after the environment in MMC, then there's no chance of overlap and the size doesn't matter.

Ah, right. Can you put that in your commit log?

Thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180125/363ce4b7/attachment.sig>
author maintainer
#5 lore raw

PATCH 1/7 sunxi: binman: Fix U-Boot binary size check

Quoted 28 lines · Maxime Ripard
Quoted 27 lines · Samuel Holland
Quoted 25 lines · Maxime Ripard

Hi!

Quoted 14 lines · Samuel Holland

If raw mode is disabled, CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR is not defined, which breaks compiling the device trees. Only enable the size check when it actually matters--that is, when MMC raw mode is enabled.

---
 arch/arm/dts/sunxi-u-boot.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/dts/sunxi-u-boot.dtsi +0 -0
index 72e95afd78..996f391030 100644

arch/arm/dts/sunxi-u-boot.dtsi line 20

Quoted 5 lines
arch/arm/dts/sunxi-u-boot.dtsi +1 -1
@@ -17,7 +17,7 @@
 			filename = "spl/sunxi-spl.bin";
 		};
 		u-boot-img {
-#ifdef CONFIG_MMC
+#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR

Why don't you change for ENV_IS_IN_MMC like your commit log would suggest?

Quoted 6 lines
Quoted 4 lines

Because if the environment is in MMC but U-Boot isn't (e.g. it's in SPI), or CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION is in effect and the U-Boot image is stored after the environment in MMC, then there's no chance of overlap and the size doesn't matter.

Ah, right. Can you put that in your commit log?

Sure, I'll do that for v2.

Quoted 2 lines

Thanks!
Maxime

Thanks,
Samuel

author maintainer
#6 lore raw

PATCH 2/7 sun50i: a64: Fix USB clock/reset properties

In reply to Samuel Holland

Move the CLK_USB_OHCI0/1 clocks to the OHCI nodes where they belong, and make the format consistent with the H3/H5 nodes. While here, also remove leading zeros from the USB nodes' unit addresses.

---
 arch/arm/dts/sun50i-a64.dtsi | 34 ++++++++++++++--------------------
 1 file changed, 14 insertions(+), 20 deletions(-)
arch/arm/dts/sun50i-a64.dtsi +14 -20
index 65a344d9ce..02061cc608 100644
@@ -171,7 +171,7 @@
 			#size-cells = <0>;
 		};
 
-		usb_otg: usb at 01c19000 {
+		usb_otg: usb at 1c19000 {
 			compatible = "allwinner,sun8i-a33-musb";
 			reg = <0x01c19000 0x0400>;
 			clocks = <&ccu CLK_BUS_OTG>;
@@ -184,7 +184,7 @@
 			status = "disabled";
 		};
 
-		usbphy: phy at 01c19400 {
+		usbphy: phy at 1c19400 {
 			compatible = "allwinner,sun50i-a64-usb-phy";
 			reg = <0x01c19400 0x14>,
 			      <0x01c1a800 0x4>,
@@ -204,49 +204,43 @@
 			#phy-cells = <1>;
 		};
 
-		ehci0: usb at 01c1a000 {
+		ehci0: usb at 1c1a000 {
 			compatible = "allwinner,sun50i-a64-ehci", "generic-ehci";
 			reg = <0x01c1a000 0x100>;
 			interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&ccu CLK_BUS_OHCI0>,
-				 <&ccu CLK_BUS_EHCI0>,
-				 <&ccu CLK_USB_OHCI0>;
-			resets = <&ccu RST_BUS_OHCI0>,
-				 <&ccu RST_BUS_EHCI0>;
+			clocks = <&ccu CLK_BUS_EHCI0>, <&ccu CLK_BUS_OHCI0>;
+			resets = <&ccu RST_BUS_EHCI0>, <&ccu RST_BUS_OHCI0>;
 			status = "disabled";
 		};
 
-		ohci0: usb at 01c1a400 {
+		ohci0: usb at 1c1a400 {
 			compatible = "allwinner,sun50i-a64-ohci", "generic-ohci";
 			reg = <0x01c1a400 0x100>;
 			interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&ccu CLK_BUS_OHCI0>,
+			clocks = <&ccu CLK_BUS_EHCI0>, <&ccu CLK_BUS_OHCI0>,
 				 <&ccu CLK_USB_OHCI0>;
-			resets = <&ccu RST_BUS_OHCI0>;
+			resets = <&ccu RST_BUS_EHCI0>, <&ccu RST_BUS_OHCI0>;
 			status = "disabled";
 		};
 
-		ehci1: usb at 01c1b000 {
+		ehci1: usb at 1c1b000 {
 			compatible = "allwinner,sun50i-a64-ehci", "generic-ehci";
 			reg = <0x01c1b000 0x100>;
 			interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&ccu CLK_BUS_OHCI1>,
-				 <&ccu CLK_BUS_EHCI1>,
-				 <&ccu CLK_USB_OHCI1>;
-			resets = <&ccu RST_BUS_OHCI1>,
-				 <&ccu RST_BUS_EHCI1>;
+			clocks = <&ccu CLK_BUS_EHCI1>, <&ccu CLK_BUS_OHCI1>;
+			resets = <&ccu RST_BUS_EHCI1>, <&ccu RST_BUS_OHCI1>;
 			phys = <&usbphy 1>;
 			phy-names = "usb";
 			status = "disabled";
 		};
 
-		ohci1: usb at 01c1b400 {
+		ohci1: usb at 1c1b400 {
 			compatible = "allwinner,sun50i-a64-ohci", "generic-ohci";
 			reg = <0x01c1b400 0x100>;
 			interrupts = <GIC_SPI 75 IRQ_TYPE_LEVEL_HIGH>;
-			clocks = <&ccu CLK_BUS_OHCI1>,
+			clocks = <&ccu CLK_BUS_EHCI1>, <&ccu CLK_BUS_OHCI1>,
 				 <&ccu CLK_USB_OHCI1>;
-			resets = <&ccu RST_BUS_OHCI1>;
+			resets = <&ccu RST_BUS_EHCI1>, <&ccu RST_BUS_OHCI1>;
 			phys = <&usbphy 1>;
 			phy-names = "usb";
 			status = "disabled";
Signature · 1 line
2.13.6
#7 lore raw

PATCH 2/7 sun50i: a64: Fix USB clock/reset properties

Quoted 5 lines · Samuel Holland

Move the CLK_USB_OHCI0/1 clocks to the OHCI nodes where they belong, and make the format consistent with the H3/H5 nodes. While here, also remove leading zeros from the USB nodes' unit addresses.

I guess you just took the linux DTS?

You can just mention that, along with which version of the kernel you used for that synchronization.

Thanks!
Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180124/2c1c9474/attachment-0001.sig>
author maintainer
#8 lore raw

PATCH 2/7 sun50i: a64: Fix USB clock/reset properties

Quoted 8 lines · Maxime Ripard
Quoted 5 lines · Samuel Holland

Move the CLK_USB_OHCI0/1 clocks to the OHCI nodes where they belong, and make the format consistent with the H3/H5 nodes. While here, also remove leading zeros from the USB nodes' unit addresses.

I guess you just took the linux DTS?

No, actually the Linux DTS has the same issue with the clocks (the unit addresses there have been fixed). Should I send a patch there first?

Quoted 2 lines

You can just mention that, along with which version of the kernel you used for that synchronization.

And then once that's merged, send a patch for synchronization?

Quoted 2 lines

Thanks!
Maxime

Thanks,
Samuel

#9 lore raw

PATCH 2/7 sun50i: a64: Fix USB clock/reset properties

Quoted 6 lines · Samuel Holland
Quoted 5 lines · Maxime Ripard
Quoted 4 lines · Samuel Holland

Move the CLK_USB_OHCI0/1 clocks to the OHCI nodes where they belong, and make the format consistent with the H3/H5 nodes. While here, also remove leading zeros from the USB nodes' unit addresses.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

I guess you just took the linux DTS?

No, actually the Linux DTS has the same issue with the clocks (the unit addresses there have been fixed). Should I send a patch there first?

A patch fixing that has been merged in 4.15.

Quoted 4 lines
Quoted 2 lines

You can just mention that, along with which version of the kernel you used for that synchronization.

And then once that's merged, send a patch for synchronization?

So you're only left with that :)

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180125/2def75fe/attachment.sig>
author maintainer
#10 lore raw

PATCH 3/7 sun50i: a64: Move ethernet nodes to SoC DTS

In reply to Samuel Holland

These nodes were previously in an unused file specific to the Pine64. Move them to the base SoC device tree for use by other boards. Require individual boards to enable the emac and provide a pin configuration.

---
 arch/arm/dts/sun50i-a64-pine64-plus-u-boot.dtsi | 50 -------------------------
 arch/arm/dts/sun50i-a64.dtsi                    | 28 ++++++++++++++
 2 files changed, 28 insertions(+), 50 deletions(-)
 delete mode 100644 arch/arm/dts/sun50i-a64-pine64-plus-u-boot.dtsi
arch/arm/dts/sun50i-a64-pine64-plus-u-boot.dtsi deleted +0 -50
deleted file mode 100644
index 9c61beac01..0000000000
@@ -1,50 +0,0 @@
-/ {
-	aliases {
-		ethernet0 = &emac;
-	};
-
-	soc {
-		emac: ethernet at 01c30000 {
-			compatible = "allwinner,sun50i-a64-emac";
-			reg = <0x01c30000 0x2000>, <0x01c00030 0x4>;
-			reg-names = "emac", "syscon";
-			interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
-			resets = <&ccu RST_BUS_EMAC>;
-			reset-names = "ahb";
-			clocks = <&ccu CLK_BUS_EMAC>;
-			clock-names = "ahb";
-			#address-cells = <1>;
-			#size-cells = <0>;
-			pinctrl-names = "default";
-			pinctrl-0 = <&rgmii_pins>;
-			phy-mode = "rgmii";
-			phy = <&phy1>;
-			status = "okay";
-
-			phy1: ethernet-phy at 1 {
-				reg = <1>;
-			};
-		};
-	};
-};
-
-&pio {
-	rmii_pins: rmii_pins {
-		allwinner,pins = "PD10", "PD11", "PD13", "PD14",
-				 "PD17", "PD18", "PD19", "PD20",
-				 "PD22", "PD23";
-		allwinner,function = "emac";
-		allwinner,drive = <3>;
-		allwinner,pull = <0>;
-	};
-
-	rgmii_pins: rgmii_pins {
-		allwinner,pins = "PD8", "PD9", "PD10", "PD11",
-				 "PD12", "PD13", "PD15",
-				 "PD16", "PD17", "PD18", "PD19",
-				 "PD20", "PD21", "PD22", "PD23";
-		allwinner,function = "emac";
-		allwinner,drive = <3>;
-		allwinner,pull = <0>;
-	};
-};
arch/arm/dts/sun50i-a64.dtsi +28 -0
index 02061cc608..c686707cf5 100644
@@ -51,6 +51,10 @@
 	#address-cells = <1>;
 	#size-cells = <1>;
 
+	aliases {
+		ethernet0 = &emac;
+	};
+
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
@@ -267,6 +271,16 @@
 			interrupt-controller;
 			#interrupt-cells = <3>;
 
+			emac_rgmii_pins: emac_rgmii_pins {
+				allwinner,pins = "PD8", "PD9", "PD10", "PD11",
+						 "PD12", "PD13", "PD15",
+						 "PD16", "PD17", "PD18", "PD19",
+						 "PD20", "PD21", "PD22", "PD23";
+				allwinner,function = "emac";
+				allwinner,drive = <3>;
+				allwinner,pull = <0>;
+			};
+
 			i2c1_pins: i2c1_pins {
 				pins = "PH2", "PH3";
 				function = "i2c1";
@@ -401,6 +415,20 @@
 			#size-cells = <0>;
 		};
 
+		emac: ethernet at 01c30000 {
+			compatible = "allwinner,sun50i-a64-emac";
+			reg = <0x01c30000 0x2000>, <0x01c00030 0x4>;
+			reg-names = "emac", "syscon";
+			interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
+			resets = <&ccu RST_BUS_EMAC>;
+			reset-names = "ahb";
+			clocks = <&ccu CLK_BUS_EMAC>;
+			clock-names = "ahb";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "disabled";
+		};
+
 		gic: interrupt-controller at 1c81000 {
 			compatible = "arm,gic-400";
 			reg = <0x01c81000 0x1000>,
Signature · 1 line
2.13.6
#11 lore raw

PATCH 3/7 sun50i: a64: Move ethernet nodes to SoC DTS

Quoted 10 lines · Samuel Holland

These nodes were previously in an unused file specific to the Pine64. Move them to the base SoC device tree for use by other boards. Require individual boards to enable the emac and provide a pin configuration.

---
 arch/arm/dts/sun50i-a64-pine64-plus-u-boot.dtsi | 50 -------------------------
 arch/arm/dts/sun50i-a64.dtsi                    | 28 ++++++++++++++
 2 files changed, 28 insertions(+), 50 deletions(-)
 delete mode 100644 arch/arm/dts/sun50i-a64-pine64-plus-u-boot.dtsi

On that note, it seems like it would be a good idea to re-sync this with mainline Linux now that emac bindings exist in-tree [1] and these are generally becoming standard. Thoughts?

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi#n508

#12 lore raw

PATCH 3/7 sun50i: a64: Move ethernet nodes to SoC DTS

Quoted 12 lines · Kyle Evans
Quoted 10 lines · Samuel Holland

These nodes were previously in an unused file specific to the Pine64. Move them to the base SoC device tree for use by other boards. Require individual boards to enable the emac and provide a pin configuration.

---
 arch/arm/dts/sun50i-a64-pine64-plus-u-boot.dtsi | 50 -------------------------
 arch/arm/dts/sun50i-a64.dtsi                    | 28 ++++++++++++++
 2 files changed, 28 insertions(+), 50 deletions(-)
 delete mode 100644 arch/arm/dts/sun50i-a64-pine64-plus-u-boot.dtsi
Quoted 5 lines

On that note, it seems like it would be a good idea to re-sync this with mainline Linux now that emac bindings exist in-tree [1] and these are generally becoming standard. Thoughts?

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi#n508

Agreed.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180124/6b9d95e2/attachment.sig>
#13 lore raw

PATCH 3/7 sun50i: a64: Move ethernet nodes to SoC DTS

In reply to Kyle Evans
Quoted 12 lines · Kyle Evans
Quoted 10 lines · Samuel Holland

These nodes were previously in an unused file specific to the Pine64. Move them to the base SoC device tree for use by other boards. Require individual boards to enable the emac and provide a pin configuration.

---
 arch/arm/dts/sun50i-a64-pine64-plus-u-boot.dtsi | 50 -------------------------
 arch/arm/dts/sun50i-a64.dtsi                    | 28 ++++++++++++++
 2 files changed, 28 insertions(+), 50 deletions(-)
 delete mode 100644 arch/arm/dts/sun50i-a64-pine64-plus-u-boot.dtsi
Quoted 3 lines

On that note, it seems like it would be a good idea to re-sync this with mainline Linux now that emac bindings exist in-tree [1] and these are generally becoming standard. Thoughts?

Sure. The problem with that is that the Ethernet nodes are no longer compatible with what the U-Boot driver understands. Solutions are:
- Keep the EMAC nodes - in "old" U-Boot style - in a *-u-boot.dtsi override. Easy enough, but bad idea.
- Teach the U-Boot EMAC driver to cope with the new bindings. I sent patches for that a while ago [2]. Problem is that people didn't like the "handish" way of parsing the pinctrl properties - instead opting for a proper DM pinctrl driver for sunxi. Sounds reasonable - but is a quite a chunk of work. This was on the list before - but IMHO a bit over the top by copying the Linux driver.

I was wondering if we could just go with the easy pinctrl solution (as in [2], based on what we currently have in the EMAC driver). We could switch anytime to a proper DM pinctrl driver - which is on my list, but not very high on it. I have some ideas on how to make this small and simple, as we don't need the fully glory and bloat of the Linux driver.

If people are OK with this, I can post a rebased version of [2]. We can then just copy the mainline DTs for A64 into U-Boot.
And leave the DM pinctrl driver for another time.

Cheers,
Andre.

[2] https://lists.denx.de/pipermail/u-boot/2017-July/296923.html

Quoted 2 lines

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi#n508

#14 lore raw

PATCH 3/7 sun50i: a64: Move ethernet nodes to SoC DTS

Quoted 34 lines · André Przywara
Quoted 12 lines · Kyle Evans
Quoted 10 lines · Samuel Holland

These nodes were previously in an unused file specific to the Pine64. Move them to the base SoC device tree for use by other boards. Require individual boards to enable the emac and provide a pin configuration.

---
 arch/arm/dts/sun50i-a64-pine64-plus-u-boot.dtsi | 50 -------------------------
 arch/arm/dts/sun50i-a64.dtsi                    | 28 ++++++++++++++
 2 files changed, 28 insertions(+), 50 deletions(-)
 delete mode 100644 arch/arm/dts/sun50i-a64-pine64-plus-u-boot.dtsi
Quoted 3 lines

On that note, it seems like it would be a good idea to re-sync this with mainline Linux now that emac bindings exist in-tree [1] and these are generally becoming standard. Thoughts?

Sure. The problem with that is that the Ethernet nodes are no longer compatible with what the U-Boot driver understands. Solutions are:
- Keep the EMAC nodes - in "old" U-Boot style - in a *-u-boot.dtsi override. Easy enough, but bad idea.
- Teach the U-Boot EMAC driver to cope with the new bindings. I sent patches for that a while ago [2]. Problem is that people didn't like the "handish" way of parsing the pinctrl properties - instead opting for a proper DM pinctrl driver for sunxi. Sounds reasonable - but is a quite a chunk of work. This was on the list before - but IMHO a bit over the top by copying the Linux driver.

I was wondering if we could just go with the easy pinctrl solution (as in [2], based on what we currently have in the EMAC driver). We could switch anytime to a proper DM pinctrl driver - which is on my list, but not very high on it. I have some ideas on how to make this small and simple, as we don't need the fully glory and bloat of the Linux driver.

Quoted 3 lines

If people are OK with this, I can post a rebased version of [2]. We can then just copy the mainline DTs for A64 into U-Boot.
And leave the DM pinctrl driver for another time.

That's what I was about to suggest. The pinctrl discussion is pretty much orthogonal, and we'll have to convert a whole bunch of drivers anyway when that happens, so it's not a big deal to add a new driver that doesn't rely on pinctrl at the moment.

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180125/b0742d58/attachment.sig>
#15 lore raw

PATCH 3/7 sun50i: a64: Move ethernet nodes to SoC DTS

Hi,

Quoted 35 lines · Maxime Ripard
Quoted 34 lines · André Przywara
Quoted 12 lines · Kyle Evans
Quoted 10 lines · Samuel Holland

These nodes were previously in an unused file specific to the Pine64. Move them to the base SoC device tree for use by other boards. Require individual boards to enable the emac and provide a pin configuration.

---
 arch/arm/dts/sun50i-a64-pine64-plus-u-boot.dtsi | 50 -------------------------
 arch/arm/dts/sun50i-a64.dtsi                    | 28 ++++++++++++++
 2 files changed, 28 insertions(+), 50 deletions(-)
 delete mode 100644 arch/arm/dts/sun50i-a64-pine64-plus-u-boot.dtsi
Quoted 3 lines

On that note, it seems like it would be a good idea to re-sync this with mainline Linux now that emac bindings exist in-tree [1] and these are generally becoming standard. Thoughts?

Sure. The problem with that is that the Ethernet nodes are no longer compatible with what the U-Boot driver understands. Solutions are:
- Keep the EMAC nodes - in "old" U-Boot style - in a *-u-boot.dtsi override. Easy enough, but bad idea.
- Teach the U-Boot EMAC driver to cope with the new bindings. I sent patches for that a while ago [2]. Problem is that people didn't like the "handish" way of parsing the pinctrl properties - instead opting for a proper DM pinctrl driver for sunxi. Sounds reasonable - but is a quite a chunk of work. This was on the list before - but IMHO a bit over the top by copying the Linux driver.

I was wondering if we could just go with the easy pinctrl solution (as in [2], based on what we currently have in the EMAC driver). We could switch anytime to a proper DM pinctrl driver - which is on my list, but not very high on it. I have some ideas on how to make this small and simple, as we don't need the fully glory and bloat of the Linux driver.

Quoted 8 lines
Quoted 3 lines

If people are OK with this, I can post a rebased version of [2]. We can then just copy the mainline DTs for A64 into U-Boot.
And leave the DM pinctrl driver for another time.

That's what I was about to suggest. The pinctrl discussion is pretty much orthogonal, and we'll have to convert a whole bunch of drivers anyway when that happens, so it's not a big deal to add a new driver that doesn't rely on pinctrl at the moment.

Thanks, I totally agree.

I will post something after I have tested it later tonight. If you don't mind, I will include the mainline H3/H5 DTs as well (in a separate patch), as they suffer from the same EMAC problem and are stuck at a copy from an ancient kernel (if at all) at the moment.

Cheers,
Andre.

author maintainer
#16 lore raw

PATCH 4/7 sun50i: a64: Update OrangePi Win defconfig and DTS

In reply to Samuel Holland

Enable Ethernet support in the device tree and add the necessary MACPWR configuration. Also fix spacing in USB device tree nodes and add the relevant configuration options.

---
 arch/arm/dts/sun50i-a64-orangepi-win.dts | 18 +++++++++++++++---
 configs/orangepi_win_defconfig           |  5 ++++-
 2 files changed, 19 insertions(+), 4 deletions(-)
arch/arm/dts/sun50i-a64-orangepi-win.dts +15 -3
index cf76c35237..41bad328f0 100644
@@ -67,7 +67,19 @@
 };
 
 &ehci1 {
-       status = "okay";
+	status = "okay";
+};
+
+&emac {
+	pinctrl-names = "default";
+	pinctrl-0 = <&emac_rgmii_pins>;
+	phy-mode = "rgmii";
+	phy = <&phy1>;
+	status = "okay";
+
+	phy1: ethernet-phy at 1 {
+		reg = <1>;
+	};
 };
 
 &mmc0 {
@@ -80,7 +92,7 @@
 };
 
 &ohci1 {
-       status = "okay";
+	status = "okay";
 };
 
 &uart0 {
@@ -90,5 +102,5 @@
 };
 
 &usbphy {
-       status = "okay";
+	status = "okay";
 };
configs/orangepi_win_defconfig +4 -1
index f9c3d4acf9..670c1868b2 100644
@@ -1,7 +1,10 @@
 CONFIG_ARM=y
 CONFIG_ARCH_SUNXI=y
 CONFIG_MACH_SUN50I=y
-CONFIG_RESERVE_ALLWINNER_BOOT0_HEADER=y
+CONFIG_DRAM_ZQ=3881977
+CONFIG_MACPWR="PD14"
+CONFIG_USB0_ID_DET="PH9"
+CONFIG_USB1_VBUS_PIN="PD7"
 CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-orangepi-win"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SPL=y
Signature · 1 line
2.13.6
author maintainer
#17 lore raw

PATCH 5/7 sun50i: h5: Clean up OrangePi PC 2 device tree

In reply to Samuel Holland

Sort nodes alphabetically, and remove the ethernet alias duplicated from the SoC device tree.

---
 arch/arm/dts/sun50i-h5-orangepi-pc2.dts | 41 ++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 21 deletions(-)
arch/arm/dts/sun50i-h5-orangepi-pc2.dts +20 -21
index 780d59a096..fd8cfc6ff3 100644
@@ -60,7 +60,6 @@
 
 	aliases {
 		serial0 = &uart0;
-		ethernet0 = &emac;
 	};
 
 	soc {
@@ -73,6 +72,22 @@
 	};
 };
 
+&ehci1 {
+	status = "okay";
+};
+
+&emac {
+	pinctrl-names = "default";
+	pinctrl-0 = <&emac_rgmii_pins>;
+	phy-mode = "rgmii";
+	phy = <&phy1>;
+	status = "okay";
+
+	phy1: ethernet-phy at 1 {
+		reg = <1>;
+	};
+};
+
 &mmc0 {
 	compatible = "allwinner,sun50i-h5-mmc",
 		     "allwinner,sun50i-a64-mmc",
@@ -86,32 +101,16 @@
 	status = "okay";
 };
 
-&uart0 {
-	pinctrl-names = "default";
-	pinctrl-0 = <&uart0_pins_a>;
-	status = "okay";
-};
-
-&usbphy {
-	status = "okay";
-};
-
 &ohci1 {
 	status = "okay";
 };
 
-&ehci1 {
+&uart0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart0_pins_a>;
 	status = "okay";
 };
 
-&emac {
-	pinctrl-names = "default";
-	pinctrl-0 = <&emac_rgmii_pins>;
-	phy-mode = "rgmii";
-	phy = <&phy1>;
+&usbphy {
 	status = "okay";
-
-	phy1: ethernet-phy at 1 {
-		reg = <1>;
-	};
 };
Signature · 1 line
2.13.6
author maintainer
#18 lore raw

PATCH 6/7 sun50i: h5: Enable remaining USB ports on OrangePi PC2

In reply to Samuel Holland

The OrangePi PC 2 has three USB type A ports, with one connected to each EHCI/OHCI controller. Enable the controllers for the other two ports.

---
 arch/arm/dts/sun50i-h5-orangepi-pc2.dts | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
arch/arm/dts/sun50i-h5-orangepi-pc2.dts +16 -0
index fd8cfc6ff3..dd0cb2dc50 100644
@@ -76,6 +76,14 @@
 	status = "okay";
 };
 
+&ehci2 {
+	status = "okay";
+};
+
+&ehci3 {
+	status = "okay";
+};
+
 &emac {
 	pinctrl-names = "default";
 	pinctrl-0 = <&emac_rgmii_pins>;
@@ -105,6 +113,14 @@
 	status = "okay";
 };
 
+&ohci2 {
+	status = "okay";
+};
+
+&ohci3 {
+	status = "okay";
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pins_a>;
Signature · 1 line
2.13.6
author maintainer
#19 lore raw

PATCH 7/7 sun50i: h5: Add support for the Orange Pi Zero Plus

In reply to Samuel Holland

The Orange Pi Zero Plus is a single board computer based on the Allwinner H5 SoC. It has 512MiB RAM, gigabit Ethernet, and one USB 2.0 port, with headers for two additional ports.

---
 arch/arm/dts/Makefile                          |   1 +
 arch/arm/dts/sun50i-h5-orangepi-zero-plus.dts  | 115 +++++++++++++++++++++++++
 arch/arm/dts/sun50i-h5-orangepi-zero-plus2.dts |   1 +
 board/sunxi/MAINTAINERS                        |   6 ++
 configs/orangepi_zero_plus_defconfig           |  18 ++++
 5 files changed, 141 insertions(+)
 create mode 100644 arch/arm/dts/sun50i-h5-orangepi-zero-plus.dts
 create mode 100644 configs/orangepi_zero_plus_defconfig
arch/arm/dts/Makefile +1 -0
index 9540ba4313..67635662cb 100644
@@ -356,6 +356,7 @@ dtb-$(CONFIG_MACH_SUN50I_H5) += \
 	sun50i-h5-nanopi-neo-plus2.dtb \
 	sun50i-h5-orangepi-pc2.dtb \
 	sun50i-h5-orangepi-prime.dtb \
+	sun50i-h5-orangepi-zero-plus.dtb \
 	sun50i-h5-orangepi-zero-plus2.dtb
 dtb-$(CONFIG_MACH_SUN50I) += \
 	sun50i-a64-bananapi-m64.dtb \
arch/arm/dts/sun50i-h5-orangepi-zero-plus.dts new file +115 -0

115 lines not on this page · raw message

arch/arm/dts/sun50i-h5-orangepi-zero-plus2.dts +1 -0
index 3f4baba310..e44e75733e 100644
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 Jagan Teki <[email protected]>
+ * Copyright (C) 2017 Samuel Holland <[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
board/sunxi/MAINTAINERS +6 -0
index 362edffc42..7b165e4ba0 100644
@@ -321,6 +321,12 @@ M:	Icenowy Zheng <[email protected]>
 S:	Maintained
 F:	configs/orangepi_zero_defconfig
 
+ORANGEPI ZERO PLUS BOARD
+M:	Samuel Holland <[email protected]>
+S:	Maintained
+F:	arch/arm/dts/sun50i-h5-orangepi-zero-plus.dts
+F:	configs/orangepi_zero_plus_defconfig
+
 ORANGEPI ZERO PLUS 2 BOARD
 M:	Jagan Teki <[email protected]>
 S:	Maintained
configs/orangepi_zero_plus_defconfig new file +18 -0
new file mode 100644
index 0000000000..49954bbe4f
@@ -0,0 +1,18 @@
+CONFIG_ARM=y
+CONFIG_ARCH_SUNXI=y
+CONFIG_MACH_SUN50I_H5=y
+CONFIG_DRAM_ZQ=3881977
+CONFIG_MACPWR="PD6"
+CONFIG_USB0_ID_DET="PG12"
+CONFIG_DEFAULT_DEVICE_TREE="sun50i-h5-orangepi-zero-plus"
+# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
+CONFIG_SPL=y
+# CONFIG_CMD_FLASH is not set
+# CONFIG_CMD_FPGA is not set
+# CONFIG_SPL_DOS_PARTITION is not set
+# CONFIG_SPL_ISO_PARTITION is not set
+# CONFIG_SPL_EFI_PARTITION is not set
+CONFIG_SPL_SPI_SUNXI=y
+CONFIG_SUN8I_EMAC=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y
Signature · 1 line
2.13.6
#20 lore raw

PATCH 7/7 sun50i: h5: Add support for the Orange Pi Zero Plus

arch/arm/dts/sun50i-h5-orangepi-zero-plus2.dts line 6

Quoted 11 lines · Samuel Holland
arch/arm/dts/sun50i-h5-orangepi-zero-plus2.dts +1 -0
index 3f4baba310..e44e75733e 100644
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 Jagan Teki <[email protected]>
+ * Copyright (C) 2017 Samuel Holland <[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

You haven't touched that file. I guess this was meant for the Orange Pi Zero Plus and not the Plus2?

Maxime

Signature · 10 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180124/5a940726/attachment.sig>
author maintainer
#21 lore raw

PATCH 7/7 sun50i: h5: Add support for the Orange Pi Zero Plus

Quoted 15 lines · Maxime Ripard

arch/arm/dts/sun50i-h5-orangepi-zero-plus2.dts line 6

Quoted 11 lines · Samuel Holland
arch/arm/dts/sun50i-h5-orangepi-zero-plus2.dts +1 -0
index 3f4baba310..e44e75733e 100644
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2017 Jagan Teki <[email protected]>
+ * Copyright (C) 2017 Samuel Holland <[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

You haven't touched that file. I guess this was meant for the Orange Pi Zero Plus and not the Plus2?

Yes, it was, sorry.

Quoted 1 line

Maxime

Thanks,
Samuel