diff options
author | Sinthu Raja <sinthu.raja@ti.com> | 2022-02-09 15:06:48 +0530 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-02-16 14:19:30 -0500 |
commit | d948fc4e664a0e40870d7c4e2fc7e41179d99253 (patch) | |
tree | f5592e2f74f46d5ee384f1ddeeb8e47494745e60 | |
parent | df1fa2718f8700ff23e77dba9e5b2fdf5f6ba562 (diff) | |
download | u-boot-d948fc4e664a0e40870d7c4e2fc7e41179d99253.zip u-boot-d948fc4e664a0e40870d7c4e2fc7e41179d99253.tar.gz u-boot-d948fc4e664a0e40870d7c4e2fc7e41179d99253.tar.bz2 |
board: ti: j721e: Guard functions with right #ifdef to avoid build warnings
board_late_init(), setup_board_eeprom_env() and setup_serial() is
called only under CONFIG_BOARD_LATE_INIT, so guard these functions
with the same. Also, reorder these functions to place it under
single #ifdef
Signed-off-by: Sinthu Raja <sinthu.raja@ti.com>
-rw-r--r-- | board/ti/j721e/evm.c | 80 |
1 files changed, 41 insertions, 39 deletions
diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c index ad85b9d..e15ab76 100644 --- a/board/ti/j721e/evm.c +++ b/board/ti/j721e/evm.c @@ -172,45 +172,6 @@ int checkboard(void) return 0; } -static void setup_board_eeprom_env(void) -{ - char *name = "j721e"; - - if (do_board_detect()) - goto invalid_eeprom; - - if (board_is_j721e_som()) - name = "j721e"; - else if (board_is_j7200_som()) - name = "j7200"; - else - printf("Unidentified board claims %s in eeprom header\n", - board_ti_get_name()); - -invalid_eeprom: - set_board_info_env_am6(name); -} - -static void setup_serial(void) -{ - struct ti_am6_eeprom *ep = TI_AM6_EEPROM_DATA; - unsigned long board_serial; - char *endp; - char serial_string[17] = { 0 }; - - if (env_get("serial#")) - return; - - board_serial = hextoul(ep->serial, &endp); - if (*endp != '\0') { - pr_err("Error: Can't set serial# to %s\n", ep->serial); - return; - } - - snprintf(serial_string, sizeof(serial_string), "%016lx", board_serial); - env_set("serial#", serial_string); -} - /* * Declaration of daughtercards to probe. Note that when adding more * cards they should be grouped by the 'i2c_addr' field to allow for a @@ -447,6 +408,46 @@ void configure_serdes_sierra(void) printf("phy_power_on failed !!\n"); } +#ifdef CONFIG_BOARD_LATE_INIT +static void setup_board_eeprom_env(void) +{ + char *name = "j721e"; + + if (do_board_detect()) + goto invalid_eeprom; + + if (board_is_j721e_som()) + name = "j721e"; + else if (board_is_j7200_som()) + name = "j7200"; + else + printf("Unidentified board claims %s in eeprom header\n", + board_ti_get_name()); + +invalid_eeprom: + set_board_info_env_am6(name); +} + +static void setup_serial(void) +{ + struct ti_am6_eeprom *ep = TI_AM6_EEPROM_DATA; + unsigned long board_serial; + char *endp; + char serial_string[17] = { 0 }; + + if (env_get("serial#")) + return; + + board_serial = hextoul(ep->serial, &endp); + if (*endp != '\0') { + pr_err("Error: Can't set serial# to %s\n", ep->serial); + return; + } + + snprintf(serial_string, sizeof(serial_string), "%016lx", board_serial); + env_set("serial#", serial_string); +} + int board_late_init(void) { if (IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT)) { @@ -465,6 +466,7 @@ int board_late_init(void) return 0; } +#endif void spl_board_init(void) { |