i2c, fsl_i2c: switch to new multibus/multiadapter support

- added to fsl_i2c driver new multibus/multiadpater support
- adapted all config files, which uses this driver

Signed-off-by: Heiko Schocher <hs@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>
diff --git a/board/esd/vme8349/vme8349.c b/board/esd/vme8349/vme8349.c
index 96698e7..8c8b8ee 100644
--- a/board/esd/vme8349/vme8349.c
+++ b/board/esd/vme8349/vme8349.c
@@ -186,11 +186,11 @@
 
 int vme8349_read_spd(uchar chip, uint addr, int alen, uchar *buffer, int len)
 {
-	int old_bus = I2C_GET_BUS();
+	int old_bus = i2c_get_bus_num();
 	unsigned int l, sum;
 	int valid = 0;
 
-	I2C_SET_BUS(0);
+	i2c_set_bus_num(0);
 
 	if (i2c_read(chip, addr, alen, buffer, len) == 0)
 		if (memcmp(&buffer[64], &default_spd_eeprom.mid[0], 8) == 0) {
@@ -215,7 +215,7 @@
 		buffer[63] = sum;
 	}
 
-	I2C_SET_BUS(old_bus);
+	i2c_set_bus_num(old_bus);
 
 	return 0;
 }
diff --git a/board/freescale/m52277evb/README b/board/freescale/m52277evb/README
index d5e7b05..3178d49 100644
--- a/board/freescale/m52277evb/README
+++ b/board/freescale/m52277evb/README
@@ -82,7 +82,7 @@
 CONFIG_MCFTMR		-- define to use DMA timer
 CONFIG_MCFPIT		-- define to use PIT timer
 
-CONFIG_FSL_I2C		-- define to use FSL common I2C driver
+CONFIG_SYS_I2C_FSL	-- define to use FSL common I2C driver
 CONFIG_HARD_I2C		-- define for I2C hardware support
 CONFIG_SYS_I2C_SOFT	-- define for I2C bit-banged
 CONFIG_SYS_I2C_SPEED		-- define for I2C speed
diff --git a/board/freescale/m53017evb/README b/board/freescale/m53017evb/README
index 855bbd1..84fc1ec 100644
--- a/board/freescale/m53017evb/README
+++ b/board/freescale/m53017evb/README
@@ -90,7 +90,7 @@
 CONFIG_MCFTMR			-- define to use DMA timer
 CONFIG_MCFPIT			-- define to use PIT timer
 
-CONFIG_FSL_I2C			-- define to use FSL common I2C driver
+CONFIG_SYS_I2C_FSL		-- define to use FSL common I2C driver
 CONFIG_HARD_I2C			-- define for I2C hardware support
 CONFIG_SYS_I2C_SOFT		-- define for I2C bit-banged
 CONFIG_SYS_I2C_SPEED		-- define for I2C speed
diff --git a/board/freescale/m5373evb/README b/board/freescale/m5373evb/README
index 61e6d97..52eac7b 100644
--- a/board/freescale/m5373evb/README
+++ b/board/freescale/m5373evb/README
@@ -89,7 +89,7 @@
 CONFIG_MCFTMR		-- define to use DMA timer
 CONFIG_MCFPIT		-- define to use PIT timer
 
-CONFIG_FSL_I2C		-- define to use FSL common I2C driver
+CONFIG_SYS_I2C_FSL	-- define to use FSL common I2C driver
 CONFIG_HARD_I2C		-- define for I2C hardware support
 CONFIG_SYS_I2C_SOFT	-- define for I2C bit-banged
 CONFIG_SYS_I2C_SPEED		-- define for I2C speed
diff --git a/board/freescale/m54455evb/README b/board/freescale/m54455evb/README
index 2b25952..c70c4c5 100644
--- a/board/freescale/m54455evb/README
+++ b/board/freescale/m54455evb/README
@@ -112,7 +112,7 @@
 CONFIG_MCFTMR		-- define to use DMA timer
 CONFIG_MCFPIT		-- define to use PIT timer
 
-CONFIG_FSL_I2C		-- define to use FSL common I2C driver
+CONFIG_SYS_FSL_I2C	-- define to use FSL common I2C driver
 CONFIG_HARD_I2C		-- define for I2C hardware support
 CONFIG_SYS_I2C_SOFT	-- define for I2C bit-banged
 CONFIG_SYS_I2C_SPEED		-- define for I2C speed
diff --git a/board/freescale/m547xevb/README b/board/freescale/m547xevb/README
index 1a8cbce..ce497c0 100644
--- a/board/freescale/m547xevb/README
+++ b/board/freescale/m547xevb/README
@@ -97,7 +97,7 @@
 
 CONFIG_SLTTMR		-- define to use SLT timer
 
