summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2024-02-21 16:03:18 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2024-03-13 12:00:28 +0100
commitbde0b95e268d4d05660f8445ecf990b159feb5e4 (patch)
tree41dff2fc91a79934b0017f2a9834e9fae1012f7e
parentc8a779f22885c8c1eec581956dcbbb16ca5a1367 (diff)
downloadbarebox-bde0b95e268d4d05660f8445ecf990b159feb5e4.tar.gz
barebox-bde0b95e268d4d05660f8445ecf990b159feb5e4.tar.xz
board: tq: add support for 16bit eeprom
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. Link: https://lore.barebox.org/20240221150323.2715164-4-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--arch/arm/boards/tqma93xx/lowlevel.c2
-rw-r--r--common/boards/tq/tq_eeprom.c4
-rw-r--r--include/boards/tq/tq_eeprom.h2
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