]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - include/configs/mgsuvd.h
mgcoge, mgsuvd: add board specific I2C deblocking mechanism.
[karo-tx-uboot.git] / include / configs / mgsuvd.h
index 740767e1e2f340e751b0f6a5007fd27f558af26e..20485750ea1513959ad904265421e970c90c6220 100644 (file)
 
 #define CONFIG_CMD_ASKENV
 #define CONFIG_CMD_DHCP
+#define CONFIG_CMD_DTT
+#define CONFIG_CMD_EEPROM
+#define CONFIG_CMD_I2C
 #define CONFIG_CMD_NFS
 #define CONFIG_CMD_PING
 
 #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
+#define CFG_I2C_INIT_BOARD     1
+
+/* EEprom support */
+#define CFG_I2C_EEPROM_ADDR_LEN        1
+#define CFG_I2C_MULTI_EEPROMS  1
+#define CFG_EEPROM_PAGE_WRITE_ENABLE
+#define CFG_EEPROM_PAGE_WRITE_BITS 3
+#define CFG_EEPROM_PAGE_WRITE_DELAY_MS 10
+
+/* I2C SYSMON (LM75, AD7414 is almost compatible)                      */
+#define CONFIG_DTT_LM75                1       /* ON Semi's LM75               */
+#define CONFIG_DTT_SENSORS     {0, 2, 4, 6}    /* Sensor addresses             */
+#define CFG_DTT_MAX_TEMP       70
+#define CFG_DTT_LOW_TEMP       -30
+#define CFG_DTT_HYSTERESIS     3
+#define CFG_DTT_BUS_NUM                (CFG_MAX_I2C_BUS)
+
 #endif /* __CONFIG_H */