Add command for handling DDR ECC registers on MPC8349EE MDS board.
[oweals/u-boot.git] / common / soft_i2c.c
index 9a10b3126c1d5e2e91d3388eda1375728a2fefdb..b3642dafc24564b44b151db1e4f0cffd50b3473e 100644 (file)
 #ifdef CONFIG_MPC8260                  /* only valid for MPC8260 */
 #include <ioports.h>
 #endif
+#ifdef CONFIG_AT91RM9200DK             /* need this for the at91rm9200dk */
+#include <asm/io.h>
+#include <asm/arch/hardware.h>
+#endif
 #include <i2c.h>
 
 #if defined(CONFIG_SOFT_I2C)
@@ -160,13 +164,10 @@ static void send_ack(int ack)
        volatile immap_t *immr = (immap_t *)CFG_IMMR;
 #endif
 
-       I2C_ACTIVE;
        I2C_SCL(0);
        I2C_DELAY;
-
-       I2C_SDA(ack);
-
        I2C_ACTIVE;
+       I2C_SDA(ack);
        I2C_DELAY;
        I2C_SCL(1);
        I2C_DELAY;
@@ -284,7 +285,10 @@ int i2c_probe(uchar addr)
 {
        int rc;
 
-       /* perform 1 byte read transaction */
+       /*
+        * perform 1 byte write transaction with just address byte
+        * (fake write)
+        */
        send_start();
        rc = write_byte ((addr << 1) | 0);
        send_stop();
@@ -395,7 +399,7 @@ int  i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len)
  */
 uchar i2c_reg_read(uchar i2c_addr, uchar reg)
 {
-       char buf;
+       uchar buf;
 
        i2c_read(i2c_addr, reg, 1, &buf, 1);