[PATCH 00/22] sunxi: Prepare platform Kconfig to support multiple architectures

sunxi is getting a new RISC-V platform, D1. We want to share as much of the existing configuration as possible, to provide a familiar environment, DRAM layout, partition layout, etc.
Because U-Boot includes all architecture Kconfig files at once, we must use a symbol outside of both CONFIG_ARM and CONFIG_RISCV to contain shared Kconfig options. I chose BOARD_SUNXI, corresponding to the file location and somewhat following the BOARD_SPECIFIC_OPTIONS pattern.
I did a buildman run on this series. The only net option changes are the expected ones: - Host-side USB gets enabled on several boards by the first patch (emlid_neutis_n5_devboard orangepi_zero2 pinephone pinetab tanix_tx6 x96_mate teres_i) - CONFIG_BOARD_SUNXI gets added everywhere - CONFIG_SYS_I2C_MVTWSI gets enabled by the corresponding patch
Andre, please feel free to take any subset of these; they don't all have to go in at once. And I'm open to suggestions about what instances of ARCH_SUNXI should (not) be converted. Some of them are open to opinion.
I left alone the options in arch/arm/mach-sunxi/Kconfig that are covered by other series (MMC CD/USB PHY/power pins, AXP GPIO).
After this series, the Kconfig changes needed for D1 support are quite small, something like this commit: https://github.com/smaeul/u-boot/commit/c12cf6c5d72f5327eff793518229ddbd41dc...
Adding SUNXI_MINIMUM_DRAM_MB certainly made things nicer. There are a few options that probably still need some adjustment to respect it.
Samuel Holland (22): sunxi: Fix default-enablement of USB host drivers sunxi: Remove unnecessary Kconfig selections sunxi: Add missing dependencies to Kconfig selections sunxi: Hide image type selection if SPL is disabled sunxi: Share the board Kconfig across architectures sunxi: Move most Kconfig selections to the board Kconfig sunxi: Globally enable SUPPORT_SPL sunxi: Downgrade driver selections to implications sunxi: Enable the I2C driver by default sunxi: Move default values to the board Kconfig sunxi: Hide the SUNXI_MINIMUM_DRAM_MB symbol sunxi: Clean up the SPL_STACK_R_ADDR defaults sunxi: Move PRE_CON_BUF_ADDR to the board Kconfig sunxi: Move SPL_BSS_START_ADDR to the board Kconfig sunxi: Move SPL_TEXT_BASE to the board Kconfig sunxi: Move SYS_LOAD_ADDR to the board Kconfig sunxi: Move TEXT_BASE to the board Kconfig sunxi: Move most board options to the board Kconfig env: sunxi: Replace ARCH_SUNXI with BOARD_SUNXI drivers: sunxi: Replace ARCH_SUNXI with BOARD_SUNXI disk: sunxi: Replace ARCH_SUNXI with BOARD_SUNXI spl: sunxi: Replace ARCH_SUNXI with BOARD_SUNXI
Kconfig | 3 - arch/Kconfig | 1 + arch/arm/Kconfig | 48 +------- arch/arm/mach-sunxi/Kconfig | 154 ----------------------- board/sunxi/Kconfig | 224 ++++++++++++++++++++++++++++++++++ boot/Kconfig | 4 - common/Kconfig | 2 - common/spl/Kconfig | 18 +-- disk/Kconfig | 6 +- drivers/clk/sunxi/Kconfig | 2 +- drivers/fastboot/Kconfig | 13 +- drivers/gpio/Kconfig | 2 +- drivers/mmc/Kconfig | 2 +- drivers/net/phy/Kconfig | 4 +- drivers/phy/allwinner/Kconfig | 2 +- drivers/pinctrl/sunxi/Kconfig | 2 +- drivers/reset/Kconfig | 2 +- drivers/spi/Kconfig | 2 +- drivers/usb/Kconfig | 2 +- drivers/usb/gadget/Kconfig | 8 +- drivers/usb/host/Kconfig | 2 - drivers/usb/musb-new/Kconfig | 2 +- drivers/video/Kconfig | 2 +- drivers/watchdog/Kconfig | 4 +- env/Kconfig | 12 +- scripts/Makefile.spl | 2 +- 26 files changed, 267 insertions(+), 258 deletions(-)

We tried to enable USB_EHCI_GENERIC and USB_OHCI_GENERIC by default. This did not work because those symbols depend on USB_EHCI_HCD and USB_OHCI_HCD, which were not enabled. Fix this by implying all four.
Signed-off-by: Samuel Holland samuel@sholland.org ---
arch/arm/Kconfig | 4 ++++ drivers/usb/host/Kconfig | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 710f171f87..d3a1f03b36 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1185,7 +1185,11 @@ config ARCH_SUNXI imply SYSRESET imply SYSRESET_WATCHDOG imply SYSRESET_WATCHDOG_AUTO + imply USB_EHCI_GENERIC + imply USB_EHCI_HCD imply USB_GADGET + imply USB_OHCI_GENERIC + imply USB_OHCI_HCD imply WDT
config ARCH_U8500 diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 1aabe062fb..a4d62bc9e8 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -280,7 +280,6 @@ config USB_EHCI_ZYNQ config USB_EHCI_GENERIC bool "Support for generic EHCI USB controller" depends on DM_USB - default ARCH_SUNXI ---help--- Enables support for generic EHCI controller.
@@ -342,7 +341,6 @@ config USB_OHCI_PCI
config USB_OHCI_GENERIC bool "Support for generic OHCI USB controller" - default ARCH_SUNXI ---help--- Enables support for generic OHCI controller.

On Tue, 1 Nov 2022 00:08:13 -0500 Samuel Holland samuel@sholland.org wrote:
Hi Samuel,
We tried to enable USB_EHCI_GENERIC and USB_OHCI_GENERIC by default.
Well, I am not really sure that was the real intention, looking at commit 29d280c88a1ff3, and the fact that those symbols are still explicitly defined in many board config files. My main concern is that this change enables USB on many boards which had it disabled - at least some of them probably on purpose. I believe for the Pinephone for instance it's off to decrease boot time.
This did not work because those symbols depend on USB_EHCI_HCD and USB_OHCI_HCD, which were not enabled. Fix this by implying all four.
The change itself looks correct, but as mentioned, 47 out of 161 boards now come with USB newly enabled. 25 of those don't have EHCI or OHCI nodes in their DT, so enabling USB doesn't make much sense there. For the others I don't know if USB was disabled on purpose, on some tablets for instance it seems that the only USB HCI port is connected to an on-board WiFi chip, which we don't support in U-Boot.
So in a first round I would like to skip this patch. If we want to have it (I am not against it, since the majority of boards have USB), this should be paired with: # USB_EHCI_HCD is not set # USB_OHCI_HCD is not set in the defconfigs at least for those boards without HCI DT nodes (I have a list), to keep it disabled there. If someone cares, and it has been disabled by mistake, they can fix that with an extra patch. For the other boards we should remove the ?HCI symbols from their defconfigs, since they would be redundant then.
Cheers, Andre
Signed-off-by: Samuel Holland samuel@sholland.org
arch/arm/Kconfig | 4 ++++ drivers/usb/host/Kconfig | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 710f171f87..d3a1f03b36 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1185,7 +1185,11 @@ config ARCH_SUNXI imply SYSRESET imply SYSRESET_WATCHDOG imply SYSRESET_WATCHDOG_AUTO
- imply USB_EHCI_GENERIC
- imply USB_EHCI_HCD imply USB_GADGET
- imply USB_OHCI_GENERIC
- imply USB_OHCI_HCD imply WDT
config ARCH_U8500 diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 1aabe062fb..a4d62bc9e8 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -280,7 +280,6 @@ config USB_EHCI_ZYNQ config USB_EHCI_GENERIC bool "Support for generic EHCI USB controller" depends on DM_USB
- default ARCH_SUNXI ---help--- Enables support for generic EHCI controller.
@@ -342,7 +341,6 @@ config USB_OHCI_PCI
config USB_OHCI_GENERIC bool "Support for generic OHCI USB controller"
- default ARCH_SUNXI ---help--- Enables support for generic OHCI controller.

Two of these selections are redundant and have no effect: - DM_KEYBOARD is selected by USB_KEYBOARD - DM_MMC is selected by MMC
This selection has no effect by default and is unnecessarily strong: - USB_STORAGE is implied by DISTRO_DEFAULTS
Signed-off-by: Samuel Holland samuel@sholland.org ---
arch/arm/Kconfig | 3 --- 1 file changed, 3 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index d3a1f03b36..939f76867e 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1144,8 +1144,6 @@ config ARCH_SUNXI select DM_I2C if I2C select DM_SPI if SPI select DM_SPI_FLASH if SPI - select DM_KEYBOARD - select DM_MMC if MMC select DM_SCSI if SCSI select DM_SERIAL select GPIO_EXTRA_HEADER @@ -1163,7 +1161,6 @@ config ARCH_SUNXI select SYS_THUMB_BUILD if !ARM64 select USB if DISTRO_DEFAULTS select USB_KEYBOARD if DISTRO_DEFAULTS && USB_HOST - select USB_STORAGE if DISTRO_DEFAULTS && USB_HOST select SPL_USE_TINY_PRINTF select USE_PREBOOT select SYS_RELOC_GD_ENV_ADDR

On Tue, 1 Nov 2022 00:08:14 -0500 Samuel Holland samuel@sholland.org wrote:
Two of these selections are redundant and have no effect:
- DM_KEYBOARD is selected by USB_KEYBOARD
- DM_MMC is selected by MMC
This selection has no effect by default and is unnecessarily strong:
- USB_STORAGE is implied by DISTRO_DEFAULTS
With patch 01/22 removed (for now), this disables DM_KEYBOARD on 15 boards, it looks like for those without USB. I wouldn't be aware of any other keyboard type supported on Allwinner boards, so the change is fine:
Signed-off-by: Samuel Holland samuel@sholland.org
Reviewed-by: Andre Przywara andre.przywara@arm.com
Cheers, Andre
arch/arm/Kconfig | 3 --- 1 file changed, 3 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index d3a1f03b36..939f76867e 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1144,8 +1144,6 @@ config ARCH_SUNXI select DM_I2C if I2C select DM_SPI if SPI select DM_SPI_FLASH if SPI
- select DM_KEYBOARD
- select DM_MMC if MMC select DM_SCSI if SCSI select DM_SERIAL select GPIO_EXTRA_HEADER
@@ -1163,7 +1161,6 @@ config ARCH_SUNXI select SYS_THUMB_BUILD if !ARM64 select USB if DISTRO_DEFAULTS select USB_KEYBOARD if DISTRO_DEFAULTS && USB_HOST
- select USB_STORAGE if DISTRO_DEFAULTS && USB_HOST select SPL_USE_TINY_PRINTF select USE_PREBOOT select SYS_RELOC_GD_ENV_ADDR

Some of the selected symbols have a user-visible dependency. Make the selections conditional on that dependency to avoid creating invalid configurations.
Signed-off-by: Samuel Holland samuel@sholland.org ---
arch/arm/Kconfig | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 939f76867e..4e5daa9e7f 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1134,30 +1134,30 @@ config ARCH_SOCFPGA config ARCH_SUNXI bool "Support sunxi (Allwinner) SoCs" select BINMAN - select CMD_GPIO + select CMD_GPIO if GPIO select CMD_MMC if MMC select CMD_USB if DISTRO_DEFAULTS && USB_HOST select CLK select DM - select DM_ETH - select DM_GPIO + select DM_ETH if NET + select DM_GPIO if GPIO select DM_I2C if I2C + select DM_SCSI if BLK && SCSI + select DM_SERIAL if SERIAL select DM_SPI if SPI select DM_SPI_FLASH if SPI - select DM_SCSI if SCSI - select DM_SERIAL select GPIO_EXTRA_HEADER select OF_BOARD_SETUP select OF_CONTROL select OF_SEPARATE select PINCTRL - select SPECIFY_CONSOLE_INDEX + select SPECIFY_CONSOLE_INDEX if SERIAL select SPL_SEPARATE_BSS if SPL select SPL_STACK_R if SPL select SPL_SYS_MALLOC_SIMPLE if SPL select SPL_SYS_THUMB_BUILD if !ARM64 - select SUNXI_GPIO - select SYS_NS16550 + select SUNXI_GPIO if GPIO + select SYS_NS16550 if SERIAL select SYS_THUMB_BUILD if !ARM64 select USB if DISTRO_DEFAULTS select USB_KEYBOARD if DISTRO_DEFAULTS && USB_HOST

On Tue, 1 Nov 2022 00:08:15 -0500 Samuel Holland samuel@sholland.org wrote:
Some of the selected symbols have a user-visible dependency. Make the selections conditional on that dependency to avoid creating invalid configurations.
No change in any of the generated configs, so looks fine:
Signed-off-by: Samuel Holland samuel@sholland.org
Reviewed-by: Andre Przywara andre.przywara@arm.com
Thanks, Andre
arch/arm/Kconfig | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 939f76867e..4e5daa9e7f 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1134,30 +1134,30 @@ config ARCH_SOCFPGA config ARCH_SUNXI bool "Support sunxi (Allwinner) SoCs" select BINMAN
- select CMD_GPIO
- select CMD_GPIO if GPIO select CMD_MMC if MMC select CMD_USB if DISTRO_DEFAULTS && USB_HOST select CLK select DM
- select DM_ETH
- select DM_GPIO
- select DM_ETH if NET
- select DM_GPIO if GPIO select DM_I2C if I2C
- select DM_SCSI if BLK && SCSI
- select DM_SERIAL if SERIAL select DM_SPI if SPI select DM_SPI_FLASH if SPI
- select DM_SCSI if SCSI
- select DM_SERIAL select GPIO_EXTRA_HEADER select OF_BOARD_SETUP select OF_CONTROL select OF_SEPARATE select PINCTRL
- select SPECIFY_CONSOLE_INDEX
- select SPECIFY_CONSOLE_INDEX if SERIAL select SPL_SEPARATE_BSS if SPL select SPL_STACK_R if SPL select SPL_SYS_MALLOC_SIMPLE if SPL select SPL_SYS_THUMB_BUILD if !ARM64
- select SUNXI_GPIO
- select SYS_NS16550
- select SUNXI_GPIO if GPIO
- select SYS_NS16550 if SERIAL select SYS_THUMB_BUILD if !ARM64 select USB if DISTRO_DEFAULTS select USB_KEYBOARD if DISTRO_DEFAULTS && USB_HOST

This choice is meaningless when SPL is disabled. Hide it to avoid any possible confusion.
Signed-off-by: Samuel Holland samuel@sholland.org ---
board/sunxi/Kconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index 084a8b0c6c..42f61df5c5 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -1,5 +1,6 @@ choice prompt "SPL Image Type" + depends on SPL default SPL_IMAGE_TYPE_SUNXI_EGON
config SPL_IMAGE_TYPE_SUNXI_EGON

On Tue, 1 Nov 2022 00:08:16 -0500 Samuel Holland samuel@sholland.org wrote:
This choice is meaningless when SPL is disabled. Hide it to avoid any possible confusion.
Signed-off-by: Samuel Holland samuel@sholland.org
Reviewed-by: Andre Przywara andre.przywara@arm.com
Cheers, Andre
board/sunxi/Kconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index 084a8b0c6c..42f61df5c5 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -1,5 +1,6 @@ choice prompt "SPL Image Type"
- depends on SPL default SPL_IMAGE_TYPE_SUNXI_EGON
config SPL_IMAGE_TYPE_SUNXI_EGON

With the introduction of the Allwinner D1, the sunxi board family now spans multiple architectures (ARM and RISC-V). Since ARCH_SUNXI depends on ARM, it cannot be used to gate architecture-independent options. Specifically, this means the board Kconfig file cannot be sourced from inside the "if ARCH_SUNXI" block.
Introduce a new BOARD_SUNXI symbol that can be selected by both ARCH_SUNXI now and the new RISC-V SoC symbols when they are added, and use it to gate the architecture-independent board options.
Signed-off-by: Samuel Holland samuel@sholland.org ---
arch/Kconfig | 1 + arch/arm/Kconfig | 1 + arch/arm/mach-sunxi/Kconfig | 2 -- board/sunxi/Kconfig | 11 +++++++++++ 4 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/arch/Kconfig b/arch/Kconfig index e3a456a98d..a77192096a 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -458,6 +458,7 @@ source "arch/Kconfig.nxp" endif
source "board/keymile/Kconfig" +source "board/sunxi/Kconfig"
if MIPS || MICROBLAZE
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 4e5daa9e7f..f2852783d4 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1134,6 +1134,7 @@ config ARCH_SOCFPGA config ARCH_SUNXI bool "Support sunxi (Allwinner) SoCs" select BINMAN + select BOARD_SUNXI select CMD_GPIO if GPIO select CMD_MMC if MMC select CMD_USB if DISTRO_DEFAULTS && USB_HOST diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig index dbe6005daa..a03e700a0b 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig @@ -1046,8 +1046,6 @@ config BLUETOOTH_DT_DEVICE_FIXUP The used address is "bdaddr" if set, and "ethaddr" with the LSB flipped elsewise.
-source "board/sunxi/Kconfig" - endif
config CHIP_DIP_SCAN diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index 42f61df5c5..9010631b16 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -1,3 +1,10 @@ +config BOARD_SUNXI + bool + +if BOARD_SUNXI + +menu "sunxi board options" + choice prompt "SPL Image Type" depends on SPL @@ -23,3 +30,7 @@ config SPL_IMAGE_TYPE string default "sunxi_egon" if SPL_IMAGE_TYPE_SUNXI_EGON default "sunxi_toc0" if SPL_IMAGE_TYPE_SUNXI_TOC0 + +endmenu + +endif

