]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
eeprom: starfive: function get_product_id_from_eeprom()
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Tue, 2 Apr 2024 08:49:08 +0000 (10:49 +0200)
committerLeo Yu-Chi Liang <ycliang@andestech.com>
Tue, 9 Apr 2024 03:30:37 +0000 (11:30 +0800)
Export a function get_product_id_from_eeprom() to read the product ID.
This value can be used for fixing up the device-tree on JH7110 based
products.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
arch/riscv/include/asm/arch-jh7110/eeprom.h
board/starfive/visionfive2/visionfive2-i2c-eeprom.c

index d2776d5b6cb349aef4dbfe7605e83a48fd66742a..62d184aeb5719e91b1a6e39f223b3fffa56575a3 100644 (file)
 u8 get_pcb_revision_from_eeprom(void);
 u32 get_ddr_size_from_eeprom(void);
 
+/**
+ * get_product_id_from_eeprom - get product ID string
+ *
+ * A string like "VF7110A1-2228-D008E000-00000001" is returned.
+ *
+ * Return:     product ID string
+ */
+const char *get_product_id_from_eeprom(void);
+
 #endif /* _ASM_RISCV_EEPROM_H */
index c36de1a5125b56285fa3d4b6de3d858782347b85..a9f4376c8e1dfda10397b309880b84822be90e66 100644 (file)
@@ -405,6 +405,14 @@ static void set_product_id(char *string)
        update_crc();
 }
 
+const char *get_product_id_from_eeprom(void)
+{
+       if (read_eeprom())
+               return NULL;
+
+       return pbuf.eeprom.atom1.data.pstr;
+}
+
 int do_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
        char *cmd;