mpc83xx: Update 83xx to use fsl_i2c.c
Update the 83xx tree to use I2C support in drivers/fsl_i2c.c. Delete
cpu/mpc83xx/i2c.c, include/asm-ppc/i2c.h, and all references to those files.
Added multiple I2C bus support to fsl_i2c.c.
Signed-off-by: Timur Tabi <timur@freescale.com>
diff --git a/board/mpc8349itx/mpc8349itx.c b/board/mpc8349itx/mpc8349itx.c
index c0e72c9..097bb37 100644
--- a/board/mpc8349itx/mpc8349itx.c
+++ b/board/mpc8349itx/mpc8349itx.c
@@ -134,8 +134,7 @@
};
#endif /* CONFIG_PCI */
-/* If MPC8349E-mITX is soldered with SDRAM, then initialize it.
-*/
+/* If MPC8349E-mITX is soldered with SDRAM, then initialize it. */
void sdram_init(void)
{
@@ -255,32 +254,12 @@
int checkboard(void)
{
-#ifdef CONFIG_HARD_I2C
- u8 i2c_data;
-#endif
-
- puts("Board: Freescale MPC8349E-mITX");
-
-#ifdef CONFIG_HARD_I2C
- i2c_set_bus_num(2);
- if (i2c_read(CFG_I2C_8574A_ADDR2, 0, 0, &i2c_data, sizeof(i2c_data)) ==
- 0)
- printf(" %u.%u (PCF8475A)", (i2c_data & 0x02) >> 1,
- i2c_data & 0x01);
- else if (i2c_read(CFG_I2C_8574_ADDR2, 0, 0, &i2c_data, sizeof(i2c_data))
- == 0)
- printf(" %u.%u (PCF8475)", (i2c_data & 0x02) >> 1,
- i2c_data & 0x01);
- else
- printf(" ?.?");
-#endif
-
- puts("\n");
+ puts("Board: Freescale MPC8349E-mITX\n");
return 0;
}
-/**
+/*
* Implement a work-around for a hardware problem with compact
* flash.
*
@@ -347,7 +326,7 @@
return 0;
}
-/**
+/*
* Make sure the EEPROM has the HRCW correctly programmed.
* Make sure the RTC is correctly programmed.
*
@@ -366,7 +345,8 @@
#ifdef CONFIG_HARD_I2C
- uchar orig_bus = i2c_get_bus_num();;
+ unsigned int orig_bus = i2c_get_bus_num();;
+ u8 i2c_data;
#ifdef CFG_I2C_RTC_ADDR
char ds1339_data[17];
@@ -381,8 +361,21 @@
};
u8 data[sizeof(eeprom_data)];
+#endif
+ printf("Board revision: ");
i2c_set_bus_num(1);
+ if (i2c_read(CFG_I2C_8574A_ADDR2, 0, 0, &i2c_data, sizeof(i2c_data)) == 0)
+ printf("%u.%u (PCF8475A)\n", (i2c_data & 0x02) >> 1, i2c_data & 0x01);
+ else if (i2c_read(CFG_I2C_8574_ADDR2, 0, 0, &i2c_data, sizeof(i2c_data)) == 0)
+ printf("%u.%u (PCF8475)\n", (i2c_data & 0x02) >> 1, i2c_data & 0x01);
+ else {
+ printf("Unknown\n");
+ rc = 1;
+ }
+
+#ifdef CFG_I2C_EEPROM_ADDR
+ i2c_set_bus_num(0);
if (i2c_read(CFG_I2C_EEPROM_ADDR, 0, 2, data, sizeof(data)) == 0) {
if (memcmp(data, eeprom_data, sizeof(data)) != 0) {
@@ -400,7 +393,7 @@
#endif
#ifdef CFG_I2C_RTC_ADDR
- i2c_set_bus_num(2);
+ i2c_set_bus_num(1);
if (i2c_read(CFG_I2C_RTC_ADDR, 0, 1, ds1339_data, sizeof(ds1339_data))
== 0) {
diff --git a/board/mpc8349itx/pci.c b/board/mpc8349itx/pci.c
index 535cc34..e81ad27 100644
--- a/board/mpc8349itx/pci.c
+++ b/board/mpc8349itx/pci.c
@@ -29,6 +29,9 @@
#include <pci.h>
#include <asm/mpc8349_pci.h>
#include <i2c.h>
+#if defined(CONFIG_OF_FLAT_TREE)
+#include <ft_build.h>
+#endif
DECLARE_GLOBAL_DATA_PTR;
@@ -105,7 +108,7 @@
udelay(2000);
#ifdef CONFIG_HARD_I2C
- i2c_set_bus_num(2);
+ i2c_set_bus_num(1);
/* Read the PCI_M66EN jumper setting */
if ((i2c_read(CFG_I2C_8574_ADDR2, 0, 0, ®8, sizeof(reg8)) == 0) ||
(i2c_read(CFG_I2C_8574A_ADDR2, 0, 0, ®8, sizeof(reg8)) == 0)) {