To maintain consistent behavior across architectures, most of the options selected by ARCH_SUNXI should be selected for the D1 SoC as well. To accomplish this, select them from BOARD_SUNXI instead.
No functional change here. Lines are only moved and alphabetized.
Signed-off-by: Samuel Holland samuel@sholland.org ---
arch/arm/Kconfig | 46 --------------------------------------------- board/sunxi/Kconfig | 46 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 46 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index f2852783d4..2c32b419a8 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1133,62 +1133,16 @@ config ARCH_SOCFPGA
config ARCH_SUNXI bool "Support sunxi (Allwinner) SoCs" - select BINMAN select BOARD_SUNXI - select CMD_GPIO if GPIO - select CMD_MMC if MMC - select CMD_USB if DISTRO_DEFAULTS && USB_HOST - select CLK - select DM - select DM_ETH if NET - select DM_GPIO if GPIO - select DM_I2C if I2C - select DM_SCSI if BLK && SCSI - select DM_SERIAL if SERIAL - select DM_SPI if SPI - select DM_SPI_FLASH if SPI select GPIO_EXTRA_HEADER - select OF_BOARD_SETUP select OF_CONTROL select OF_SEPARATE - select PINCTRL select SPECIFY_CONSOLE_INDEX if SERIAL - select SPL_SEPARATE_BSS if SPL select SPL_STACK_R if SPL select SPL_SYS_MALLOC_SIMPLE if SPL select SPL_SYS_THUMB_BUILD if !ARM64 - select SUNXI_GPIO if GPIO - select SYS_NS16550 if SERIAL select SYS_THUMB_BUILD if !ARM64 - select USB if DISTRO_DEFAULTS - select USB_KEYBOARD if DISTRO_DEFAULTS && USB_HOST select SPL_USE_TINY_PRINTF - select USE_PREBOOT - select SYS_RELOC_GD_ENV_ADDR - imply BOARD_LATE_INIT - imply CMD_DM - imply CMD_GPT - imply CMD_UBI if MTD_RAW_NAND - imply DISTRO_DEFAULTS - imply FAT_WRITE - imply FIT - imply OF_LIBFDT_OVERLAY - imply PRE_CONSOLE_BUFFER - imply SPL_GPIO - imply SPL_LIBCOMMON_SUPPORT - imply SPL_LIBGENERIC_SUPPORT - imply SPL_MMC if MMC - imply SPL_POWER - imply SPL_SERIAL - imply SYSRESET - imply SYSRESET_WATCHDOG - imply SYSRESET_WATCHDOG_AUTO - imply USB_EHCI_GENERIC - imply USB_EHCI_HCD - imply USB_GADGET - imply USB_OHCI_GENERIC - imply USB_OHCI_HCD - imply WDT
config ARCH_U8500 bool "ST-Ericsson U8500 Series" diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index 9010631b16..1d0700fe5f 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -1,5 +1,51 @@ config BOARD_SUNXI bool + select BINMAN + select CLK + select CMD_GPIO if GPIO + select CMD_MMC if MMC + select CMD_USB if DISTRO_DEFAULTS && USB_HOST + select DM + select DM_ETH if NET + select DM_GPIO if GPIO + select DM_I2C if I2C + select DM_SCSI if BLK && SCSI + select DM_SERIAL if SERIAL + select DM_SPI if SPI + select DM_SPI_FLASH if SPI + select OF_BOARD_SETUP + select PINCTRL + select SPL_SEPARATE_BSS if SPL + select SUNXI_GPIO if GPIO + select SYS_NS16550 if SERIAL + select SYS_RELOC_GD_ENV_ADDR + select USB if DISTRO_DEFAULTS + select USB_KEYBOARD if DISTRO_DEFAULTS && USB_HOST + select USE_PREBOOT + imply BOARD_LATE_INIT + imply CMD_DM + imply CMD_GPT + imply CMD_UBI if MTD_RAW_NAND + imply DISTRO_DEFAULTS + imply FAT_WRITE + imply FIT + imply OF_LIBFDT_OVERLAY + imply PRE_CONSOLE_BUFFER + imply SPL_GPIO + imply SPL_LIBCOMMON_SUPPORT + imply SPL_LIBGENERIC_SUPPORT + imply SPL_MMC if MMC + imply SPL_POWER + imply SPL_SERIAL + imply SYSRESET + imply SYSRESET_WATCHDOG + imply SYSRESET_WATCHDOG_AUTO + imply USB_EHCI_GENERIC + imply USB_EHCI_HCD + imply USB_GADGET + imply USB_OHCI_GENERIC + imply USB_OHCI_HCD + imply WDT
if BOARD_SUNXI

This was already supported by every machine type. It is unlikely that any new SoC support will be added without SPL support.
Signed-off-by: Samuel Holland samuel@sholland.org ---
arch/arm/mach-sunxi/Kconfig | 14 -------------- board/sunxi/Kconfig | 2 ++ 2 files changed, 2 insertions(+), 14 deletions(-)
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig index a03e700a0b..73097e5a40 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig @@ -133,7 +133,6 @@ config SUN50I_GEN_H6 select FIT select SPL_LOAD_FIT select MMC_SUNXI_HAS_NEW_MODE - select SUPPORT_SPL ---help--- Select this for sunxi SoCs which have H6 like peripherals, clocks and memory map. @@ -167,7 +166,6 @@ config MACH_SUNXI_H3_H5 select SUNXI_DRAM_DW select SUNXI_DRAM_DW_32BIT select SUNXI_GEN_SUN6I - select SUPPORT_SPL
# TODO: try out A80's 8GiB DRAM space config SUNXI_DRAM_MAX_SIZE @@ -184,7 +182,6 @@ config MACH_SUNIV bool "suniv (Allwinner F1C100s/F1C200s/F1C600/R6)" select CPU_ARM926EJS select SUNXI_GEN_SUN6I - select SUPPORT_SPL select SKIP_LOWLEVEL_INIT_ONLY select SPL_SKIP_LOWLEVEL_INIT_ONLY
@@ -194,7 +191,6 @@ config MACH_SUN4I select PHY_SUN4I_USB select DRAM_SUN4I select SUNXI_GEN_SUN4I - select SUPPORT_SPL imply SPL_SYS_I2C_LEGACY imply SYS_I2C_LEGACY
@@ -204,7 +200,6 @@ config MACH_SUN5I select DRAM_SUN4I select PHY_SUN4I_USB select SUNXI_GEN_SUN4I - select SUPPORT_SPL imply SPL_SYS_I2C_LEGACY imply SYS_I2C_LEGACY
@@ -220,7 +215,6 @@ config MACH_SUN6I select SPL_I2C select SUN6I_PRCM select SUNXI_GEN_SUN6I - select SUPPORT_SPL select SYS_I2C_SUN6I_P2WI select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
@@ -234,7 +228,6 @@ config MACH_SUN7I select DRAM_SUN4I select PHY_SUN4I_USB select SUNXI_GEN_SUN4I - select SUPPORT_SPL select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT imply SPL_SYS_I2C_LEGACY imply SYS_I2C_LEGACY @@ -249,7 +242,6 @@ config MACH_SUN8I_A23 select PHY_SUN4I_USB select SPL_I2C select SUNXI_GEN_SUN6I - select SUPPORT_SPL select SYS_I2C_SUN8I_RSB select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
@@ -263,7 +255,6 @@ config MACH_SUN8I_A33 select PHY_SUN4I_USB select SPL_I2C select SUNXI_GEN_SUN6I - select SUPPORT_SPL select SYS_I2C_SUN8I_RSB select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
@@ -276,7 +267,6 @@ config MACH_SUN8I_A83T select SUNXI_GEN_SUN6I select MMC_SUNXI_HAS_NEW_MODE select MMC_SUNXI_HAS_MODE_SWITCH - select SUPPORT_SPL select SYS_I2C_SUN8I_RSB
config MACH_SUN8I_H3 @@ -296,7 +286,6 @@ config MACH_SUN8I_R40 select ARCH_SUPPORT_PSCI select SUNXI_GEN_SUN6I select MMC_SUNXI_HAS_NEW_MODE - select SUPPORT_SPL select SUNXI_DRAM_DW select SUNXI_DRAM_DW_32BIT select PHY_SUN4I_USB @@ -311,7 +300,6 @@ config MACH_SUN8I_V3S select SUNXI_GEN_SUN6I select SUNXI_DRAM_DW select SUNXI_DRAM_DW_16BIT - select SUPPORT_SPL select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
config MACH_SUN9I @@ -322,7 +310,6 @@ config MACH_SUN9I select SPL_I2C select SUN6I_PRCM select SUNXI_GEN_SUN6I - select SUPPORT_SPL
config MACH_SUN50I bool "sun50i (Allwinner A64)" @@ -332,7 +319,6 @@ config MACH_SUN50I select SUNXI_DE2 select SUNXI_GEN_SUN6I select MMC_SUNXI_HAS_NEW_MODE - select SUPPORT_SPL select SUNXI_DRAM_DW select SUNXI_DRAM_DW_32BIT select FIT diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index 1d0700fe5f..056ccb6f74 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -18,6 +18,7 @@ config BOARD_SUNXI select SPL_SEPARATE_BSS if SPL select SUNXI_GPIO if GPIO select SYS_NS16550 if SERIAL + select SUPPORT_SPL select SYS_RELOC_GD_ENV_ADDR select USB if DISTRO_DEFAULTS select USB_KEYBOARD if DISTRO_DEFAULTS && USB_HOST @@ -31,6 +32,7 @@ config BOARD_SUNXI imply FIT imply OF_LIBFDT_OVERLAY imply PRE_CONSOLE_BUFFER + imply SPL imply SPL_GPIO imply SPL_LIBCOMMON_SUPPORT imply SPL_LIBGENERIC_SUPPORT

While not especially likely, it is plausible that someone wants to build U-Boot without GPIO or UART support. Don't force building these drivers.
Signed-off-by: Samuel Holland samuel@sholland.org ---
board/sunxi/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index 056ccb6f74..b301ba998e 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -16,8 +16,6 @@ config BOARD_SUNXI select OF_BOARD_SETUP select PINCTRL select SPL_SEPARATE_BSS if SPL - select SUNXI_GPIO if GPIO - select SYS_NS16550 if SERIAL select SUPPORT_SPL select SYS_RELOC_GD_ENV_ADDR select USB if DISTRO_DEFAULTS @@ -39,6 +37,8 @@ config BOARD_SUNXI imply SPL_MMC if MMC imply SPL_POWER imply SPL_SERIAL + imply SUNXI_GPIO + imply SYS_NS16550 imply SYSRESET imply SYSRESET_WATCHDOG imply SYSRESET_WATCHDOG_AUTO

This is used by quite a large number of boards, for PMIC/regulator or LCD panel control.
Signed-off-by: Samuel Holland samuel@sholland.org ---
board/sunxi/Kconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index b301ba998e..809cd17f54 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -38,6 +38,7 @@ config BOARD_SUNXI imply SPL_POWER imply SPL_SERIAL imply SUNXI_GPIO + imply SYS_I2C_MVTWSI imply SYS_NS16550 imply SYSRESET imply SYSRESET_WATCHDOG

