[PATCH v2 0/3] sunxi: add OrangePi Zero 3 board support

A small update for the OrangePi Zero 3 support series. This fixes USB support, and upgrades the DRAM clock to 792, for better stability (as the other DRAM parameters were tailored to that frequency). I added the tags on the way. Please test!
================= The OrangePi Zero 3 is a small development board featuring the Allwinner H618 SoC. Compared to its predecessor OrangePi Zero 2, the new board uses LPDDR4 DRAM instead of DDR3 DRAM, and an X-Powers AXP313 PMIC instead of the AXP305. U-Boot gained support for both LPDDR4 DRAM and the new PMIC just recently, so add a user for those features by adding a defconfig for the new board. To make this work, patch 1/3 introduces support for zBIT SPI NOR flash chip, and patch 2/3 removes the default AXP305 PMIC selection when compiling for H616 SoCs. Patch 3/3 then adds the defconfig. The DT was already synced from the Linux kernel repo a few weeks ago.
Cheers, Andre
Changelog v1 .. v2: - add tags - set DRAM clock to 792 MHz (from the default 720 MHz) - fix USB support by supplying USB VBUS enable GPIO
Andre Przywara (3): mtd: spi-nor: Add support for zBIT ZB25VQ128 sunxi: H616: remove default AXP305 selection sunxi: H616: Add OrangePi Zero 3 board support
arch/arm/dts/Makefile | 1 + board/sunxi/MAINTAINERS | 5 +++++ configs/orangepi_zero2_defconfig | 1 + configs/orangepi_zero3_defconfig | 32 ++++++++++++++++++++++++++++++++ configs/x96_mate_defconfig | 1 + drivers/mtd/spi/Kconfig | 5 +++++ drivers/mtd/spi/spi-nor-ids.c | 5 +++++ drivers/power/Kconfig | 1 - 8 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 configs/orangepi_zero3_defconfig

Add support for the zBIT ZB25VQ128 (128M-bit) SPI NOR flash memory chip, as used on the Xunlong Orange Pi Zero 3 board.
Signed-off-by: Andre Przywara andre.przywara@arm.com --- drivers/mtd/spi/Kconfig | 5 +++++ drivers/mtd/spi/spi-nor-ids.c | 5 +++++ 2 files changed, 10 insertions(+)
diff --git a/drivers/mtd/spi/Kconfig b/drivers/mtd/spi/Kconfig index 732b0760452..abed392c28d 100644 --- a/drivers/mtd/spi/Kconfig +++ b/drivers/mtd/spi/Kconfig @@ -224,6 +224,11 @@ config SPI_FLASH_XTX Add support for various XTX (XTX Technology Limited) SPI flash chips (XT25xxx).
+config SPI_FLASH_ZBIT + bool "ZBIT SPI flash support" + help + Add support for Zbit Semiconductor Inc. SPI flash chips (ZB25xxx). + endif
config SPI_FLASH_USE_4K_SECTORS diff --git a/drivers/mtd/spi/spi-nor-ids.c b/drivers/mtd/spi/spi-nor-ids.c index 3cb132dcffc..f86e7ff8e58 100644 --- a/drivers/mtd/spi/spi-nor-ids.c +++ b/drivers/mtd/spi/spi-nor-ids.c @@ -571,6 +571,11 @@ const struct flash_info spi_nor_ids[] = { SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) }, { INFO("xt25w01g", 0x0b651B, 0, 64 * 1024, 2048, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) }, +#endif +#ifdef CONFIG_SPI_FLASH_ZBIT + /* Zbit Semiconductor Inc. */ + { INFO("zb25vq128", 0x5e4018, 0, 64 * 1024, 256, + SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) }, #endif { }, };

