ClearFog Base static variant support
Subsystems (3)
v4 cover ClearFog Base static variant support
This patch series adds support for ClearFog Base static configuration, as well as updating and fixing the ClearFog support for MMC and SPI booting.
v2 changes:
- updated against, and dependent on, https://patchwork.ozlabs.org/cover/1200324
v3 changes:
- rebased against ClearFog runtime TLV EEPROM changes merged into mvebu/master
v4
- adjust static SerDes configuration at runtime instead of #ifdef
Joel Johnson (12):
arm: mvebu: fix SerDes table alignment
arm: mvebu: solidrun: remove hardcoded DTS MAC address
arm: mvebu: clearfog: use Pro name by default
arm: mvebu: clearfog: initial ClearFog Base variant
arm: mvebu: clearfog: Unify DT selection paths
arm: mvebu: clearfog: Add option for 2.5 Gbps SFP
arm: mvebu: clearfog: add SPI offsets
arm: mvebu: enable working default boot support
arm: mvebu: clearfog: move ENV params to Kconfig
arm: mvebu: clearfog: don't always use SPL MMC
arm: mvebu: clearfog: Add SATA mode flags
arm: mvebu: clearfog: Use Pro DT by default
.../arm/dts/armada-38x-solidrun-microsom.dtsi | 1 - arch/arm/mach-mvebu/Kconfig | 13 ++++ .../serdes/a38x/high_speed_env_spec.c | 6 +- board/solidrun/clearfog/Kconfig | 62 +++++++++++++++++++ board/solidrun/clearfog/clearfog.c | 44 +++++++++++-- configs/clearfog_defconfig | 4 -- include/configs/clearfog.h | 1 - 7 files changed, 118 insertions(+), 13 deletions(-) create mode 100644 board/solidrun/clearfog/Kconfig
Signature · 1 line
2.20.1
PATCH v4 1/12 arm: mvebu: fix SerDes table alignment
Tested on Solidrun ClearFog Base. Table alignment was:
| Lane # | Speed | Type |
--------------------------------
| 0 | 3 | SATA0 | | 1 | 0 | SGMII1 | | 2 | 3 | SATA1 | | 3 | 5 | USB3 HOST1 | | 4 | 5 | USB3 HOST0 | | 5 | 4 | SGMII2 |
--------------------------------
After the change, it's correctly aligned as:
| Lane # | Speed | Type |
--------------------------------
| 0 | 3 | SATA0 | | 1 | 0 | SGMII1 | | 2 | 5 | PCIe1 | | 3 | 5 | USB3 HOST1 | | 4 | 5 | PCIe2 | | 5 | 0 | SGMII2 |
--------------------------------
---
v2 changes
- none
v3 changes
- none
v4 changes
- none
--- arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c +3 -3
@@ -1366,16 +1366,16 @@ static void print_topology_details(const struct serdes_map *serdes_map,DEBUG_INIT_S ("board SerDes lanes topology details:\n" ); -DEBUG_INIT_S (" | Lane # | Speed | Type |\n" ); +DEBUG_INIT_S (" | Lane # | Speed | Type |\n" );DEBUG_INIT_S (" --------------------------------\n" );for (lane_num =0 ; lane_num < count; lane_num++) {if (serdes_map[lane_num].serdes_type ==DEFAULT_SERDES )continue ;DEBUG_INIT_S (" | " );DEBUG_INIT_D (hws_get_physical_serdes_num (lane_num),1 ); -DEBUG_INIT_S (" | " ); +DEBUG_INIT_S (" | " );DEBUG_INIT_D (serdes_map[lane_num].serdes_speed,2 ); -DEBUG_INIT_S (" | " ); +DEBUG_INIT_S (" | " );DEBUG_INIT_S ((char *) serdes_type_to_string[serdes_map[lane_num]. serdes_type]);
Signature · 1 line
2.20.1
PATCH v4 2/12 arm: mvebu: solidrun: remove hardcoded DTS MAC address
In reply to Joel JohnsonUsing a consistent hardcoded MAC address from the DTS file causes issues when using multiple devices on the same network segment. Instead rely on environment configuration or random generation.
---
v2 changes:
- none
v3 changes:
- none
v4 changes:
- none
--- arch/arm/dts/armada-38x-solidrun-microsom.dtsi | 1 - 1 file changed, 1 deletion(-)
arch/arm/dts/armada-38x-solidrun-microsom.dtsi +0 -1
@@ -39,7 +39,6 @@ ð0 { /* ethernet at 70000 */ - mac-address = [00 50 43 02 02 01]; pinctrl-0 = <&ge0_rgmii_pins>; pinctrl-names = "default"; phy = <&phy_dedicated>;
Signature · 1 line
2.20.1
PATCH v4 3/12 arm: mvebu: clearfog: use Pro name by default
In reply to Joel JohnsonMake the board version printed indicate the Pro variant default. Also adjust static name casing to match what is expected for EEPROM product name to share string constants.
---
Baruch - can you confirm expected/desired branding casing? The SolidRun website and prior to this commit uses "ClearFog", however the EEPROM checked values use "Clearfog", so I changed to match to be able to use the same string constant values for consistency.
--- board/solidrun/clearfog/clearfog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
board/solidrun/clearfog/clearfog.c +1 -1
@@ -170,7 +170,7 @@ int board_init(void)int checkboard (void ) { -char *board ="ClearFog" ; +char *board ="Clearfog Pro" ;cf_read_tlv_data ();if (strlen (cf_tlv_data.tlv_product_name[0 ]) >0 )
Signature · 1 line
2.20.1
PATCH v4 3/12 arm: mvebu: clearfog: use Pro name by default
Hi Joel,
Quoted 11 lines · Joel Johnson
Make the board version printed indicate the Pro variant default. Also adjust static name casing to match what is expected for EEPROM product name to share string constants.
---
Baruch - can you confirm expected/desired branding casing? The SolidRun website and prior to this commit uses "ClearFog", however the EEPROM checked values use "Clearfog", so I changed to match to be able to use the same string constant values for consistency.
I am fine with this change. The official name is "ClearFog", but you can also find "Clearfog" in the documentation, for example:
https://developer.solid-run.com/knowledge-base/a388-debian/
baruch
Quoted 18 lines
Signed-off-by Joel Johnson <[email protected]>--- board/solidrun/clearfog/clearfog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)board/solidrun/clearfog/clearfog.c +1
-1@@ -170,7 +170,7 @@ int board_init(void)int checkboard (void ) { -char *board ="ClearFog" ; +char *board ="Clearfog Pro" ;cf_read_tlv_data ();if (strlen (cf_tlv_data.tlv_product_name[0 ]) >0 )
Signature · 3 lines
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -PATCH v4 4/12 arm: mvebu: clearfog: initial ClearFog Base variant
In reply to Joel JohnsonAdd a unique entry for ClearFog Base variant, reflected in the board name and adjusted SerDes topology.
---
v2 changes:
- reworked based on Baruch's run-time TLV EEPROM detection series
v3 changes:
- rebased on mvebu merged run-time TLV EEPROM detection series
- minor update to help test regarding runtime detection failures
v4 changes:
- use runtime static config adjust instead of #ifdef in cases where hardware EEPROM detection fails or is disabled in build
SPL size change for defconfig increases 36 bytes (122893 to 122929) SPL size change for defconfig+Base increases 60 bytes (122893 to 122953)
- add placeholder support for EEPROM based Clearfog Pro, based on initial name confirmation from Baruch. I wanted to include the check at least in the patch for review to indicate expected usage to ensure that a Clearfog Pro EEPROM device boots correctly even if the image is built with Base static configuration. If there are other prerelease concerns and this should be added separately later, I'd be fine with that too.
- Note that this approach *does not* currently provide any mechanism for EEPROM detected boards to have their SFP speed changed or switch between PCIE/SATA signalling. I'm assuming that will be done based on hardware detection, but confirmation/acceptance in review would be appreciated so it can be revisited if needed.
--- arch/arm/mach-mvebu/Kconfig | 2 ++ board/solidrun/clearfog/Kconfig | 18 ++++++++++++++++++ board/solidrun/clearfog/clearfog.c | 25 ++++++++++++++++++++++--- 3 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 board/solidrun/clearfog/Kconfig
arch/arm/mach-mvebu/Kconfig +2 -0
@@ -280,4 +280,6 @@ config SECURED_MODE_CSK_INDEX default 0 depends on SECURED_MODE_IMAGE +source "board/solidrun/clearfog/Kconfig" + endif
board/solidrun/clearfog/Kconfig new file +18 -0
@@ -0,0 +1,18 @@ +menu "ClearFog configuration" + depends on TARGET_CLEARFOG + +config TARGET_CLEARFOG_BASE + bool "Use ClearFog Base static configuration" + help + Use the ClearFog Base as the static configuration instead of the + default which uses the ClearFog Pro. + + Runtime board detection is always attempted and used if available. The + static configuration is used as a fallback in cases where runtime + detection is disabled, is not available in hardware, or otherwise fails. + + Only newer revisions of the ClearFog product line support runtime + detection via additional EEPROM hardware. This option enables selecting + the Base variant for older hardware revisions. + +endmenu
board/solidrun/clearfog/clearfog.c +22 -3
@@ -42,6 +42,7 @@ static void cf_read_tlv_data(void)read_tlv_data (&cf_tlv_data); } +/* The starting board_serdes_map reflects original Clearfog Pro usage */ static struct serdes_map board_serdes_map[] = { {SATA0 ,SERDES_SPEED_3_GBPS ,SERDES_DEFAULT_MODE ,0 ,0 }, {SGMII1 ,SERDES_SPEED_1_25_GBPS ,SERDES_DEFAULT_MODE ,0 ,0 },
@@ -51,6 +52,15 @@ static struct serdes_map board_serdes_map[] = { {SGMII2, SERDES_SPEED_1_25_GBPS, SERDES_DEFAULT_MODE, 0, 0}, }; +void config_static_serdes_map (void ) +{ +if (IS_ENABLED (CONFIG_TARGET_CLEARFOG_BASE )) { + board_serdes_map[4 ].serdes_type =USB3_HOST0 ; + board_serdes_map[4 ].serdes_speed =SERDES_SPEED_5_GBPS ; + board_serdes_map[4 ].serdes_mode =SERDES_DEFAULT_MODE ; + } +} +int hws_board_topology_load (struct serdes_map **serdes_map_array,u8 *count) {cf_read_tlv_data ();
@@ -59,12 +69,17 @@ int hws_board_topology_load(struct serdes_map **serdes_map_array, u8 *count) board_serdes_map[0 ].serdes_type =PEX0 ; board_serdes_map[0 ].serdes_speed =SERDES_SPEED_5_GBPS ; board_serdes_map[0 ].serdes_mode =PEX_ROOT_COMPLEX_X1 ; - } - -if (sr_product_is (&cf_tlv_data,"Clearfog Base" )) { + }else if (sr_product_is (&cf_tlv_data,"Clearfog Pro" )) { +/* handle recognized product as noop, no adjustment required */ + }else if (sr_product_is (&cf_tlv_data,"Clearfog Base" )) { board_serdes_map[4 ].serdes_type =USB3_HOST0 ; board_serdes_map[4 ].serdes_speed =SERDES_SPEED_5_GBPS ; board_serdes_map[4 ].serdes_mode =SERDES_DEFAULT_MODE ; + }else { +/* fallback to static default since runtime detection failed, +* either EEPROM not being available or unrecognized product +*/ +config_static_serdes_map (); } *serdes_map_array = board_serdes_map;
@@ -171,6 +186,8 @@ int board_init(void)int checkboard (void ) {char *board ="Clearfog Pro" ; +if (IS_ENABLED (CONFIG_TARGET_CLEARFOG_BASE )) + board ="Clearfog Base" ;cf_read_tlv_data ();if (strlen (cf_tlv_data.tlv_product_name[0 ]) >0 )
@@ -200,6 +217,8 @@ int board_late_init(void)env_set ("fdtfile" ,"armada-385-clearfog-gtr-s4.dtb" ); else if (sr_product_is(&cf_tlv_data, "Clearfog GTR L8"))env_set ("fdtfile" ,"armada-385-clearfog-gtr-l8.dtb" ); + else if (IS_ENABLED(CONFIG_TARGET_CLEARFOG_BASE)) + env_set("fdtfile", "armada-388-clearfog-base.dtb");return 0 ; }
Signature · 1 line
2.20.1
PATCH v4 5/12 arm: mvebu: clearfog: Unify DT selection paths
In reply to Joel JohnsonUnify the location of DT selection into board_late_init instead of split between detection and static configuration paths.
---
v2 changes
- newly added in V2 series based on run-time rebasing
v3 changes
- none
v4 changes
- separate change to explicit pro DT into separate commit
--- board/solidrun/clearfog/clearfog.c | 2 ++ include/configs/clearfog.h | 1 - 2 files changed, 2 insertions(+), 1 deletion(-)
board/solidrun/clearfog/clearfog.c +2 -0
@@ -219,6 +219,8 @@ int board_late_init(void)env_set ("fdtfile" ,"armada-385-clearfog-gtr-l8.dtb" ); else if (IS_ENABLED(CONFIG_TARGET_CLEARFOG_BASE)) env_set("fdtfile", "armada-388-clearfog-base.dtb"); + else + env_set("fdtfile", "armada-388-clearfog.dtb");return 0 ; }
include/configs/clearfog.h +0 -1
@@ -134,7 +134,6 @@#define CONFIG_EXTRA_ENV_SETTINGS \ RELOCATION_LIMITS_ENV_SETTINGS \ LOAD_ADDRESS_ENV_SETTINGS \ - "fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \ "console=ttyS0,115200\0" \ BOOTENV
Signature · 1 line
2.20.1
PATCH v4 6/12 arm: mvebu: clearfog: Add option for 2.5 Gbps SFP
In reply to Joel JohnsonWhile newer Linux kernels provide autoconfiguration of SFP, provide an option for setting in U-Boot Kconfig for use prior to booting.
---
v2 changes:
- fixed help indentation
v3 changes:
- none
v4 changes:
- adjust static SerDes configuration at runtime instead of #ifdef
--- board/solidrun/clearfog/Kconfig | 7 +++++++ board/solidrun/clearfog/clearfog.c | 3 +++ 2 files changed, 10 insertions(+)
board/solidrun/clearfog/Kconfig +7 -0
@@ -15,4 +15,11 @@ config TARGET_CLEARFOG_BASE detection via additional EEPROM hardware. This option enables selecting the Base variant for older hardware revisions. +config CLEARFOG_SFP_25GB + bool "Enable 2.5 Gbps mode for SFP" + help + Set the SFP module connection to support 2.5 Gbps transfer speed for the + SGMII connection (requires a supporting SFP). By default, transfer speed + of 1.25 Gbps is used, suitable for a more common 1 Gbps SFP module. + endmenu
board/solidrun/clearfog/clearfog.c +3 -0
@@ -59,6 +59,9 @@ void config_static_serdes_map(void) board_serdes_map[4 ].serdes_speed =SERDES_SPEED_5_GBPS ; board_serdes_map[4 ].serdes_mode =SERDES_DEFAULT_MODE ; } + +if (IS_ENABLED (CONFIG_CLEARFOG_SFP_25GB )) + board_serdes_map[5 ].serdes_speed =SERDES_SPEED_3_125_GBPS ; }int hws_board_topology_load (struct serdes_map **serdes_map_array,u8 *count)
Signature · 1 line
2.20.1
PATCH v4 6/12 arm: mvebu: clearfog: Add option for 2.5 Gbps SFP
Hi Joel,
Quoted 40 lines · Joel Johnson
While newer Linux kernels provide autoconfiguration of SFP, provide an option for setting in U-Boot
Kconfigfor use prior to booting.Signed-off-by Joel Johnson <[email protected]>---
v2 changes:
- fixed help indentation
v3 changes:
- none
v4 changes:
- adjust static SerDes configuration at runtime instead of #ifdef--- board/solidrun/clearfog/Kconfig | 7 +++++++ board/solidrun/clearfog/clearfog.c | 3 +++ 2 files changed, 10 insertions(+)board/solidrun/clearfog/Kconfig +7
-0@@ -15,4 +15,11 @@ config TARGET_CLEARFOG_BASE detection via additional EEPROM hardware. This option enables selecting the Base variant for older hardware revisions. +config CLEARFOG_SFP_25GB + bool "Enable 2.5 Gbps mode for SFP" + help + Set the SFP module connection to support 2.5 Gbps transfer speed for the + SGMII connection (requires a supporting SFP). By default, transfer speed + of 1.25 Gbps is used, suitable for a more common 1 Gbps SFP module. + endmenuboard/solidrun/clearfog/clearfog.c +0
-0
board/solidrun/clearfog/clearfog.c void config_static_serdes_map(void) · line 64
Quoted 6 lines
board/solidrun/clearfog/clearfog.c +3
-0@@ -59,6 +59,9 @@ void config_static_serdes_map(void) board_serdes_map[4 ].serdes_speed =SERDES_SPEED_5_GBPS ; board_serdes_map[4 ].serdes_mode =SERDES_DEFAULT_MODE ; } + +if (IS_ENABLED (CONFIG_CLEARFOG_SFP_25GB )) + board_serdes_map[5 ].serdes_speed =SERDES_SPEED_3_125_GBPS ;
config_static_serdes_map() is not called only when TLV EEPROM is present. So CONFIG_CLEARFOG_SFP_25GB has no effect in that case. This code should move to hws_board_topology_load() to avoid that.
baruch
board/solidrun/clearfog/clearfog.c void config_static_serdes_map(void) · line 67
Quoted 3 lines
board/solidrun/clearfog/clearfog.c +0
-0}int hws_board_topology_load (struct serdes_map **serdes_map_array,u8 *count)
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
PATCH v4 6/12 arm: mvebu: clearfog: Add option for 2.5 Gbps SFP
Quoted 51 lines · Baruch Siach
Hi Joel,
Quoted 48 lines · Joel Johnson
While newer Linux kernels provide autoconfiguration of SFP, provide an option for setting in U-Boot
Kconfigfor use prior to booting.Signed-off-by Joel Johnson <[email protected]>---
v2 changes:
- fixed help indentation
v3 changes:
- none
v4 changes:
- adjust static SerDes configuration at runtime instead of #ifdef--- board/solidrun/clearfog/Kconfig | 7 +++++++ board/solidrun/clearfog/clearfog.c | 3 +++ 2 files changed, 10 insertions(+)board/solidrun/clearfog/Kconfig +0
-0@@ -15,4 +15,11 @@ config TARGET_CLEARFOG_BASE detection via additional EEPROM hardware. This option enablesselecting
board/solidrun/clearfog/Kconfig +4
-0the Base variant for older hardware revisions. +config CLEARFOG_SFP_25GB + bool "Enable 2.5 Gbps mode for SFP" + help + Set the SFP module connection to support 2.5 Gbps transfer speedfor the
board/solidrun/clearfog/Kconfig +1
-0+ SGMII connection (requires a supporting SFP). By default, transferspeed
board/solidrun/clearfog/Kconfig +1
-0+ of 1.25 Gbps is used, suitable for a more common 1 Gbps SFPmodule.
board/solidrun/clearfog/Kconfig +1
-0+ endmenuboard/solidrun/clearfog/clearfog.c +0
-0@@ -59,6 +59,9 @@ void config_static_serdes_map(void) board_serdes_map[4 ].serdes_speed =SERDES_SPEED_5_GBPS ; board_serdes_map[4 ].serdes_mode =SERDES_DEFAULT_MODE ;
Quoted 8 lines
board/solidrun/clearfog/clearfog.c void config_static_serdes_map(void) · line 64
Quoted 4 lines
board/solidrun/clearfog/clearfog.c +3
-0} + +if (IS_ENABLED (CONFIG_CLEARFOG_SFP_25GB )) + board_serdes_map[5 ].serdes_speed =SERDES_SPEED_3_125_GBPS ;
config_static_serdes_map()is not called only when TLV EEPROM is present. SoCONFIG_CLEARFOG_SFP_25GBhas no effect in that case. This code should move tohws_board_topology_load()to avoid that.
Yeah, that's what I was trying to ask with the question below embedded in patch 4.
"Note that this approach *does not* currently provide any mechanism for EEPROM detected boards to have their SFP speed changed or switch between PCIE/SATA signalling. I'm assuming that will be done based
on
hardware detection, but confirmation/acceptance in review would be appreciated so it can be revisited if needed.
After sending the series and thinking about it more, I didn't see any other mechanism by which the configuration would be changed. The question was really to confirm what I had inferred from code, namely that Pro/Base boards even with EEPROM would still have to have a U-Boot built with custom options in order to change the PCIe/SATA or SFP options. I would like to confirm with you that is desired and expected even in the cases of EEPROM supporting units. If that's the case, I'll rework the location of setting, along with updating the help text for those options. Pending your confirmation, I plan to get rid of the separate config_static_serdes_map function and fold it back in, with the SATA and SFP options coming before the board runtime detection configuration.
Joel
PATCH v4 6/12 arm: mvebu: clearfog: Add option for 2.5 Gbps SFP
Hi Joel,
Quoted 67 lines · Joel Johnson
Quoted 48 lines · Baruch Siach
Quoted 47 lines · Joel Johnson
While newer Linux kernels provide autoconfiguration of SFP, provide an option for setting in U-Boot
Kconfigfor use prior to booting.Signed-off-by Joel Johnson <[email protected]>---
v2 changes:
- fixed help indentation
v3 changes:
- none
v4 changes:
- adjust static SerDes configuration at runtime instead of #ifdef--- board/solidrun/clearfog/Kconfig | 7 +++++++ board/solidrun/clearfog/clearfog.c | 3 +++ 2 files changed, 10 insertions(+)board/solidrun/clearfog/Kconfig +0
-0@@ -15,4 +15,11 @@ config TARGET_CLEARFOG_BASE detection via additional EEPROM hardware. This option enablesselecting
board/solidrun/clearfog/Kconfig +4
-0the Base variant for older hardware revisions. +config CLEARFOG_SFP_25GB + bool "Enable 2.5 Gbps mode for SFP" + help + Set the SFP module connection to support 2.5 Gbps transfer speed forthe
board/solidrun/clearfog/Kconfig +1
-0+ SGMII connection (requires a supporting SFP). By default, transferspeed
board/solidrun/clearfog/Kconfig +2
-0+ of 1.25 Gbps is used, suitable for a more common 1 Gbps SFP module. + endmenuboard/solidrun/clearfog/clearfog.c +0
-0@@ -59,6 +59,9 @@ void config_static_serdes_map(void) board_serdes_map[4 ].serdes_speed =SERDES_SPEED_5_GBPS ; board_serdes_map[4 ].serdes_mode =SERDES_DEFAULT_MODE ;Quoted 8 lines
board/solidrun/clearfog/clearfog.c void config_static_serdes_map(void) · line 64
Quoted 4 lines
board/solidrun/clearfog/clearfog.c +3
-0} + +if (IS_ENABLED (CONFIG_CLEARFOG_SFP_25GB )) + board_serdes_map[5 ].serdes_speed =SERDES_SPEED_3_125_GBPS ;
config_static_serdes_map()is not called only when TLV EEPROM is present. SoCONFIG_CLEARFOG_SFP_25GBhas no effect in that case. This code should move tohws_board_topology_load()to avoid that.Yeah, that's what I was trying to ask with the question below embedded in patch 4.
"Note that this approach *does not* currently provide any mechanism for EEPROM detected boards to have their SFP speed changed or switch between PCIE/SATA signalling. I'm assuming that will be done based on hardware detection, but confirmation/acceptance in review would be appreciated so it can be revisited if needed.
Quoted 10 lines
After sending the series and thinking about it more, I didn't see any other mechanism by which the configuration would be changed. The question was really to confirm what I had inferred from code, namely that Pro/Base boards even with EEPROM would still have to have a U-Boot built with custom options in order to change the PCIe/SATA or SFP options. I would like to confirm with you that is desired and expected even in the cases of EEPROM supporting units. If that's the case, I'll rework the location of setting, along with updating the help text for those options. Pending your confirmation, I plan to get rid of the separate
config_static_serdes_mapfunction and fold it back in, with the SATA and SFP options coming before the board runtime detection configuration.
My thinking is that EEPROM TLV is only meant to describe the hardware as manufactured, and never change. SATA (read mSATA) and SFP are user setup that TLV can't cover. So I think that SATA and SFP build time selection should apply regardless of TLV.
In theory it could have been even better to store SATA/SFP selection in environment variables. But that is not currently possible, since serdes configuration takes place at SPL phase where the environment is not accessible.
baruch
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
PATCH v4 6/12 arm: mvebu: clearfog: Add option for 2.5 Gbps SFP
Quoted 105 lines · Baruch Siach
Hi Joel,
Quoted 86 lines · Joel Johnson
Quoted 51 lines · Baruch Siach
Quoted 50 lines · Joel Johnson
While newer Linux kernels provide autoconfiguration of SFP, provide an option for setting in U-Boot
Kconfigfor use prior to booting.Signed-off-by Joel Johnson <[email protected]>---
v2 changes:
- fixed help indentation
v3 changes:
- none
v4 changes:
- adjust static SerDes configuration at runtime instead of #ifdef--- board/solidrun/clearfog/Kconfig | 7 +++++++ board/solidrun/clearfog/clearfog.c | 3 +++ 2 files changed, 10 insertions(+)board/solidrun/clearfog/Kconfig +0
-0@@ -15,4 +15,11 @@ config TARGET_CLEARFOG_BASE detection via additional EEPROM hardware. This option enablesselecting
board/solidrun/clearfog/Kconfig +4
-0the Base variant for older hardware revisions. +config CLEARFOG_SFP_25GB + bool "Enable 2.5 Gbps mode for SFP" + help + Set the SFP module connection to support 2.5 Gbps transfer speedfor
theboard/solidrun/clearfog/Kconfig +1
-0+ SGMII connection (requires a supporting SFP). By default,transfer
speedboard/solidrun/clearfog/Kconfig +1
-0+ of 1.25 Gbps is used, suitable for a more common 1 Gbps SFPmodule.
board/solidrun/clearfog/Kconfig +1
-0+ endmenuboard/solidrun/clearfog/clearfog.c +0
-0@@ -59,6 +59,9 @@ void config_static_serdes_map(void) board_serdes_map[4 ].serdes_speed =SERDES_SPEED_5_GBPS ; board_serdes_map[4 ].serdes_mode =SERDES_DEFAULT_MODE ;Quoted 8 lines
board/solidrun/clearfog/clearfog.c void config_static_serdes_map(void) · line 64
Quoted 4 lines
board/solidrun/clearfog/clearfog.c +3
-0} + +if (IS_ENABLED (CONFIG_CLEARFOG_SFP_25GB )) + board_serdes_map[5 ].serdes_speed =SERDES_SPEED_3_125_GBPS ;
config_static_serdes_map()is not called only when TLV EEPROM is present. SoCONFIG_CLEARFOG_SFP_25GBhas no effect in that case. This code should move tohws_board_topology_load()to avoid that.Yeah, that's what I was trying to ask with the question below embedded in
patch 4."Note that this approach *does not* currently provide any
mechanism
for EEPROM detected boards to have their SFP speed changed or
switch
between PCIE/SATA signalling. I'm assuming that will be done based
on
hardware detection, but confirmation/acceptance in review would be appreciated so it can be revisited if needed.After sending the series and thinking about it more, I didn't see any other
mechanism by which the configuration would be changed. The question was really
to confirm what I had inferred from code, namely that Pro/Base boards even
with EEPROM would still have to have a U-Boot built with custom options in
order to change the PCIe/SATA or SFP options. I would like to confirm with you
that is desired and expected even in the cases of EEPROM supporting units. IfQuoted 8 lines
that's the case, I'll rework the location of setting, along with updating the
help text for those options. Pending your confirmation, I plan to get rid of
the separateconfig_static_serdes_mapfunction and fold it back in, with the
SATA and SFP options coming before the board runtime detection configuration.My thinking is that EEPROM TLV is only meant to describe the hardware as
manufactured, and never change. SATA (read mSATA) and SFP are user setup
that TLV can't cover. So I think that SATA and SFP build time selection should apply regardless of TLV.
Quoted 6 lines
In theory it could have been even better to store SATA/SFP selection in environment variables. But that is not currently possible, since serdes configuration takes place at SPL phase where the environment is not accessible.
baruch
Yeah, that makes sense and as I thought further on it is the only logical option based at least on what's currently exposed for runtime detction. I'll send out the updated series with this change and a few code style cleanups after completing the SATA testing, hopefully later today.
Any other items pending for this series? I think it's in good shape, pending any further thoughts or discussion on the Pro DT by default change.
Joel
PATCH v4 6/12 arm: mvebu: clearfog: Add option for 2.5 Gbps SFP
Quoted 124 lines · Joel Johnson
Quoted 108 lines · Baruch Siach
Hi Joel,
Quoted 88 lines · Joel Johnson
Quoted 52 lines · Baruch Siach
Quoted 51 lines · Joel Johnson
While newer Linux kernels provide autoconfiguration of SFP, provide an option for setting in U-Boot
Kconfigfor use prior to booting.Signed-off-by Joel Johnson <[email protected]>---
v2 changes:
- fixed help indentation
v3 changes:
- none
v4 changes:
- adjust static SerDes configuration at runtime instead of #ifdef--- board/solidrun/clearfog/Kconfig | 7 +++++++ board/solidrun/clearfog/clearfog.c | 3 +++ 2 files changed, 10 insertions(+)board/solidrun/clearfog/Kconfig +0
-0@@ -15,4 +15,11 @@ config TARGET_CLEARFOG_BASE detection via additional EEPROM hardware. This option enablesselecting
board/solidrun/clearfog/Kconfig +4
-0the Base variant for older hardware revisions. +config CLEARFOG_SFP_25GB + bool "Enable 2.5 Gbps mode for SFP" + help + Set the SFP module connection to support 2.5 Gbps transferspeed for
theboard/solidrun/clearfog/Kconfig +1
-0+ SGMII connection (requires a supporting SFP). By default,transfer
speedboard/solidrun/clearfog/Kconfig +1
-0+ of 1.25 Gbps is used, suitable for a more common 1 Gbps SFPmodule.
board/solidrun/clearfog/Kconfig +1
-0+ endmenuboard/solidrun/clearfog/clearfog.c +0
-0@@ -59,6 +59,9 @@ void config_static_serdes_map(void) board_serdes_map[4 ].serdes_speed =SERDES_SPEED_5_GBPS ; board_serdes_map[4 ].serdes_mode =SERDES_DEFAULT_MODE ; }Quoted 8 lines
board/solidrun/clearfog/clearfog.c void config_static_serdes_map(void) · line 64
Quoted 3 lines
board/solidrun/clearfog/clearfog.c +3
-0+ +if (IS_ENABLED (CONFIG_CLEARFOG_SFP_25GB )) + board_serdes_map[5 ].serdes_speed =SERDES_SPEED_3_125_GBPS ;
config_static_serdes_map()is not called only when TLV EEPROM is present. SoCONFIG_CLEARFOG_SFP_25GBhas no effect in that case. This
code should move tohws_board_topology_load()to avoid that.Yeah, that's what I was trying to ask with the question below embedded in
patch 4."Note that this approach *does not* currently provide any
mechanism
for EEPROM detected boards to have their SFP speed changed or
switch
between PCIE/SATA signalling. I'm assuming that will be done
based on
hardware detection, but confirmation/acceptance in review would
be
appreciated so it can be revisited if needed.After sending the series and thinking about it more, I didn't see any other
mechanism by which the configuration would be changed. The question was really
to confirm what I had inferred from code, namely that Pro/Base boards even
with EEPROM would still have to have a U-Boot built with custom options in
order to change the PCIe/SATA or SFP options. I would like to confirm with you
that is desired and expected even in the cases of EEPROM supporting units. IfQuoted 8 lines
that's the case, I'll rework the location of setting, along with updating the
help text for those options. Pending your confirmation, I plan to get rid of
the separateconfig_static_serdes_mapfunction and fold it back in, with the
SATA and SFP options coming before the board runtime detection configuration.My thinking is that EEPROM TLV is only meant to describe the hardware as
manufactured, and never change. SATA (read mSATA) and SFP are user setup
that TLV can't cover. So I think that SATA and SFP build time selection
should apply regardless of TLV.Quoted 8 lines
In theory it could have been even better to store SATA/SFP selection in
environment variables. But that is not currently possible, since serdes
configuration takes place at SPL phase where the environment is not accessible.baruch
Yeah, that makes sense and as I thought further on it is the only logical option based at least on what's currently exposed for runtime detction. I'll send out the updated series with this change and a few code style cleanups after completing the SATA testing, hopefully later today.
Quoted 5 lines
Any other items pending for this series? I think it's in good shape, pending any further thoughts or discussion on the Pro DT by default change.
Joel
While SATA testing is pending, I'm including the updated resulting board/solidrun/clearfog/clearfog.c snippet (without patch separations) for review on the updated approach. I recognize that the final "Clearfog Base" and static IS_ENABLED check take the same path and could be combined, but I prefer to keep them separate to highlight and distinguish between the runtime detection and fallback cases.
Joel
void config_cfbase_serdes_map(void)
{
board_serdes_map[4].serdes_type = USB3_HOST0;
board_serdes_map[4].serdes_speed = SERDES_SPEED_5_GBPS;
board_serdes_map[4].serdes_mode = SERDES_DEFAULT_MODE;
}int hws_board_topology_load(struct serdes_map **serdes_map_array, u8 *count)
{
cf_read_tlv_data();
/* Apply build configuration options before runtime configuration */
if (IS_ENABLED(CONFIG_CLEARFOG_SFP_25GB))
board_serdes_map[5].serdes_speed =SERDES_SPEED_3_125_GBPS;
if (IS_ENABLED(CONFIG_CLEARFOG_CON2_SATA) &&
!IS_ENABLED(CONFIG_TARGET_CLEARFOG_BASE)) {
board_serdes_map[4].serdes_type = SATA2;
board_serdes_map[4].serdes_speed = SERDES_SPEED_3_GBPS;
board_serdes_map[4].serdes_mode = SERDES_DEFAULT_MODE;
board_serdes_map[4].swap_rx = 1;
}
if (IS_ENABLED(CONFIG_CLEARFOG_CON3_SATA)) {
board_serdes_map[2].serdes_type = SATA1;
board_serdes_map[2].serdes_speed = SERDES_SPEED_3_GBPS;
board_serdes_map[2].serdes_mode = SERDES_DEFAULT_MODE;
board_serdes_map[2].swap_rx = 1;
}
/* Apply runtime detection changes */
if (sr_product_is(&cf_tlv_data, "Clearfog GTR")) {
board_serdes_map[0].serdes_type = PEX0;
board_serdes_map[0].serdes_speed = SERDES_SPEED_5_GBPS;
board_serdes_map[0].serdes_mode = PEX_ROOT_COMPLEX_X1;
} else if (sr_product_is(&cf_tlv_data, "Clearfog Pro")) {
/* handle recognized product as noop, no adjustment
required */
} else if (sr_product_is(&cf_tlv_data, "Clearfog Base")) {
config_cfbase_serdes_map();
} else if (IS_ENABLED(CONFIG_TARGET_CLEARFOG_BASE)) {
/*
* Fallback to static default. Runtime detection either
* failed, hardware support not present, EEPROM is
corrupt,
* or an unrecognized product name is present.
*/
config_cfbase_serdes_map();
}
*serdes_map_array = board_serdes_map;
*count = ARRAY_SIZE(board_serdes_map);
return 0;
}PATCH v4 7/12 arm: mvebu: clearfog: add SPI offsets
In reply to Joel JohnsonAdd reasonable default SPI offsets and ENV size when configured to boot from SPI flash.
---
v2 changes:
- none
v3 changes:
- none
v4 changes:
- none
There was some reasonable concern raised about duplicating config entries within a board specific config file rather than making board specific configurations within defconfig. This seems to offer a more board localized mechanism to provide platform defaults for core values. As mentioned in the review, this usage seems to match the Kconfig documented intended usage. As noted at
https://www.kernel.org/doc/html/latest/kbuild/kconfig-language.html:
"Default values are not limited to the menu entry where
they are defined. This means the default can be defined somewhere else or be overridden by an earlier definition."
Given that there is some dependency variability with these values I prefer keeping them as Kconfig values, but defer to maintainers. Notably, for the ENV values in this and a later commit, I'm using a pattern already in used several other board configs.
--- board/solidrun/clearfog/Kconfig | 12 ++++++++++++ 1 file changed, 12 insertions(+)
board/solidrun/clearfog/Kconfig +12 -0
@@ -22,4 +22,16 @@ config CLEARFOG_SFP_25GB SGMII connection (requires a supporting SFP). By default, transfer speed of 1.25 Gbps is used, suitable for a more common 1 Gbps SFP module. +config ENV_SECT_SIZE + hex "Environment Sector-Size" + # Use SPI flash erase block size of 4 KiB + default 0x1000 if MVEBU_SPL_BOOT_DEVICE_SPI + # Use optimistic 64 KiB erase block, will vary between actual media + default 0x10000 if MVEBU_SPL_BOOT_DEVICE_MMC + +config SYS_SPI_U_BOOT_OFFS + hex "address of u-boot payload in SPI flash" + default 0x20000 + depends on MVEBU_SPL_BOOT_DEVICE_SPI + endmenu
Signature · 1 line
2.20.1
PATCH v4 8/12 arm: mvebu: enable working default boot support
In reply to Joel JohnsonWith the move to driver model usage, ensure that the required driver support for SPI and MMC booting is available in SPL.
Tested on SolidRun ClearFog devices.
---
v2 changes:
- change "select" for ENV_IS_IN_X to "imply" to allow disabling the default env location and configuring a different one if desired
- remove SPL_DM_GPIO from defconfig, only include if needed for MMC booting
v3 changes:
- none
v4 changes:
- none
--- arch/arm/mach-mvebu/Kconfig | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm/mach-mvebu/Kconfig +10 -0
@@ -235,9 +235,19 @@ choice config MVEBU_SPL_BOOT_DEVICE_SPI bool "SPI NOR flash" + imply ENV_IS_IN_SPI_FLASH + select SPL_DM_SPI + select SPL_MTD_SUPPORT + select SPL_SPI_FLASH_SUPPORT + select SPL_SPI_LOAD + select SPL_SPI_SUPPORT config MVEBU_SPL_BOOT_DEVICE_MMC bool "SDIO/MMC card" + imply ENV_IS_IN_MMC + # GPIO required for SD card presence detection line + select SPL_DM_GPIO + select SPL_DM_MMC select SPL_LIBDISK_SUPPORT config MVEBU_SPL_BOOT_DEVICE_SATA
Signature · 1 line
2.20.1
PATCH v4 9/12 arm: mvebu: clearfog: move ENV params to Kconfig
In reply to Joel JohnsonMigrate the values for ENV_SIZE and ENV_OFFSET into board specific Kconfig defaults so they're more accessible for configuration.
---
v2 changes:
- none
v3 changes:
- none
v4 changes:
- none
--- board/solidrun/clearfog/Kconfig | 8 ++++++++ configs/clearfog_defconfig | 2 -- 2 files changed, 8 insertions(+), 2 deletions(-)
board/solidrun/clearfog/Kconfig +8 -0
@@ -22,6 +22,14 @@ config CLEARFOG_SFP_25GB SGMII connection (requires a supporting SFP). By default, transfer speed of 1.25 Gbps is used, suitable for a more common 1 Gbps SFP module. +config ENV_SIZE + hex "Environment Size" + default 0x10000 + +config ENV_OFFSET + hex "Environment offset" + default 0xF0000 + config ENV_SECT_SIZE hex "Environment Sector-Size" # Use SPI flash erase block size of 4 KiB
configs/clearfog_defconfig +0 -2
@@ -9,8 +9,6 @@ CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_TARGET_CLEARFOG=y CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC=y -CONFIG_ENV_SIZE=0x10000 -CONFIG_ENV_OFFSET=0xF0000 CONFIG_DM_GPIO=y CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y
Signature · 1 line
2.20.1
PATCH v4 10/12 arm: mvebu: clearfog: don't always use SPL MMC
In reply to Joel JohnsonMove MMC booting assuptions from defconfig to Kconfig which includes as needed based on dependent options.
---
v2 changes:
- rebased on master to use Baruch's dynamic MMC/SD offset logic
- update description, will revisit removal of CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC in separate future path if a more viable option is identified
v3 changes:
- none
v4 changes:
- none
--- arch/arm/mach-mvebu/Kconfig | 1 + configs/clearfog_defconfig | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-)
arch/arm/mach-mvebu/Kconfig +1 -0
@@ -249,6 +249,7 @@ config MVEBU_SPL_BOOT_DEVICE_MMC select SPL_DM_GPIO select SPL_DM_MMC select SPL_LIBDISK_SUPPORT + select SPL_MMC_SUPPORT config MVEBU_SPL_BOOT_DEVICE_SATA bool "SATA"
configs/clearfog_defconfig +0 -2
@@ -10,7 +10,6 @@ CONFIG_SYS_MALLOC_F_LEN=0x2000 CONFIG_TARGET_CLEARFOG=y CONFIG_MVEBU_SPL_BOOT_DEVICE_MMC=y CONFIG_DM_GPIO=y -CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_NR_DRAM_BANKS=2 CONFIG_SPL=y
@@ -42,7 +41,6 @@ CONFIG_CMD_CACHE=y CONFIG_CMD_TIME=y # CONFIG_SPL_PARTITION_UUIDS is not set CONFIG_DEFAULT_DEVICE_TREE="armada-388-clearfog" -CONFIG_ENV_IS_IN_MMC=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_SPL_OF_TRANSLATE=y CONFIG_AHCI_MVEBU=y
Signature · 1 line
2.20.1
PATCH v4 11/12 arm: mvebu: clearfog: Add SATA mode flags
In reply to Joel JohnsonThe mPCIe slots on ClearFog Pro and ClearFog Base may be alternately configured for SATA usage.
---
v2 changes:
- fixed help indentation
v3 changes:
- none
v4 changes:
- adjust static SerDes configuration at runtime instead of #ifdef
- add setting of swap_rx for SATA (as yet untested on hardware)
Baruch, thanks for the pointer on the swap_rx flags. I've added them here based on your input, my drives for testing are in another office so I won't be able to do final testing on the updated series for another day or so.
--- board/solidrun/clearfog/Kconfig | 17 +++++++++++++++++ board/solidrun/clearfog/clearfog.c | 12 ++++++++++++ 2 files changed, 29 insertions(+)
board/solidrun/clearfog/Kconfig +17 -0
@@ -15,6 +15,23 @@ config TARGET_CLEARFOG_BASE detection via additional EEPROM hardware. This option enables selecting the Base variant for older hardware revisions. +config CLEARFOG_CON3_SATA + bool "Use CON3 slot in SATA mode" + help + Use the CON3 port with SATA protocol instead of the default PCIe. + The ClearFog port allows usage of either mSATA or miniPCIe + modules, but the desired protocol must be configured at build + time since it affects the SerDes topology layout. + +config CLEARFOG_CON2_SATA + bool "Use CON2 slot in SATA mode" + depends on !TARGET_CLEARFOG_BASE + help + Use the CON2 port with SATA protocol instead of the default PCIe. + The ClearFog port allows usage of either mSATA or miniPCIe + modules, but the desired protocol must be configured at build + time since it affects the SerDes topology layout. + config CLEARFOG_SFP_25GB bool "Enable 2.5 Gbps mode for SFP" help
board/solidrun/clearfog/clearfog.c +12 -0
@@ -58,6 +58,18 @@ void config_static_serdes_map(void) board_serdes_map[4 ].serdes_type =USB3_HOST0 ; board_serdes_map[4 ].serdes_speed =SERDES_SPEED_5_GBPS ; board_serdes_map[4 ].serdes_mode =SERDES_DEFAULT_MODE ; + }else if (IS_ENABLED (CONFIG_CLEARFOG_CON2_SATA )) { + board_serdes_map[4 ].serdes_type =SATA2 ; + board_serdes_map[4 ].serdes_speed =SERDES_SPEED_3_GBPS ; + board_serdes_map[4 ].serdes_mode =SERDES_DEFAULT_MODE ; + board_serdes_map[4 ].swap_rx =1 ; + } + +if (IS_ENABLED (CONFIG_CLEARFOG_CON3_SATA )) { + board_serdes_map[2 ].serdes_type =SATA1 ; + board_serdes_map[2 ].serdes_speed =SERDES_SPEED_3_GBPS ; + board_serdes_map[2 ].serdes_mode =SERDES_DEFAULT_MODE ; + board_serdes_map[2 ].swap_rx =1 ; }if (IS_ENABLED (CONFIG_CLEARFOG_SFP_25GB ))
Signature · 1 line
2.20.1
PATCH v4 12/12 arm: mvebu: clearfog: Use Pro DT by default
In reply to Joel JohnsonSwitch to explicitly using the Pro variant DT, which has been available since Linux 4.11.
---
I separated out this change to the end of the series since it drew questioning on prior review. I'd still advocate for making the change, since especially with the additions of static variants and runtime detection, it becomes easier from within a booted kernel to identify the type and version of U-Boot image installed. Without making this change, it becomes less direct to determine an actual Pro vs. Base, vs old U-Boot image maybe supporting some hybrid variant configuration.
Even in the Linux kernel adding of the Pro DTS, it is indicated that it was meant for backwards compatibility.
Except for cases where checking is done directly against the product name from userspace, I don't see downsides even from a compatibility perspective for not making this change. In cases where checking *is* done from userspace, the broadening of the Clearfog product line would seem to mean that userspace checking should be flagged as needing to be udpated as well (or glob/regex matched as needed).
--- board/solidrun/clearfog/clearfog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
board/solidrun/clearfog/clearfog.c +1 -1
@@ -235,7 +235,7 @@ int board_late_init(void)else if (IS_ENABLED (CONFIG_TARGET_CLEARFOG_BASE ))env_set ("fdtfile" ,"armada-388-clearfog-base.dtb" );else -env_set ("fdtfile" ,"armada-388-clearfog.dtb" ); +env_set ("fdtfile" ,"armada-388-clearfog-pro.dtb" );return 0 ; }
Signature · 1 line
2.20.1