Re: [PATCH 5/7] arm: mach-k3: am62x: Move board selection to mach-k3

2023-11-02 Thread Andrew Davis

On 11/2/23 3:55 AM, Francesco Dolcini wrote:

Hello Andrew,

On Wed, Nov 01, 2023 at 03:35:28PM -0500, Andrew Davis wrote:

Currently each set of board targets from a vendor is selected inside
the board directory for that vendor. This has the problem of multiple
targets, one from each vendor, being selectable at the same time.
For instance you can select both TARGET_AM654_A53_EVM and
TARGET_IOT2050_A53 in the same build.

To fix this we need to move the target board choice to a common location
for each parent SoC selection. Do this in arch/arm/mach-k3.


Is this oddity specific of ti k3 based board or is this a generic issue
in u-boot? Asking to understand if a k3-specific fix is the correct one
here.



Some platforms/archs do it this way, others don't, so it is mixed. Right
now I'm just fixing mach-k3 but I agree it would be good to audit for this
u-boot wide.

Thinking more on this, what we really need is a consistent strategy for
selecting target boards in Kconfig. I'd like to keep as much vendor
specific stuff in the board/ dirs, but in this case we end up
with the problem in the commit message.

I think arch/x86/ has the right idea. We can have in arch/arm/mach-k3/Kconfig

config VENDOR_*

selections which lets you choose only one vendor. From there we would
only include the one board directory matching that SoC+vendor combo.
That way we could keep the target selection down in the board/ dirs so
you don't have to make changes in arch/arm/mach-k3 when adding new board.

If everyone is okay with that, I can make that change to this series.
Could be a template then for other arch and vendors.

Andrew


Re: [PATCH 5/7] arm: mach-k3: am62x: Move board selection to mach-k3

2023-11-02 Thread Francesco Dolcini
Hello Andrew,

On Wed, Nov 01, 2023 at 03:35:28PM -0500, Andrew Davis wrote:
> Currently each set of board targets from a vendor is selected inside
> the board directory for that vendor. This has the problem of multiple
> targets, one from each vendor, being selectable at the same time.
> For instance you can select both TARGET_AM654_A53_EVM and
> TARGET_IOT2050_A53 in the same build.
> 
> To fix this we need to move the target board choice to a common location
> for each parent SoC selection. Do this in arch/arm/mach-k3.

Is this oddity specific of ti k3 based board or is this a generic issue
in u-boot? Asking to understand if a k3-specific fix is the correct one
here.

Francesco



[PATCH 5/7] arm: mach-k3: am62x: Move board selection to mach-k3

2023-11-01 Thread Andrew Davis
Currently each set of board targets from a vendor is selected inside
the board directory for that vendor. This has the problem of multiple
targets, one from each vendor, being selectable at the same time.
For instance you can select both TARGET_AM654_A53_EVM and
TARGET_IOT2050_A53 in the same build.

To fix this we need to move the target board choice to a common location
for each parent SoC selection. Do this in arch/arm/mach-k3.

Signed-off-by: Andrew Davis 
---
 arch/arm/mach-k3/Kconfig  |  4 +--
 arch/arm/mach-k3/am62x/Kconfig| 49 +++
 board/ti/am62x/Kconfig| 23 ---
 board/toradex/verdin-am62/Kconfig | 23 ---
 4 files changed, 51 insertions(+), 48 deletions(-)
 create mode 100644 arch/arm/mach-k3/am62x/Kconfig

diff --git a/arch/arm/mach-k3/Kconfig b/arch/arm/mach-k3/Kconfig
index 7293e3cb4fd..a460952f119 100644
--- a/arch/arm/mach-k3/Kconfig
+++ b/arch/arm/mach-k3/Kconfig
@@ -189,9 +189,9 @@ config K3_X509_SWRV
 
 source "arch/arm/mach-k3/am65x/Kconfig"
 source "arch/arm/mach-k3/am64x/Kconfig"
-source "board/ti/am62x/Kconfig"
+source "arch/arm/mach-k3/am62x/Kconfig"
 source "board/ti/am62ax/Kconfig"
 source "arch/arm/mach-k3/j721e/Kconfig"
 source "board/ti/j721s2/Kconfig"