On Mon, 4 Dec 2023 00:59:52 +0000 Andre Przywara andre.przywara@arm.com wrote:
Hi,
Add support for the zBIT ZB25VQ128 (128M-bit) SPI NOR flash memory chip, as used on the Xunlong Orange Pi Zero 3 board.
does anyone have any objections against this patch? I wanted to take this via the sunxi tree, as this blocks some board support patches.
IIUC Linux gave up on adding rather generic entries up for each and every SPI NOR chip, if there is nothing special about them: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i... Should we follow suit here?
Cheers, Andre
Signed-off-by: Andre Przywara andre.przywara@arm.com
drivers/mtd/spi/Kconfig | 5 +++++ drivers/mtd/spi/spi-nor-ids.c | 5 +++++ 2 files changed, 10 insertions(+)
diff --git a/drivers/mtd/spi/Kconfig b/drivers/mtd/spi/Kconfig index 732b0760452..abed392c28d 100644 --- a/drivers/mtd/spi/Kconfig +++ b/drivers/mtd/spi/Kconfig @@ -224,6 +224,11 @@ config SPI_FLASH_XTX Add support for various XTX (XTX Technology Limited) SPI flash chips (XT25xxx).
+config SPI_FLASH_ZBIT
- bool "ZBIT SPI flash support"
- help
Add support for Zbit Semiconductor Inc. SPI flash chips (ZB25xxx).
endif
config SPI_FLASH_USE_4K_SECTORS diff --git a/drivers/mtd/spi/spi-nor-ids.c b/drivers/mtd/spi/spi-nor-ids.c index 3cb132dcffc..f86e7ff8e58 100644 --- a/drivers/mtd/spi/spi-nor-ids.c +++ b/drivers/mtd/spi/spi-nor-ids.c @@ -571,6 +571,11 @@ const struct flash_info spi_nor_ids[] = { SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) }, { INFO("xt25w01g", 0x0b651B, 0, 64 * 1024, 2048, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) }, +#endif +#ifdef CONFIG_SPI_FLASH_ZBIT
- /* Zbit Semiconductor Inc. */
- { INFO("zb25vq128", 0x5e4018, 0, 64 * 1024, 256,
SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
#endif { }, };

Hello Andre,
On 2023-12-06 17:24, Andre Przywara wrote:
On Mon, 4 Dec 2023 00:59:52 +0000 Andre Przywara andre.przywara@arm.com wrote:
Add support for the zBIT ZB25VQ128 (128M-bit) SPI NOR flash memory chip, as used on the Xunlong Orange Pi Zero 3 board.
does anyone have any objections against this patch? I wanted to take this via the sunxi tree, as this blocks some board support patches.
The patch looks perfectly fine to me. Thus,
Reviewed-by: Dragan Simic dsimic@manjaro.org
IIUC Linux gave up on adding rather generic entries up for each and every SPI NOR chip, if there is nothing special about them: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i... Should we follow suit here?
I think it would be good to employ the same approach, to make it easier to support more chips and more boards in the future. Also, at least a few already existing chip definitions could be dropped, after testing, of course. Simplifying the things is almost always a good choice.
As visible in [1] and [2], the Linux kernel no longer accepts entries for the chips that can be detected automatically and don't require some specific fixes.
[1] https://lore.kernel.org/linux-mtd/542998283b464d19fa5f354898de79df@walle.cc/... [2] https://lore.kernel.org/linux-mtd/20231123160721.64561-2-tudor.ambarus@linar...
Signed-off-by: Andre Przywara andre.przywara@arm.com
drivers/mtd/spi/Kconfig | 5 +++++ drivers/mtd/spi/spi-nor-ids.c | 5 +++++ 2 files changed, 10 insertions(+)
diff --git a/drivers/mtd/spi/Kconfig b/drivers/mtd/spi/Kconfig index 732b0760452..abed392c28d 100644 --- a/drivers/mtd/spi/Kconfig +++ b/drivers/mtd/spi/Kconfig @@ -224,6 +224,11 @@ config SPI_FLASH_XTX Add support for various XTX (XTX Technology Limited) SPI flash chips (XT25xxx).
+config SPI_FLASH_ZBIT
- bool "ZBIT SPI flash support"
- help
Add support for Zbit Semiconductor Inc. SPI flash chips (ZB25xxx).
endif
config SPI_FLASH_USE_4K_SECTORS diff --git a/drivers/mtd/spi/spi-nor-ids.c b/drivers/mtd/spi/spi-nor-ids.c index 3cb132dcffc..f86e7ff8e58 100644 --- a/drivers/mtd/spi/spi-nor-ids.c +++ b/drivers/mtd/spi/spi-nor-ids.c @@ -571,6 +571,11 @@ const struct flash_info spi_nor_ids[] = { SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) }, { INFO("xt25w01g", 0x0b651B, 0, 64 * 1024, 2048, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_4B_OPCODES) }, +#endif +#ifdef CONFIG_SPI_FLASH_ZBIT
- /* Zbit Semiconductor Inc. */
- { INFO("zb25vq128", 0x5e4018, 0, 64 * 1024, 256,
SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
#endif { }, };

On Wed, Dec 06, 2023 at 04:24:43PM +0000, Andre Przywara wrote:
On Mon, 4 Dec 2023 00:59:52 +0000 Andre Przywara andre.przywara@arm.com wrote:
Hi,
Add support for the zBIT ZB25VQ128 (128M-bit) SPI NOR flash memory chip, as used on the Xunlong Orange Pi Zero 3 board.
does anyone have any objections against this patch? I wanted to take this via the sunxi tree, as this blocks some board support patches.
IIUC Linux gave up on adding rather generic entries up for each and every SPI NOR chip, if there is nothing special about them: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i... Should we follow suit here?
And we could then start trimming the table we do have as well, to reclaim space?

On 2023-12-09 21:34, Tom Rini wrote:
On Wed, Dec 06, 2023 at 04:24:43PM +0000, Andre Przywara wrote:
On Mon, 4 Dec 2023 00:59:52 +0000 Andre Przywara andre.przywara@arm.com wrote:
Hi,
Add support for the zBIT ZB25VQ128 (128M-bit) SPI NOR flash memory chip, as used on the Xunlong Orange Pi Zero 3 board.
does anyone have any objections against this patch? I wanted to take this via the sunxi tree, as this blocks some board support patches.
IIUC Linux gave up on adding rather generic entries up for each and every SPI NOR chip, if there is nothing special about them: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i... Should we follow suit here?
And we could then start trimming the table we do have as well, to reclaim space?
In general, yes, but we'd also need to consume a bit more space with the additional auto-detection logic.

On Sat, Dec 09, 2023 at 09:37:28PM +0100, Dragan Simic wrote:
On 2023-12-09 21:34, Tom Rini wrote:
On Wed, Dec 06, 2023 at 04:24:43PM +0000, Andre Przywara wrote:
On Mon, 4 Dec 2023 00:59:52 +0000 Andre Przywara andre.przywara@arm.com wrote:
Hi,
Add support for the zBIT ZB25VQ128 (128M-bit) SPI NOR flash memory chip, as used on the Xunlong Orange Pi Zero 3 board.
does anyone have any objections against this patch? I wanted to take this via the sunxi tree, as this blocks some board support patches.
IIUC Linux gave up on adding rather generic entries up for each and every SPI NOR chip, if there is nothing special about them: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i... Should we follow suit here?
And we could then start trimming the table we do have as well, to reclaim space?
In general, yes, but we'd also need to consume a bit more space with the additional auto-detection logic.
Maybe part one of the series is backport that logic, part two is remove all the easy to remove tables? Or at least a number of them so the series is a wash and then a targeted series of drop-an-entry and cc the person that added it so they can run-time verify it's still fine?

On 2023-12-09 21:43, Tom Rini wrote:
On Sat, Dec 09, 2023 at 09:37:28PM +0100, Dragan Simic wrote:
On 2023-12-09 21:34, Tom Rini wrote:
On Wed, Dec 06, 2023 at 04:24:43PM +0000, Andre Przywara wrote:
On Mon, 4 Dec 2023 00:59:52 +0000 Andre Przywara andre.przywara@arm.com wrote:
Hi,
Add support for the zBIT ZB25VQ128 (128M-bit) SPI NOR flash memory chip, as used on the Xunlong Orange Pi Zero 3 board.
does anyone have any objections against this patch? I wanted to take this via the sunxi tree, as this blocks some board support patches.
IIUC Linux gave up on adding rather generic entries up for each and every SPI NOR chip, if there is nothing special about them: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i... Should we follow suit here?
And we could then start trimming the table we do have as well, to reclaim space?
In general, yes, but we'd also need to consume a bit more space with the additional auto-detection logic.
Maybe part one of the series is backport that logic, part two is remove all the easy to remove tables? Or at least a number of them so the series is a wash and then a targeted series of drop-an-entry and cc the person that added it so they can run-time verify it's still fine?
Sounds like a plan to me and I'm willing to work on that. Though, I think we'll inevitably end up with increasing the resulting image sizes a bit, but that might be an acceptable trade-off for making supporting more SPI chips and more new boards much easier in the future.

On Sat, Dec 09, 2023 at 10:02:09PM +0100, Dragan Simic wrote:
On 2023-12-09 21:43, Tom Rini wrote:
On Sat, Dec 09, 2023 at 09:37:28PM +0100, Dragan Simic wrote:
On 2023-12-09 21:34, Tom Rini wrote:
On Wed, Dec 06, 2023 at 04:24:43PM +0000, Andre Przywara wrote:
On Mon, 4 Dec 2023 00:59:52 +0000 Andre Przywara andre.przywara@arm.com wrote:
Hi,
Add support for the zBIT ZB25VQ128 (128M-bit) SPI NOR flash memory chip, as used on the Xunlong Orange Pi Zero 3 board.
does anyone have any objections against this patch? I wanted to take this via the sunxi tree, as this blocks some board support patches.
IIUC Linux gave up on adding rather generic entries up for each and every SPI NOR chip, if there is nothing special about them: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i... Should we follow suit here?
And we could then start trimming the table we do have as well, to reclaim space?
In general, yes, but we'd also need to consume a bit more space with the additional auto-detection logic.
Maybe part one of the series is backport that logic, part two is remove all the easy to remove tables? Or at least a number of them so the series is a wash and then a targeted series of drop-an-entry and cc the person that added it so they can run-time verify it's still fine?
Sounds like a plan to me and I'm willing to work on that. Though, I think we'll inevitably end up with increasing the resulting image sizes a bit, but that might be an acceptable trade-off for making supporting more SPI chips and more new boards much easier in the future.
Yeah, this is where we need to go overall long term if nothing else.

On 2023-12-09 22:21, Tom Rini wrote:
On Sat, Dec 09, 2023 at 10:02:09PM +0100, Dragan Simic wrote:
On 2023-12-09 21:43, Tom Rini wrote:
On Sat, Dec 09, 2023 at 09:37:28PM +0100, Dragan Simic wrote:
On 2023-12-09 21:34, Tom Rini wrote:
On Wed, Dec 06, 2023 at 04:24:43PM +0000, Andre Przywara wrote:
On Mon, 4 Dec 2023 00:59:52 +0000 Andre Przywara andre.przywara@arm.com wrote: > Add support for the zBIT ZB25VQ128 (128M-bit) SPI NOR flash memory chip, > as used on the Xunlong Orange Pi Zero 3 board.
does anyone have any objections against this patch? I wanted to take this via the sunxi tree, as this blocks some board support patches.
IIUC Linux gave up on adding rather generic entries up for each and every SPI NOR chip, if there is nothing special about them: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i... Should we follow suit here?
And we could then start trimming the table we do have as well, to reclaim space?
In general, yes, but we'd also need to consume a bit more space with the additional auto-detection logic.
Maybe part one of the series is backport that logic, part two is remove all the easy to remove tables? Or at least a number of them so the series is a wash and then a targeted series of drop-an-entry and cc the person that added it so they can run-time verify it's still fine?
Sounds like a plan to me and I'm willing to work on that. Though, I think we'll inevitably end up with increasing the resulting image sizes a bit, but that might be an acceptable trade-off for making supporting more SPI chips and more new boards much easier in the future.
Yeah, this is where we need to go overall long term if nothing else.
I agree, it would make the things a bit easier. I'll see to start working on it next week.

On Sat, Dec 09, 2023 at 10:43:35PM +0100, Dragan Simic wrote:
On 2023-12-09 22:21, Tom Rini wrote:
On Sat, Dec 09, 2023 at 10:02:09PM +0100, Dragan Simic wrote:
On 2023-12-09 21:43, Tom Rini wrote:
On Sat, Dec 09, 2023 at 09:37:28PM +0100, Dragan Simic wrote:
On 2023-12-09 21:34, Tom Rini wrote:
On Wed, Dec 06, 2023 at 04:24:43PM +0000, Andre Przywara wrote: > On Mon, 4 Dec 2023 00:59:52 +0000 > Andre Przywara andre.przywara@arm.com wrote: > > Add support for the zBIT ZB25VQ128 (128M-bit) SPI NOR flash memory chip, > > as used on the Xunlong Orange Pi Zero 3 board. > > does anyone have any objections against this patch? I wanted to take > this > via the sunxi tree, as this blocks some board support patches. > > IIUC Linux gave up on adding rather generic entries up for each and > every > SPI NOR chip, if there is nothing special about them: > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i... > Should we follow suit here?
And we could then start trimming the table we do have as well, to reclaim space?
In general, yes, but we'd also need to consume a bit more space with the additional auto-detection logic.
Maybe part one of the series is backport that logic, part two is remove all the easy to remove tables? Or at least a number of them so the series is a wash and then a targeted series of drop-an-entry and cc the person that added it so they can run-time verify it's still fine?
Sounds like a plan to me and I'm willing to work on that. Though, I think we'll inevitably end up with increasing the resulting image sizes a bit, but that might be an acceptable trade-off for making supporting more SPI chips and more new boards much easier in the future.
Yeah, this is where we need to go overall long term if nothing else.
I agree, it would make the things a bit easier. I'll see to start working on it next week.
Thanks!

On 2023-12-09 23:13, Tom Rini wrote:
On Sat, Dec 09, 2023 at 10:43:35PM +0100, Dragan Simic wrote:
On 2023-12-09 22:21, Tom Rini wrote:
On Sat, Dec 09, 2023 at 10:02:09PM +0100, Dragan Simic wrote:
On 2023-12-09 21:43, Tom Rini wrote:
On Sat, Dec 09, 2023 at 09:37:28PM +0100, Dragan Simic wrote:
On 2023-12-09 21:34, Tom Rini wrote: > On Wed, Dec 06, 2023 at 04:24:43PM +0000, Andre Przywara wrote: > > On Mon, 4 Dec 2023 00:59:52 +0000 > > Andre Przywara andre.przywara@arm.com wrote: > > > Add support for the zBIT ZB25VQ128 (128M-bit) SPI NOR flash memory chip, > > > as used on the Xunlong Orange Pi Zero 3 board. > > > > does anyone have any objections against this patch? I wanted to take > > this > > via the sunxi tree, as this blocks some board support patches. > > > > IIUC Linux gave up on adding rather generic entries up for each and > > every > > SPI NOR chip, if there is nothing special about them: > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i... > > Should we follow suit here? > > And we could then start trimming the table we do have as well, to > reclaim space?
In general, yes, but we'd also need to consume a bit more space with the additional auto-detection logic.
Maybe part one of the series is backport that logic, part two is remove all the easy to remove tables? Or at least a number of them so the series is a wash and then a targeted series of drop-an-entry and cc the person that added it so they can run-time verify it's still fine?
Sounds like a plan to me and I'm willing to work on that. Though, I think we'll inevitably end up with increasing the resulting image sizes a bit, but that might be an acceptable trade-off for making supporting more SPI chips and more new boards much easier in the future.
Yeah, this is where we need to go overall long term if nothing else.
I agree, it would make the things a bit easier. I'll see to start working on it next week.
Thanks!
Thank you for agreeing with this new approach.

The original H616 devices released about three years ago were typically paired with an X-Powers AXP305 PMIC. Newer devices uses the smaller AXP313, and there seem to be far more systems with this PMIC around now.
Remove the default AXP305 selection for the H616 SoC from the Kconfig, and move the PMIC selection into the board defconfig files instead.
Signed-off-by: Andre Przywara andre.przywara@arm.com Reviewed-by: Jaehoon Chung jh80.chung@samsung.com --- configs/orangepi_zero2_defconfig | 1 + configs/x96_mate_defconfig | 1 + drivers/power/Kconfig | 1 - 3 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/configs/orangepi_zero2_defconfig b/configs/orangepi_zero2_defconfig index 50009e823cb..98aed846f1f 100644 --- a/configs/orangepi_zero2_defconfig +++ b/configs/orangepi_zero2_defconfig @@ -20,6 +20,7 @@ CONFIG_SYS_I2C_SPEED=400000 CONFIG_SPI_FLASH_MACRONIX=y CONFIG_PHY_REALTEK=y CONFIG_SUN8I_EMAC=y +CONFIG_AXP305_POWER=y CONFIG_SPI=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_OHCI_HCD=y diff --git a/configs/x96_mate_defconfig b/configs/x96_mate_defconfig index 318951e19c2..e805e0952b3 100644 --- a/configs/x96_mate_defconfig +++ b/configs/x96_mate_defconfig @@ -18,6 +18,7 @@ CONFIG_SPL_SYS_I2C_LEGACY=y CONFIG_SYS_I2C_MVTWSI=y CONFIG_SYS_I2C_SLAVE=0x7f CONFIG_SYS_I2C_SPEED=400000 +CONFIG_AXP305_POWER=y CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_OHCI_HCD=y diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig index 2395720c99c..33b8bc1214d 100644 --- a/drivers/power/Kconfig +++ b/drivers/power/Kconfig @@ -56,7 +56,6 @@ choice depends on ARCH_SUNXI default AXP209_POWER if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I default AXP221_POWER if MACH_SUN6I || MACH_SUN8I_A23 || MACH_SUN8I_A33 || MACH_SUN8I_R40 - default AXP305_POWER if MACH_SUN50I_H616 default AXP818_POWER if MACH_SUN8I_A83T default SUNXI_NO_PMIC if MACH_SUNXI_H3_H5 || MACH_SUN50I || MACH_SUN8I_V3S

The OrangePi Zero 3 is a small development board featuring the Allwinner H618 SoC, shipping with up to 4GB of DRAM, Gigabit Ethernet, a micro-HDMI connector and two USB sockets. The board uses LPDDR4 DRAM and an X-Powers AXP313a PMIC, support for which was recently added to U-Boot.
Add a defconfig file selecting the right drivers and DRAM options. Since the .dts file was synced from the Linux kernel repo already, we just need to add one line to the Makefile to actually build the .dtb.
The DRAM parameters were derived from the values found in the BSP DRAM drivers on the SPI NOR flash.
Signed-off-by: Andre Przywara andre.przywara@arm.com Tested-by: Mikhail Kalashnikov iuncuim@gmail.com Tested-by: Bob McChesney bob@electricworry.net --- arch/arm/dts/Makefile | 1 + board/sunxi/MAINTAINERS | 5 +++++ configs/orangepi_zero3_defconfig | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 configs/orangepi_zero3_defconfig
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 1be08c5fdc2..5fc888680b3 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -835,6 +835,7 @@ dtb-$(CONFIG_MACH_SUN50I_H6) += \ sun50i-h6-tanix-tx6-mini.dtb dtb-$(CONFIG_MACH_SUN50I_H616) += \ sun50i-h616-orangepi-zero2.dtb \ + sun50i-h618-orangepi-zero3.dtb \ sun50i-h616-x96-mate.dtb dtb-$(CONFIG_MACH_SUN50I) += \ sun50i-a64-amarula-relic.dtb \ diff --git a/board/sunxi/MAINTAINERS b/board/sunxi/MAINTAINERS index 00614372119..f556857a391 100644 --- a/board/sunxi/MAINTAINERS +++ b/board/sunxi/MAINTAINERS @@ -455,6 +455,11 @@ M: Jernej Skrabec jernej.skrabec@siol.net S: Maintained F: configs/orangepi_zero2_defconfig
+ORANGEPI ZERO 3 BOARD +M: Andre Przywara andre.przywara@arm.com +S: Maintained +F: configs/orangepi_zero3_defconfig + ORANGEPI PC 2 BOARD M: Andre Przywara andre.przywara@arm.com S: Maintained diff --git a/configs/orangepi_zero3_defconfig b/configs/orangepi_zero3_defconfig new file mode 100644 index 00000000000..5a019fed84b --- /dev/null +++ b/configs/orangepi_zero3_defconfig @@ -0,0 +1,32 @@ +CONFIG_ARM=y +CONFIG_ARCH_SUNXI=y +CONFIG_DEFAULT_DEVICE_TREE="sun50i-h618-orangepi-zero3" +CONFIG_SPL=y +CONFIG_DRAM_SUN50I_H616_DX_ODT=0x07070707 +CONFIG_DRAM_SUN50I_H616_DX_DRI=0x0e0e0e0e +CONFIG_DRAM_SUN50I_H616_CA_DRI=0x0e0e +CONFIG_DRAM_SUN50I_H616_ODT_EN=0xaaaaeeee +CONFIG_DRAM_SUN50I_H616_TPR6=0x44000000 +CONFIG_DRAM_SUN50I_H616_TPR10=0x402f6663 +CONFIG_DRAM_SUN50I_H616_TPR11=0x24242624 +CONFIG_DRAM_SUN50I_H616_TPR12=0x0f0f100f +CONFIG_MACH_SUN50I_H616=y +CONFIG_SUNXI_DRAM_H616_LPDDR4=y +CONFIG_DRAM_CLK=792 +CONFIG_USB1_VBUS_PIN="PC16" +CONFIG_R_I2C_ENABLE=y +CONFIG_SPL_SPI_SUNXI=y +# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +CONFIG_SPL_I2C=y +CONFIG_SPL_SYS_I2C_LEGACY=y +CONFIG_SYS_I2C_MVTWSI=y +CONFIG_SYS_I2C_SLAVE=0x7f +CONFIG_SYS_I2C_SPEED=400000 +CONFIG_SPI_FLASH_ZBIT=y +CONFIG_PHY_MOTORCOMM=y +CONFIG_SUN8I_EMAC=y +CONFIG_AXP313_POWER=y +CONFIG_SPI=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_OHCI_HCD=y +CONFIG_USB_MUSB_GADGET=y

I have tested a newly built u-boot with the patches you provided and it works well. It is the same configuration as what I have been testing with for the last few weeks.
I loaded the U-boot to SPI flash and tested with the SD card removed from the system and put in a USB card reader. The output for that test is below.
For completeness you might want to mention that another difference between the zero2 and zero3 is the emac phy going from Realtek to Motorcomm.
Thank you for fixing my patch attempt. It is the first one I have ever done. Thank you also for your patience with my fumbling attempts. I have learned a lot from you in the last two weeks.
U-Boot SPL 2024.01-rc3-00043-g5c4e9d0c74-dirty (Dec 03 2023 - 18:21:41 -0800) DRAM: 1024 MiB Trying to boot from sunxi SPI NOTICE: BL31: v2.10.0 (debug):v2.10.0 NOTICE: BL31: Built : 18:07:18, Nov 23 2023 NOTICE: BL31: Detected Allwinner H616 SoC (1823) NOTICE: BL31: Found U-Boot DTB at 0x4a0b2828, model: OrangePi Zero3 INFO: ARM GICv2 driver initialized INFO: Configuring SPC Controller INFO: PMIC: Probing AXP305 on RSB ERROR: RSB: set run-time address: 0x10003 INFO: Could not init RSB: -65539 INFO: BL31: Platform setup done INFO: BL31: Initializing runtime services INFO: BL31: cortex_a53: CPU workaround for erratum 855873 was applied INFO: BL31: cortex_a53: CPU workaround for erratum 1530924 was applied INFO: PSCI: Suspend is unavailable INFO: BL31: Preparing for EL3 exit to normal world INFO: Entry point address = 0x4a000000 INFO: SPSR = 0x3c9 INFO: Changed devicetree.
U-Boot 2024.01-rc3-00043-g5c4e9d0c74-dirty (Dec 03 2023 - 18:21:41 -0800) Allwinner Technology
CPU: Allwinner H616 (SUN50I) Model: OrangePi Zero3 DRAM: 1 GiB Core: 57 devices, 25 uclasses, devicetree: separate WDT: Not starting watchdog@30090a0 MMC: mmc@4020000: 0 Loading Environment from SPIFlash... SF: Detected zb25vq128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB OK In: serial@5000000 Out: serial@5000000 Err: serial@5000000 Allwinner mUSB OTG (Peripheral) Net: eth0: ethernet@5020000using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in MAC de:ad:be:ef:00:01 HOST MAC de:ad:be:ef:00:00 RNDIS ready , eth1: usb_ether starting USB... Bus usb@5200000: USB EHCI 1.00 Bus usb@5200400: USB OHCI 1.0 scanning bus usb@5200000 for devices... Device NOT ready Request Sense returned 02 3A 00 Device NOT ready Request Sense returned 02 3A 00 Device NOT ready Request Sense returned 02 3A 00 2 USB Device(s) found scanning bus usb@5200400 for devices... 1 USB Device(s) found scanning usb for storage devices... 1 Storage Device(s) found Hit any key to stop autoboot: 0 Card did not respond to voltage select! : -110
Device 0: Vendor: Generic- Rev: 1.00 Prod: SD/MMC Type: Removable Hard Disk Capacity: 15193.5 MB = 14.8 GB (31116288 x 512) ... is now current device Scanning usb 0:1... Found U-Boot script /boot/boot.scr 1052 bytes read in 1 ms (1 MiB/s) ## Executing script at 4fc00000 Card did not respond to voltage select! : -110 ** Bad device specification mmc 0 ** 19472 bytes read in 3 ms (6.2 MiB/s) No FDT memory address configured. Please configure the FDT address via "fdt addr <address>" command. Aborting! 7088139 bytes read in 324 ms (20.9 MiB/s) 22491144 bytes read in 1025 ms (20.9 MiB/s) Moving Image from 0x40080000 to 0x40200000, end=41800000 ## Loading init Ramdisk from Legacy Image at 4ff00000 ... Image Name: uInitrd Image Type: AArch64 Linux RAMDisk Image (gzip compressed) Data Size: 7088075 Bytes = 6.8 MiB Load Address: 00000000 Entry Point: 00000000 Verifying Checksum ... OK ## Flattened Device Tree blob at 4fa00000 Booting using the fdt blob at 0x4fa00000 Working FDT set to 4fa00000 Loading Ramdisk to 4993d000, end 49fff7cb ... OK Loading Device Tree to 0000000049935000, end 000000004993cc0f ... OK Working FDT set to 49935000
Starting kernel ...
Welcome to Debian GNU/Linux 12 (bookworm)!
On 2023-12-03 4:59 p.m., Andre Przywara wrote:
A small update for the OrangePi Zero 3 support series. This fixes USB support, and upgrades the DRAM clock to 792, for better stability (as the other DRAM parameters were tailored to that frequency). I added the tags on the way. Please test!
================= The OrangePi Zero 3 is a small development board featuring the Allwinner H618 SoC. Compared to its predecessor OrangePi Zero 2, the new board uses LPDDR4 DRAM instead of DDR3 DRAM, and an X-Powers AXP313 PMIC instead of the AXP305. U-Boot gained support for both LPDDR4 DRAM and the new PMIC just recently, so add a user for those features by adding a defconfig for the new board. To make this work, patch 1/3 introduces support for zBIT SPI NOR flash chip, and patch 2/3 removes the default AXP305 PMIC selection when compiling for H616 SoCs. Patch 3/3 then adds the defconfig. The DT was already synced from the Linux kernel repo a few weeks ago.
Cheers, Andre
Changelog v1 .. v2:
- add tags
- set DRAM clock to 792 MHz (from the default 720 MHz)
- fix USB support by supplying USB VBUS enable GPIO
Andre Przywara (3): mtd: spi-nor: Add support for zBIT ZB25VQ128 sunxi: H616: remove default AXP305 selection sunxi: H616: Add OrangePi Zero 3 board support
arch/arm/dts/Makefile | 1 + board/sunxi/MAINTAINERS | 5 +++++ configs/orangepi_zero2_defconfig | 1 + configs/orangepi_zero3_defconfig | 32 ++++++++++++++++++++++++++++++++ configs/x96_mate_defconfig | 1 + drivers/mtd/spi/Kconfig | 5 +++++ drivers/mtd/spi/spi-nor-ids.c | 5 +++++ drivers/power/Kconfig | 1 - 8 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 configs/orangepi_zero3_defconfig

On Sun, 3 Dec 2023 21:57:51 -0800 Stephen Graf stephen.graf@gmail.com wrote:
Hi Stephen,
I have tested a newly built u-boot with the patches you provided and it works well. It is the same configuration as what I have been testing with for the last few weeks.
I loaded the U-boot to SPI flash and tested with the SD card removed from the system and put in a USB card reader. The output for that test is below.
thanks for your testing efforts! Is it OK if I convert this statement into a "Tested-by:" tag with your email, to become part of the commit?
Cheers, Andre
For completeness you might want to mention that another difference between the zero2 and zero3 is the emac phy going from Realtek to Motorcomm.
Thank you for fixing my patch attempt. It is the first one I have ever done. Thank you also for your patience with my fumbling attempts. I have learned a lot from you in the last two weeks.
U-Boot SPL 2024.01-rc3-00043-g5c4e9d0c74-dirty (Dec 03 2023 - 18:21:41 -0800) DRAM: 1024 MiB Trying to boot from sunxi SPI NOTICE: BL31: v2.10.0 (debug):v2.10.0 NOTICE: BL31: Built : 18:07:18, Nov 23 2023 NOTICE: BL31: Detected Allwinner H616 SoC (1823) NOTICE: BL31: Found U-Boot DTB at 0x4a0b2828, model: OrangePi Zero3 INFO: ARM GICv2 driver initialized INFO: Configuring SPC Controller INFO: PMIC: Probing AXP305 on RSB ERROR: RSB: set run-time address: 0x10003 INFO: Could not init RSB: -65539 INFO: BL31: Platform setup done INFO: BL31: Initializing runtime services INFO: BL31: cortex_a53: CPU workaround for erratum 855873 was applied INFO: BL31: cortex_a53: CPU workaround for erratum 1530924 was applied INFO: PSCI: Suspend is unavailable INFO: BL31: Preparing for EL3 exit to normal world INFO: Entry point address = 0x4a000000 INFO: SPSR = 0x3c9 INFO: Changed devicetree.
U-Boot 2024.01-rc3-00043-g5c4e9d0c74-dirty (Dec 03 2023 - 18:21:41 -0800) Allwinner Technology
CPU: Allwinner H616 (SUN50I) Model: OrangePi Zero3 DRAM: 1 GiB Core: 57 devices, 25 uclasses, devicetree: separate WDT: Not starting watchdog@30090a0 MMC: mmc@4020000: 0 Loading Environment from SPIFlash... SF: Detected zb25vq128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB OK In: serial@5000000 Out: serial@5000000 Err: serial@5000000 Allwinner mUSB OTG (Peripheral) Net: eth0: ethernet@5020000using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in MAC de:ad:be:ef:00:01 HOST MAC de:ad:be:ef:00:00 RNDIS ready , eth1: usb_ether starting USB... Bus usb@5200000: USB EHCI 1.00 Bus usb@5200400: USB OHCI 1.0 scanning bus usb@5200000 for devices... Device NOT ready Request Sense returned 02 3A 00 Device NOT ready Request Sense returned 02 3A 00 Device NOT ready Request Sense returned 02 3A 00 2 USB Device(s) found scanning bus usb@5200400 for devices... 1 USB Device(s) found scanning usb for storage devices... 1 Storage Device(s) found Hit any key to stop autoboot: 0 Card did not respond to voltage select! : -110
Device 0: Vendor: Generic- Rev: 1.00 Prod: SD/MMC Type: Removable Hard Disk Capacity: 15193.5 MB = 14.8 GB (31116288 x 512) ... is now current device Scanning usb 0:1... Found U-Boot script /boot/boot.scr 1052 bytes read in 1 ms (1 MiB/s) ## Executing script at 4fc00000 Card did not respond to voltage select! : -110 ** Bad device specification mmc 0 ** 19472 bytes read in 3 ms (6.2 MiB/s) No FDT memory address configured. Please configure the FDT address via "fdt addr <address>" command. Aborting! 7088139 bytes read in 324 ms (20.9 MiB/s) 22491144 bytes read in 1025 ms (20.9 MiB/s) Moving Image from 0x40080000 to 0x40200000, end=41800000 ## Loading init Ramdisk from Legacy Image at 4ff00000 ... Image Name: uInitrd Image Type: AArch64 Linux RAMDisk Image (gzip compressed) Data Size: 7088075 Bytes = 6.8 MiB Load Address: 00000000 Entry Point: 00000000 Verifying Checksum ... OK ## Flattened Device Tree blob at 4fa00000 Booting using the fdt blob at 0x4fa00000 Working FDT set to 4fa00000 Loading Ramdisk to 4993d000, end 49fff7cb ... OK Loading Device Tree to 0000000049935000, end 000000004993cc0f ... OK Working FDT set to 49935000
Starting kernel ...
Welcome to Debian GNU/Linux 12 (bookworm)!
On 2023-12-03 4:59 p.m., Andre Przywara wrote:
A small update for the OrangePi Zero 3 support series. This fixes USB support, and upgrades the DRAM clock to 792, for better stability (as the other DRAM parameters were tailored to that frequency). I added the tags on the way. Please test!
================= The OrangePi Zero 3 is a small development board featuring the Allwinner H618 SoC. Compared to its predecessor OrangePi Zero 2, the new board uses LPDDR4 DRAM instead of DDR3 DRAM, and an X-Powers AXP313 PMIC instead of the AXP305. U-Boot gained support for both LPDDR4 DRAM and the new PMIC just recently, so add a user for those features by adding a defconfig for the new board. To make this work, patch 1/3 introduces support for zBIT SPI NOR flash chip, and patch 2/3 removes the default AXP305 PMIC selection when compiling for H616 SoCs. Patch 3/3 then adds the defconfig. The DT was already synced from the Linux kernel repo a few weeks ago.
Cheers, Andre
Changelog v1 .. v2:
- add tags
- set DRAM clock to 792 MHz (from the default 720 MHz)
- fix USB support by supplying USB VBUS enable GPIO
Andre Przywara (3): mtd: spi-nor: Add support for zBIT ZB25VQ128 sunxi: H616: remove default AXP305 selection sunxi: H616: Add OrangePi Zero 3 board support
arch/arm/dts/Makefile | 1 + board/sunxi/MAINTAINERS | 5 +++++ configs/orangepi_zero2_defconfig | 1 + configs/orangepi_zero3_defconfig | 32 ++++++++++++++++++++++++++++++++ configs/x96_mate_defconfig | 1 + drivers/mtd/spi/Kconfig | 5 +++++ drivers/mtd/spi/spi-nor-ids.c | 5 +++++ drivers/power/Kconfig | 1 - 8 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 configs/orangepi_zero3_defconfig
participants (4)
-
Andre Przywara
-
Dragan Simic
-
Stephen Graf
-
Tom Rini