This keeps all of the defaults for sunxi platforms in one place. Most of these only depend on architecture-independent features of the SoC (clock tree or SRAM layout) anyway.
No functional change; just some minor help text cleanup.
Signed-off-by: Samuel Holland samuel@sholland.org ---
arch/arm/mach-sunxi/Kconfig | 67 ------------------------------------ board/sunxi/Kconfig | 68 +++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 67 deletions(-)
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig index 73097e5a40..24840f6d7e 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig @@ -1,8 +1,5 @@ if ARCH_SUNXI
-config IDENT_STRING - default " Allwinner Technology" - config DRAM_SUN4I bool help @@ -99,17 +96,6 @@ config AXP_PMIC_BUS Select this PMIC bus access helpers for Sunxi platform PRCM or other AXP family PMIC devices.
-config SUNXI_SRAM_ADDRESS - hex - default 0x10000 if MACH_SUN9I || MACH_SUN50I || MACH_SUN50I_H5 - default 0x20000 if SUN50I_GEN_H6 - default 0x0 - ---help--- - Older Allwinner SoCs have their mask boot ROM mapped just below 4GB, - with the first SRAM region being located at address 0. - Some newer SoCs map the boot ROM at address 0 instead and move the - SRAM to a different address. - config SUNXI_A64_TIMER_ERRATUM bool
@@ -573,48 +559,6 @@ config DRAM_ODT_CORRECTION then the correction is negative. Usually the value for this is 0. endif
-config SYS_CLK_FREQ - default 408000000 if MACH_SUNIV - default 1008000000 if MACH_SUN4I - default 1008000000 if MACH_SUN5I - default 1008000000 if MACH_SUN6I - default 912000000 if MACH_SUN7I - default 816000000 if MACH_SUN50I || MACH_SUN50I_H5 - default 1008000000 if MACH_SUN8I - default 1008000000 if MACH_SUN9I - default 888000000 if MACH_SUN50I_H6 - default 1008000000 if MACH_SUN50I_H616 - -config SYS_CONFIG_NAME - default "suniv" if MACH_SUNIV - default "sun4i" if MACH_SUN4I - default "sun5i" if MACH_SUN5I - default "sun6i" if MACH_SUN6I - default "sun7i" if MACH_SUN7I - default "sun8i" if MACH_SUN8I - default "sun9i" if MACH_SUN9I - default "sun50i" if MACH_SUN50I - default "sun50i" if MACH_SUN50I_H6 - default "sun50i" if MACH_SUN50I_H616 - -config SYS_BOARD - default "sunxi" - -config SYS_SOC - default "sunxi" - -config SUNXI_MINIMUM_DRAM_MB - int "minimum DRAM size" - default 32 if MACH_SUNIV - default 64 if MACH_SUN8I_V3S - default 256 - ---help--- - Minimum DRAM size expected on the board. Traditionally we assumed - 256 MB, so that U-Boot would load at 160MB. With co-packaged DRAM - we have smaller sizes, though, so that U-Boot's own load address and - the default payload addresses must be shifted down. - This is expected to be fixed by the SoC selection. - config UART0_PORT_F bool "UART0 on MicroSD breakout board" ---help--- @@ -985,17 +929,6 @@ config GMAC_TX_DELAY ---help--- Set the GMAC Transmit Clock Delay Chain value.
-config SPL_STACK_R_ADDR - default 0x81e00000 if MACH_SUNIV - default 0x4fe00000 if MACH_SUN4I - default 0x4fe00000 if MACH_SUN5I - default 0x4fe00000 if MACH_SUN6I - default 0x4fe00000 if MACH_SUN7I - default 0x4fe00000 if MACH_SUN8I - default 0x2fe00000 if MACH_SUN9I - default 0x4fe00000 if MACH_SUN50I - default 0x4fe00000 if SUN50I_GEN_H6 - config SPL_SPI_SUNXI bool "Support for SPI Flash on Allwinner SoCs in SPL" depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUNXI_H3_H5 || MACH_SUN50I || MACH_SUN8I_R40 || SUN50I_GEN_H6 || MACH_SUNIV diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index 809cd17f54..105c902036 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -52,6 +52,74 @@ config BOARD_SUNXI
if BOARD_SUNXI
+config IDENT_STRING + default " Allwinner Technology" + +config SPL_STACK_R_ADDR + default 0x81e00000 if MACH_SUNIV + default 0x4fe00000 if MACH_SUN4I + default 0x4fe00000 if MACH_SUN5I + default 0x4fe00000 if MACH_SUN6I + default 0x4fe00000 if MACH_SUN7I + default 0x4fe00000 if MACH_SUN8I + default 0x2fe00000 if MACH_SUN9I + default 0x4fe00000 if MACH_SUN50I + default 0x4fe00000 if SUN50I_GEN_H6 + +config SUNXI_MINIMUM_DRAM_MB + int "minimum DRAM size" + default 32 if MACH_SUNIV + default 64 if MACH_SUN8I_V3S + default 256 + help + Minimum DRAM size expected on the board. Traditionally we + assumed 256 MB, so that U-Boot would load at 160MB. With + co-packaged DRAM we have smaller sizes, though, so U-Boot's + own load address and the default payload addresses must be + shifted down. This is expected to be fixed by the SoC + selection. + +config SUNXI_SRAM_ADDRESS + hex + default 0x10000 if MACH_SUN9I || MACH_SUN50I || MACH_SUN50I_H5 + default 0x20000 if SUN50I_GEN_H6 + default 0x0 + help + Older Allwinner SoCs have their boot mask ROM mapped just + below 4GB, with the first SRAM region located at address 0. + Newer SoCs map the boot ROM at address 0 instead and move the + SRAM to a different address. + +config SYS_BOARD + default "sunxi" + +config SYS_CLK_FREQ + default 408000000 if MACH_SUNIV + default 1008000000 if MACH_SUN4I + default 1008000000 if MACH_SUN5I + default 1008000000 if MACH_SUN6I + default 912000000 if MACH_SUN7I + default 1008000000 if MACH_SUN8I + default 1008000000 if MACH_SUN9I + default 816000000 if MACH_SUN50I || MACH_SUN50I_H5 + default 888000000 if MACH_SUN50I_H6 + default 1008000000 if MACH_SUN50I_H616 + +config SYS_CONFIG_NAME + default "suniv" if MACH_SUNIV + default "sun4i" if MACH_SUN4I + default "sun5i" if MACH_SUN5I + default "sun6i" if MACH_SUN6I + default "sun7i" if MACH_SUN7I + default "sun8i" if MACH_SUN8I + default "sun9i" if MACH_SUN9I + default "sun50i" if MACH_SUN50I + default "sun50i" if MACH_SUN50I_H6 + default "sun50i" if MACH_SUN50I_H616 + +config SYS_SOC + default "sunxi" + menu "sunxi board options"
choice

This option affects the ABI between SPL/U-Boot and U-Boot/scripts, so it should not normally be changed by the user.
Signed-off-by: Samuel Holland samuel@sholland.org ---
board/sunxi/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index 105c902036..d686d84170 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -67,7 +67,7 @@ config SPL_STACK_R_ADDR default 0x4fe00000 if SUN50I_GEN_H6
config SUNXI_MINIMUM_DRAM_MB - int "minimum DRAM size" + int default 32 if MACH_SUNIV default 64 if MACH_SUN8I_V3S default 256

Update this option to be based on SUNXI_MINIMUM_DRAM_MB. This corrects the value used on V3s, which previously was the MACH_SUN8I default, and so relied on addresses wrapping modulo the DRAM size.
Signed-off-by: Samuel Holland samuel@sholland.org ---
board/sunxi/Kconfig | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index d686d84170..7d678108a0 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -57,14 +57,9 @@ config IDENT_STRING
config SPL_STACK_R_ADDR default 0x81e00000 if MACH_SUNIV - default 0x4fe00000 if MACH_SUN4I - default 0x4fe00000 if MACH_SUN5I - default 0x4fe00000 if MACH_SUN6I - default 0x4fe00000 if MACH_SUN7I - default 0x4fe00000 if MACH_SUN8I default 0x2fe00000 if MACH_SUN9I - default 0x4fe00000 if MACH_SUN50I - default 0x4fe00000 if SUN50I_GEN_H6 + default 0x4fe00000 if SUNXI_MINIMUM_DRAM_MB >= 256 + default 0x43e00000 if SUNXI_MINIMUM_DRAM_MB >= 64
config SUNXI_MINIMUM_DRAM_MB int

This provides a default value for RISC-V when that is added, and it makes sense to put this option next to the other DRAM layout options.
While at it, provide sensible values for platforms with less DRAM.
Signed-off-by: Samuel Holland samuel@sholland.org ---
board/sunxi/Kconfig | 6 ++++++ common/Kconfig | 2 -- 2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index 7d678108a0..704535d467 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -55,6 +55,12 @@ if BOARD_SUNXI config IDENT_STRING default " Allwinner Technology"
+config PRE_CON_BUF_ADDR + default 0x81000000 if MACH_SUNIV + default 0x2f000000 if MACH_SUN9I + default 0x4f000000 if SUNXI_MINIMUM_DRAM_MB >= 256 + default 0x43000000 if SUNXI_MINIMUM_DRAM_MB >= 64 + config SPL_STACK_R_ADDR default 0x81e00000 if MACH_SUNIV default 0x2fe00000 if MACH_SUN9I diff --git a/common/Kconfig b/common/Kconfig index 21434c5cf1..bc2c078d4a 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -195,8 +195,6 @@ config PRE_CON_BUF_SZ config PRE_CON_BUF_ADDR hex "Address of the pre-console buffer" depends on PRE_CONSOLE_BUFFER - default 0x2f000000 if ARCH_SUNXI && MACH_SUN9I - default 0x4f000000 if ARCH_SUNXI && !MACH_SUN9I default 0x0f000000 if ROCKCHIP_RK3288 default 0x0f200000 if ROCKCHIP_RK3399 help

