Skip to contentSkip to conversation

sunxi: A64: enable AXP driver support

PATCH In review Andre Przywara 3 participants 5 messages May 7, 2025 – Aug 28, 2025

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

cover sunxi: A64: enable AXP driver support

Hi,

this series enables the build of the AXP driver in U-Boot proper for all boards using the Allwinner A64 SoC. So far some static PMIC rail setup was done by TF-A, but this was rather static (enabling too many) and increases the code size of the rather limited BL31 build.

Do this for the A64 only first, since this uses RSB consistently, while the H6 boards are undergoing a transition to use I2C.

Please have a look and test!

Cheers,
Andre

Andre Przywara (2):
sunxi: A64: enable DRIVEVBUS support for respective boards
sunxi: A64: enable AXP drivers

 arch/arm/Kconfig                     | 1 +
 arch/arm/mach-sunxi/Kconfig          | 3 +++
 configs/a64-olinuxino-emmc_defconfig | 1 +
 configs/a64-olinuxino_defconfig      | 1 +
 configs/amarula_a64_relic_defconfig  | 1 +
 configs/bananapi_m64_defconfig       | 1 +
 configs/orangepi_win_defconfig       | 1 +
 configs/pinetab_defconfig            | 1 +
 8 files changed, 10 insertions(+)
Signature · 1 line
2.46.3
#1 lore raw

PATCH 1/2 sunxi: A64: enable DRIVEVBUS support for respective boards

The X-Powers AXP PMICs contain a special pin that can be used to drive USB VBUS power, which requires a special AXP (sub-)driver.

Enable that for the 64-bit boards that use this pin, so that they can enable VBUS power on their own, without relying on the help of TF-A.

---
 configs/a64-olinuxino-emmc_defconfig | 1 +
 configs/a64-olinuxino_defconfig      | 1 +
 configs/amarula_a64_relic_defconfig  | 1 +
 configs/bananapi_m64_defconfig       | 1 +
 configs/orangepi_win_defconfig       | 1 +
 configs/pinetab_defconfig            | 1 +
 6 files changed, 6 insertions(+)
configs/a64-olinuxino-emmc_defconfig +1 -0
index a5989fab1c6..93f9e2eac28 100644
@@ -7,5 +7,6 @@ CONFIG_MMC_SUNXI_SLOT_EXTRA=2
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_SUN8I_EMAC=y
+CONFIG_REGULATOR_AXP_DRIVEVBUS=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_OHCI_HCD=y
configs/a64-olinuxino_defconfig +1 -0
index 0b469c25d0d..0b64b8370b4 100644
@@ -6,5 +6,6 @@ CONFIG_MACH_SUN50I=y
 CONFIG_MMC_SUNXI_SLOT_EXTRA=2
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SUN8I_EMAC=y
+CONFIG_REGULATOR_AXP_DRIVEVBUS=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_OHCI_HCD=y
configs/amarula_a64_relic_defconfig +1 -0
index 292af6e372e..8ea23ee4936 100644
@@ -6,6 +6,7 @@ CONFIG_MACH_SUN50I=y
 CONFIG_MMC_SUNXI_SLOT_EXTRA=2
 # CONFIG_VIDEO_DE2 is not set
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
+CONFIG_REGULATOR_AXP_DRIVEVBUS=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_OHCI_HCD=y
 CONFIG_USB_MUSB_GADGET=y
configs/bananapi_m64_defconfig +1 -0
index d957071cb13..9d23739ffe5 100644
@@ -7,6 +7,7 @@ CONFIG_MMC_SUNXI_SLOT_EXTRA=2
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_SUN8I_EMAC=y
+CONFIG_REGULATOR_AXP_DRIVEVBUS=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_OHCI_HCD=y
 CONFIG_USB_MUSB_GADGET=y
configs/orangepi_win_defconfig +1 -0
index 4ce36cbab34..30c42366d1c 100644
@@ -9,6 +9,7 @@ CONFIG_MTD=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_PHY_REALTEK=y
 CONFIG_SUN8I_EMAC=y
+CONFIG_REGULATOR_AXP_DRIVEVBUS=y
 CONFIG_SPI=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_OHCI_HCD=y
configs/pinetab_defconfig +1 -0
index 0cc24146b39..696357a222c 100644
@@ -8,3 +8,4 @@ CONFIG_DRAM_CLK=552
 CONFIG_DRAM_ZQ=3881949
 CONFIG_MMC_SUNXI_SLOT_EXTRA=2
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
+CONFIG_REGULATOR_AXP_DRIVEVBUS=y
Signature · 1 line
2.46.3
#2 lore raw

