From patchwork Sat Sep 25 18:26:36 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enric Balletbo Serra X-Patchwork-Id: 65750 X-Patchwork-Delegate: leann.ogasawara@canonical.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id EFC15B70F5 for ; Sun, 26 Sep 2010 04:27:06 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1OzZSc-0004r5-Pl; Sat, 25 Sep 2010 19:26:58 +0100 Received: from mail-wy0-f177.google.com ([74.125.82.177]) by chlorine.canonical.com with esmtp (Exim 4.69) (envelope-from ) id 1OzZSW-0004pG-ML for kernel-team@lists.ubuntu.com; Sat, 25 Sep 2010 19:26:52 +0100 Received: by mail-wy0-f177.google.com with SMTP id 38so3871325wyb.8 for ; Sat, 25 Sep 2010 11:26:52 -0700 (PDT) Received: by 10.227.129.84 with SMTP id n20mr4424985wbs.61.1285439212278; Sat, 25 Sep 2010 11:26:52 -0700 (PDT) Received: from localhost.localdomain (192.Red-88-27-117.staticIP.rima-tde.net [88.27.117.192]) by mx.google.com with ESMTPS id m5sm3063860wbc.21.2010.09.25.11.26.50 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 25 Sep 2010 11:26:51 -0700 (PDT) From: Enric Balletbo i Serra To: linaro-dev@lists.linaro.org, kernel-team@lists.ubuntu.com Subject: [PATCH 3/6] omap3: Introduce function to detect the IGEP v2 hardware revision. Date: Sat, 25 Sep 2010 20:26:36 +0200 Message-Id: <1285439199-7352-4-git-send-email-eballetbo@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1285439199-7352-1-git-send-email-eballetbo@gmail.com> References: <1285439199-7352-1-git-send-email-eballetbo@gmail.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com Signed-off-by: Enric Balletbo i Serra --- arch/arm/mach-omap2/board-igep0020.c | 47 ++++++++++++++++++++++++++++++++++ 1 files changed, 47 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c index 9f25d0d..a386425 100644 --- a/arch/arm/mach-omap2/board-igep0020.c +++ b/arch/arm/mach-omap2/board-igep0020.c @@ -45,6 +45,49 @@ #define IGEP2_GPIO_WIFI_NPD 94 #define IGEP2_GPIO_WIFI_NRESET 95 +/* + * IGEP2 Hardware Revision Table + * + * -------------------------- + * | Id. | Hw Rev. | HW0 (28) | + * -------------------------- + * | 0 | B/C | high | + * | 1 | C | low | + * -------------------------- + */ + +#define IGEP2_BOARD_HWREV_B 0 +#define IGEP2_BOARD_HWREV_C 1 + +static u8 hwrev; + +static void __init igep2_get_revision(void) +{ + u8 ret; + + omap_mux_init_gpio(IGEP2_GPIO_LED1_RED, OMAP_PIN_INPUT); + + if ((gpio_request(IGEP2_GPIO_LED1_RED, "GPIO_HW0_REV") == 0) && + (gpio_direction_input(IGEP2_GPIO_LED1_RED) == 0)) { + ret = gpio_get_value(IGEP2_GPIO_LED1_RED); + if (hwrev == 0) { + pr_info("IGEP2: Hardware Revision C (B-NON compatible)\n"); + hwrev = IGEP2_BOARD_HWREV_C; + } else if (hwrev == 1) { + pr_info("IGEP2: Hardware Revision B/C (B compatible)\n"); + hwrev = IGEP2_BOARD_HWREV_B; + } else { + pr_err("IGEP2: Unknow Hardware Revision\n"); + hwrev = -1; + } + } else { + pr_warning("IGEP2: Could not obtain gpio GPIO_HW0_REV\n"); + pr_err("IGEP2: Unknow Hardware Revision\n"); + } + + gpio_free(IGEP2_GPIO_LED1_RED); +} + #if defined(CONFIG_MTD_ONENAND_OMAP2) || \ defined(CONFIG_MTD_ONENAND_OMAP2_MODULE) @@ -535,6 +578,10 @@ static struct omap_board_mux board_mux[] __initdata = { static void __init igep2_init(void) { omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); + + /* Get IGEP2 hardware revision */ + igep2_get_revision(); + igep2_i2c_init(); platform_add_devices(igep2_devices, ARRAY_SIZE(igep2_devices)); omap_serial_init();