Skip to contentSkip to conversation

sunxi: update Pine64 device tree

PATCH Superseded Andre Przywara 4 participants 8 messages May 23, 2017 – May 24, 2017

Subsystems (5)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover sunxi: update Pine64 device tree

Hi,

an updated version: the first patch is unchanged (still the exact same DT as in Linux), but the second patch reformats the Ethernet nodes as a .dtsi and uses the new U-Boot specific DT addon feature to make it clear that these nodes are for a (preliminary) U-Boot specific binding. Once the Ethernet driver made it into Linux, we will either adapt the U-Boot driver to cope with the new binding or get a new (Designware based) driver anyway. In any case this -u-boot.dtsi can then just be removed.

==================
When the Pine64 support was merged into U-Boot, there was no official Pine64 .dts in the Linux tree. Since this has changed now and the meanwhile merged Linux DT differs quite a lot from the (preliminary) .dts we used in U-Boot so far, let's update U-Boot's DT to match the Linux version. Beside the effect of using a single instance of the DT we gain the huge advantage of not (necessarily) needing to load a .dtb to boot Linux. Instead just specifying $fdtcontroladdr does the trick, which is used by the UEFI boot scheme already. This has the potential of relieving distributions from the burden of supplying .dtb files for each and every "supported" board.

Following Chen-Yu's suggestion on the last post, the first patch is a 1:1 copy of the Linux version (as of 4.12-rc1), the second one (re-)adds the DT nodes for the Ethernet MAC, which is both not-yet-upstream in Linux and also differening from the proposed Linux driver bindings. But let's fix that later once the Linux driver gets merged.

Given that U-Boot itself does not use the DT much (at least at the moment), there is little risk of breakage, so I'd be grateful if this could be still merged into the next release.

Cheers,
Andre.

Andre Przywara (2):
sunxi: A64/Pine64: update device tree from Linux
sunxi: A64/Pine64: (re-)add sun8i emac DT nodes

 arch/arm/dts/sun50i-a64-pine64-plus-u-boot.dtsi    |  50 ++
 arch/arm/dts/sun50i-a64-pine64-plus.dts            |  26 +-
 arch/arm/dts/sun50i-a64-pine64.dts                 |  59 +-
 arch/arm/dts/sun50i-a64.dtsi                       | 639 ++++++---------------
 include/dt-bindings/clock/sun50i-a64-ccu.h         | 134 +++++
 .../dt-bindings/reset/sun50i-a64-ccu.h             | 109 ++--
 6 files changed, 489 insertions(+), 528 deletions(-)
 create mode 100644 arch/arm/dts/sun50i-a64-pine64-plus-u-boot.dtsi
 create mode 100644 include/dt-bindings/clock/sun50i-a64-ccu.h
 rename arch/arm/dts/sun50i-a64-pine64-common.dtsi => include/dt-bindings/reset/sun50i-a64-ccu.h (52%)
Signature · 1 line
2.9.0
#1 lore raw

PATCH v2 1/2 sunxi: A64/Pine64: update device tree from Linux

The Linux device tree for the Allwinner A64 SoC has changed a lot since the U-Boot version was merged.
Let's replace the current DT with a exact copy of the Linux one as of:
commit c6778ff813d2ca3e3c8733c87dc8b6831a64578b
Merge: 0ff4c01 3c0e3abd
Author: Linus Torvalds <[email protected]>
Date: Tue May 9 10:07:33 2017 -0700

This is the DT used in 4.12-rc1.

For this patch this makes U-Boot lose the (not yet upstream) Ethernet node, but the next patch will fix this up.

---
 arch/arm/dts/sun50i-a64-pine64-plus.dts            |  26 +-
 arch/arm/dts/sun50i-a64-pine64.dts                 |  59 +-
 arch/arm/dts/sun50i-a64.dtsi                       | 639 ++++++---------------
 include/dt-bindings/clock/sun50i-a64-ccu.h         | 134 +++++
 .../dt-bindings/reset/sun50i-a64-ccu.h             | 109 ++--
 5 files changed, 439 insertions(+), 528 deletions(-)
 create mode 100644 include/dt-bindings/clock/sun50i-a64-ccu.h
 rename arch/arm/dts/sun50i-a64-pine64-common.dtsi => include/dt-bindings/reset/sun50i-a64-ccu.h (52%)