This provides a default value for RISC-V when that is added, and it makes sense to put this option next to the other DRAM layout options.
While at it, provide sensible values for platforms with less DRAM.
Signed-off-by: Samuel Holland samuel@sholland.org ---
board/sunxi/Kconfig | 6 ++++++ common/spl/Kconfig | 3 --- 2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index 704535d467..1abb3e1816 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -61,6 +61,12 @@ config PRE_CON_BUF_ADDR default 0x4f000000 if SUNXI_MINIMUM_DRAM_MB >= 256 default 0x43000000 if SUNXI_MINIMUM_DRAM_MB >= 64
+config SPL_BSS_START_ADDR + default 0x81f80000 if MACH_SUNIV + default 0x2ff80000 if MACH_SUN9I + default 0x4ff80000 if SUNXI_MINIMUM_DRAM_MB >= 256 + default 0x43f80000 if SUNXI_MINIMUM_DRAM_MB >= 64 + config SPL_STACK_R_ADDR default 0x81e00000 if MACH_SUNIV default 0x2fe00000 if MACH_SUN9I diff --git a/common/spl/Kconfig b/common/spl/Kconfig index b738c749ff..b1e9926e68 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -118,9 +118,6 @@ config SPL_BSS_START_ADDR default 0x88200000 if (ARCH_MX6 && (MX6SX || MX6SL || MX6UL || MX6ULL)) || ARCH_MX7 default 0x18200000 if ARCH_MX6 && !(MX6SX || MX6SL || MX6UL || MX6ULL) default 0x80a00000 if ARCH_OMAP2PLUS - default 0x81f80000 if ARCH_SUNXI && MACH_SUNIV - default 0x4ff80000 if ARCH_SUNXI && !(MACH_SUN9I || MACH_SUNIV) - default 0x2ff80000 if ARCH_SUNXI && MACH_SUN9I default 0x1000 if ARCH_ZYNQMP
choice

It makes sense to put this near the definition of SUNXI_SRAM_ADDRESS.
Signed-off-by: Samuel Holland samuel@sholland.org ---
board/sunxi/Kconfig | 5 +++++ common/spl/Kconfig | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index 1abb3e1816..b561dd467f 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -73,6 +73,11 @@ config SPL_STACK_R_ADDR default 0x4fe00000 if SUNXI_MINIMUM_DRAM_MB >= 256 default 0x43e00000 if SUNXI_MINIMUM_DRAM_MB >= 64
+config SPL_TEXT_BASE + default 0x10060 if MACH_SUN9I || MACH_SUN50I || MACH_SUN50I_H5 + default 0x20060 if SUN50I_GEN_H6 + default 0x00060 + config SUNXI_MINIMUM_DRAM_MB int default 32 if MACH_SUNIV diff --git a/common/spl/Kconfig b/common/spl/Kconfig index b1e9926e68..930028b5af 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -260,9 +260,6 @@ config SPL_TEXT_BASE default 0x402F4000 if AM43XX default 0x402F0400 if AM33XX default 0x40301350 if OMAP54XX - default 0x10060 if MACH_SUN50I || MACH_SUN50I_H5 || MACH_SUN9I - default 0x20060 if SUN50I_GEN_H6 - default 0x00060 if ARCH_SUNXI default 0xfffc0000 if ARCH_ZYNQMP default 0x0 help

This will provide a default value for RISC-V when that is added, and it makes sense to put this option next to the other DRAM layout options.
Signed-off-by: Samuel Holland samuel@sholland.org ---
Kconfig | 3 --- board/sunxi/Kconfig | 5 +++++ 2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/Kconfig b/Kconfig index ef94f88adc..70e159221c 100644 --- a/Kconfig +++ b/Kconfig @@ -508,9 +508,6 @@ config SYS_LOAD_ADDR hex "Address in memory to use by default" default 0x01000000 if ARCH_SOCFPGA default 0x02000000 if PPC || X86 - default 0x81000000 if MACH_SUNIV - default 0x22000000 if MACH_SUN9I - default 0x42000000 if ARCH_SUNXI default 0x82000000 if ARCH_KEYSTONE || ARCH_OMAP2PLUS || ARCH_K3 default 0x82000000 if ARCH_MX6 && (MX6SL || MX6SLL || MX6SX || MX6UL || MX6ULL) default 0x12000000 if ARCH_MX6 && !(MX6SL || MX6SLL || MX6SX || MX6UL || MX6ULL) diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index b561dd467f..d463474535 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -129,6 +129,11 @@ config SYS_CONFIG_NAME default "sun50i" if MACH_SUN50I_H6 default "sun50i" if MACH_SUN50I_H616
+config SYS_LOAD_ADDR + default 0x81000000 if MACH_SUNIV + default 0x22000000 if MACH_SUN9I + default 0x42000000 + config SYS_SOC default "sunxi"

This is how the vast majority of platforms provided TEXT_BASE. sunxi was the exception here.
Signed-off-by: Samuel Holland samuel@sholland.org ---
board/sunxi/Kconfig | 6 ++++++ boot/Kconfig | 4 ---- 2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index d463474535..7ff0275ae4 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -137,6 +137,12 @@ config SYS_LOAD_ADDR config SYS_SOC default "sunxi"
+config TEXT_BASE + default 0x81700000 if MACH_SUNIV + default 0x2a000000 if MACH_SUN9I + default 0x4a000000 if SUNXI_MINIMUM_DRAM_MB >= 256 + default 0x42e00000 if SUNXI_MINIMUM_DRAM_MB >= 64 + menu "sunxi board options"
choice diff --git a/boot/Kconfig b/boot/Kconfig index d5c582ebe8..b650a0b052 100644 --- a/boot/Kconfig +++ b/boot/Kconfig @@ -633,10 +633,6 @@ config TEXT_BASE depends on HAVE_TEXT_BASE default 0x0 if POSITION_INDEPENDENT default 0x80800000 if ARCH_OMAP2PLUS || ARCH_K3 - default 0x81700000 if MACH_SUNIV - default 0x2a000000 if MACH_SUN9I - default 0x4a000000 if SUNXI_MINIMUM_DRAM_MB >= 256 - default 0x42e00000 if SUNXI_MINIMUM_DRAM_MB >= 64 hex "Text Base" help The address in memory that U-Boot will be running from, initially.

This excludes options that are inherently ARM-specific or are specific to legacy non-DM drivers.
Some help text is cleaned up along the way.
Signed-off-by: Samuel Holland samuel@sholland.org ---
arch/arm/mach-sunxi/Kconfig | 71 ------------------------------------ board/sunxi/Kconfig | 72 +++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 71 deletions(-)
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig index 24840f6d7e..ff21d94842 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig @@ -559,16 +559,6 @@ config DRAM_ODT_CORRECTION then the correction is negative. Usually the value for this is 0. endif
-config UART0_PORT_F - bool "UART0 on MicroSD breakout board" - ---help--- - Repurpose the SD card slot for getting access to the UART0 serial - console. Primarily useful only for low level u-boot debugging on - tablets, where normal UART0 is difficult to access and requires - device disassembly and/or soldering. As the SD card can't be used - at the same time, the system can be only booted in the FEL mode. - Only enable this if you really know what you are doing. - config OLD_SUNXI_KERNEL_COMPAT bool "Enable workarounds for booting old kernels" ---help--- @@ -609,20 +599,6 @@ config MMC3_CD_PIN ---help--- See MMC0_CD_PIN help text.
-config MMC1_PINS_PH - bool "Pins for mmc1 are on Port H" - depends on MACH_SUN4I || MACH_SUN7I || MACH_SUN8I_R40 - ---help--- - Select this option for boards where mmc1 uses the Port H pinmux. - -config MMC_SUNXI_SLOT_EXTRA - int "mmc extra slot number" - default -1 - ---help--- - sunxi builds always enable mmc0, some boards also have a second sdcard - slot or emmc on mmc1 - mmc3. Setting this to 1, 2 or 3 will enable - support for this. - config USB0_VBUS_PIN string "Vbus enable pin for usb0 (otg)" default "" @@ -699,16 +675,6 @@ config AXP_GPIO ---help--- Say Y here to enable support for the gpio pins of the axp PMIC ICs.
-config AXP_DISABLE_BOOT_ON_POWERON - bool "Disable device boot on power plug-in" - depends on AXP209_POWER || AXP221_POWER || AXP809_POWER || AXP818_POWER - default n - ---help--- - Say Y here to prevent the device from booting up because of a plug-in - event. When set, the device will boot into the SPL briefly to - determine why it was powered on, and if it was determined because of - a plug-in event instead of a button press event it will shut back off. - config VIDEO_SUNXI bool "Enable graphical uboot console on HDMI, LCD or VGA" depends on !MACH_SUN8I_A83T @@ -937,41 +903,4 @@ config SPL_SPI_SUNXI sunxi SPI Flash. It uses the same method as the boot ROM, so does not need any extra configuration.
-config PINE64_DT_SELECTION - bool "Enable Pine64 device tree selection code" - depends on MACH_SUN50I - help - The original Pine A64 and Pine A64+ are similar but different - boards and can be differed by the DRAM size. Pine A64 has - 512MiB DRAM, and Pine A64+ has 1GiB or 2GiB. By selecting this - option, the device tree selection code specific to Pine64 which - utilizes the DRAM size will be enabled. - -config PINEPHONE_DT_SELECTION - bool "Enable PinePhone device tree selection code" - depends on MACH_SUN50I - help - Enable this option to automatically select the device tree for the - correct PinePhone hardware revision during boot. - -config BLUETOOTH_DT_DEVICE_FIXUP - string "Fixup the Bluetooth controller address" - default "" - help - This option specifies the DT compatible name of the Bluetooth - controller for which to set the "local-bd-address" property. - Set this option if your device ships with the Bluetooth controller - default address. - The used address is "bdaddr" if set, and "ethaddr" with the LSB - flipped elsewise. - endif - -config CHIP_DIP_SCAN - bool "Enable DIPs detection for CHIP board" - select SUPPORT_EXTENSION_SCAN - select W1 - select W1_GPIO - select W1_EEPROM - select W1_EEPROM_DS24XXX - select CMD_EXTENSION diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index 7ff0275ae4..f5e5c3770f 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -171,6 +171,78 @@ config SPL_IMAGE_TYPE default "sunxi_egon" if SPL_IMAGE_TYPE_SUNXI_EGON default "sunxi_toc0" if SPL_IMAGE_TYPE_SUNXI_TOC0
+config MMC_SUNXI_SLOT_EXTRA + int "MMC extra slot number" + default -1 + help + sunxi builds always enable mmc0. Some boards also have a + second SD card slot or eMMC on mmc1 - mmc3. Setting this to 1, + 2 or 3 will enable support for this. + +config MMC1_PINS_PH + bool "MMC1 pins are on Port H" + depends on MACH_SUN4I || MACH_SUN7I || MACH_SUN8I_R40 + help + Select this option on boards where mmc1 uses the Port H pinmux. + +config UART0_PORT_F + bool "UART0 pins are on Port F (MicroSD breakout board)" + help + Repurpose the SD card slot for getting access to the UART0 + serial console. Primarily useful only for low level u-boot + debugging on tablets, where normal UART0 is difficult to + access and requires device disassembly and/or soldering. As + the SD card can't be used at the same time, the system can be + only booted in FEL mode. Only enable this if you really know + what you are doing. + +config AXP_DISABLE_BOOT_ON_POWERON + bool "Disable device boot on power plug-in" + depends on AXP209_POWER || AXP221_POWER || AXP809_POWER || AXP818_POWER + help + Say Y here to prevent the device from booting up because of a + plug-in event. When set, the device will boot into the SPL + briefly to determine why it was powered on, and if the board + was powered on because of a plug-in event instead of a button + press event, it will shut back off. + +config CHIP_DIP_SCAN + bool "Enable DIPs detection for CHIP board" + select SUPPORT_EXTENSION_SCAN + select W1 + select W1_GPIO + select W1_EEPROM + select W1_EEPROM_DS24XXX + select CMD_EXTENSION + +config PINE64_DT_SELECTION + bool "Enable Pine64 device tree selection code" + depends on MACH_SUN50I + help + The original Pine A64 and Pine A64+ are similar but different + boards and can be differed by the DRAM size. Pine A64 has + 512MiB DRAM, and Pine A64+ has 1GiB or 2GiB. By selecting this + option, the device tree selection code specific to Pine64 which + utilizes the DRAM size will be enabled. + +config PINEPHONE_DT_SELECTION + bool "Enable PinePhone device tree selection code" + depends on MACH_SUN50I + help + Enable this option to automatically select the device tree for the + correct PinePhone hardware revision during boot. + +config BLUETOOTH_DT_DEVICE_FIXUP + string "Fixup the Bluetooth controller address" + default "" + help + This option specifies the DT compatible name of the Bluetooth + controller for which to set the "local-bd-address" property. + Set this option if your device ships with the Bluetooth controller + default address. + The used address is "bdaddr" if set, and "ethaddr" with the LSB + flipped elsewise. + endmenu
endif

