Skip to contentSkip to conversation

arm64: dts: allwinner: Various DT fixes

PATCH In review Andre Przywara 4 participants 13 messages Jan 13, 2021 – Jan 14, 2021

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

v2 cover arm64: dts: allwinner: Various DT fixes

Hi,

small update, mostly adding Fixes: tags.
Patch 1/7 has been split up to cover A64 and H6 separately.

I tried to reach out to people with Pine64-LTS boards to clarify on the blue LED, as it seems like production boards are spread thinly across developers. We got confirmation from several people with several board revisions that this LED works and is indeed blue.

I also double checked on the CD pin situation on the two SoPine SOMs I have, and could confirm their functionality.

Rebased on top of sunxi/dt-for-5.12.

================
a collection of DT fixes I gathered over time:

- Adding usbphy references to [EO]HCI0 nodes (A64, H6)
- Adding Pine64-LTS status LED
- Dropping non-removable from SoPine/Pine64-LTS SD card
- Enabling HS200 @ 150 MHz on Pine H64 (H6)
- Enabling HS200 @ 150 MHz on Pine64-LTS

For details please see the individual patches!

Thanks,
Andre

Changelog v1 .. v2:
- Add Fixes: tags
- Add Chen-Yu's ACKs
- split USB PHY 0 link patch

Andre Przywara (8):
arm64: dts: allwinner: A64: properly connect USB PHY to port 0
arm64: dts: allwinner: H6: properly connect USB PHY to port 0
arm64: dts: allwinner: Pine64-LTS: Add status LED
arm64: dts: allwinner: Drop non-removable from SoPine/LTS SD card
arm64: dts: allwinner: H6: Allow up to 150 MHz MMC bus frequency
arm64: dts: allwinner: A64: Limit MMC2 bus frequency to 150 MHz
arm64: dts: allwinner: Pine64-LTS/SoPine: Enable HS200 eMMC mode
arm64: dts: allwinner: Pine H64: Enable HS200 eMMC mode

 .../boot/dts/allwinner/sun50i-a64-pine64-lts.dts      | 11 +++++++++++
 arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts |  5 +----
 .../dts/allwinner/sun50i-a64-sopine-baseboard.dts     |  1 +
 arch/arm64/boot/dts/allwinner/sun50i-a64-sopine.dtsi  |  1 -
 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi         |  6 +++++-
 arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts  |  1 +
 arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi          |  7 +++++++
 7 files changed, 26 insertions(+), 6 deletions(-)
Signature · 1 line
2.17.5
#1 lore raw

PATCH v2 1/8 arm64: dts: allwinner: A64: properly connect USB PHY to port 0

In recent Allwinner SoCs the first USB host controller (HCI0) shares the first PHY with the MUSB controller. Probably to make this sharing work, we were avoiding to declare this in the DT. This has two shortcomings:
- U-Boot (which uses the same .dts) cannot use this port in host mode without a PHY linked, so we were loosing one USB port there.
- It requires the MUSB driver to be enabled and loaded, although we don't actually use it.

To avoid those issues, let's add this PHY link to the A64 .dtsi file. After all PHY port 0 *is* connected to HCI0, so we should describe it as this. Remove the part from the Pinebook DTS which already had this property.

This makes it work in U-Boot, also improves compatiblity when no MUSB driver is loaded (for instance in distribution installers).

Fixes dc03a047df1d ("arm64: allwinner: a64: add EHCI0/OHCI0 nodes to A64 DTSI")
---
 arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts | 4 ----
 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi         | 4 ++++
 2 files changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts +0 -4
index 896f34fd9fc3..d07cf05549c3 100644
@@ -126,8 +126,6 @@
 };
 
 &ehci0 {
-	phys = <&usbphy 0>;
-	phy-names = "usb";
 	status = "okay";
 };
 
@@ -177,8 +175,6 @@
 };
 
 &ohci0 {
-	phys = <&usbphy 0>;
-	phy-names = "usb";
 	status = "okay";
 };
 
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi +4 -0
index 51cc30e84e26..19e9b8ca8432 100644
@@ -593,6 +593,8 @@
 				 <&ccu CLK_USB_OHCI0>;
 			resets = <&ccu RST_BUS_OHCI0>,
 				 <&ccu RST_BUS_EHCI0>;
+			phys = <&usbphy 0>;
+			phy-names = "usb";
 			status = "disabled";
 		};
 
@@ -603,6 +605,8 @@
 			clocks = <&ccu CLK_BUS_OHCI0>,
 				 <&ccu CLK_USB_OHCI0>;
 			resets = <&ccu RST_BUS_OHCI0>;
