mbox series

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

Message ID 20221101050835.2421-1-samuel@sholland.org
Headers show
Series sunxi: Prepare platform Kconfig to support multiple architectures | expand

Message

Samuel Holland Nov. 1, 2022, 5:08 a.m. UTC
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/c12cf6c5d72f5327eff793518229ddbd41dcf729.patch

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(-)

Comments

Andre Przywara Nov. 3, 2022, 4:46 p.m. UTC | #1
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/c12cf6c5d72f5327eff793518229ddbd41dcf729.patch
> 
> 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(-)
>
Samuel Holland Nov. 6, 2022, 10:32 p.m. UTC | #2
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