This ensures the same environment layout will be used across all sunxi boards, regardless of CPU architecture.
Signed-off-by: Samuel Holland samuel@sholland.org ---
env/Kconfig | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/env/Kconfig b/env/Kconfig index 24111dfaf4..ae28e4e3e6 100644 --- a/env/Kconfig +++ b/env/Kconfig @@ -92,7 +92,7 @@ config ENV_IS_IN_FAT bool "Environment is in a FAT filesystem" depends on !CHAIN_OF_TRUST default y if ARCH_BCM283X - default y if ARCH_SUNXI && MMC + default y if BOARD_SUNXI && MMC default y if MMC_OMAP_HS && TI_COMMON_CMD_OPTIONS select FS_FAT select FAT_WRITE @@ -338,7 +338,7 @@ config ENV_IS_IN_SPI_FLASH default y if NORTHBRIDGE_INTEL_IVYBRIDGE default y if INTEL_QUARK default y if INTEL_QUEENSBAY - default y if ARCH_SUNXI + default y if BOARD_SUNXI help Define this if you have a SPI Flash memory device which you want to use for the environment. @@ -461,7 +461,7 @@ config ENV_FAT_DEVICE_AND_PART depends on ENV_IS_IN_FAT default "0:1" if TI_COMMON_CMD_OPTIONS default "0:auto" if ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_VERSAL - default ":auto" if ARCH_SUNXI + default ":auto" if BOARD_SUNXI default "0" if ARCH_AT91 help Define this to a string to specify the partition of the device. It can @@ -555,7 +555,7 @@ config ENV_OFFSET ENV_IS_IN_SPI_FLASH default 0x3f8000 if ARCH_ROCKCHIP && ENV_IS_IN_MMC default 0x140000 if ARCH_ROCKCHIP && ENV_IS_IN_SPI_FLASH - default 0xF0000 if ARCH_SUNXI + default 0xF0000 if BOARD_SUNXI default 0xE0000 if ARCH_ZYNQ default 0x1E00000 if ARCH_ZYNQMP default 0x7F40000 if ARCH_VERSAL || ARCH_VERSAL_NET @@ -580,7 +580,7 @@ config ENV_SIZE hex "Environment Size" default 0x40000 if ENV_IS_IN_SPI_FLASH && ARCH_ZYNQMP default 0x20000 if ARCH_ZYNQ || ARCH_OMAP2PLUS || ARCH_AT91 - default 0x10000 if ARCH_SUNXI + default 0x10000 if BOARD_SUNXI default 0x8000 if ARCH_ROCKCHIP && ENV_IS_IN_MMC default 0x2000 if ARCH_ROCKCHIP && ENV_IS_IN_SPI_FLASH default 0x8000 if ARCH_ZYNQMP || ARCH_VERSAL || ARCH_VERSAL_NET @@ -596,7 +596,7 @@ config ENV_SECT_SIZE default 0x40000 if ARCH_ZYNQMP || ARCH_VERSAL || ARCH_VERSAL_NET default 0x20000 if ARCH_ZYNQ || ARCH_OMAP2PLUS || ARCH_AT91 default 0x20000 if MICROBLAZE && ENV_IS_IN_SPI_FLASH - default 0x10000 if ARCH_SUNXI && ENV_IS_IN_SPI_FLASH + default 0x10000 if BOARD_SUNXI && ENV_IS_IN_SPI_FLASH help Size of the sector containing the environment.