PATCH 2/2 sunxi: A64: enable AXP drivers

In reply to Andre Przywara

So far the 64-bit SoCs were relying on Trusted-Firmware to do the PMIC setup, which was quite static: enabling most rails, regardless of whether they are needed or not.

We have a fully DM compliant AXP regulator driver for a while, so that U-Boot proper can do its own PMIC setup, based on the actual need (typically for USB, Ethernet, HDMI).

Enable that driver by default for all A64 boards, along with the RSB driver.

The goal is to allow dropping the ill-fated regulator setup code from TF-A, so that this can become smaller, and we only enable rails that are really needed.

---
 arch/arm/Kconfig            | 1 +
 arch/arm/mach-sunxi/Kconfig | 3 +++
 2 files changed, 4 insertions(+)
arch/arm/Kconfig +1 -0
index fedfdb21457..6b59ff5be32 100644
@@ -1190,6 +1190,7 @@ config ARCH_SUNXI
 	select DM_SPI_FLASH if SPI && MTD
 	select DM_KEYBOARD
 	select DM_SERIAL
+	select DM_PMIC
 	select MMU_PGPROT if ARM64
 	select OF_BOARD_SETUP
 	select OF_CONTROL
arch/arm/mach-sunxi/Kconfig +3 -0
index fce817c9d40..c3718126cec 100644
@@ -435,6 +435,9 @@ config MACH_SUN50I
 	select FIT
 	select SPL_LOAD_FIT if SPL
 	select SUNXI_A64_TIMER_ERRATUM
+	imply SYS_I2C_SUN8I_RSB
+	imply REGULATOR_AXP
+	imply PMIC_AXP
 
 config MACH_SUN50I_H5
 	bool "sun50i (Allwinner H5)"
Signature · 1 line
2.46.3
maintainer
#3 lore raw
In reply to Andre Przywara

Dne sreda, 7. maj 2025 ob 02:53:23 Srednjeevropski poletni čas je Andre Przywara napisal(a):

Quoted 9 lines

Hi,

this series enables the build of the AXP driver in U-Boot proper for all boards using the Allwinner A64 SoC. So far some static PMIC rail setup was done by TF-A, but this was rather static (enabling too many) and increases the code size of the rather limited BL31 build.

Do this for the A64 only first, since this uses RSB consistently, while the H6 boards are undergoing a transition to use I2C.

What is status of this? Unfortunatelly I don't have time to test currently, but it would be nice to have this in.

Best regards,
Jernej

Quoted 21 lines

Please have a look and test!

Cheers,
Andre

Andre Przywara (2):
sunxi: A64: enable DRIVEVBUS support for respective boards
sunxi: A64: enable AXP drivers

 arch/arm/Kconfig                     | 1 +
 arch/arm/mach-sunxi/Kconfig          | 3 +++
 configs/a64-olinuxino-emmc_defconfig | 1 +
 configs/a64-olinuxino_defconfig      | 1 +
 configs/amarula_a64_relic_defconfig  | 1 +
 configs/bananapi_m64_defconfig       | 1 +
 configs/orangepi_win_defconfig       | 1 +
 configs/pinetab_defconfig            | 1 +
 8 files changed, 10 insertions(+)
Reviewed-by Tested-by on the v1 series
#4 lore raw
In reply to Andre Przywara
Quoted 8 lines · Andre Przywara

Hi,

this series enables the build of the AXP driver in U-Boot proper for all boards using the Allwinner A64 SoC. So far some static PMIC rail setup was done by TF-A, but this was rather static (enabling too many) and increases the code size of the rather limited BL31 build.

Quoted 4 lines

Do this for the A64 only first, since this uses RSB consistently, while the H6 boards are undergoing a transition to use I2C.

Please have a look and test!

For the series:

Tested on a Pine64+, I enabled CMD_PMIC and CMD_REGULATOR and could see all the expected details as well as in the output in 'dm tree' and it boots and runs as expected with Fedora 43.

Peter

Quoted 20 lines

Cheers,
Andre

Andre Przywara (2):
sunxi: A64: enable DRIVEVBUS support for respective boards
sunxi: A64: enable AXP drivers

 arch/arm/Kconfig                     | 1 +
 arch/arm/mach-sunxi/Kconfig          | 3 +++
 configs/a64-olinuxino-emmc_defconfig | 1 +
 configs/a64-olinuxino_defconfig      | 1 +
 configs/amarula_a64_relic_defconfig  | 1 +
 configs/bananapi_m64_defconfig       | 1 +
 configs/orangepi_win_defconfig       | 1 +
 configs/pinetab_defconfig            | 1 +
 8 files changed, 10 insertions(+)

--
2.46.3