2023-07-31 02:02:26

by Andre Przywara

[permalink] [raw]
Subject: [PATCH 0/3] sunxi: Orange Pi Zero 3 DT support

Hi,

Orange Pi recently released the Orange Pi Zero 3 board, which is some
updated version of their former Zero 2 development board. Some component
changes (Motorcomm PHY instead of Realtek, different PMIC), some board
layout changes, and it ships with up to 4GB of DRAM now. The SoC is now
labelled H618 instead of H616, which apparently is the same, just with
more L2 cache.

Split the existing OPi Zero2 DT, to allow sharing most DT nodes, then
add the binding documentation and DT for the new board.

Linux v6.5-rc boots out of the box (the PMIC driver just made it in),
and most things work: UART, PSCI, GPIO, SPI flash, SD card, USB.
Ethernet is almost working, I get an IP address via DHCP, but no further
packets come through. Might be either a problem with the new Motorcomm
PHY driver, or some missing delay settings, I have to investigate, any
help or advice welcome.
Also let me know if the DT split is a good idea or not, happy to roll
that back if requested.

Cheers,
Andre

Andre Przywara (3):
arm64: dts: allwinner: h616: Split Orange Pi Zero 2 DT
dt-bindings: arm: sunxi: document Orange Pi Zero 3 board name
arm64: dts: allwinner: h616: Add OrangePi Zero 3 board support

.../devicetree/bindings/arm/sunxi.yaml | 5 +
arch/arm64/boot/dts/allwinner/Makefile | 1 +
.../allwinner/sun50i-h616-orangepi-zero2.dts | 119 +---------------
.../allwinner/sun50i-h616-orangepi-zerox.dtsi | 131 ++++++++++++++++++
.../allwinner/sun50i-h618-orangepi-zero3.dts | 86 ++++++++++++
5 files changed, 224 insertions(+), 118 deletions(-)
create mode 100644 arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zerox.dtsi
create mode 100644 arch/arm64/boot/dts/allwinner/sun50i-h618-orangepi-zero3.dts

--
2.35.8



2023-07-31 02:04:01

by Andre Przywara

[permalink] [raw]
Subject: [PATCH 3/3] arm64: dts: allwinner: h616: Add OrangePi Zero 3 board support

The OrangePi Zero 3 is a development board based on the Allwinner H618 SoC,
which seems to be just an H616 with more L2 cache. The board itself is a
slightly updated version of the Orange Pi Zero 2. It features:
- Four ARM Cortex-A53 cores, Mali-G31 MP2 GPU
- 1/1.5/2/4 GiB LPDDR4 DRAM SKUs (only up to 1GB on the Zero2)
- AXP313a PMIC (more capable AXP305 on the Zero2)
- Raspberry-Pi-1 compatible GPIO header
- extra 13 pin expansion header, exposing pins for 2x USB 2.0 ports
- 1 USB 2.0 host port
- 1 USB 2.0 type C port (power supply + OTG)
- MicroSD slot
- on-board 16MiB bootable SPI NOR flash (only 2MB on the Zero2)
- 1Gbps Ethernet port (via Motorcomm YT8531 PHY) (RTL8211 on the Zero2)
- micro-HDMI port
- (yet) unsupported Allwinner WiFi/BT chip

Add the devicetree file describing the currently supported features,
namely LEDs, SD card, PMIC, SPI flash, Ethernet, USB.

Signed-off-by: Andre Przywara <[email protected]>
---
arch/arm64/boot/dts/allwinner/Makefile | 1 +
.../allwinner/sun50i-h618-orangepi-zero3.dts | 86 +++++++++++++++++++
2 files changed, 87 insertions(+)
create mode 100644 arch/arm64/boot/dts/allwinner/sun50i-h618-orangepi-zero3.dts