This provides a unified configuration across all sunxi boards, regardless of CPU architecture.
Signed-off-by: Samuel Holland samuel@sholland.org ---
drivers/clk/sunxi/Kconfig | 2 +- drivers/fastboot/Kconfig | 13 ++++++------- drivers/gpio/Kconfig | 2 +- drivers/mmc/Kconfig | 2 +- drivers/net/phy/Kconfig | 4 ++-- drivers/phy/allwinner/Kconfig | 2 +- drivers/pinctrl/sunxi/Kconfig | 2 +- drivers/reset/Kconfig | 2 +- drivers/spi/Kconfig | 2 +- drivers/usb/Kconfig | 2 +- drivers/usb/gadget/Kconfig | 8 ++++---- drivers/usb/musb-new/Kconfig | 2 +- drivers/video/Kconfig | 2 +- drivers/watchdog/Kconfig | 4 ++-- 14 files changed, 24 insertions(+), 25 deletions(-)
diff --git a/drivers/clk/sunxi/Kconfig b/drivers/clk/sunxi/Kconfig index bf11fad6ee..72310e231d 100644 --- a/drivers/clk/sunxi/Kconfig +++ b/drivers/clk/sunxi/Kconfig @@ -1,6 +1,6 @@ config CLK_SUNXI bool "Clock support for Allwinner SoCs" - depends on CLK && ARCH_SUNXI + depends on CLK && BOARD_SUNXI select DM_RESET select SPL_DM_RESET if SPL_CLK default y diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig index b97c67bf60..a55fdac370 100644 --- a/drivers/fastboot/Kconfig +++ b/drivers/fastboot/Kconfig @@ -8,7 +8,7 @@ config FASTBOOT config USB_FUNCTION_FASTBOOT bool "Enable USB fastboot gadget" depends on USB_GADGET - default y if ARCH_SUNXI && USB_MUSB_GADGET + default y if BOARD_SUNXI && USB_MUSB_GADGET select FASTBOOT select USB_GADGET_DOWNLOAD help @@ -32,10 +32,9 @@ if FASTBOOT
config FASTBOOT_BUF_ADDR hex "Define FASTBOOT buffer address" + default SYS_LOAD_ADDR if BOARD_SUNXI default 0x82000000 if MX6SX || MX6SL || MX6UL || MX6SLL default 0x81000000 if ARCH_OMAP2PLUS - default 0x42000000 if ARCH_SUNXI && !MACH_SUN9I - default 0x22000000 if ARCH_SUNXI && MACH_SUN9I default 0x60800800 if ROCKCHIP_RK3036 || ROCKCHIP_RK3188 || \ ROCKCHIP_RK322X default 0x800800 if ROCKCHIP_RK3288 || ROCKCHIP_RK3329 || \ @@ -52,7 +51,7 @@ config FASTBOOT_BUF_SIZE hex "Define FASTBOOT buffer size" default 0x8000000 if ARCH_ROCKCHIP default 0x6000000 if ARCH_ZYNQMP - default 0x2000000 if ARCH_SUNXI + default 0x2000000 if BOARD_SUNXI default 0x8192 if SANDBOX default 0x7000000 help @@ -71,7 +70,7 @@ config FASTBOOT_USB_DEV
config FASTBOOT_FLASH bool "Enable FASTBOOT FLASH command" - default y if ARCH_SUNXI || ARCH_ROCKCHIP + default y if BOARD_SUNXI || ARCH_ROCKCHIP depends on MMC || (MTD_RAW_NAND && CMD_MTDPARTS) select IMAGE_SPARSE help @@ -105,8 +104,8 @@ config FASTBOOT_FLASH_MMC_DEV int "Define FASTBOOT MMC FLASH default device" depends on FASTBOOT_FLASH_MMC default 0 if ARCH_ROCKCHIP - default 0 if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA = -1 - default 1 if ARCH_SUNXI && MMC_SUNXI_SLOT_EXTRA != -1 + default 0 if BOARD_SUNXI && MMC_SUNXI_SLOT_EXTRA = -1 + default 1 if BOARD_SUNXI && MMC_SUNXI_SLOT_EXTRA != -1 help The fastboot "flash" command requires additional information regarding the non-volatile storage device. Define this to diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index ff87fbfb39..defdb91368 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -363,7 +363,7 @@ config SANDBOX_GPIO_COUNT
config SUNXI_GPIO bool "Allwinner GPIO driver" - depends on ARCH_SUNXI + depends on BOARD_SUNXI select SPL_STRTO if SPL help Support the GPIO device in Allwinner SoCs. diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig index 56f42820c7..6a7271de75 100644 --- a/drivers/mmc/Kconfig +++ b/drivers/mmc/Kconfig @@ -749,7 +749,7 @@ config ZYNQ_HISPD_BROKEN
config MMC_SUNXI bool "Allwinner sunxi SD/MMC Host Controller support" - depends on ARCH_SUNXI + depends on BOARD_SUNXI default y help This selects support for the SD/MMC Host Controller on diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig index 52ce08b3b3..a68298fa08 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig @@ -19,14 +19,14 @@ if PHYLIB
config PHY_ADDR_ENABLE bool "Limit phy address" - default y if ARCH_SUNXI + default y if BOARD_SUNXI help Select this if you want to control which phy address is used
if PHY_ADDR_ENABLE config PHY_ADDR int "PHY address" - default 1 if ARCH_SUNXI + default 1 if BOARD_SUNXI default 0 help The address of PHY on MII bus. Usually in range of 0 to 31. diff --git a/drivers/phy/allwinner/Kconfig b/drivers/phy/allwinner/Kconfig index f8f1e99c4f..ab43681f0c 100644 --- a/drivers/phy/allwinner/Kconfig +++ b/drivers/phy/allwinner/Kconfig @@ -3,7 +3,7 @@ # config PHY_SUN4I_USB bool "Allwinner Sun4I USB PHY driver" - depends on ARCH_SUNXI + depends on BOARD_SUNXI select DM_REGULATOR select PHY help diff --git a/drivers/pinctrl/sunxi/Kconfig b/drivers/pinctrl/sunxi/Kconfig index 77da90836b..eb574236a3 100644 --- a/drivers/pinctrl/sunxi/Kconfig +++ b/drivers/pinctrl/sunxi/Kconfig @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0
-if ARCH_SUNXI +if BOARD_SUNXI
config PINCTRL_SUNXI select PINCTRL_FULL diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig index 4cb0ba0850..cb15372306 100644 --- a/drivers/reset/Kconfig +++ b/drivers/reset/Kconfig @@ -137,7 +137,7 @@ config RESET_MTMIPS
config RESET_SUNXI bool "RESET support for Allwinner SoCs" - depends on DM_RESET && ARCH_SUNXI + depends on DM_RESET && BOARD_SUNXI default y help This enables support for common reset driver for diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 34b92ceaee..20412e1887 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig @@ -442,7 +442,7 @@ config SOFT_SPI
config SPI_SUNXI bool "Allwinner SoC SPI controllers" - default ARCH_SUNXI + default BOARD_SUNXI help Enable the Allwinner SoC SPi controller driver.
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index 3afb45d5cc..8c0d4da193 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig @@ -116,7 +116,7 @@ config USB_KEYBOARD_FN_KEYS
choice prompt "USB keyboard polling" - default SYS_USB_EVENT_POLL_VIA_INT_QUEUE if ARCH_SUNXI + default SYS_USB_EVENT_POLL_VIA_INT_QUEUE if BOARD_SUNXI default SYS_USB_EVENT_POLL ---help--- Enable a polling mechanism for USB keyboard. diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index e8da73c788..19071e003e 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -40,7 +40,7 @@ if USB_GADGET
config USB_GADGET_MANUFACTURER string "Vendor name of the USB device" - default "Allwinner Technology" if ARCH_SUNXI + default "Allwinner Technology" if BOARD_SUNXI default "Rockchip" if ARCH_ROCKCHIP default "U-Boot" help @@ -49,7 +49,7 @@ config USB_GADGET_MANUFACTURER
config USB_GADGET_VENDOR_NUM hex "Vendor ID of the USB device" - default 0x1f3a if ARCH_SUNXI + default 0x1f3a if BOARD_SUNXI default 0x2207 if ARCH_ROCKCHIP default 0x0 help @@ -59,7 +59,7 @@ config USB_GADGET_VENDOR_NUM
config USB_GADGET_PRODUCT_NUM hex "Product ID of the USB device" - default 0x1010 if ARCH_SUNXI + default 0x1010 if BOARD_SUNXI default 0x310a if ROCKCHIP_RK3036 default 0x300a if ROCKCHIP_RK3066 default 0x310c if ROCKCHIP_RK3128 @@ -202,7 +202,7 @@ endif # USB_GADGET_DOWNLOAD config USB_ETHER bool "USB Ethernet Gadget" depends on NET - default y if ARCH_SUNXI && USB_MUSB_GADGET + default y if BOARD_SUNXI && USB_MUSB_GADGET help Creates an Ethernet network device through a USB peripheral controller. This will create a network interface on both the device diff --git a/drivers/usb/musb-new/Kconfig b/drivers/usb/musb-new/Kconfig index 51f876cd71..d2d86a5c0e 100644 --- a/drivers/usb/musb-new/Kconfig +++ b/drivers/usb/musb-new/Kconfig @@ -67,7 +67,7 @@ config USB_MUSB_PIC32
config USB_MUSB_SUNXI bool "Enable sunxi OTG / DRC USB controller" - depends on ARCH_SUNXI + depends on BOARD_SUNXI select USB_MUSB_PIO_ONLY default y ---help--- diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index c841b99bb3..4e9e179d12 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -183,7 +183,7 @@ config CONSOLE_TRUETYPE_MAX_METRICS
config SYS_WHITE_ON_BLACK bool "Display console as white on a black background" - default y if ARCH_AT91 || ARCH_EXYNOS || ARCH_ROCKCHIP || ARCH_TEGRA || X86 || ARCH_SUNXI + default y if ARCH_AT91 || ARCH_EXYNOS || ARCH_ROCKCHIP || ARCH_TEGRA || X86 || BOARD_SUNXI help Normally the display is black on a white background, Enable this option to invert this, i.e. white on a black background. This can be diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index f1b1cf63ca..575dea5da5 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -29,7 +29,7 @@ config WATCHDOG_TIMEOUT_MSECS default 128000 if ARCH_MX31 || ARCH_MX5 || ARCH_MX6 default 128000 if ARCH_MX7 || ARCH_VF610 default 30000 if ARCH_SOCFPGA - default 16000 if ARCH_SUNXI + default 16000 if BOARD_SUNXI default 60000 help Watchdog timeout in msec @@ -321,7 +321,7 @@ config WDT_STM32MP
config WDT_SUNXI bool "Allwinner sunxi watchdog timer support" - depends on WDT && ARCH_SUNXI + depends on WDT && BOARD_SUNXI default y help Enable support for the watchdog timer in Allwinner sunxi SoCs.

This provides a unified configuration across all sunxi boards, regardless of CPU architecture.
Signed-off-by: Samuel Holland samuel@sholland.org ---
disk/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/disk/Kconfig b/disk/Kconfig index c9b9dbaf1a..b9d3625dc2 100644 --- a/disk/Kconfig +++ b/disk/Kconfig @@ -61,7 +61,7 @@ config SPL_DOS_PARTITION bool "Enable MS Dos partition table for SPL" depends on SPL default n if ARCH_MVEBU - default n if ARCH_SUNXI + default n if BOARD_SUNXI default y if DOS_PARTITION select SPL_PARTITIONS
@@ -104,7 +104,7 @@ config EFI_PARTITION config EFI_PARTITION_ENTRIES_NUMBERS int "Number of the EFI partition entries" depends on EFI_PARTITION - default 56 if ARCH_SUNXI + default 56 if BOARD_SUNXI default 128 help Specify the number of partition entries in the GPT. This is @@ -132,7 +132,7 @@ config SPL_EFI_PARTITION bool "Enable EFI GPT partition table for SPL" depends on SPL default n if ARCH_MVEBU - default n if ARCH_SUNXI + default n if BOARD_SUNXI default y if EFI_PARTITION select SPL_PARTITIONS

