public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Robert Nelson <robertcnelson@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] beagle: expansion boards: retry i2c_read with 16bit addressing
Date: Mon,  4 Feb 2013 10:03:10 -0600	[thread overview]
Message-ID: <1359993790-22454-1-git-send-email-robertcnelson@gmail.com> (raw)

Some expansion boards now ship with at24 eeproms that need to communicate
via 16bit addressing.

Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
---
 board/ti/beagle/beagle.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c
index b829a79..9493c6b 100644
--- a/board/ti/beagle/beagle.c
+++ b/board/ti/beagle/beagle.c
@@ -227,6 +227,14 @@ static unsigned int get_expansion_id(void)
 	i2c_read(EXPANSION_EEPROM_I2C_ADDRESS, 0, 1, (u8 *)&expansion_config,
 		 sizeof(expansion_config));
 
+	/* retry reading configuration data with 16bit addressing */
+	if ((expansion_config.device_vendor == 0xFFFFFF00) ||
+	    (expansion_config.device_vendor == 0xFFFFFFFF)) {
+		printf("EEPROM is blank or 8bit addressing failed: retrying with 16bit:\n");
+		i2c_read(EXPANSION_EEPROM_I2C_ADDRESS, 0, 2, (u8 *)&expansion_config,
+			 sizeof(expansion_config));
+	}
+
 	i2c_set_bus_num(TWL4030_I2C_BUS);
 
 	return expansion_config.device_vendor;
-- 
1.7.10.4

             reply	other threads:[~2013-02-04 16:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-04 16:03 Robert Nelson [this message]
2013-02-19 16:15 ` [U-Boot] [U-Boot, 1/2] beagle: expansion boards: retry i2c_read with 16bit addressing Tom Rini

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=1359993790-22454-1-git-send-email-robertcnelson@gmail.com \
    --to=robertcnelson@gmail.com \
    --cc=u-boot@lists.denx.de \
    /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