diff --git a/arch/arm64/boot/dts/allwinner/Makefile b/arch/arm64/boot/dts/allwinner/Makefile
index 6a96494a2e0a3..3b0ad54062381 100644
--- a/arch/arm64/boot/dts/allwinner/Makefile
+++ b/arch/arm64/boot/dts/allwinner/Makefile
@@ -40,3 +40,4 @@ dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h6-tanix-tx6.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h6-tanix-tx6-mini.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h616-orangepi-zero2.dtb
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h616-x96-mate.dtb
+dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h618-orangepi-zero3.dtb
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h618-orangepi-zero3.dts b/arch/arm64/boot/dts/allwinner/sun50i-h618-orangepi-zero3.dts
new file mode 100644
index 0000000000000..1964e27b7b187
--- /dev/null
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h618-orangepi-zero3.dts
@@ -0,0 +1,86 @@
+// SPDX-License-Identifier: (GPL-2.0+ or MIT)
+/*
+ * Copyright (C) 2023 Arm Ltd.
+ */
+
+/dts-v1/;
+
+#include "sun50i-h616-orangepi-zerox.dtsi"
+
+/ {
+ model = "OrangePi Zero3";
+ compatible = "xunlong,orangepi-zero3", "allwinner,sun50i-h618";
+};
+
+&emac0 {
+ phy-supply = <&reg_dldo1>;
+};
+
+&mmc0 {
+ vmmc-supply = <&reg_dldo1>;
+ broken-cd;
+};
+
+&r_i2c {
+ status = "okay";
+
+ axp313: pmic@36 {
+ compatible = "x-powers,axp313a";
+ interrupt-parent = <&pio>;
+ interrupts = <2 9 IRQ_TYPE_LEVEL_LOW>; /* PC9 */
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ reg = <0x36>;
+
+ vin1-supply = <&reg_vcc5v>;
+ vin2-supply = <&reg_vcc5v>;
+ vin3-supply = <&reg_vcc5v>;
+
+ regulators {
+ /* Supplies VCC-PLL, so needs to be always on. */
+ reg_aldo1: aldo1 {
+ regulator-always-on;
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+ regulator-name = "vcc1v8";
+ };
+
+ /* Supplies VCC-IO, so needs to be always on. */
+ reg_dldo1: dldo1 {
+ regulator-always-on;
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ regulator-name = "vcc3v3";
+ };
+
+ reg_dcdc1: dcdc1 {
+ regulator-always-on;
+ regulator-min-microvolt = <810000>;
+ regulator-max-microvolt = <1100000>;
+ regulator-name = "vdd-gpu-sys";
+ };
+
+ reg_dcdc2: dcdc2 {
+ regulator-always-on;
+ regulator-min-microvolt = <810000>;
+ regulator-max-microvolt = <990000>;
+ regulator-name = "vdd-cpu";
+ };
+
+ reg_dcdc3: dcdc3 {
+ regulator-always-on;
+ regulator-min-microvolt = <1100000>;
+ regulator-max-microvolt = <1100000>;
+ regulator-name = "vdd-dram";
+ };
+ };
+ };
+};
+
+&pio {
+ vcc-pc-supply = <&reg_dldo1>;
+ vcc-pf-supply = <&reg_dldo1>;
+ vcc-pg-supply = <&reg_aldo1>;
+ vcc-ph-supply = <&reg_dldo1>;
+ vcc-pi-supply = <&reg_dldo1>;
+};
--
2.35.8


2023-08-03 21:12:19

by Jernej Škrabec

[permalink] [raw]
Subject: Re: [PATCH 0/3] sunxi: Orange Pi Zero 3 DT support

Dne ponedeljek, 31. julij 2023 ob 03:17:22 CEST je Andre Przywara napisal(a):
> Hi,
>
> Orange Pi recently released the Orange Pi Zero 3 board, which is some
> updated version of their former Zero 2 development board. Some component
> changes (Motorcomm PHY instead of Realtek, different PMIC), some board
> layout changes, and it ships with up to 4GB of DRAM now. The SoC is now
> labelled H618 instead of H616, which apparently is the same, just with
> more L2 cache.
>
> Split the existing OPi Zero2 DT, to allow sharing most DT nodes, then
> add the binding documentation and DT for the new board.
>
> Linux v6.5-rc boots out of the box (the PMIC driver just made it in),
> and most things work: UART, PSCI, GPIO, SPI flash, SD card, USB.
> Ethernet is almost working, I get an IP address via DHCP, but no further
> packets come through. Might be either a problem with the new Motorcomm
> PHY driver, or some missing delay settings, I have to investigate, any
> help or advice welcome.

When I worked with Motorcomm PHYs, I had to add

motorcomm,clk-out-frequency-hz = <125000000>;

and usual reset gpio related properties. Have you tried that? In any case,
it's not 100% reliable, but I don't know why.

Best regards,
Jernej

