Skip to contentSkip to conversation

SC5xx Carrier Board Kconfig Cleanup

PATCH In review Caleb Ethridge 2 participants 5 messages Oct 30 – Nov 7

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

cover SC5xx Carrier Board Kconfig Cleanup

From: Caleb Ethridge <[email protected]>

This patch series does some small cleanup of the Kconfig options for the sc5xx boards. Common code for the SOMCRR carrier boards is now only built when one of the carrier boards is selected. Previously, it was built unconditionally which resulted in dead code.

The series also fixes a bug with the sc594 EZLITE where it was being built with the EZKIT carrier code, resulting in the Ethernet not being set up properly. As the carrier board Kconfig option was a choice, the select from the TARGET was being ignored and the fallback was the default EZKIT code. Carrier board options have been changed from choices to bools so that the board targets can select the carrier board properly.

Also, removing the explicit carrier board option from the sc598 EZLITE, since with the change to the bool options for the carrier boards it is no longer needed.

Caleb Ethridge (3):
board: adi: Build SOMCRR common code only with a carrier board
arm: mach-sc5xx: Make the SC5xx board target select the carrier board
configs: sc598-som-ezlite: drop explicit carrier board option

 arch/arm/mach-sc5xx/Kconfig            | 26 ++++++++++++--------------
 board/adi/carriers/Makefile            |  2 +-
 board/adi/common-sc594-som/sc594-som.c |  4 +---
 board/adi/common-sc598-som/sc598-som.c |  4 +---
 configs/sc598-som-ezlite-spl_defconfig |  1 -
 5 files changed, 15 insertions(+), 22 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/3 board: adi: Build SOMCRR common code only with a carrier board

From: Caleb Ethridge <[email protected]>

somcrr_common.c calls adi_somcrr_enable_ethernet() and adi_somcrr_disable_ethernet(), which are only provided by the carrier-specific files. It is built unconditionally, so a SOM built without a carrier board would be left with undefined references.

Add an ADI_CARRIER_SOMCRR_COMMON symbol, selected by each carrier board option, and only build somcrr_common.o when it is enabled.

---
 arch/arm/mach-sc5xx/Kconfig            | 8 ++++++++
 board/adi/carriers/Makefile            | 2 +-
 board/adi/common-sc594-som/sc594-som.c | 4 +---
 board/adi/common-sc598-som/sc598-som.c | 4 +---
 4 files changed, 11 insertions(+), 7 deletions(-)
arch/arm/mach-sc5xx/Kconfig +8 -0
index 0f4e63a355e..cf154c221eb 100644
@@ -210,6 +210,12 @@ config ADI_BUG_EZKHW21
 	  This workaround affects the SC584 EZKIT and addresses bug EZKHW21.
 	  It disables gigabit ethernet mode and limits the board to 100 Mbps
 
+config ADI_CARRIER_SOMCRR_COMMON
+	bool
+	help
+	  Common code shared by the EV-SOMCRR carrier board support.
+	  Selected by the carrier board options.
+
 choice
 	prompt "Analog Devices SOM Carrier Board Variant"
 	depends on (SC59X || SC59X_64)
@@ -220,12 +226,14 @@ choice
 
 config ADI_CARRIER_SOMCRR_EZKIT
 	bool "Support the EV-SOMCRR-EZKIT"
+	select ADI_CARRIER_SOMCRR_COMMON
 	help
 	  Say y to include support for the EV-SOMCRR-EZKIT carrier board,
 	  which is compatible with the SC594 and SC598 SOMs.
 
 config ADI_CARRIER_SOMCRR_EZLITE
 	bool "Support the EV-SOMCRR-EZLITE"
+	select ADI_CARRIER_SOMCRR_COMMON
 	help
 	  Say y to include support for the EV-SOMCRR-EZLITE carrier board,
 	  which is compatible with the SC594 and SC598 SOMs.
board/adi/carriers/Makefile +1 -1
index cefd2cc837f..ccb44e262fe 100644
@@ -3,6 +3,6 @@
 # (C) Copyright 2024 - Analog Devices, Inc.
 #
 
-obj-y += somcrr_common.o
+obj-$(CONFIG_ADI_CARRIER_SOMCRR_COMMON) += somcrr_common.o
 obj-$(CONFIG_ADI_CARRIER_SOMCRR_EZKIT) += somcrr_ezkit.o
 obj-$(CONFIG_ADI_CARRIER_SOMCRR_EZLITE) += somcrr_ezlite.o
