]> git.sur5r.net Git - u-boot/blobdiff - board/keymile/common/common.c
Merge branch 'master' of git://git.denx.de/u-boot-ppc4xx
[u-boot] / board / keymile / common / common.c
index 259462360ce6ba4d41970c8ca5fecc792888fc95..7b4eefd5c828565b4d93c383bcc6aa32cef49e88 100644 (file)
@@ -35,6 +35,7 @@
 #include <libfdt.h>
 #endif
 
+#include "../common/common.h"
 #if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
 #include <i2c.h>
 
@@ -421,9 +422,9 @@ static int get_scl (void)
 
        return ((val & SCL_BIT) == SCL_BIT);
 }
-
 #endif
 
+#if !defined(CONFIG_KMETER1)
 static void writeStartSeq (void)
 {
        set_sda (1);
@@ -474,6 +475,7 @@ static int i2c_make_abort (void)
        get_sda ();
        return ret;
 }
+#endif
 
 /**
  * i2c_init_board - reset i2c bus. When the board is powercycled during a
@@ -481,7 +483,24 @@ static int i2c_make_abort (void)
  */
 void i2c_init_board(void)
 {
-#if defined(CONFIG_HARD_I2C)
+#if defined(CONFIG_KMETER1)
+       struct fsl_i2c *dev;
+       dev = (struct fsl_i2c *) (CONFIG_SYS_IMMR + CONFIG_SYS_I2C_OFFSET);
+       uchar   dummy;
+
+       out_8 (&dev->cr, (I2C_CR_MSTA));
+       out_8 (&dev->cr, (I2C_CR_MEN | I2C_CR_MSTA));
+       dummy = in_8(&dev->dr);
+       dummy = in_8(&dev->dr);
+       if (dummy != 0xff) {
+               dummy = in_8(&dev->dr);
+       }
+       out_8 (&dev->cr, (I2C_CR_MEN));
+       out_8 (&dev->cr, 0x00);
+       out_8 (&dev->cr, (I2C_CR_MEN));
+
+#else
+#if defined(CONFIG_HARD_I2C) && !defined(CONFIG_MACH_SUEN3)
        volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR ;
        volatile i2c8260_t *i2c = (i2c8260_t *)&immap->im_i2c;
 
@@ -500,6 +519,7 @@ void i2c_init_board(void)
        /* Set the PortPins back to use for I2C */
        setports (0);
 #endif
+#endif
 }
 #endif
 #endif
@@ -558,10 +578,12 @@ int fdt_get_node_and_value (void *blob,
 }
 #endif
 
+#if !defined(CONFIG_MACH_SUEN3)
 int ethernet_present (void)
 {
        return (in_8((u8 *)CONFIG_SYS_PIGGY_BASE + CONFIG_SYS_SLOT_ID_OFF) & 0x80);
 }
+#endif
 
 int board_eth_init (bd_t *bis)
 {