arch/arm/dts/sun50i-a64-pine64-plus.dts +2 -24
index 389c609..790d14d 100644
@@ -40,33 +40,11 @@
  *     OTHER DEALINGS IN THE SOFTWARE.
  */
 
-/dts-v1/;
-
-#include "sun50i-a64-pine64-common.dtsi"
+#include "sun50i-a64-pine64.dts"
 
 / {
 	model = "Pine64+";
 	compatible = "pine64,pine64-plus", "allwinner,sun50i-a64";
 
-	chosen {
-		stdout-path = "serial0:115200n8";
-	};
-
-	/* There is a model with 2GB of DRAM, but U-Boot fixes this for us. */
-	memory {
-		reg = <0x40000000 0x40000000>;
-	};
-};
-
-&emac {
-	pinctrl-names = "default";
-	pinctrl-0 = <&rgmii_pins>;
-	phy-mode = "rgmii";
-	phy = <&phy1>;
-	status = "okay";
-
-	phy1: ethernet-phy at 1 {
-	reg = <1>;
-	};
+	/* TODO: Camera, Ethernet PHY, touchscreen, etc. */
 };
-
arch/arm/dts/sun50i-a64-pine64.dts +56 -3

73 lines not on this page · raw message

arch/arm/dts/sun50i-a64.dtsi +190 -449

803 lines not on this page · raw message

include/dt-bindings/clock/sun50i-a64-ccu.h new file +134 -0

134 lines not on this page · raw message

include/dt-bindings/reset/sun50i-a64-ccu.h renamed from arch/arm/dts/sun50i-a64-pine64-common.dtsi +57 -52

128 lines not on this page · raw message

Signature · 1 line
2.9.0
#2 lore raw

PATCH v2 2/2 sunxi: A64/Pine64: (re-)add sun8i emac DT nodes

In reply to Andre Przywara

As the kernel DT does not have an Ethernet driver and bindings, lets add the DT bindings for U-Boot's sun8i EMAC Ethernet driver as a U-Boot specific DT include.
This re-adds the nodes that got lost when syncing the kernel DT to U-Boot. Compared to the former bits it slightly updates the DT nodes to adapt to the new DT (clock and reset nodes), but keeps the rest the same to let it work with the existing U-Boot driver.

---
 arch/arm/dts/sun50i-a64-pine64-plus-u-boot.dtsi | 50 +++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 arch/arm/dts/sun50i-a64-pine64-plus-u-boot.dtsi
arch/arm/dts/sun50i-a64-pine64-plus-u-boot.dtsi new file +50 -0
new file mode 100644
index 0000000..9c61bea
@@ -0,0 +1,50 @@
+/ {
+	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>;
+	};
+};
Signature · 1 line
2.9.0
#3 lore raw

v2 cover sunxi: update Pine64 device tree

In reply to Andre Przywara

Hi Andre,

Am 23.05.2017 um 12:09 schrieb Andre Przywara:

Quoted 7 lines

an updated version: the first patch is unchanged (still the exact same DT as in Linux), but the second patch reformats the Ethernet nodes as a .dtsi and uses the new U-Boot specific DT addon feature to make it clear that these nodes are for a (preliminary) U-Boot specific binding. Once the Ethernet driver made it into Linux, we will either adapt the U-Boot driver to cope with the new binding or get a new (Designware based) driver anyway. In any case this -u-boot.dtsi can then just be removed.

Could we squash the two? Or add the .dtsi first? That would keep the series bisectable.

Cheers,
Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
#4 lore raw

v2 cover sunxi: update Pine64 device tree

Hi,

Quoted 11 lines · Andreas Färber

Hi Andre,

Am 23.05.2017 um 12:09 schrieb Andre Przywara:

Quoted 7 lines

an updated version: the first patch is unchanged (still the exact same DT as in Linux), but the second patch reformats the Ethernet nodes as a .dtsi and uses the new U-Boot specific DT addon feature to make it clear that these nodes are for a (preliminary) U-Boot specific binding. Once the Ethernet driver made it into Linux, we will either adapt the U-Boot driver to cope with the new binding or get a new (Designware based) driver anyway. In any case this -u-boot.dtsi can then just be removed.