-CONFIG_FSL_I2C		-- define to use FSL common I2C driver
+CONFIG_SYS_I2C_FSL	-- define to use FSL common I2C driver
 CONFIG_HARD_I2C		-- define for I2C hardware support
 CONFIG_SYS_I2C_SOFT	-- define for I2C bit-banged
 CONFIG_SYS_I2C_SPEED		-- define for I2C speed
diff --git a/board/freescale/mpc8349itx/mpc8349itx.c b/board/freescale/mpc8349itx/mpc8349itx.c
index 9cc808e..271768d 100644
--- a/board/freescale/mpc8349itx/mpc8349itx.c
+++ b/board/freescale/mpc8349itx/mpc8349itx.c
@@ -263,8 +263,7 @@
 {
 	int rc = 0;
 
-#ifdef CONFIG_HARD_I2C
-
+#if defined(CONFIG_SYS_I2C)
 	unsigned int orig_bus = i2c_get_bus_num();
 	u8 i2c_data;
 
diff --git a/board/freescale/mpc8349itx/pci.c b/board/freescale/mpc8349itx/pci.c
index 7d30d9b..1ab4e0c 100644
--- a/board/freescale/mpc8349itx/pci.c
+++ b/board/freescale/mpc8349itx/pci.c
@@ -87,7 +87,7 @@
 #endif
 	u8 reg8;
 
-#ifdef CONFIG_HARD_I2C
+#if defined(CONFIG_SYS_I2C)
 	i2c_set_bus_num(1);
 	/* Read the PCI_M66EN jumper setting */
 	if ((i2c_read(CONFIG_SYS_I2C_8574_ADDR2, 0, 0, &reg8, sizeof(reg8)) == 0) ||
diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
index 2e0e0c7..e4f577f 100644
--- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
+++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
@@ -248,7 +248,7 @@
 		in_8(&cpld_data->pcba_rev) & 0x0F);
 
 	/* Initialize i2c early for rom_loc and flash bank information */
-	i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+	i2c_set_bus_num(CONFIG_SYS_SPD_BUS_NUM);
 
 	if (i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 0, 1, &in, 1) < 0 ||
 	    i2c_read(CONFIG_SYS_I2C_PCA9557_ADDR, 1, 1, &out, 1) < 0 ||
diff --git a/board/keymile/common/ivm.c b/board/keymile/common/ivm.c
index 918a6ab..a14496f 100644
--- a/board/keymile/common/ivm.c
+++ b/board/keymile/common/ivm.c
@@ -314,29 +314,13 @@
 
 int ivm_read_eeprom(void)
 {
-#if defined(CONFIG_I2C_MUX)
-	I2C_MUX_DEVICE *dev = NULL;
-#endif
 	uchar i2c_buffer[CONFIG_SYS_IVM_EEPROM_MAX_LEN];
 	char	*buf;
 	unsigned long dev_addr = CONFIG_SYS_IVM_EEPROM_ADR;
 	int ret;
 
-#if defined(CONFIG_SYS_I2C)
 	buf = getenv("EEprom_ivm");
 	i2c_set_bus_num(buf ? (int)simple_strtol(buf, NULL, 10) : 0);
-#else
-#if defined(CONFIG_I2C_MUX)
-	/* First init the Bus, select the Bus */
-	buf = (unsigned char *) getenv("EEprom_ivm");
-	if (buf != NULL)
-		dev = i2c_mux_ident_muxstring(buf);
-	if (dev == NULL) {
-		printf("Error couldnt add Bus for IVM\n");
-		return -1;
-	}
-	i2c_set_bus_num(dev->busid);
-#endif
 	/* add deblocking here */
 	i2c_make_abort();
 
diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c
index faaa39b..6d45809 100644
--- a/board/keymile/km83xx/km83xx.c
+++ b/board/keymile/km83xx/km83xx.c
@@ -95,19 +95,6 @@
 	{0,  0, 0, 0, QE_IOP_TAB_END},
 };
 
-static int board_init_i2c_busses(void)
-{
-	I2C_MUX_DEVICE *dev = NULL;
-	uchar *dtt_bus = (uchar *)"pca9547:70:a";
-
-	/* Set up the Bus for the DTTs */
-	dev = i2c_mux_ident_muxstring(dtt_bus);
-	if (dev == NULL)
-		printf("Error couldn't add Bus for DTT\n");
-
-	return 0;
-}
-
 #if defined(CONFIG_SUVD3)
 const uint upma_table[] = {
 	0x1ffedc00, 0x0ffcdc80, 0x0ffcdc80, 0x0ffcdc04, /* Words 0 to 3 */
@@ -206,8 +193,6 @@
 
 int misc_init_r(void)
 {
-	/* add board specific i2c busses */
-	board_init_i2c_busses();
 	return 0;
 }