Add yavia carrier & rework carrier and display adapter name handling
cover Add yavia carrier & rework carrier and display adapter name handling
This series adds Yavia Carrier board name string to the known Toradex carrier board list, and reworks carrier board and display adapter name handling.
Max Krummenacher (3):
toradex: tdx-cfg-block: add yavia carrier cfg block info
toradex: tdx-cfg-block: rework carrier board name handling
toradex: tdx-cfg-block: rework display adapter name handling
board/toradex/common/tdx-cfg-block.c | 57 ++++++++++++++++++++++------ board/toradex/common/tdx-cfg-block.h | 5 ++- board/toradex/common/tdx-common.c | 6 +-- 3 files changed, 52 insertions(+), 16 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/3 toradex: tdx-cfg-block: add yavia carrier cfg block info
From: Max Krummenacher <[email protected]>
Add the Yavia Carrier board name string to the known carrier board list.
--- board/toradex/common/tdx-cfg-block.c | 1 + 1 file changed, 1 insertion(+)
board/toradex/common/tdx-cfg-block.c +1 -0
@@ -145,6 +145,7 @@ const char * const toradex_carrier_boards[] = { [0] = "UNKNOWN CARRIER BOARD", [155] = "Dahlia", [156] = "Verdin Development Board", + [173] = "Yavia", };const char *const toradex_display_adapters[] = {
Signature · 1 line
2.34.1
Re: [PATCH v1 1/3] toradex: tdx-cfg-block: add yavia carrier cfg block info
Quoted 7 lines · Andrejs Cainikovs
From: Max Krummenacher <[email protected]>
Add the Yavia Carrier board name string to the known carrier board list.
Signed-off-by Max Krummenacher <[email protected]>Signed-off-by Andrejs Cainikovs <[email protected]>
For the series, applied to u-boot/master, thanks!
Signature · 1 line
Tom
PATCH 2/3 toradex: tdx-cfg-block: rework carrier board name handling
In reply to Andrejs CainikovsFrom: Max Krummenacher <[email protected]>
Rework the rather big array of zero length strings with 4 entries of actual carrier board names to a array of structs which ties a pid4 to its correspondent human readable string.
Provide an accessor to get the string for a given PID4. Rework the user of the information to use the accessor.
Note that check_pid8_sanity() is used for early samples of Dahlia and the development board. Yavia isn't affected.
--- board/toradex/common/tdx-cfg-block.c | 36 +++++++++++++++++++++------- board/toradex/common/tdx-cfg-block.h | 3 ++- board/toradex/common/tdx-common.c | 6 ++--- 3 files changed, 33 insertions(+), 12 deletions(-)
board/toradex/common/tdx-cfg-block.c +28 -8
@@ -141,11 +141,17 @@ const struct toradex_som toradex_modules[] = { [68] = { "Verdin iMX8M Mini Quad 2GB WB IT", TARGET_IS_ENABLED(VERDIN_IMX8MM) }, }; -const char *const toradex_carrier_boards[] = { - [0 ] ="UNKNOWN CARRIER BOARD" , - [155 ] ="Dahlia" , - [156 ] ="Verdin Development Board" , - [173 ] ="Yavia" , +struct pid4list { +int pid4; +char *const name; +}; + +const struct pid4list toradex_carrier_boards[] = { +/* the code assumes unknown at index 0 */ + {0 ,"UNKNOWN CARRIER BOARD" }, + {DAHLIA ,"Dahlia" }, + {VERDIN_DEVELOPMENT_BOARD ,"Verdin Development Board" }, + {YAVIA ,"Yavia" }, };const char *const toradex_display_adapters[] = {
@@ -159,6 +165,19 @@ const u32 toradex_ouis[] = { [1] = 0x8c06cbUL, }; +const char *const get_toradex_carrier_boards (int pid4) +{ +int i, index =0 ; + +for (i =1 ; i <ARRAY_SIZE (toradex_carrier_boards); i++) { +if (pid4 == toradex_carrier_boards[i].pid4) { + index = i; +break ; + } + } +return toradex_carrier_boards[index].name; +} +static u32 get_serial_from_mac (struct toradex_eth_addr *eth_addr) {int i;
@@ -638,10 +657,11 @@ static int get_cfgblock_carrier_interactive(void)int ret =0 ;printf ("Supported carrier boards:\n" ); -printf ("CARRIER BOARD NAME\t\t [ID]\n" ); +printf ("%30s\t[ID]\n" ,"CARRIER BOARD NAME" );for (int i =0 ; i <ARRAY_SIZE (toradex_carrier_boards); i++) -if (toradex_carrier_boards[i]) -printf ("%s \t\t [%d]\n" , toradex_carrier_boards[i], i); +printf ("%30s\t[%d]\n" , + toradex_carrier_boards[i].name, + toradex_carrier_boards[i].pid4);sprintf (message,"Choose your carrier board (provide ID): " ); len =cli_readline (message);
board/toradex/common/tdx-cfg-block.h +2 -1
@@ -99,6 +99,7 @@ enum {enum {DAHLIA =155 ,VERDIN_DEVELOPMENT_BOARD =156 , +YAVIA =173 , };enum {
@@ -107,7 +108,6 @@ enum { };extern const struct toradex_som toradex_modules[]; -extern const char *const toradex_carrier_boards[];extern bool valid_cfgblock;extern struct toradex_hw tdx_hw_tag;extern struct toradex_hw tdx_car_hw_tag;
@@ -117,6 +117,7 @@ extern u32 tdx_car_serial;int read_tdx_cfg_block (void );int read_tdx_cfg_block_carrier (void ); +const char *const get_toradex_carrier_boards (int pid4);int try_migrate_tdx_cfg_block_carrier (void );
board/toradex/common/tdx-common.c +3 -3
@@ -31,7 +31,7 @@ static char tdx_board_rev_str[MODULE_VER_STR_LEN + MODULE_REV_STR_LEN + 1];#ifdef CONFIG_TDX_CFG_BLOCK_EXTRA static char tdx_car_serial_str[SERIAL_STR_LEN +1 ];static char tdx_car_rev_str[MODULE_VER_STR_LEN +MODULE_REV_STR_LEN +1 ]; -static char *tdx_carrier_board_name; +static const char *tdx_carrier_board_name;#endif #if defined(CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG )
@@ -125,8 +125,8 @@ int show_board_info(void)printf ("MISSING TORADEX CARRIER CONFIG BLOCKS\n" );try_migrate_tdx_cfg_block_carrier (); }else { - tdx_carrier_board_name = (char *) - toradex_carrier_boards[tdx_car_hw_tag.prodid]; + tdx_carrier_board_name = +get_toradex_carrier_boards (tdx_car_hw_tag.prodid);snprintf (tdx_car_serial_str,sizeof (tdx_car_serial_str),"%08u" , tdx_car_serial);
Signature · 1 line
2.34.1
PATCH 3/3 toradex: tdx-cfg-block: rework display adapter name handling
In reply to Andrejs CainikovsFrom: Max Krummenacher <[email protected]>
Rework the rather big array of zero length strings with 4 entries of actual display adapter names to a array of structs which ties a pid4 to its correspondent human readable string.
Provide an accessor to get the string for a given PID4.
--- board/toradex/common/tdx-cfg-block.c | 22 ++++++++++++++++++---- board/toradex/common/tdx-cfg-block.h | 2 +- 2 files changed, 19 insertions(+), 5 deletions(-)
board/toradex/common/tdx-cfg-block.c +18 -4
@@ -154,10 +154,11 @@ const struct pid4list toradex_carrier_boards[] = { {YAVIA, "Yavia"}, }; -const char *const toradex_display_adapters[] = { - [0 ] ="UNKNOWN DISPLAY ADAPTER" , - [157 ] ="Verdin DSI to HDMI Adapter" , - [159 ] ="Verdin DSI to LVDS Adapter" , +const struct pid4list toradex_display_adapters[] = { +/* the code assumes unknown at index 0 */ + {0 ,"UNKNOWN DISPLAY ADAPTER" }, + {VERDIN_DSI_TO_HDMI_ADAPTER ,"Verdin DSI to HDMI Adapter" }, + {VERDIN_DSI_TO_LVDS_ADAPTER ,"Verdin DSI to LVDS Adapter" }, }; const u32 toradex_ouis[] = {
@@ -178,6 +179,19 @@ const char * const get_toradex_carrier_boards(int pid4)return toradex_carrier_boards[index].name; } +const char *const get_toradex_display_adapters (int pid4) +{ +int i, index =0 ; + +for (i =1 ; i <ARRAY_SIZE (toradex_display_adapters); i++) { +if (pid4 == toradex_display_adapters[i].pid4) { + index = i; +break ; + } + } +return toradex_display_adapters[index].name; +} +static u32 get_serial_from_mac (struct toradex_eth_addr *eth_addr) {int i;
board/toradex/common/tdx-cfg-block.h +1 -1
@@ -118,7 +118,7 @@ extern u32 tdx_car_serial;int read_tdx_cfg_block (void );int read_tdx_cfg_block_carrier (void );const char *const get_toradex_carrier_boards (int pid4); - +const char *const get_toradex_display_adapters (int pid4);int try_migrate_tdx_cfg_block_carrier (void );void get_mac_from_serial (u32 tdx_serial,struct toradex_eth_addr *eth_addr);
Signature · 1 line
2.34.1