From patchwork Sat Sep 25 18:19:03 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: 209142 X-Patchwork-Delegate: tony@atomide.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o8PIJJ5Q031732 for ; Sat, 25 Sep 2010 18:19:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756376Ab0IYSTV (ORCPT ); Sat, 25 Sep 2010 14:19:21 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:42781 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751448Ab0IYSTT (ORCPT ); Sat, 25 Sep 2010 14:19:19 -0400 Received: by mail-wy0-f174.google.com with SMTP id 28so2805411wyb.19 for ; Sat, 25 Sep 2010 11:19:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=t/8nu4gP2/at2VcGzFQA0sawwb7IRrR7LI0zpbRcUCo=; b=CipvfZN8x1sIXDuGqVOqiExyDbvelPgpjzq8jaLuZSD2Fs8TLIWaI/1WS/JS0u2yPb VyvvNDrNE49I8GBhsI6xEqVV/qB+/MU43JBglUdnuY8FF9ian6BP2Z8Es+1noilAcKVX DFmcP0B/g5t+vbJkAaJzbaYcoHSCrWKjfQvn8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=AWNaIABmR2fw/ddY05mT3lv4FdoC23ZMolJPbLx6ZN2X+2dXlhDDgwI+2DpP00ODEW DdKKGEsTkLw0fZxqMX8Hli0ia+3HsoC7isElXsgr2j17Jz+HHMnP8WutYs07juDUnai8 67x/22nYFJ+My/2AlR1vP+/zcrRbkSh2NIXdM= Received: by 10.216.131.161 with SMTP id m33mr4197046wei.13.1285438759089; Sat, 25 Sep 2010 11:19:19 -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 w29sm2259049weq.42.2010.09.25.11.19.17 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 25 Sep 2010 11:19:18 -0700 (PDT) From: Enric Balletbo i Serra To: linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org Cc: Enric Balletbo i Serra Subject: [PATCH 3/6] omap3: Introduce function to detect the IGEP v2 hardware revision. Date: Sat, 25 Sep 2010 20:19:03 +0200 Message-Id: <1285438746-7311-4-git-send-email-eballetbo@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1285438746-7311-1-git-send-email-eballetbo@gmail.com> References: <1285438746-7311-1-git-send-email-eballetbo@gmail.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Sat, 25 Sep 2010 18:19:22 +0000 (UTC) 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();