+			phys = <&usbphy 0>;
+			phy-names = "usb";
 			status = "disabled";
 		};
 
Signature · 1 line
2.17.5
#2 lore raw

PATCH v2 2/8 arm64: dts: allwinner: H6: properly connect USB PHY to port 0

In reply to Andre Przywara

In recent Allwinner SoCs the first USB host controller (HCI0) shares the first PHY with the MUSB controller. Probably to make this sharing work, we were avoiding to declare this in the DT. This has two shortcomings:
- U-Boot (which uses the same .dts) cannot use this port in host mode without a PHY linked, so we were loosing one USB port there.
- It requires the MUSB driver to be enabled and loaded, although we don't actually use it.

To avoid those issues, let's add this PHY link to the H6 .dtsi file. After all PHY port 0 *is* connected to HCI0, so we should describe it as this.

This makes it work in U-Boot, also improves compatiblity when no MUSB driver is loaded (for instance in distribution installers).

Fixes eabb3d424b6d ("arm64: dts: allwinner: h6: add USB2-related device nodes")
---
 arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi +4 -0
index 8a62a9fbe347..f593cfeaecc9 100644
@@ -680,6 +680,8 @@
 				 <&ccu CLK_USB_OHCI0>;
 			resets = <&ccu RST_BUS_OHCI0>,
 				 <&ccu RST_BUS_EHCI0>;
+			phys = <&usb2phy 0>;
+			phy-names = "usb";
 			status = "disabled";
 		};
 
@@ -690,6 +692,8 @@
 			clocks = <&ccu CLK_BUS_OHCI0>,
 				 <&ccu CLK_USB_OHCI0>;
 			resets = <&ccu RST_BUS_OHCI0>;
+			phys = <&usb2phy 0>;
+			phy-names = "usb";
 			status = "disabled";
 		};
 
Signature · 1 line
2.17.5
#3 lore raw

PATCH v2 3/8 arm64: dts: allwinner: Pine64-LTS: Add status LED

In reply to Andre Przywara

The Pine64-LTS board features a blue status LED on pin PL7.

Describe it in the DT.

---
 .../boot/dts/allwinner/sun50i-a64-pine64-lts.dts      | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-lts.dts +11 -0
index 302e24be0a31..93d271fdbb6c 100644
@@ -1,10 +1,21 @@
 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 // Copyright (c) 2018 ARM Ltd.
 
+#include <dt-bindings/leds/common.h>
 #include "sun50i-a64-sopine-baseboard.dts"
 
 / {
 	model = "Pine64 LTS";
 	compatible = "pine64,pine64-lts", "allwinner,sun50i-r18",
 		     "allwinner,sun50i-a64";
+
+	led {
+		compatible = "gpio-leds";
+
+		status {
+			function = LED_FUNCTION_STATUS;
+			color = <LED_COLOR_ID_BLUE>;
+			gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */
+		};
+	};
 };
Signature · 1 line
2.17.5
#5 lore raw

Re: [PATCH v2 3/8] arm64: dts: allwinner: Pine64-LTS: Add status LED

In reply to Andre Przywara

Hi,

Quoted 23 lines · Andre Przywara

The Pine64-LTS board features a blue status LED on pin PL7.

Describe it in the DT.

---
 .../boot/dts/allwinner/sun50i-a64-pine64-lts.dts      | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-lts.dts +1 -0
index 302e24be0a31..93d271fdbb6c 100644
@@ -1,10 +1,21 @@
 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 // Copyright (c) 2018 ARM Ltd.
 
