]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/i2c/tegra_i2c.c
Merge branch 'agust@denx.de' of git://git.denx.de/u-boot-staging
[karo-tx-uboot.git] / drivers / i2c / tegra_i2c.c
index 97f0ca44c59a48cedde0ded34e53eb8579c3647e..257b72f0f7cdf71b40afc10a2d18a9d48fdf700d 100644 (file)
@@ -224,14 +224,16 @@ static int send_recv_packets(struct i2c_bus *i2c_bus,
 
                if (is_write) {
                        /* deal with word alignment */
-                       if ((unsigned)dptr & 3) {
+                       if ((words == 1) && last_bytes) {
+                               local = 0;
+                               memcpy(&local, dptr, last_bytes);
+                       } else if ((unsigned)dptr & 3) {
                                memcpy(&local, dptr, sizeof(u32));
-                               writel(local, &control->tx_fifo);
-                               debug("pkt data sent (0x%x)\n", local);
                        } else {
-                               writel(*wptr, &control->tx_fifo);
-                               debug("pkt data sent (0x%x)\n", *wptr);
+                               local = *wptr;
                        }
+                       writel(local, &control->tx_fifo);
+                       debug("pkt data sent (0x%x)\n", local);
                        if (!wait_for_tx_fifo_empty(control)) {
                                error = -1;
                                goto exit;
@@ -546,8 +548,8 @@ static int tegra_i2c_read(struct i2c_adapter *adap, uchar chip, uint addr,
        uint offset;
        int i;
 
-       debug("i2c_read: chip=0x%x, addr=0x%x, len=0x%x\n",
-                               chip, addr, len);
+       debug("i2c_read: chip=0x%x, addr=0x%x, alen=0x%x len=0x%x\n",
+             chip, addr, alen, len);
        bus = tegra_i2c_get_bus(adap);
        if (!bus)
                return 1;
@@ -585,8 +587,8 @@ static int tegra_i2c_write(struct i2c_adapter *adap, uchar chip, uint addr,
        uint offset;
        int i;
 
-       debug("i2c_write: chip=0x%x, addr=0x%x, len=0x%x\n",
-                               chip, addr, len);
+       debug("i2c_write: chip=0x%x, addr=0x%x, alen=0x%x len=0x%x\n",
+             chip, addr, alen, len);
        bus = tegra_i2c_get_bus(adap);
        if (!bus)
                return 1;