board/adi/common-sc594-som/sc594-som.c +1 -3
index 37817c4b062..136548b4f35 100644
@@ -23,10 +23,8 @@ int board_init(void)
 {
 	sc59x_remap_ospi();
 
-	if (IS_ENABLED(CONFIG_ADI_CARRIER_SOMCRR_EZKIT) ||
-	    IS_ENABLED(CONFIG_ADI_CARRIER_SOMCRR_EZLITE)) {
+	if (IS_ENABLED(CONFIG_ADI_CARRIER_SOMCRR_COMMON))
 		adi_somcrr_init_ethernet();
-	}
 
 	sc5xx_enable_rgmii();
 
board/adi/common-sc598-som/sc598-som.c +1 -3
index 0e1ee828956..51c96fd69c8 100644
@@ -23,10 +23,8 @@ int board_init(void)
 {
 	sc59x_remap_ospi();
 
-	if (IS_ENABLED(CONFIG_ADI_CARRIER_SOMCRR_EZKIT) ||
-	    IS_ENABLED(CONFIG_ADI_CARRIER_SOMCRR_EZLITE)) {
+	if (IS_ENABLED(CONFIG_ADI_CARRIER_SOMCRR_COMMON))
 		adi_somcrr_init_ethernet();
-	}
 
 	sc5xx_enable_rgmii();
 
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/3 arm: mach-sc5xx: Make the SC5xx board target select the carrier board

In reply to Caleb Ethridge

From: Caleb Ethridge <[email protected]>

The TARGET_SC5xx_SOM_* board options pick their carrier board with "select ADI_CARRIER_SOMCRR_*", but the carrier options are members of a choice and Kconfig ignores select on choice values. The carrier always fell back to the choice default instead, so the sc594-som-ezlite was built with the EZKIT carrier code.

Turn the carrier options into plain bool symbols so that we can leverage the existing selects in the board targets.

Fixes 9e24d9a61560 ("arm: SC594-SOM-EZLITE initial support")
---
 arch/arm/mach-sc5xx/Kconfig | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)
arch/arm/mach-sc5xx/Kconfig +6 -16
index cf154c221eb..fe19eb5ff66 100644
@@ -216,29 +216,19 @@ config ADI_CARRIER_SOMCRR_COMMON
 	  Common code shared by the EV-SOMCRR carrier board support.
 	  Selected by the carrier board options.
 
-choice
-	prompt "Analog Devices SOM Carrier Board Variant"
-	depends on (SC59X || SC59X_64)
-	default ADI_CARRIER_SOMCRR_EZKIT
-	help
-	  Select the specific EV-SOMCRR carrier board that you are using.
-	  Using a SOM without a carrier board is not supported.
-
 config ADI_CARRIER_SOMCRR_EZKIT
-	bool "Support the EV-SOMCRR-EZKIT"
+	bool
 	select ADI_CARRIER_SOMCRR_COMMON
 	help
-	  Say y to include support for the EV-SOMCRR-EZKIT carrier board,
-	  which is compatible with the SC594 and SC598 SOMs.
+	  Support for the EV-SOMCRR-EZKIT carrier board, which is compatible
+	  with the SC594 and SC598 SOMs. Selected by the board target.
 
 config ADI_CARRIER_SOMCRR_EZLITE
-	bool "Support the EV-SOMCRR-EZLITE"
+	bool
 	select ADI_CARRIER_SOMCRR_COMMON
 	help
-	  Say y to include support for the EV-SOMCRR-EZLITE carrier board,
-	  which is compatible with the SC594 and SC598 SOMs.
-
-endchoice
+	  Support for the EV-SOMCRR-EZLITE carrier board, which is compatible
+	  with the SC594 and SC598 SOMs. Selected by the board target.
 
 config ADI_SPL_FORCE_BMODE
 	int "Force the SPL to use this BMODE device during next boot stage"
Signature · 1 line
2.43.0
#3 lore raw

PATCH 3/3 configs: sc598-som-ezlite: drop explicit carrier board option

In reply to Caleb Ethridge

From: Caleb Ethridge <[email protected]>

ADI_CARRIER_SOMCRR_EZLITE is now a symbol selected by TARGET_SC598_SOM_EZLITE, remove the explicit carrier board option.

---
 configs/sc598-som-ezlite-spl_defconfig | 1 -
 1 file changed, 1 deletion(-)
configs/sc598-som-ezlite-spl_defconfig +0 -1
index 8d42e9a4d2f..0c15da00ce7 100644
@@ -12,7 +12,6 @@ CONFIG_SPL_STACK=0x200E4000
 CONFIG_SC59X_64=y
 CONFIG_SYS_BOOTM_LEN=0x4000000
 CONFIG_SYS_LOAD_ADDR=0x90000000
-CONFIG_ADI_CARRIER_SOMCRR_EZLITE=y
 CONFIG_CGU1_PLL3_DDRCLK=y
 CONFIG_CGU1_PLL3_VCO_MSEL=64
 CONFIG_CGU1_PLL3_DCLK_DIV=2
Signature · 1 line
2.43.0
Reviewed-by on the v1 series
#4 lore raw
In reply to Caleb Ethridge

Hi Caleb,

Quoted 31 lines · Caleb Ethridge

From: Caleb Ethridge <[email protected]>

This patch series does some small cleanup of the Kconfig options for the sc5xx boards. Common code for the SOMCRR carrier boards is now only built when one of the carrier boards is selected. Previously, it was built unconditionally which resulted in dead code.

The series also fixes a bug with the sc594 EZLITE where it was being built with the EZKIT carrier code, resulting in the Ethernet not being set up properly. As the carrier board Kconfig option was a choice, the select from the TARGET was being ignored and the fallback was the default EZKIT code. Carrier board options have been changed from choices to bools so that the board targets can select the carrier board properly.

Also, removing the explicit carrier board option from the sc598 EZLITE, since with the change to the bool options for the carrier boards it is no longer needed.

Caleb Ethridge (3):
board: adi: Build SOMCRR common code only with a carrier board
arm: mach-sc5xx: Make the SC5xx board target select the carrier board
configs: sc598-som-ezlite: drop explicit carrier board option

 arch/arm/mach-sc5xx/Kconfig            | 26 ++++++++++++--------------
 board/adi/carriers/Makefile            |  2 +-
 board/adi/common-sc594-som/sc594-som.c |  4 +---
 board/adi/common-sc598-som/sc598-som.c |  4 +---
 configs/sc598-som-ezlite-spl_defconfig |  1 -
 5 files changed, 15 insertions(+), 22 deletions(-)
Quoted 3 lines

--
2.43.0

Good catch. This looks pretty good to me and everything works on my end, so for the whole series,

Thanks,
Greg