+#include <dt-bindings/leds/common.h>
 #include "sun50i-a64-sopine-baseboard.dts"
 
 / {
 	model = "Pine64 LTS";
 	compatible = "pine64,pine64-lts", "allwinner,sun50i-r18",

arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-lts.dts line 19

Quoted 10 lines
arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-lts.dts +9 -0
 		     "allwinner,sun50i-a64";
+
+	led {
+		compatible = "gpio-leds";
+
+		status {
+			function = LED_FUNCTION_STATUS;
+			color = <LED_COLOR_ID_BLUE>;
+			gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */
+		};

Thanks for fixing the node names, but I guess my comment was a bit too
vague: it's status that needed to be changed, not the upper level one.

I've updated it while applying

Maxime

#6 lore raw

PATCH v2 4/8 arm64: dts: allwinner: Drop non-removable from SoPine/LTS SD card

In reply to Andre Przywara

The SD card on the SoPine SoM module is somewhat concealed, so was originally defined as "non-removable".
However there is a working card-detect pin (tested on two different SoM versions), and in certain SoM base boards it might be actually accessible at runtime.
Also the Pine64-LTS shares the SoPine base .dtsi, so inherited the non-removable flag, even though the SD card slot is perfectly accessible and usable there. (It turns out that just *my* board has a broken card detect switch, so I originally thought CD wouldn't work on the LTS.)

Drop the "non-removable" flag to describe the SD card slot properly.

Fixes c3904a269891 ("arm64: allwinner: a64: add DTSI file for SoPine SoM")
---
 arch/arm64/boot/dts/allwinner/sun50i-a64-sopine.dtsi | 1 -
 1 file changed, 1 deletion(-)
arch/arm64/boot/dts/allwinner/sun50i-a64-sopine.dtsi +0 -1
index c48692b06e1f..3402cec87035 100644
@@ -32,7 +32,6 @@
 	pinctrl-names = "default";
 	pinctrl-0 = <&mmc0_pins>;
 	vmmc-supply = <&reg_dcdc1>;
-	non-removable;
 	disable-wp;
 	bus-width = <4>;
 	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
Signature · 1 line
2.17.5
#7 lore raw

PATCH v2 5/8 arm64: dts: allwinner: H6: Allow up to 150 MHz MMC bus frequency

In reply to Andre Przywara

The H6 manual explicitly lists a frequency limit of 150 MHz for the bus frequency of the MMC controllers. So far we had no explicit limits in the DT, which limited eMMC to the spec defined frequencies, or whatever the driver defines (both Linux and FreeBSD use 52 MHz here).

Put those maximum frequencies in the SoC .dtsi, to allow higher speed modes (which still would need to be explicitly enabled, per board).

Tested with an eMMC using HS-200 on a Pine H64. Running at the spec'ed 200 MHz indeed fails with I/O errors, but 150 MHz seems to work stably.

Fixes 8f54bd1595b3 ("arm64: allwinner: h6: add device tree nodes for MMC controllers")
---
 arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 3 +++
 1 file changed, 3 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi +3 -0
index f593cfeaecc9..77765d4a05ec 100644
@@ -436,6 +436,7 @@
 			interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>;
 			pinctrl-names = "default";
 			pinctrl-0 = <&mmc0_pins>;
+			max-frequency = <150000000>;
 			status = "disabled";
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -452,6 +453,7 @@
 			interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
 			pinctrl-names = "default";
 			pinctrl-0 = <&mmc1_pins>;
+			max-frequency = <150000000>;
 			status = "disabled";
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -468,6 +470,7 @@
 			interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_HIGH>;
 			pinctrl-names = "default";
 			pinctrl-0 = <&mmc2_pins>;
+			max-frequency = <150000000>;
 			status = "disabled";
 			#address-cells = <1>;
 			#size-cells = <0>;
Signature · 1 line
2.17.5
#8 lore raw

PATCH v2 6/8 arm64: dts: allwinner: A64: Limit MMC2 bus frequency to 150 MHz

In reply to Andre Przywara

In contrast to the H6 (and later) manuals, the A64 datasheet does not specify any limitations in the maximum possible frequency for eMMC controllers.
However experimentation has found that a 150 MHz limit similar to other SoCs and also the MMC0 and MMC1 controllers on the A64 seems to exist for the MMC2 controller.

Limit the frequency for the MMC2 controller to 150 MHz in the SoC .dtsi. The Pinebook seems to be the an odd exception, since it apparently seems to work with 200 MHz as well, so overwrite this in its board .dts file.

Tested on a Pine64-LTS: 200 MHz HS-200 fails, 150 MHz HS-200 works.

Fixes 22be992faea7 ("arm64: allwinner: a64: Increase the MMC max frequency")
---
 arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts | 1 +
 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi         | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts +1 -0
index d07cf05549c3..7ae16541d14f 100644
@@ -167,6 +167,7 @@
 	pinctrl-0 = <&mmc2_pins>, <&mmc2_ds_pin>;
 	vmmc-supply = <&reg_dcdc1>;
 	vqmmc-supply = <&reg_eldo1>;
+	max-frequency = <200000000>;
 	bus-width = <8>;
 	non-removable;
 	cap-mmc-hw-reset;
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi +1 -1
index 19e9b8ca8432..57786fc120c3 100644
@@ -514,7 +514,7 @@
 			resets = <&ccu RST_BUS_MMC2>;
 			reset-names = "ahb";
 			interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>;
-			max-frequency = <200000000>;
+			max-frequency = <150000000>;
 			status = "disabled";
 			#address-cells = <1>;
 			#size-cells = <0>;
Signature · 1 line
2.17.5
#9 lore raw

PATCH v2 7/8 arm64: dts: allwinner: Pine64-LTS/SoPine: Enable HS200 eMMC mode

In reply to Andre Przywara

The eMMC modules offered for the Pine64 boards are capable of the HS200 eMMC speed mode, when observing the frequency limit of 150 MHz.

Enable that in the DT.

This increases the interface speed from ~80 MB/s to ~120 MB/s.

---
 arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts +1 -0
index d4069749d721..e22b94c83647 100644
@@ -111,6 +111,7 @@
 	bus-width = <8>;
 	non-removable;
 	cap-mmc-hw-reset;
+	mmc-hs200-1_8v;
 	status = "okay";
 };
 
Signature · 1 line
2.17.5
#10 lore raw

PATCH v2 8/8 arm64: dts: allwinner: Pine H64: Enable HS200 eMMC mode

In reply to Andre Przywara

The eMMC modules offered for the Pine64 boards are capable of the HS200 eMMC speed mode, when observing the frequency limit of 150 MHz.

Enable that in the DT.

This increases the interface speed from ~80 MB/s to ~120 MB/s.

---
 arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64.dts +1 -0
index 961732c52aa0..15ceba027a73 100644
@@ -142,6 +142,7 @@
 	vqmmc-supply = <&reg_bldo2>;
 	non-removable;
 	cap-mmc-hw-reset;
+	mmc-hs200-1_8v;
 	bus-width = <8>;
 	status = "okay";
 };
Signature · 1 line
2.17.5
Acked-by on the v2 series
#11 lore raw
In reply to Andre Przywara
Quoted 35 lines · Andre Przywara

Hi,

small update, mostly adding Fixes: tags.
Patch 1/7 has been split up to cover A64 and H6 separately.

I tried to reach out to people with Pine64-LTS boards to clarify on the blue LED, as it seems like production boards are spread thinly across developers. We got confirmation from several people with several board revisions that this LED works and is indeed blue.

I also double checked on the CD pin situation on the two SoPine SOMs I have, and could confirm their functionality.

Rebased on top of sunxi/dt-for-5.12.

================
a collection of DT fixes I gathered over time:

- Adding usbphy references to [EO]HCI0 nodes (A64, H6)
- Adding Pine64-LTS status LED
- Dropping non-removable from SoPine/Pine64-LTS SD card
- Enabling HS200 @ 150 MHz on Pine H64 (H6)
- Enabling HS200 @ 150 MHz on Pine64-LTS

For details please see the individual patches!

Thanks,
Andre

Changelog v1 .. v2:
- Add Fixes: tags
- Add Chen-Yu's ACKs
- split USB PHY 0 link patch

Quoted 9 lines

Andre Przywara (8):
arm64: dts: allwinner: A64: properly connect USB PHY to port 0
arm64: dts: allwinner: H6: properly connect USB PHY to port 0
arm64: dts: allwinner: Pine64-LTS: Add status LED
arm64: dts: allwinner: Drop non-removable from SoPine/LTS SD card
arm64: dts: allwinner: H6: Allow up to 150 MHz MMC bus frequency
arm64: dts: allwinner: A64: Limit MMC2 bus frequency to 150 MHz
arm64: dts: allwinner: Pine64-LTS/SoPine: Enable HS200 eMMC mode
arm64: dts: allwinner: Pine H64: Enable HS200 eMMC mode

Everything looks good to me.

#12 lore raw
In reply to Andre Przywara
Quoted 18 lines · Andre Przywara

Hi,

small update, mostly adding Fixes: tags.
Patch 1/7 has been split up to cover A64 and H6 separately.

I tried to reach out to people with Pine64-LTS boards to clarify on the blue LED, as it seems like production boards are spread thinly across developers. We got confirmation from several people with several board revisions that this LED works and is indeed blue.

I also double checked on the CD pin situation on the two SoPine SOMs I have, and could confirm their functionality.

Rebased on top of sunxi/dt-for-5.12.

================
a collection of DT fixes I gathered over time:

Quoted 7 lines

- Adding usbphy references to [EO]HCI0 nodes (A64, H6)
- Adding Pine64-LTS status LED
- Dropping non-removable from SoPine/Pine64-LTS SD card
- Enabling HS200 @ 150 MHz on Pine H64 (H6)
- Enabling HS200 @ 150 MHz on Pine64-LTS

For details please see the individual patches!

Applied the series (with the fix mentionned in patch 3)

Thanks!
Maxime