]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
83xx, kmeter1: add I2C, dtt, eeprom support
authorHeiko Schocher <hs@denx.de>
Tue, 24 Feb 2009 10:30:34 +0000 (11:30 +0100)
committerKim Phillips <kim.phillips@freescale.com>
Fri, 6 Mar 2009 00:21:17 +0000 (18:21 -0600)
This patch adds I2C support for the Keymile kmeter1 board.
It uses the First I2C Controller from the CPU, for
accessing 4 temperature sensors, an eeprom with IVM data
and the booteeprom over a pca9547 mux.

Signed-off-by: Heiko Schocher <hs@denx.de>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
board/keymile/common/common.c
board/keymile/kmeter1/kmeter1.c
include/configs/keymile-common.h
include/configs/kmeter1.h

index 1338950814426e5dd2d5ca4350e996dbd3c0fa13..48ce613b7e29b430f6c15fb1c441e8be04e59674 100644 (file)
@@ -318,7 +318,7 @@ int ivm_read_eeprom (void)
        if (buf != NULL)
                dev_addr = simple_strtoul ((char *)buf, NULL, 16);
 
-       if (eeprom_read (dev_addr, 0, i2c_buffer, CONFIG_SYS_IVM_EEPROM_MAX_LEN) != 0) {
+       if (i2c_read(dev_addr, 0, 1, i2c_buffer, CONFIG_SYS_IVM_EEPROM_MAX_LEN) != 0) {
                printf ("Error reading EEprom\n");
                return -2;
        }
index f04a57a9cc16c145c5c6f99dd0a420ccfbe1b4e3..a3c58aecf1bb8dd23d400349508a812ff2374b4a 100644 (file)
@@ -59,6 +59,23 @@ const qe_iop_conf_t qe_iop_conf_tab[] = {
        {0,  0, 0, 0, QE_IOP_TAB_END},
 };
 
+static int board_init_i2c_busses (void)
+{
+       I2C_MUX_DEVICE *dev = NULL;
+       uchar   *buf;
+
+       /* Set up the Bus for the DTTs */
+       buf = (unsigned char *) getenv ("dtt_bus");
+       if (buf != NULL)
+               dev = i2c_mux_ident_muxstring (buf);
+       if (dev == NULL) {
+               printf ("Error couldn't add Bus for DTT\n");
+               printf ("please setup dtt_bus to where your\n");
+               printf ("DTT is found.\n");
+       }
+       return 0;
+}
+
 int board_early_init_r (void)
 {
        void *reg = (void *)(CONFIG_SYS_IMMR + 0x14a8);
@@ -80,6 +97,13 @@ int board_early_init_r (void)
        return 0;
 }
 
+int misc_init_r (void)
+{
+       /* add board specific i2c busses */
+       board_init_i2c_busses ();
+       return 0;
+}
+
 int fixed_sdram(void)
 {
        volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR;
@@ -156,3 +180,12 @@ void ft_board_setup (void *blob, bd_t *bd)
        ft_cpu_setup (blob, bd);
 }
 #endif
+
+#if defined(CONFIG_HUSH_INIT_VAR)
+extern int ivm_read_eeprom (void);
+int hush_init_var (void)
+{
+       ivm_read_eeprom ();
+       return 0;
+}
+#endif
index d70bc4808259ceb70d42fb44ab6c639d9ae35834..c7f6ba34d437310e47a18d705da9ec36754dc260 100644 (file)
 #define CONFIG_CMD_IMMAP
 #define CONFIG_CMD_MII
 #define CONFIG_CMD_PING
-
-/* should go away, if kmeter I2C support is enabled */
-#if defined(CONFIG_MGCOGE) || defined(CONFIG_MGSUVD)
 #define CONFIG_CMD_DTT
 #define CONFIG_CMD_EEPROM
 #define CONFIG_CMD_I2C
-#endif
 
 #undef CONFIG_WATCHDOG                 /* disable platform specific watchdog */
 
 #define CONFIG_SYS_BARGSIZE            CONFIG_SYS_CBSIZE       /* Boot Argument Buffer Size  */
 #define CONFIG_CMDLINE_EDITING         1       /* add command line history     */
 
-/* should go away, if kmeter I2C support is enabled */
-#if defined(CONFIG_MGCOGE) || defined(CONFIG_MGSUVD)
 #define CONFIG_HUSH_INIT_VAR   1
-#endif
 
 #define CONFIG_SYS_ALT_MEMTEST         /* memory test, takes time */
 #define CONFIG_SYS_MEMTEST_START       0x00100000      /* memtest works on */
index b86c61d5ffe2517fa6f36fecbf57890ae95e8e35..a23c9edb5f07b594db9b8345f213951d91598288 100644 (file)
@@ -32,6 +32,7 @@
 /* include common defines/options for all Keymile boards */
 #include "keymile-common.h"
 
+#define CONFIG_MISC_INIT_R     1
 /*
  * System Clock Setup
  */
 #define CONFIG_ENV_SIZE                0x2000
 #endif /* CFG_RAMBOOT */
 
+/* I2C */
+#define CONFIG_HARD_I2C                /* I2C with hardware support */
+#undef CONFIG_SOFT_I2C         /* I2C bit-banged */
+#define CONFIG_FSL_I2C
+#define CONFIG_SYS_I2C_SPEED   200000  /* I2C speed and slave address */
+#define CONFIG_SYS_I2C_SLAVE   0x7F
+#define CONFIG_SYS_I2C_OFFSET  0x3000
+#define CONFIG_I2C_MULTI_BUS   1
+#define CONFIG_I2C_CMD_TREE    1
+#define CONFIG_SYS_MAX_I2C_BUS         2
+#define CONFIG_I2C_MUX         1
+
+/* EEprom support */
+#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
+#define CONFIG_SYS_I2C_MULTI_EEPROMS   1
+#define CONFIG_SYS_EEPROM_PAGE_WRITE_ENABLE
+#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3
+#define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 10
+
+/* Support the IVM EEprom */
+#define        CONFIG_SYS_IVM_EEPROM_ADR       0x50
+#define CONFIG_SYS_IVM_EEPROM_MAX_LEN  0x400
+#define CONFIG_SYS_IVM_EEPROM_PAGE_LEN 0x100
+
+/* I2C SYSMON (LM75, AD7414 is almost compatible)                      */
+#define CONFIG_DTT_LM75                1       /* ON Semi's LM75               */
+#define CONFIG_DTT_SENSORS     {0, 1, 2, 3}    /* Sensor addresses             */
+#define CONFIG_SYS_DTT_MAX_TEMP        70
+#define CONFIG_SYS_DTT_LOW_TEMP        -30
+#define CONFIG_SYS_DTT_HYSTERESIS      3
+#define CONFIG_SYS_DTT_BUS_NUM         (2)
+
 #if defined(CONFIG_PCI)
 #define CONFIG_CMD_PCI
 #endif
        "loadfdt=tftp ${fdt_addr_r} ${fdt_file}\0"                      \
        "loadkernel=tftp ${kernel_addr_r} ${boot_file}\0"               \
        "unlock=yes\0"                                                  \
+       "EEprom_ivm=pca9547:70:9\0"                                     \
+       "dtt_bus=pca9547:70:a\0"                                        \
    ""
 
 #endif /* __CONFIG_H */