> Also let me know if the DT split is a good idea or not, happy to roll
> that back if requested.
>
> Cheers,
> Andre
>
> Andre Przywara (3):
> arm64: dts: allwinner: h616: Split Orange Pi Zero 2 DT
> dt-bindings: arm: sunxi: document Orange Pi Zero 3 board name
> arm64: dts: allwinner: h616: Add OrangePi Zero 3 board support
>
> .../devicetree/bindings/arm/sunxi.yaml | 5 +
> arch/arm64/boot/dts/allwinner/Makefile | 1 +
> .../allwinner/sun50i-h616-orangepi-zero2.dts | 119 +---------------
> .../allwinner/sun50i-h616-orangepi-zerox.dtsi | 131 ++++++++++++++++++
> .../allwinner/sun50i-h618-orangepi-zero3.dts | 86 ++++++++++++
> 5 files changed, 224 insertions(+), 118 deletions(-)
> create mode 100644
> arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zerox.dtsi create mode
> 100644 arch/arm64/boot/dts/allwinner/sun50i-h618-orangepi-zero3.dts





2023-08-04 12:04:04

by Andre Przywara

[permalink] [raw]
Subject: Re: [PATCH 0/3] sunxi: Orange Pi Zero 3 DT support

On Thu, 03 Aug 2023 23:07:55 +0200
Jernej Škrabec <[email protected]> wrote:

Hi Jernej,

> Dne ponedeljek, 31. julij 2023 ob 03:17:22 CEST je Andre Przywara napisal(a):
> > Hi,
> >
> > Orange Pi recently released the Orange Pi Zero 3 board, which is some
> > updated version of their former Zero 2 development board. Some component
> > changes (Motorcomm PHY instead of Realtek, different PMIC), some board
> > layout changes, and it ships with up to 4GB of DRAM now. The SoC is now
> > labelled H618 instead of H616, which apparently is the same, just with
> > more L2 cache.
> >
> > Split the existing OPi Zero2 DT, to allow sharing most DT nodes, then
> > add the binding documentation and DT for the new board.
> >
> > Linux v6.5-rc boots out of the box (the PMIC driver just made it in),
> > and most things work: UART, PSCI, GPIO, SPI flash, SD card, USB.
> > Ethernet is almost working, I get an IP address via DHCP, but no further
> > packets come through. Might be either a problem with the new Motorcomm
> > PHY driver, or some missing delay settings, I have to investigate, any
> > help or advice welcome.
>
> When I worked with Motorcomm PHYs, I had to add
>
> motorcomm,clk-out-frequency-hz = <125000000>;

Ah, good point. Looking at the Linux driver code, that seems almost
mandatory, otherwise the PHY clock is not activated(?).
So that helped, I managed to SSH into my laptop, but it still hangs then.

Just for the sake of completeness, I also tried the other properties that
other boards use: As expected, motorcomm,keep-pll-enabled didn't help, as
the clock line just goes to the MAC pin, and is not used otherwise.
And also motorcomm,auto-sleep-disabled didn't improve stability. At least
not with the current settings, maybe it's needed later on.

> and usual reset gpio related properties. Have you tried that? In any case,
> it's not 100% reliable, but I don't know why.

The reset pin is hardwired via a simple RC circuit, so there is no GPIO,
and thus the delay parameters don't do anything, I suppose.

But as it's better now with the clk-out property, so I will definitely add
that.
Reports from others (Piotr) seem to suggest that Ethernet is working for
them, so I need to compare notes.

Thanks,
Andre

>
> Best regards,
> Jernej
>
> > Also let me know if the DT split is a good idea or not, happy to roll
> > that back if requested.
> >
> > Cheers,
> > Andre
> >
> > Andre Przywara (3):
> > arm64: dts: allwinner: h616: Split Orange Pi Zero 2 DT
> > dt-bindings: arm: sunxi: document Orange Pi Zero 3 board name
> > arm64: dts: allwinner: h616: Add OrangePi Zero 3 board support
> >
> > .../devicetree/bindings/arm/sunxi.yaml | 5 +
> > arch/arm64/boot/dts/allwinner/Makefile | 1 +
> > .../allwinner/sun50i-h616-orangepi-zero2.dts | 119 +---------------
> > .../allwinner/sun50i-h616-orangepi-zerox.dtsi | 131 ++++++++++++++++++
> > .../allwinner/sun50i-h618-orangepi-zero3.dts | 86 ++++++++++++
> > 5 files changed, 224 insertions(+), 118 deletions(-)
> > create mode 100644
> > arch/arm64/boot/dts/allwinner/sun50i-h616-orangepi-zerox.dtsi create mode
> > 100644 arch/arm64/boot/dts/allwinner/sun50i-h618-orangepi-zero3.dts
>
>
>
>
>