summaryrefslogtreecommitdiffstats
path: root/board
diff options
context:
space:
mode:
authorTimur Tabi <timur@freescale.com>2006-11-03 19:15:00 -0600
committerKim Phillips <kim.phillips@freescale.com>2006-11-03 19:42:23 -0600
commitbe5e61815d5a1fac290ce9c0ef09cb6a8e4288fa (patch)
treeff1cf5e25e26fe920ce38719572094de10a36e62 /board
parentd239d74b1c937984bc519083a8e7de373a390f06 (diff)
downloadbarebox-be5e61815d5a1fac290ce9c0ef09cb6a8e4288fa.tar.gz
barebox-be5e61815d5a1fac290ce9c0ef09cb6a8e4288fa.tar.xz
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>
Diffstat (limited to 'board')
-rw-r--r--board/mpc8349emds/pci.c7
-rw-r--r--board/mpc8349itx/mpc8349itx.c47
-rw-r--r--board/mpc8349itx/pci.c5
-rw-r--r--board/mpc8360emds/pci.c13
4 files changed, 29 insertions, 43 deletions
diff --git a/board/mpc8349emds/pci.c b/board/mpc8349emds/pci.c
index da49a5d80d..bb60e730bc 100644
--- a/board/mpc8349emds/pci.c
+++ b/board/mpc8349emds/pci.c
@@ -74,9 +74,7 @@ pib_init(void)
*/
/* Switch temporarily to I2C bus #2 */
orig_i2c_bus = i2c_get_bus_num();
-
- if(orig_i2c_bus != 2)
- i2c_set_bus_num(2);
+ i2c_set_bus_num(1);
val8 = 0;
i2c_write(0x23, 0x6, 1, &val8, 1);
@@ -122,8 +120,7 @@ pib_init(void)
printf("PCI2: 32-bit on PMC3\n");
#endif
/* Reset to original I2C bus */
- if(orig_i2c_bus != 2)
- i2c_set_bus_num(orig_i2c_bus);
+ i2c_set_bus_num(orig_i2c_bus);
}
/**************************************************************************
diff --git a/board/mpc8349itx/mpc8349itx.c b/board/mpc8349itx/mpc8349itx.c
index c0e72c93e1..097bb370e7 100644
--- a/board/mpc8349itx/mpc8349itx.c
+++ b/board/mpc8349itx/mpc8349itx.c
@@ -134,8 +134,7 @@ volatile static struct pci_controller hose[] = {
};
#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 @@ long int initdram(int board_type)
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 @@ int misc_init_f(void)
return 0;
}
-/**
+/*
* Make sure the EEPROM has the HRCW correctly programmed.
* Make sure the RTC is correctly programmed.
*
@@ -366,7 +345,8 @@ int misc_init_r(void)
#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 @@ int misc_init_r(void)
};
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 @@ int misc_init_r(void)
#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 535cc34afc..e81ad27356 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 @@ void pci_init_board(void)
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, &reg8, sizeof(reg8)) == 0) ||
(i2c_read(CFG_I2C_8574A_ADDR2, 0, 0, &reg8, sizeof(reg8)) == 0)) {
diff --git a/board/mpc8360emds/pci.c b/board/mpc8360emds/pci.c
index a013ba3d43..15a48dcf40 100644
--- a/board/mpc8360emds/pci.c
+++ b/board/mpc8360emds/pci.c
@@ -19,7 +19,7 @@
#include <pci.h>
#include <i2c.h>
-#include <asm/i2c.h>
+#include <asm/fsl_i2c.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -200,9 +200,7 @@ void pci_init_board(void)
/* Switch temporarily to I2C bus #2 */
orig_i2c_bus = i2c_get_bus_num();
-
- if(orig_i2c_bus != 2)
- i2c_set_bus_num(2);
+ i2c_set_bus_num(1);
val8 = 0;
i2c_write(0x23, 0x6, 1, &val8, 1);
@@ -231,12 +229,7 @@ void pci_init_board(void)
asm("eieio");
/* Reset to original I2C bus */
- if(orig_i2c_bus != 2)
- i2c_set_bus_num(orig_i2c_bus);
-
- /* Reset to original I2C bus */
- if(orig_i2c_bus != 2)
- i2c_set_bus_num(orig_i2c_bus);
+ i2c_set_bus_num(orig_i2c_bus);
/*
* Release PCI RST Output signal