summaryrefslogtreecommitdiff
path: root/cpu/mpc824x/drivers/i2c/i2c1.c
diff options
context:
space:
mode:
authorwdenk <wdenk>2003-07-24 23:38:38 +0000
committerwdenk <wdenk>2003-07-24 23:38:38 +0000
commit27b207fd0a0941b03f27e2a82c0468b1a090c745 (patch)
tree4d339d7a2a00889f09a876425ce430be57de56e9 /cpu/mpc824x/drivers/i2c/i2c1.c
parent2535d60277cc295adf75cd5721dcecd840c69a63 (diff)
downloadu-boot-imx-27b207fd0a0941b03f27e2a82c0468b1a090c745.zip
u-boot-imx-27b207fd0a0941b03f27e2a82c0468b1a090c745.tar.gz
u-boot-imx-27b207fd0a0941b03f27e2a82c0468b1a090c745.tar.bz2
* Implement new mechanism to export U-Boot's functions to standalone
applications: instead of using (PPC-specific) system calls we now use a jump table; please see doc/README.standalone for details * Patch by Dave Westwood, 24 Jul 2003: added support for Unity OS (a proprietary OS)
Diffstat (limited to 'cpu/mpc824x/drivers/i2c/i2c1.c')
-rw-r--r--cpu/mpc824x/drivers/i2c/i2c1.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/cpu/mpc824x/drivers/i2c/i2c1.c b/cpu/mpc824x/drivers/i2c/i2c1.c
index dc1c97c..94c671e 100644
--- a/cpu/mpc824x/drivers/i2c/i2c1.c
+++ b/cpu/mpc824x/drivers/i2c/i2c1.c
@@ -1197,13 +1197,16 @@ int i2c_write (uchar chip, uint addr, int alen, uchar * buffer, int len)
uchar *p;
int i;
- p = dummy_buffer;
/* fill in address in big endian order */
- for (i=0; i<alen; ++i)
- *p++ = (addr >> (i * 8)) & 0xFF;
+ for (i=alen-1; i>=0; --i) {
+ buffer[i] = addr & 0xFF;
+ addr >>= 8;
+ }
/* fill in data */
+ p = dummy_buffer + alen;
+
for (i=0; i<len; ++i)
- *p++ = *buffer;
+ *p++ = *buffer++;
status = I2C_do_buffer (0, I2C_MASTER_XMIT, chip, alen + len,
dummy_buffer, I2C_STOP, 1, I2C_NO_RESTART);