Quoted 2 lines

Could we squash the two? Or add the .dtsi first? That would keep the series bisectable.

Yeah, now with that separate file for the Ethernet node squashing the two patches into one would be the easiest.

Chen-Yu, Maxime, are you OK with this? I can send a new version then.

Cheers,
Andre.

#5 lore raw

v2 cover sunxi: update Pine64 device tree

Quoted 14 lines · Andre Przywara

Hi,

Quoted 11 lines · Andreas Färber

Hi Andre,

Am 23.05.2017 um 12:09 schrieb Andre Przywara:

Quoted 7 lines

an updated version: the first patch is unchanged (still the exact same DT as in Linux), but the second patch reformats the Ethernet nodes as a .dtsi and uses the new U-Boot specific DT addon feature to make it clear that these nodes are for a (preliminary) U-Boot specific binding. Once the Ethernet driver made it into Linux, we will either adapt the U-Boot driver to cope with the new binding or get a new (Designware based) driver anyway. In any case this -u-boot.dtsi can then just be removed.

Quoted 7 lines
Quoted 2 lines

Could we squash the two? Or add the .dtsi first? That would keep the series bisectable.

Yeah, now with that separate file for the Ethernet node squashing the two patches into one would be the easiest.

Chen-Yu, Maxime, are you OK with this? I can send a new version then.

Yep, that works for me.

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: 801 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170524/fdea2da4/attachment.sig>
#6 lore raw

v2 cover sunxi: update Pine64 device tree

In reply to Andre Przywara
Quoted 14 lines · Andre Przywara

Hi,

Quoted 11 lines · Andreas Färber

Hi Andre,

Am 23.05.2017 um 12:09 schrieb Andre Przywara:

Quoted 7 lines

an updated version: the first patch is unchanged (still the exact same DT as in Linux), but the second patch reformats the Ethernet nodes as a .dtsi and uses the new U-Boot specific DT addon feature to make it clear that these nodes are for a (preliminary) U-Boot specific binding. Once the Ethernet driver made it into Linux, we will either adapt the U-Boot driver to cope with the new binding or get a new (Designware based) driver anyway. In any case this -u-boot.dtsi can then just be removed.

Quoted 7 lines
Quoted 2 lines

Could we squash the two? Or add the .dtsi first? That would keep the series bisectable.

Yeah, now with that separate file for the Ethernet node squashing the two patches into one would be the easiest.

Chen-Yu, Maxime, are you OK with this? I can send a new version then.

You're asking the wrong person. I'm not a maintainer for U-boot. :p

Andreas' point is valid. Keeping it in one patch means the user retains ethernet support across the changes.

ChenYu

#7 lore raw

v2 cover sunxi: update Pine64 device tree

Hi,

Quoted 18 lines · Chen-Yu Tsai
Quoted 17 lines · Andre Przywara

Hi,

Quoted 13 lines · Andreas Färber

Hi Andre,

Am 23.05.2017 um 12:09 schrieb Andre Przywara:

Quoted 7 lines

an updated version: the first patch is unchanged (still the exact same DT as in Linux), but the second patch reformats the Ethernet nodes as a .dtsi and uses the new U-Boot specific DT addon feature to make it clear that these nodes are for a (preliminary) U-Boot specific binding. Once the Ethernet driver made it into Linux, we will either adapt the U-Boot driver to cope with the new binding or get a new (Designware based) driver anyway. In any case this -u-boot.dtsi can then just be removed.

Could we squash the two? Or add the .dtsi first? That would keep the series bisectable.

Quoted 6 lines
Quoted 4 lines

Yeah, now with that separate file for the Ethernet node squashing the two patches into one would be the easiest.

Chen-Yu, Maxime, are you OK with this? I can send a new version then.

You're asking the wrong person. I'm not a maintainer for U-boot. :p

I know, but you commented on my initial post a few weeks ago (suggesting to keep the DT update in one patch) and are a valuable and knowledgeable resource anyway ;-)

Cheers,
Andre.

Quoted 5 lines

Andreas' point is valid. Keeping it in one patch means the user retains ethernet support across the changes.

ChenYu