-source "board/toradex/verdin-am62/Kconfig"
+
 endif
diff --git a/arch/arm/mach-k3/am62x/Kconfig b/arch/arm/mach-k3/am62x/Kconfig
new file mode 100644
index 000..738065e3310
--- /dev/null
+++ b/arch/arm/mach-k3/am62x/Kconfig
@@ -0,0 +1,49 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/
+#  Andrew Davis 
+
+if SOC_K3_AM625
+
+choice
+   prompt "K3 AM62x based boards"
+   optional
+
+config TARGET_AM625_A53_EVM
+   bool "TI K3 based AM625 EVM running on A53"
+   select ARM64
+   select BINMAN
+
+config TARGET_AM625_R5_EVM
+   bool "TI K3 based AM625 EVM running on R5"
+   select CPU_V7R
+   select SYS_THUMB_BUILD
+   select K3_LOAD_SYSFW
+   select RAM
+   select SPL_RAM
+   select K3_DDRSS
+   select BINMAN
+   imply SYS_K3_SPL_ATF
+
+config TARGET_VERDIN_AM62_A53
+   bool "Toradex Verdin AM62 running on A53"
+   select ARM64
+   select BINMAN
+
+config TARGET_VERDIN_AM62_R5
+   bool "Toradex Verdin AM62 running on R5"
+   select CPU_V7R
+   select SYS_THUMB_BUILD
+   select K3_LOAD_SYSFW
+   select RAM
+   select SPL_RAM
+   select K3_DDRSS
+   select BINMAN
+   imply SYS_K3_SPL_ATF
+
+endchoice
+
+source "board/ti/am62x/Kconfig"
+source "board/toradex/verdin-am62/Kconfig"
+
+endif
diff --git a/board/ti/am62x/Kconfig b/board/ti/am62x/Kconfig
index b4b70337d18..610dacfdc08 100644
--- a/board/ti/am62x/Kconfig
+++ b/board/ti/am62x/Kconfig
@@ -3,29 +3,6 @@
 # Copyright (C) 2020-2022 Texas Instruments Incorporated - https://www.ti.com/
 #  Suman Anna 
 
-choice
-   prompt "TI K3 AM62x based boards"
-   depends on SOC_K3_AM625
-   optional
-
-config TARGET_AM625_A53_EVM
-   bool "TI K3 based AM625 EVM running on A53"
-   select ARM64
-   select BINMAN
-
-config TARGET_AM625_R5_EVM
-   bool "TI K3 based AM625 EVM running on R5"
-   select CPU_V7R
-   select SYS_THUMB_BUILD
-   select K3_LOAD_SYSFW
-   select RAM
-   select SPL_RAM
-   select K3_DDRSS
-   select BINMAN
-   imply SYS_K3_SPL_ATF
-
-endchoice
-
 if TARGET_AM625_A53_EVM
 
 config SYS_BOARD
diff --git a/board/toradex/verdin-am62/Kconfig 
b/board/toradex/verdin-am62/Kconfig
index abc2984f250..fd65a96b3df 100644
--- a/board/toradex/verdin-am62/Kconfig
+++ b/board/toradex/verdin-am62/Kconfig
@@ -3,29 +3,6 @@
 # Copyright 2023 Toradex
 #
 
-choice
-   prompt "Toradex Verdin AM62 based boards"
-   depends on SOC_K3_AM625
-   optional
-
-config TARGET_VERDIN_AM62_A53
-   bool "Toradex Verdin AM62 running on A53"
-   select ARM64
-   select BINMAN
-
-config TARGET_VERDIN_AM62_R5
-   bool "Toradex Verdin AM62 running on R5"
-   select CPU_V7R
-   select SYS_THUMB_BUILD
-   select K3_LOAD_SYSFW
-   select RAM
-   select SPL_RAM
-   select K3_DDRSS
-   select BINMAN
-   imply SYS_K3_SPL_ATF
-
-endchoice
-
 if TARGET_VERDIN_AM62_A53
 
 config SYS_BOARD
-- 
2.39.2