This provides a unified configuration across all sunxi boards, regardless of CPU architecture.
Signed-off-by: Samuel Holland samuel@sholland.org ---
common/spl/Kconfig | 12 ++++++------ scripts/Makefile.spl | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/common/spl/Kconfig b/common/spl/Kconfig index 930028b5af..5ff75aad9f 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -110,7 +110,7 @@ config SPL_PAD_TO config SPL_HAS_BSS_LINKER_SECTION depends on SPL_FRAMEWORK bool "Use a specific address for the BSS via the linker script" - default y if ARCH_SUNXI || ARCH_MX6 || ARCH_OMAP2PLUS || MIPS || RISCV || ARCH_ZYNQMP + default y if ARCH_MX6 || ARCH_OMAP2PLUS || ARCH_ZYNQMP || BOARD_SUNXI || MIPS || RISCV
config SPL_BSS_START_ADDR hex "Link address for the BSS within the SPL binary" @@ -334,7 +334,7 @@ config SPL_SYS_MALLOC_SIMPLE config SPL_SHARES_INIT_SP_ADDR bool "SPL and U-Boot use the same initial stack pointer location" depends on (ARM || ARCH_JZ47XX || MICROBLAZE || RISCV) && SPL_FRAMEWORK - default n if ARCH_SUNXI || ARCH_MX6 || ARCH_MX7 + default n if BOARD_SUNXI || ARCH_MX6 || ARCH_MX7 default y help In many cases, we can use the same initial stack pointer address for @@ -452,7 +452,7 @@ config SPL_DISPLAY_PRINT
config SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR bool "MMC raw mode: by sector" - default y if ARCH_SUNXI || ARCH_DAVINCI || ARCH_UNIPHIER || \ + default y if BOARD_SUNXI || ARCH_DAVINCI || ARCH_UNIPHIER || \ ARCH_MX6 || ARCH_MX7 || \ ARCH_ROCKCHIP || ARCH_MVEBU || ARCH_SOCFPGA || \ ARCH_AT91 || ARCH_ZYNQ || ARCH_KEYSTONE || OMAP34XX || \ @@ -465,7 +465,7 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR config SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR hex "Address on the MMC to load U-Boot from" depends on SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR - default 0x40 if ARCH_SUNXI + default 0x40 if BOARD_SUNXI default 0x75 if ARCH_DAVINCI default 0x8a if ARCH_MX6 || ARCH_MX7 default 0x100 if ARCH_UNIPHIER @@ -482,7 +482,7 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR config SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET hex "U-Boot main hardware partition image offset" depends on SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR - default 0x10 if ARCH_SUNXI + default 0x10 if BOARD_SUNXI default 0x0 help On some platforms SPL location depends on hardware partition. The ROM @@ -1308,7 +1308,7 @@ endif # SPL_SPI_FLASH_SUPPORT
config SYS_SPI_U_BOOT_OFFS hex "address of u-boot payload in SPI flash" - default 0x8000 if ARCH_SUNXI + default 0x8000 if BOARD_SUNXI default 0x0 depends on SPL_SPI_LOAD || SPL_SPI_SUNXI help diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index 15ac87286d..819050dd4d 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -264,7 +264,7 @@ endif
INPUTS-$(CONFIG_TARGET_SOCFPGA_SOC64) += $(obj)/u-boot-spl-dtb.hex
-ifdef CONFIG_ARCH_SUNXI +ifdef CONFIG_BOARD_SUNXI INPUTS-y += $(obj)/sunxi-spl.bin
ifdef CONFIG_NAND_SUNXI

On Tue, 1 Nov 2022 00:08:12 -0500 Samuel Holland samuel@sholland.org wrote:
Hi Samuel,
sunxi is getting a new RISC-V platform, D1. We want to share as much of the existing configuration as possible, to provide a familiar environment, DRAM layout, partition layout, etc.
Because U-Boot includes all architecture Kconfig files at once, we must use a symbol outside of both CONFIG_ARM and CONFIG_RISCV to contain shared Kconfig options. I chose BOARD_SUNXI, corresponding to the file location and somewhat following the BOARD_SPECIFIC_OPTIONS pattern.
many thanks for sending this, indeed our Kconfig deserved some cleanups, plus we need to fix the woes with RISC-V. I just skimmed over this for now, and it seems to look good.
I have some gripes with the name BOARD_SUNXI though. Bad enough we have board-agnostic generic code in board/sunxi, but maybe we shouldn't add to the confusion. Would PLAT_SUNXI be a better name? After all it's all about the Allwinner platform (and not even "architecture", for that matter).
I did a buildman run on this series. The only net option changes are the expected ones:
- Host-side USB gets enabled on several boards by the first patch (emlid_neutis_n5_devboard orangepi_zero2 pinephone pinetab tanix_tx6 x96_mate teres_i)
- CONFIG_BOARD_SUNXI gets added everywhere
- CONFIG_SYS_I2C_MVTWSI gets enabled by the corresponding patch
Andre, please feel free to take any subset of these; they don't all have to go in at once. And I'm open to suggestions about what instances of ARCH_SUNXI should (not) be converted. Some of them are open to opinion.
Yeah, I will definitely cherry-pick some patches, especially the more innocent ones. I will run my before/after defconfig comparisons to test them.
Cheers, Andre
I left alone the options in arch/arm/mach-sunxi/Kconfig that are covered by other series (MMC CD/USB PHY/power pins, AXP GPIO).
After this series, the Kconfig changes needed for D1 support are quite small, something like this commit: https://github.com/smaeul/u-boot/commit/c12cf6c5d72f5327eff793518229ddbd41dc...
Adding SUNXI_MINIMUM_DRAM_MB certainly made things nicer. There are a few options that probably still need some adjustment to respect it.
Samuel Holland (22): sunxi: Fix default-enablement of USB host drivers sunxi: Remove unnecessary Kconfig selections sunxi: Add missing dependencies to Kconfig selections sunxi: Hide image type selection if SPL is disabled sunxi: Share the board Kconfig across architectures sunxi: Move most Kconfig selections to the board Kconfig sunxi: Globally enable SUPPORT_SPL sunxi: Downgrade driver selections to implications sunxi: Enable the I2C driver by default sunxi: Move default values to the board Kconfig sunxi: Hide the SUNXI_MINIMUM_DRAM_MB symbol sunxi: Clean up the SPL_STACK_R_ADDR defaults sunxi: Move PRE_CON_BUF_ADDR to the board Kconfig sunxi: Move SPL_BSS_START_ADDR to the board Kconfig sunxi: Move SPL_TEXT_BASE to the board Kconfig sunxi: Move SYS_LOAD_ADDR to the board Kconfig sunxi: Move TEXT_BASE to the board Kconfig sunxi: Move most board options to the board Kconfig env: sunxi: Replace ARCH_SUNXI with BOARD_SUNXI drivers: sunxi: Replace ARCH_SUNXI with BOARD_SUNXI disk: sunxi: Replace ARCH_SUNXI with BOARD_SUNXI spl: sunxi: Replace ARCH_SUNXI with BOARD_SUNXI
Kconfig | 3 - arch/Kconfig | 1 + arch/arm/Kconfig | 48 +------- arch/arm/mach-sunxi/Kconfig | 154 ----------------------- board/sunxi/Kconfig | 224 ++++++++++++++++++++++++++++++++++ boot/Kconfig | 4 - common/Kconfig | 2 - common/spl/Kconfig | 18 +-- disk/Kconfig | 6 +- drivers/clk/sunxi/Kconfig | 2 +- drivers/fastboot/Kconfig | 13 +- drivers/gpio/Kconfig | 2 +- drivers/mmc/Kconfig | 2 +- drivers/net/phy/Kconfig | 4 +- drivers/phy/allwinner/Kconfig | 2 +- drivers/pinctrl/sunxi/Kconfig | 2 +- drivers/reset/Kconfig | 2 +- drivers/spi/Kconfig | 2 +- drivers/usb/Kconfig | 2 +- drivers/usb/gadget/Kconfig | 8 +- drivers/usb/host/Kconfig | 2 - drivers/usb/musb-new/Kconfig | 2 +- drivers/video/Kconfig | 2 +- drivers/watchdog/Kconfig | 4 +- env/Kconfig | 12 +- scripts/Makefile.spl | 2 +- 26 files changed, 267 insertions(+), 258 deletions(-)

On 11/3/22 11:46, Andre Przywara wrote:
On Tue, 1 Nov 2022 00:08:12 -0500 Samuel Holland samuel@sholland.org wrote:
Hi Samuel,
sunxi is getting a new RISC-V platform, D1. We want to share as much of the existing configuration as possible, to provide a familiar environment, DRAM layout, partition layout, etc.
Because U-Boot includes all architecture Kconfig files at once, we must use a symbol outside of both CONFIG_ARM and CONFIG_RISCV to contain shared Kconfig options. I chose BOARD_SUNXI, corresponding to the file location and somewhat following the BOARD_SPECIFIC_OPTIONS pattern.
many thanks for sending this, indeed our Kconfig deserved some cleanups, plus we need to fix the woes with RISC-V. I just skimmed over this for now, and it seems to look good.
I have some gripes with the name BOARD_SUNXI though. Bad enough we have board-agnostic generic code in board/sunxi, but maybe we shouldn't add to the confusion. Would PLAT_SUNXI be a better name? After all it's all about the Allwinner platform (and not even "architecture", for that matter).
I am fine with either name. "board" is U-Boot's name for the level of abstraction we are working at. I don't know that it necessarily has to refer to code for a _single_ board, as opposed to code that glues things together at the "board level" outside the CPU/SoC. But I can see where the confusion comes from. Let me know what you want me to do, and I can adjust/resend the series.
I did a buildman run on this series. The only net option changes are the expected ones:
- Host-side USB gets enabled on several boards by the first patch (emlid_neutis_n5_devboard orangepi_zero2 pinephone pinetab tanix_tx6 x96_mate teres_i)
- CONFIG_BOARD_SUNXI gets added everywhere
- CONFIG_SYS_I2C_MVTWSI gets enabled by the corresponding patch
Andre, please feel free to take any subset of these; they don't all have to go in at once. And I'm open to suggestions about what instances of ARCH_SUNXI should (not) be converted. Some of them are open to opinion.
Yeah, I will definitely cherry-pick some patches, especially the more innocent ones. I will run my before/after defconfig comparisons to test them.
I used buildman's -K option to get the list above; it outputs the list of individual boards with option changes per patch.
Regards, Samuel
participants (2)
-
Andre Przywara
-
Samuel Holland