mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 3/8] board: tq: add support for 16bit eeprom
Date: Wed, 21 Feb 2024 16:03:18 +0100	[thread overview]
Message-ID: <20240221150323.2715164-4-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20240221150323.2715164-1-s.hauer@pengutronix.de>

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@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




  parent reply	other threads:[~2024-02-21 15:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-21 15:03 [PATCH 0/8] Update TQMa6UL Sascha Hauer
2024-02-21 15:03 ` [PATCH 1/8] board: tq: add missing select Sascha Hauer
2024-02-21 15:03 ` [PATCH 2/8] board: tq: fix format specifier Sascha Hauer
2024-02-21 15:03 ` Sascha Hauer [this message]
2024-02-21 15:03 ` [PATCH 4/8] ARM: i.MX6: add i2c4 base address Sascha Hauer
2024-02-21 15:03 ` [PATCH 5/8] ARM: tqma6ul: add pr_fmt string Sascha Hauer
2024-02-21 15:03 ` [PATCH 6/8] ARM: tqma6ul: enable enet_ref_125m clk Sascha Hauer
2024-02-21 15:03 ` [PATCH 7/8] net: phy: fix miibus parent device of_node not matching phy node Sascha Hauer
2024-02-21 15:03 ` [PATCH 8/8] ARM: tqma6ul: use upstream device trees Sascha Hauer
2024-02-21 16:42   ` Ahmad Fatoum
2024-02-23  7:37     ` Sascha Hauer
2024-02-23  7:32 ` [PATCH 0/8] Update TQMa6UL Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240221150323.2715164-4-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox