summaryrefslogtreecommitdiff
path: root/board/keymile
diff options
context:
space:
mode:
authorHeiko Schocher <hs@denx.de>2009-07-09 12:04:26 +0200
committerHeiko Schocher <hs@denx.de>2009-07-21 07:06:26 +0200
commit39df00d9aecfb465b9eec9af593f9b763fb5209a (patch)
tree65392eb84672e4f25379bf65a4e9a20fb41e27c6 /board/keymile
parent1bc1538613d66cef3cbce680fc8d7c3561a0fbd0 (diff)
i2c, mpc83xx: add CONFIG_SYS_I2C_INIT_BOARD for fsl_i2c
This patch adds the possibility to call a board specific i2c bus reset routine for the fsl_i2c bus driver, and adds this option for the keymile kmeter1 board. The deblock sequence for this board is implemented and tested in the following way: CR = 0x20 (release SDA and SCL pin) CR = 0xa0 (start read) dummy read dummy read if 2. dummy read == 0x00 3. dummy read CR = 0x80 (SDA and SCL now 1 SR = 0x86) CR = 0x00 (Modul reset SR=0x81) CR = 0x80 (SDA and SCL = 1, SR = 0x81) Signed-off-by: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'board/keymile')
-rw-r--r--board/keymile/common/common.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c
index 259462360..ec27bdae2 100644
--- a/board/keymile/common/common.c
+++ b/board/keymile/common/common.c
@@ -424,6 +424,7 @@ static int get_scl (void)
#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,6 +483,23 @@ static int i2c_make_abort (void)
*/
void i2c_init_board(void)
{
+#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)
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