summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorHeiko Schocher <hs@denx.de>2008-10-15 09:36:03 +0200
committerWolfgang Denk <wd@denx.de>2008-10-18 21:54:01 +0200
commit9661bf9d120f760238b2a073b84f2baf05010057 (patch)
treec6ff961aff45582a645afea25d31b5e9ef5bc84d /board
parent98aed379586a155292efbf3209356836584b601c (diff)
downloadu-boot-imx-9661bf9d120f760238b2a073b84f2baf05010057.zip
u-boot-imx-9661bf9d120f760238b2a073b84f2baf05010057.tar.gz
u-boot-imx-9661bf9d120f760238b2a073b84f2baf05010057.tar.bz2
mgcoge, mgsuvd: add I2C support.
Signed-off-by: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'board')
-rw-r--r--board/keymile/mgcoge/mgcoge.c14
-rw-r--r--board/keymile/mgsuvd/mgsuvd.c11
2 files changed, 23 insertions, 2 deletions
diff --git a/board/keymile/mgcoge/mgcoge.c b/board/keymile/mgcoge/mgcoge.c
index a6bf9bc..d3e46f5 100644
--- a/board/keymile/mgcoge/mgcoge.c
+++ b/board/keymile/mgcoge/mgcoge.c
@@ -24,11 +24,16 @@
#include <common.h>
#include <mpc8260.h>
#include <ioports.h>
+#include <malloc.h>
#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT)
#include <libfdt.h>
#endif
+#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C)
+#include <i2c.h>
+#endif
+
/*
* I/O Port configuration table
*
@@ -163,8 +168,13 @@ const iop_conf_t iop_conf_tab[4][32] = {
/* PD18 */ { 0, 0, 0, 0, 0, 0 }, /* PD18 */
/* PD17 */ { 0, 0, 0, 0, 0, 0 }, /* PD17 */
/* PD16 */ { 0, 0, 0, 0, 0, 0 }, /* PD16 */
- /* PD15 */ { 0, 0, 0, 0, 0, 0 }, /* PD15 */
- /* PD14 */ { 0, 0, 0, 0, 0, 0 }, /* PD14 */
+#if defined(CONFIG_HARD_I2C)
+ /* PD15 */ { 1, 1, 1, 0, 1, 0 }, /* I2C SDA */
+ /* PD14 */ { 1, 1, 1, 0, 1, 0 }, /* I2C SCL */
+#else
+ /* PD15 */ { 1, 0, 0, 0, 1, 1 }, /* PD15 */
+ /* PD14 */ { 1, 0, 0, 1, 1, 1 }, /* PD14 */
+#endif
/* PD13 */ { 0, 0, 0, 0, 0, 0 }, /* PD13 */
/* PD12 */ { 0, 0, 0, 0, 0, 0 }, /* PD12 */
/* PD11 */ { 0, 0, 0, 0, 0, 0 }, /* PD11 */
diff --git a/board/keymile/mgsuvd/mgsuvd.c b/board/keymile/mgsuvd/mgsuvd.c
index c51ea7e..d78b2da 100644
--- a/board/keymile/mgsuvd/mgsuvd.c
+++ b/board/keymile/mgsuvd/mgsuvd.c
@@ -225,3 +225,14 @@ void ft_board_setup(void *blob, bd_t *bd)
ft_blob_update(blob, bd);
}
#endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */
+
+int i2c_soft_read_pin (void)
+{
+ int val;
+
+ *(unsigned short *)(I2C_BASE_DIR) &= ~SDA_CONF;
+ udelay(1);
+ val = *(unsigned char *)(I2C_BASE_PORT);
+
+ return ((val & SDA_BIT) == SDA_BIT);
+}