[PATCH 3/8] board: tq: add support for 16bit eeprom

Sascha Hauer s.hauer at pengutronix.de
Wed Feb 21 07:03:18 PST 2024


Some I2C EEPROMs must be addressed with two bytes. Add the address
argument to pbl_tq_read_eeprom(). The actual EEPROM address will be 0x0
always, but we can use the address to pass I2C_ADDR_16_BIT through it.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 arch/arm/boards/tqma93xx/lowlevel.c | 2 +-
 common/boards/tq/tq_eeprom.c        | 4 ++--
 include/boards/tq/tq_eeprom.h       | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boards/tqma93xx/lowlevel.c b/arch/arm/boards/tqma93xx/lowlevel.c
index 07491867d4..8d89ee530f 100644
--- a/arch/arm/boards/tqma93xx/lowlevel.c
+++ b/arch/arm/boards/tqma93xx/lowlevel.c
@@ -28,7 +28,7 @@ static int tqma93xx_get_formfactor(void)
 
 	i2c = imx93_i2c_early_init(IOMEM(MX9_I2C1_BASE_ADDR));
 
-	eeprom = pbl_tq_read_eeprom(i2c, 0x53);
+	eeprom = pbl_tq_read_eeprom(i2c, 0x53, 0);
 	if (!eeprom)
 		return VARD_FORMFACTOR_TYPE_CONNECTOR;
 
diff --git a/common/boards/tq/tq_eeprom.c b/common/boards/tq/tq_eeprom.c
index 06f11a8a94..fe776d6bab 100644
--- a/common/boards/tq/tq_eeprom.c
+++ b/common/boards/tq/tq_eeprom.c
@@ -118,13 +118,13 @@ static void tq_read_string(const char *src, char *dst, int len)
 	dst[i] = '\0';
 }
 
-struct tq_eeprom *pbl_tq_read_eeprom(struct pbl_i2c *i2c, u8 addr)
+struct tq_eeprom *pbl_tq_read_eeprom(struct pbl_i2c *i2c, u8 addr, u32 eeprom_addr)
 {
 	struct tq_eeprom_data raw;
 	static struct tq_eeprom eeprom;
 	int ret;
 
-	ret = eeprom_read(i2c, addr, 0, &raw, sizeof(raw));
+	ret = eeprom_read(i2c, addr, eeprom_addr, &raw, sizeof(raw));
 	if (ret)
 		return NULL;
 
diff --git a/include/boards/tq/tq_eeprom.h b/include/boards/tq/tq_eeprom.h
index 9a81e6e61d..8b639e2014 100644
--- a/include/boards/tq/tq_eeprom.h
+++ b/include/boards/tq/tq_eeprom.h
@@ -191,6 +191,6 @@ struct tq_eeprom {
 
 struct pbl_i2c;
 
-struct tq_eeprom *pbl_tq_read_eeprom(struct pbl_i2c *i2c, u8 addr);
+struct tq_eeprom *pbl_tq_read_eeprom(struct pbl_i2c *i2c, u8 addr, u32 eeprom_addr);
 
 #endif
-- 
2.39.2




More information about the barebox mailing list