Message ID | 20231009144151.773721-2-artur@conclusive.pl |
---|---|
State | Superseded |
Delegated to: | Eugen Hristev |
Headers | show |
Series | Conclusive KSTR-SAMA5D27 support | expand |
On Mon, 9 Oct 2023 at 08:42, Artur Rojek <artur@conclusive.pl> wrote: > > Rename populate_serial_number() to a more descriptive > serial_read_from_eeprom() and provide the missing function prototype. > > This is useful for boards that wish to read their serial number from > EEPROM at init. > > Signed-off-by: Artur Rojek <artur@conclusive.pl> > --- > > v4: - revert to the approach found in v2 > - keep the new serial_read_from_eeprom() name > > v3: - restore original function name and make it static > - provide a generic function for reading EEPROM serial number and > wrap it around the existing tlv logic > - move the env var check out of populate_serial_number() and into > the new serial_read_from_eeprom() in order to stay consistent with > the documentation > > v2: - rename the function > - move function documentation from .c file to the prototype location > > cmd/tlv_eeprom.c | 14 +------------- > include/init.h | 14 ++++++++++++++ > 2 files changed, 15 insertions(+), 13 deletions(-) > Reviewed-by: Simon Glass <sjg@chromium.org>
diff --git a/cmd/tlv_eeprom.c b/cmd/tlv_eeprom.c index 79796394c5c8..57cfd355df1b 100644 --- a/cmd/tlv_eeprom.c +++ b/cmd/tlv_eeprom.c @@ -1088,19 +1088,7 @@ int mac_read_from_eeprom(void) return 0; } -/** - * populate_serial_number - read the serial number from EEPROM - * - * This function reads the serial number from the EEPROM and sets the - * appropriate environment variable. - * - * The environment variable is only set if it has not been set - * already. This ensures that any user-saved variables are never - * overwritten. - * - * This function must be called after relocation. - */ -int populate_serial_number(int devnum) +int serial_read_from_eeprom(int devnum) { char serialstr[257]; int eeprom_index; diff --git a/include/init.h b/include/init.h index 4e7fe26c2004..d57a24fd00dd 100644 --- a/include/init.h +++ b/include/init.h @@ -271,6 +271,20 @@ void board_init_r(struct global_data *id, ulong dest_addr) int cpu_init_r(void); int mac_read_from_eeprom(void); + +/** + * serial_read_from_eeprom - read the serial number from EEPROM + * + * This function reads the serial number from the EEPROM and sets the + * appropriate environment variable. + * + * The environment variable is only set if it has not been set + * already. This ensures that any user-saved variables are never + * overwritten. + * + * This function must be called after relocation. + */ +int serial_read_from_eeprom(int devnum); int set_cpu_clk_info(void); int update_flash_size(int flash_size); int arch_early_init_r(void);
Rename populate_serial_number() to a more descriptive serial_read_from_eeprom() and provide the missing function prototype. This is useful for boards that wish to read their serial number from EEPROM at init. Signed-off-by: Artur Rojek <artur@conclusive.pl> --- v4: - revert to the approach found in v2 - keep the new serial_read_from_eeprom() name v3: - restore original function name and make it static - provide a generic function for reading EEPROM serial number and wrap it around the existing tlv logic - move the env var check out of populate_serial_number() and into the new serial_read_from_eeprom() in order to stay consistent with the documentation v2: - rename the function - move function documentation from .c file to the prototype location cmd/tlv_eeprom.c | 14 +------------- include/init.h | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 13 deletions(-)