summaryrefslogtreecommitdiff
path: root/include/configs/mgsuvd.h
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 /include/configs/mgsuvd.h
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 'include/configs/mgsuvd.h')
-rw-r--r--include/configs/mgsuvd.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/include/configs/mgsuvd.h b/include/configs/mgsuvd.h
index 740767e..f2cfe6e 100644
--- a/include/configs/mgsuvd.h
+++ b/include/configs/mgsuvd.h
@@ -113,6 +113,7 @@
#define CONFIG_CMD_ASKENV
#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_I2C
#define CONFIG_CMD_NFS
#define CONFIG_CMD_PING
@@ -330,4 +331,46 @@
#define OF_TBCLK (bd->bi_busfreq / 4)
#define OF_STDOUT_PATH "/soc/cpm/serial@a80"
+/* enable I2C and select the hardware/software driver */
+#undef CONFIG_HARD_I2C /* I2C with hardware support */
+#define CONFIG_SOFT_I2C 1 /* I2C bit-banged */
+#define CFG_I2C_SPEED 50000 /* I2C speed and slave address */
+#define CFG_I2C_SLAVE 0x7F
+#define I2C_SOFT_DECLARATIONS
+
+/*
+ * Software (bit-bang) I2C driver configuration
+ */
+#define I2C_BASE_DIR (CFG_PIGGY_BASE + 0x04)
+#define I2C_BASE_PORT (CFG_PIGGY_BASE + 0x09)
+
+#define SDA_BIT 0x40
+#define SCL_BIT 0x80
+#define SDA_CONF 0x1000
+#define SCL_CONF 0x2000
+
+#define I2C_ACTIVE do {} while (0)
+#define I2C_TRISTATE do {} while (0)
+#define I2C_READ i2c_soft_read_pin ()
+#define I2C_SDA(bit) if(bit) { \
+ *(unsigned short *)(I2C_BASE_DIR) &= ~SDA_CONF; \
+ } \
+ else { \
+ *(unsigned char *)(I2C_BASE_PORT) &= ~SDA_BIT; \
+ *(unsigned short *)(I2C_BASE_DIR) |= SDA_CONF; \
+ }
+#define I2C_SCL(bit) if(bit) { \
+ *(unsigned short *)(I2C_BASE_DIR) &= ~SCL_CONF; \
+ } \
+ else { \
+ *(unsigned char *)(I2C_BASE_PORT) &= ~SCL_BIT; \
+ *(unsigned short *)(I2C_BASE_DIR) |= SCL_CONF; \
+ }
+#define I2C_DELAY udelay(50) /* 1/4 I2C clock duration */
+
+#define CONFIG_I2C_MULTI_BUS 1
+#define CONFIG_I2C_CMD_TREE 1
+#define CFG_MAX_I2C_BUS 2
+
+
#endif /* __CONFIG_H */