]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
ARMV7: OMAP3: Add expansion board detection for Overo
authorSteve Sakoman <steve@sakoman.com>
Mon, 20 Sep 2010 15:05:14 +0000 (08:05 -0700)
committerSandeep Paulraj <s-paulraj@ti.com>
Thu, 4 Nov 2010 19:27:06 +0000 (15:27 -0400)
Overo expansion boards contain an i2c eeprom to identify themselves.
This patch adds code to read and parse the eeprom contents.  It prints
the expansion board name and revision and modifies environment variables
as appropriate.

Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
board/overo/overo.c
board/overo/overo.h
include/configs/omap3_overo.h

index 9c926938ba2ec661565dbf1769adaba386806e02..f917e402b06d66d2d9a6004884019d92e78d1349 100644 (file)
 #include <asm/mach-types.h>
 #include "overo.h"
 
+#define TWL4030_I2C_BUS                        0
+#define EXPANSION_EEPROM_I2C_BUS       2
+#define EXPANSION_EEPROM_I2C_ADDRESS   0x51
+
+#define GUMSTIX_SUMMIT                 0x01000200
+#define GUMSTIX_TOBI                   0x02000200
+#define GUMSTIX_TOBI_DUO               0x03000200
+#define GUMSTIX_PALO35                 0x04000200
+#define GUMSTIX_PALO43                 0x05000200
+#define GUMSTIX_CHESTNUT43             0x06000200
+#define GUMSTIX_PINTO                  0x07000200
+#define GUMSTIX_GALLOP43               0x08000200
+
+#define ETTUS_USRP_E                   0x01000300
+
+#define GUMSTIX_NO_EEPROM              0xffffffff
+
+static struct {
+       unsigned int device_vendor;
+       unsigned char revision;
+       unsigned char content;
+       char fab_revision[8];
+       char env_var[16];
+       char env_setting[64];
+} expansion_config;
+
 #if defined(CONFIG_CMD_NET)
 static void setup_net_chip(void);
 #endif
@@ -136,6 +162,31 @@ int get_sdio2_config(void)
        return sdio_direct;
 }
 
+/*
+ * Routine: get_expansion_id
+ * Description: This function checks for expansion board by checking I2C
+ *             bus 2 for the availability of an AT24C01B serial EEPROM.
+ *             returns the device_vendor field from the EEPROM
+ */
+unsigned int get_expansion_id(void)
+{
+       i2c_set_bus_num(EXPANSION_EEPROM_I2C_BUS);
+
+       /* return GUMSTIX_NO_EEPROM if eeprom doesn't respond */
+       if (i2c_probe(EXPANSION_EEPROM_I2C_ADDRESS) == 1) {
+               i2c_set_bus_num(TWL4030_I2C_BUS);
+               return GUMSTIX_NO_EEPROM;
+       }
+
+       /* read configuration data */
+       i2c_read(EXPANSION_EEPROM_I2C_ADDRESS, 0, 1, (u8 *)&expansion_config,
+                sizeof(expansion_config));
+
+       i2c_set_bus_num(TWL4030_I2C_BUS);
+
+       return expansion_config.device_vendor;
+}
+
 /*
  * Routine: misc_init_r
  * Description: Configure board specific parts
@@ -164,6 +215,70 @@ int misc_init_r(void)
                printf("Unable to detect mmc2 connection type\n");
        }
 
+       switch (get_expansion_id()) {
+       case GUMSTIX_SUMMIT:
+               printf("Recognized Summit expansion board (rev %d %s)\n",
+                       expansion_config.revision,
+                       expansion_config.fab_revision);
+               setenv("defaultdisplay", "dvi");
+               break;
+       case GUMSTIX_TOBI:
+               printf("Recognized Tobi expansion board (rev %d %s)\n",
+                       expansion_config.revision,
+                       expansion_config.fab_revision);
+               setenv("defaultdisplay", "dvi");
+               break;
+       case GUMSTIX_TOBI_DUO:
+               printf("Recognized Tobi Duo expansion board (rev %d %s)\n",
+                       expansion_config.revision,
+                       expansion_config.fab_revision);
+               break;
+       case GUMSTIX_PALO35:
+               printf("Recognized Palo35 expansion board (rev %d %s)\n",
+                       expansion_config.revision,
+                       expansion_config.fab_revision);
+               setenv("defaultdisplay", "lcd35");
+               break;
+       case GUMSTIX_PALO43:
+               printf("Recognized Palo43 expansion board (rev %d %s)\n",
+                       expansion_config.revision,
+                       expansion_config.fab_revision);
+               setenv("defaultdisplay", "lcd43");
+               break;
+       case GUMSTIX_CHESTNUT43:
+               printf("Recognized Chestnut43 expansion board (rev %d %s)\n",
+                       expansion_config.revision,
+                       expansion_config.fab_revision);
+               setenv("defaultdisplay", "lcd43");
+               break;
+       case GUMSTIX_PINTO:
+               printf("Recognized Pinto expansion board (rev %d %s)\n",
+                       expansion_config.revision,
+                       expansion_config.fab_revision);
+               break;
+       case GUMSTIX_GALLOP43:
+               printf("Recognized Gallop43 expansion board (rev %d %s)\n",
+                       expansion_config.revision,
+                       expansion_config.fab_revision);
+               setenv("defaultdisplay", "lcd43");
+               break;
+       case ETTUS_USRP_E:
+               printf("Recognized Ettus Research USRP-E (rev %d %s)\n",
+                       expansion_config.revision,
+                       expansion_config.fab_revision);
+               MUX_USRP_E();
+               setenv("defaultdisplay", "dvi");
+               break;
+       case GUMSTIX_NO_EEPROM:
+               printf("No EEPROM on expansion board\n");
+               break;
+       default:
+               printf("Unrecognized expansion board\n");
+       }
+
+       if (expansion_config.content == 1)
+               setenv(expansion_config.env_var, expansion_config.env_setting);
+
        dieid_num_r();
 
        return 0;
index 33a92e4e126849abbfeed4e8197cacc6b40e6440..68e1243e9c3f5a1bfca42045805596bf4f1e1c78 100644 (file)
@@ -419,4 +419,8 @@ const omap3_sysinfo sysinfo = {
        MUX_VAL(CP(MMC1_DAT6),          (IEN  | PTU | EN  | M4)) /*GPIO_128*/\
        MUX_VAL(CP(MMC1_DAT7),          (IEN  | PTU | EN  | M4)) /*GPIO_129*/
 
+#define MUX_USRP_E() \
+       MUX_VAL(CP(MCSPI1_SOMI),        (IEN  | PTD | DIS | M4)) /*GPIO_173 */\
+       MUX_VAL(CP(MCSPI1_CS1),         (IDIS | PTD | EN  | M4)) /*GPIO_175 */\
+
 #endif
index 02920787458f6d59d61db3db16dbb19c34118cad..052d503b35030f7cea252d1f4d5363021f662cb1 100644 (file)
 #define CONFIG_SYS_I2C_SLAVE           1
 #define CONFIG_SYS_I2C_BUS             0
 #define CONFIG_SYS_I2C_BUS_SELECT      1
+#define CONFIG_I2C_MULTI_BUS           1
 #define CONFIG_DRIVER_OMAP34XX_I2C     1
 
 /*