[PATCH v1 4/9] eeprom: starfive: Correct get_pcb_revision_from_eeprom()
    E Shattow 
    e at freeshell.de
       
    Fri Oct 24 13:30:15 CEST 2025
    
    
  
On 10/24/25 01:59, Hal Feng wrote:
> pcb_revision is stored in the pcb_revision field of ATOM4. Correct it.
> Move the function description to the header file.
> Return 0 instead of 0xFF if read_eeprom() fails.
> 
> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
> Fixes: aea1bd95b61e ("eeprom: starfive: Enable ID EEPROM configuration")
> Signed-off-by: Hal Feng <hal.feng at starfivetech.com>
> ---
>  arch/riscv/include/asm/arch-jh7110/eeprom.h         |  5 +++++
>  board/starfive/visionfive2/visionfive2-i2c-eeprom.c | 11 ++---------
>  2 files changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/riscv/include/asm/arch-jh7110/eeprom.h b/arch/riscv/include/asm/arch-jh7110/eeprom.h
> index 1ae9f2b840a..8b689a75013 100644
> --- a/arch/riscv/include/asm/arch-jh7110/eeprom.h
> +++ b/arch/riscv/include/asm/arch-jh7110/eeprom.h
> @@ -9,6 +9,11 @@
>  
>  #include <linux/types.h>
>  
> +/**
> + * get_pcb_revision_from_eeprom() - get the PCB revision
> + *
> + * @return: the PCB revision or 0 on error.
> + */
>  u8 get_pcb_revision_from_eeprom(void);
>  
>  /**
> diff --git a/board/starfive/visionfive2/visionfive2-i2c-eeprom.c b/board/starfive/visionfive2/visionfive2-i2c-eeprom.c
> index ca5039ee433..986dcc94992 100644
> --- a/board/starfive/visionfive2/visionfive2-i2c-eeprom.c
> +++ b/board/starfive/visionfive2/visionfive2-i2c-eeprom.c
> @@ -535,19 +535,12 @@ int mac_read_from_eeprom(void)
>  	return 0;
>  }
>  
> -/**
> - * get_pcb_revision_from_eeprom - get the PCB revision
> - *
> - * 1.2A return 'A'/'a', 1.3B return 'B'/'b',other values are illegal
> - */
>  u8 get_pcb_revision_from_eeprom(void)
>  {
> -	u8 pv = 0xFF;
> -
>  	if (read_eeprom())
> -		return pv;
> +		return 0;
>  
> -	return pbuf.eeprom.atom1.data.pstr[6];
> +	return pbuf.eeprom.atom4.data.pcb_revision;
>  }
>  
>  u8 get_ddr_size_from_eeprom(void)
LGTM
Reviewed-by: E Shattow <e at freeshell.de>
    
    
More information about the U-Boot
mailing list