]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
eeprom: starfive: Correct get_pcb_revision_from_eeprom()
authorHal Feng <hal.feng@starfivetech.com>
Fri, 24 Oct 2025 08:59:27 +0000 (16:59 +0800)
committerLeo Yu-Chi Liang <ycliang@andestech.com>
Mon, 16 Mar 2026 17:36:57 +0000 (01:36 +0800)
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@canonical.com>
Fixes: aea1bd95b61e ("eeprom: starfive: Enable ID EEPROM configuration")
Signed-off-by: Hal Feng <hal.feng@starfivetech.com>
arch/riscv/include/asm/arch-jh7110/eeprom.h
board/starfive/visionfive2/visionfive2-i2c-eeprom.c

index 1ae9f2b840abc97fcaa91e9f32067b8aaa1cc732..8b689a7501348f387ead73d86abdbfb9aadc2208 100644 (file)
@@ -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);
 
 /**
index ca5039ee4336618cbe805aad999ccc58a2baaef6..986dcc949920c473c57a9323b8d34acc533ec0e8 100644 (file)
@@ -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)