From: Kuo-Jung Su <dantesu@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 4/4] cmd_eeprom: bug fix for i2c read/write
Date: Thu, 28 Nov 2013 10:47:06 +0800 [thread overview]
Message-ID: <1385606826-2540-5-git-send-email-dantesu@gmail.com> (raw)
In-Reply-To: <1385606826-2540-1-git-send-email-dantesu@gmail.com>
From: Kuo-Jung Su <dantesu@faraday-tech.com>
The local pointer of address (i.e., addr) only gets
referenced in SPI mode, and it won't be appropriate
to pass only 1 bytes addr[1] to i2c_read/i2c_write while
CONFIG_SYS_I2C_EEPROM_ADDR_LEN > 1.
To avoid ambiguity, this patch would drop the use of
address pointer in I2C mode, and directly pass (dev_addr, offset)
to i2c_read/i2c_write.
Signed-off-by: Kuo-Jung Su <dantesu@faraday-tech.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
cc: Peter Tyser <ptyser@xes-inc.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Mischa Jonker <mjonker@synopsys.com>
---
Changes for v2:
- Initial release
common/cmd_eeprom.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/common/cmd_eeprom.c b/common/cmd_eeprom.c
index 02539c4..0edc259 100644
--- a/common/cmd_eeprom.c
+++ b/common/cmd_eeprom.c
@@ -161,7 +161,7 @@ int eeprom_read (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt
#if defined(CONFIG_SPI) && !defined(CONFIG_ENV_EEPROM_IS_ON_I2C)
spi_read (addr, alen, buffer, len);
#else
- if (i2c_read (addr[0], addr[1], alen-1, buffer, len) != 0)
+ if (i2c_read (dev_addr, offset, alen-1, buffer, len) != 0)
rcode = 1;
#endif
buffer += len;
@@ -339,7 +339,7 @@ int eeprom_write (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cn
/* Write is enabled ... now write eeprom value.
*/
#endif
- if (i2c_write (addr[0], addr[1], alen-1, buffer, len) != 0)
+ if (i2c_write (dev_addr, offset, alen-1, buffer, len) != 0)
rcode = 1;
#endif
--
1.7.9.5
next prev parent reply other threads:[~2013-11-28 2:47 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-25 2:48 [U-Boot] [PATCH 0/2] i2c: fti2c010: migrate to new i2c model Kuo-Jung Su
2013-11-25 2:48 ` [U-Boot] [PATCH 1/2] i2c: fti2c010: cosmetic: coding style cleanup Kuo-Jung Su
2013-11-25 2:48 ` [U-Boot] [PATCH 2/2] i2c: fti2c010: migrate to new i2c model Kuo-Jung Su
2013-11-28 2:47 ` [U-Boot] [PATCH v2 0/4] i2c: fti2c010: bug fix & new driver model Kuo-Jung Su
2013-11-28 2:47 ` [U-Boot] [PATCH v2 1/4] i2c: fti2c010: cosmetic: coding style cleanup Kuo-Jung Su
2013-11-28 2:47 ` [U-Boot] [PATCH v2 2/4] i2c: fti2c010: migrate to new i2c model Kuo-Jung Su
2013-11-28 2:47 ` [U-Boot] [PATCH v2 3/4] i2c: fti2c010: serial out r/w address in MSB order Kuo-Jung Su
2013-11-28 2:47 ` Kuo-Jung Su [this message]
2013-11-28 10:39 ` [U-Boot] [PATCH v2 4/4] cmd_eeprom: bug fix for i2c read/write Alexey Brodkin
2013-11-29 0:59 ` Kuo-Jung Su
2013-11-29 9:10 ` Alexey Brodkin
2013-11-29 9:32 ` Kuo-Jung Su
2013-11-29 9:56 ` Alexey Brodkin
2013-11-29 15:04 ` Kuo-Jung Su
2013-12-02 2:57 ` [U-Boot] [PATCH v3 0/4] i2c: fti2c010: bug fix & new driver model Kuo-Jung Su
2013-12-02 2:57 ` [U-Boot] [PATCH v3 1/4] i2c: fti2c010: cosmetic: coding style cleanup Kuo-Jung Su
2013-12-02 7:30 ` [U-Boot] [PATCH v3 0/4] i2c: fti2c010: bug fix & new driver model Heiko Schocher
2013-12-02 8:09 ` Kuo-Jung Su
2013-12-02 8:36 ` Heiko Schocher
2013-12-02 8:02 ` Kuo-Jung Su
2013-12-02 8:02 ` [U-Boot] [PATCH v3 1/4] i2c: fti2c010: cosmetic: coding style cleanup Kuo-Jung Su
2013-12-09 6:52 ` [U-Boot] [U-Boot, v3, " Heiko Schocher
2013-12-02 8:02 ` [U-Boot] [PATCH v3 2/4] i2c: fti2c010: migrate to new i2c model Kuo-Jung Su
2013-12-09 6:53 ` [U-Boot] [U-Boot, v3, " Heiko Schocher
2013-12-02 8:02 ` [U-Boot] [PATCH v3 3/4] i2c: fti2c010: serial out r/w address in MSB order Kuo-Jung Su
2013-12-09 6:55 ` [U-Boot] [U-Boot, v3, " Heiko Schocher
2013-12-02 8:02 ` [U-Boot] [PATCH v3 4/4] cmd_eeprom: bug fix for i2c read/write Kuo-Jung Su
2013-12-02 11:09 ` Alexey Brodkin
2013-12-03 0:55 ` Kuo-Jung Su
2013-12-03 7:42 ` Alexey Brodkin
2013-12-09 6:56 ` [U-Boot] [U-Boot, v3, " Heiko Schocher
2013-12-09 10:35 ` Alexey Brodkin
2013-12-09 11:21 ` Heiko Schocher
2013-12-10 10:18 ` Alexey Brodkin
2013-12-11 1:13 ` Kuo-Jung Su
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=1385606826-2540-5-git-send-email-dantesu@gmail.com \
--to=dantesu@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