* [PATCH] fsl_i2c: Added a callpoint for i2c_board_late_init
@ 2010-04-12 19:08 Richard Retanubun
0 siblings, 0 replies; 3+ messages in thread
From: Richard Retanubun @ 2010-04-12 19:08 UTC (permalink / raw)
To: u-boot
This patch adds a callpoint in i2c_init that allows board specific
i2c board initialization (typically for i2c bus reset) that is called
after i2c_init operations, allowing the i2c_board_late_init function
to use the pre-configured i2c bus speed and slave address.
---
v2: Adds missing function prototype declaration in include/i2c.h
drivers/i2c/fsl_i2c.c | 8 ++++++++
include/i2c.h | 3 +++
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/drivers/i2c/fsl_i2c.c b/drivers/i2c/fsl_i2c.c
index 2241990..a1a62fa 100644
--- a/drivers/i2c/fsl_i2c.c
+++ b/drivers/i2c/fsl_i2c.c
@@ -249,6 +249,14 @@ i2c_init(int speed, int slaveadd)
writeb(0x0, &dev->sr); /* clear status register */
writeb(I2C_CR_MEN, &dev->cr); /* start I2C controller */
#endif
+
+#ifdef CONFIG_SYS_I2C_BOARD_LATE_INIT
+ /* Call board specific i2c bus reset routine after the bus has been */
+ /* initialized. Use either this callpoint or i2c_init_board; which is */
+ /* called before i2c_init operations. */
+ /* For details about this problem see doc/I2C_Edge_Conditions. */
+ i2c_board_late_init();
+#endif
}
static int
diff --git a/include/i2c.h b/include/i2c.h
index d828964..cd23c8a 100644
--- a/include/i2c.h
+++ b/include/i2c.h
@@ -111,6 +111,9 @@ void i2c_init(int speed, int slaveaddr);
#ifdef CONFIG_SYS_I2C_INIT_BOARD
void i2c_init_board(void);
#endif
+#ifdef CONFIG_SYS_I2C_BOARD_LATE_INIT
+void i2c_board_late_init(void);
+#endif
#if defined(CONFIG_I2C_MUX)
--
1.7.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] fsl_i2c: Added a callpoint for i2c_board_late_init
@ 2010-04-12 19:08 Richard Retanubun
0 siblings, 0 replies; 3+ messages in thread
From: Richard Retanubun @ 2010-04-12 19:08 UTC (permalink / raw)
To: u-boot
This patch adds a callpoint in i2c_init that allows board specific
i2c board initialization (typically for i2c bus reset) that is called
after i2c_init operations, allowing the i2c_board_late_init function
to use the pre-configured i2c bus speed and slave address.
---
Hi Wolfgang & Heiko,
This is the patch that adds another callpoint. Thanks for
all the feedback.
- Richard
drivers/i2c/fsl_i2c.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/drivers/i2c/fsl_i2c.c b/drivers/i2c/fsl_i2c.c
index 2241990..a1a62fa 100644
--- a/drivers/i2c/fsl_i2c.c
+++ b/drivers/i2c/fsl_i2c.c
@@ -249,6 +249,14 @@ i2c_init(int speed, int slaveadd)
writeb(0x0, &dev->sr); /* clear status register */
writeb(I2C_CR_MEN, &dev->cr); /* start I2C controller */
#endif
+
+#ifdef CONFIG_SYS_I2C_BOARD_LATE_INIT
+ /* Call board specific i2c bus reset routine after the bus has been */
+ /* initialized. Use either this callpoint or i2c_init_board; which is */
+ /* called before i2c_init operations. */
+ /* For details about this problem see doc/I2C_Edge_Conditions. */
+ i2c_board_late_init();
+#endif
}
static int
--
1.7.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] fsl_i2c: Added a callpoint for i2c_board_late_init
@ 2010-04-12 19:08 Richard Retanubun
0 siblings, 0 replies; 3+ messages in thread
From: Richard Retanubun @ 2010-04-12 19:08 UTC (permalink / raw)
To: u-boot
This patch adds a callpoint in i2c_init that allows board specific
i2c board initialization (typically for i2c bus reset) that is called
after i2c_init operations, allowing the i2c_board_late_init function
to use the pre-configured i2c bus speed and slave address.
---
v3 notes:
- fixed multi-line commenting style for both
CONFIG_SYS_I2C_INIT_BOARD and CONFIG_SYS_I2C_BOARD_LATE_INIT
- Added README entry
README | 11 +++++++++++
drivers/i2c/fsl_i2c.c | 16 +++++++++++++---
include/i2c.h | 3 +++
3 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/README b/README
index 940b507..5a0a7fd 100644
--- a/README
+++ b/README
@@ -1479,6 +1479,17 @@ The following options need to be configured:
custom i2c_init_board() routine in boards/xxx/board.c
is run early in the boot sequence.
+ CONFIG_SYS_I2C_BOARD_LATE_INIT
+
+ An alternative to CONFIG_SYS_I2C_INIT_BOARD. If this option is
+ defined a custom i2c_board_late_init() routine in
+ boards/xxx/board.c is run AFTER the operations in i2c_init()
+ is completed. This callpoint can be used to unreset i2c bus
+ using CPU i2c controller register accesses for CPUs whose i2c
+ controller provide such a method. It is called at the end of
+ i2c_init() to allow i2c_init operations to setup the i2c bus
+ controller on the CPU (e.g. setting bus speed & slave address).
+
CONFIG_I2CFAST (PPC405GP|PPC405EP only)
This option enables configuration of bi_iic_fast[] flags
diff --git a/drivers/i2c/fsl_i2c.c b/drivers/i2c/fsl_i2c.c
index 2241990..cb13dee 100644
--- a/drivers/i2c/fsl_i2c.c
+++ b/drivers/i2c/fsl_i2c.c
@@ -221,9 +221,10 @@ i2c_init(int speed, int slaveadd)
unsigned int temp;
#ifdef CONFIG_SYS_I2C_INIT_BOARD
- /* call board specific i2c bus reset routine before accessing the */
- /* environment, which might be in a chip on that bus. For details */
- /* about this problem see doc/I2C_Edge_Conditions. */
+ /* Call board specific i2c bus reset routine before accessing the
+ * environment, which might be in a chip on that bus. For details
+ * about this problem see doc/I2C_Edge_Conditions.
+ */
i2c_init_board();
#endif
dev = (struct fsl_i2c *) (CONFIG_SYS_IMMR + CONFIG_SYS_I2C_OFFSET);
@@ -249,6 +250,15 @@ i2c_init(int speed, int slaveadd)
writeb(0x0, &dev->sr); /* clear status register */
writeb(I2C_CR_MEN, &dev->cr); /* start I2C controller */
#endif
+
+#ifdef CONFIG_SYS_I2C_BOARD_LATE_INIT
+ /* Call board specific i2c bus reset routine AFTER the bus has been
+ * initialized. Use either this callpoint or i2c_init_board;
+ * which is called before i2c_init operations.
+ * For details about this problem see doc/I2C_Edge_Conditions.
+ */
+ i2c_board_late_init();
+#endif
}
static int
diff --git a/include/i2c.h b/include/i2c.h
index d828964..cd23c8a 100644
--- a/include/i2c.h
+++ b/include/i2c.h
@@ -111,6 +111,9 @@ void i2c_init(int speed, int slaveaddr);
#ifdef CONFIG_SYS_I2C_INIT_BOARD
void i2c_init_board(void);
#endif
+#ifdef CONFIG_SYS_I2C_BOARD_LATE_INIT
+void i2c_board_late_init(void);
+#endif
#if defined(CONFIG_I2C_MUX)
--
1.7.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-04-12 19:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-12 19:08 [PATCH] fsl_i2c: Added a callpoint for i2c_board_late_init Richard Retanubun
2010-04-12 19:08 Richard Retanubun
2010-04-12 19:08 Richard Retanubun
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.