From patchwork Wed Oct 20 21:33:56 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Sakoman X-Patchwork-Id: 71910 X-Patchwork-Delegate: s-paulraj@ti.com Return-Path: X-Original-To: wd@gemini.denx.de Delivered-To: wd@gemini.denx.de Received: from diddl.denx.de (diddl.denx.de [10.0.0.6]) by gemini.denx.de (Postfix) with ESMTP id 32EF1136320 for ; Wed, 20 Oct 2010 23:37:20 +0200 (CEST) Received: from diddl.denx.de (localhost.localdomain [127.0.0.1]) by diddl.denx.de (Postfix) with ESMTP id 12726348C9D1 for ; Wed, 20 Oct 2010 23:37:20 +0200 (CEST) Received: from pop.mnet-online.de by diddl.denx.de with POP3 (fetchmail-6.3.17) for (single-drop); Wed, 20 Oct 2010 23:37:20 +0200 (CEST) Received: from murder ([192.168.6.180]) by backend2 (Cyrus v2.2.12) with LMTPA; Wed, 20 Oct 2010 23:34:28 +0200 X-Sieve: CMU Sieve 2.2 Received: from mail.m-online.net (localhost [127.0.0.1]) by frontend3.mail.m-online.net (Cyrus v2.2.12) with LMTPA; Wed, 20 Oct 2010 23:34:28 +0200 Received: from scanner-4.m-online.net (scanner-4.mail.m-online.net [192.168.1.18]) by mail.m-online.net (Postfix) with ESMTP id 187581C000B0; Wed, 20 Oct 2010 23:34:28 +0200 (CEST) Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by mxin-1.m-online.net (Postfix) with ESMTP id 384EC46C0A8; Wed, 20 Oct 2010 23:34:24 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E5EC0281D3; Wed, 20 Oct 2010 23:34:16 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gG9CMnvcXIbN; Wed, 20 Oct 2010 23:34:16 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0EB92281D4; Wed, 20 Oct 2010 23:34:11 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2F7A6281CA for ; Wed, 20 Oct 2010 23:34:07 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id a8-Ts92dcmPW for ; Wed, 20 Oct 2010 23:34:05 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-ww0-f52.google.com (mail-ww0-f52.google.com [74.125.82.52]) by theia.denx.de (Postfix) with ESMTP id 12394281C9 for ; Wed, 20 Oct 2010 23:34:03 +0200 (CEST) Received: by wwb31 with SMTP id 31so3222687wwb.9 for ; Wed, 20 Oct 2010 14:34:03 -0700 (PDT) Received: by 10.216.154.206 with SMTP id h56mr7936wek.111.1287610442874; Wed, 20 Oct 2010 14:34:02 -0700 (PDT) Received: from [192.168.0.210] (static-74-41-60-154.dsl1.pco.ca.frontiernet.net [74.41.60.154]) by mx.google.com with ESMTPS id x15sm525105weq.31.2010.10.20.14.33.59 (version=SSLv3 cipher=RC4-MD5); Wed, 20 Oct 2010 14:34:00 -0700 (PDT) From: Steve Sakoman To: "u-boot@lists.denx.de" Date: Wed, 20 Oct 2010 14:33:56 -0700 Message-ID: <1287610436.7756.241.camel@quadra> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Subject: [U-Boot] [PATCH] ARMV7: OMAP3: Add expansion board detection for Overo X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de X-Virus-Scanned: by amavisd-new at m-online.net ARMV7: OMAP3: Add expansion board detection for Overo 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 diff --git a/board/overo/overo.c b/board/overo/overo.c index 9c92693..95fd44e 100644 --- a/board/overo/overo.c +++ b/board/overo/overo.c @@ -40,6 +40,32 @@ #include #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 @@ -137,6 +163,29 @@ int get_sdio2_config(void) } /* + * 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) + 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 +213,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; diff --git a/board/overo/overo.h b/board/overo/overo.h index 33a92e4..68e1243 100644 --- a/board/overo/overo.h +++ b/board/overo/overo.h @@ -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 diff --git a/include/configs/omap3_overo.h b/include/configs/omap3_overo.h index 69f9126..29f0aa8 100644 --- a/include/configs/omap3_overo.h +++ b/include/configs/omap3_overo.h @@ -120,6 +120,7 @@ #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 /*