All of lore.kernel.org
 help / color / mirror / Atom feed
From: Enric Balletbo i Serra <eballetbo@gmail.com>
To: linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org
Cc: Enric Balletbo i Serra <eballetbo@gmail.com>
Subject: [PATCH 3/6] omap3: Introduce function to detect the IGEP v2 hardware revision.
Date: Sat, 25 Sep 2010 20:19:03 +0200	[thread overview]
Message-ID: <1285438746-7311-4-git-send-email-eballetbo@gmail.com> (raw)
In-Reply-To: <1285438746-7311-1-git-send-email-eballetbo@gmail.com>

Signed-off-by: Enric Balletbo i Serra <eballetbo@gmail.com>
---
 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();
-- 
1.7.0.4

WARNING: multiple messages have this Message-ID (diff)
From: eballetbo@gmail.com (Enric Balletbo i Serra)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/6] omap3: Introduce function to detect the IGEP v2 hardware revision.
Date: Sat, 25 Sep 2010 20:19:03 +0200	[thread overview]
Message-ID: <1285438746-7311-4-git-send-email-eballetbo@gmail.com> (raw)
In-Reply-To: <1285438746-7311-1-git-send-email-eballetbo@gmail.com>

Signed-off-by: Enric Balletbo i Serra <eballetbo@gmail.com>
---
 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();
-- 
1.7.0.4

  parent reply	other threads:[~2010-09-25 18:19 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-25 18:19 [PATCH 0/6] omap3: Various fixes and improvements for IGEP v2 board Enric Balletbo i Serra
2010-09-25 18:19 ` Enric Balletbo i Serra
2010-09-25 18:19 ` [PATCH 1/6] omap3: Add GPIO's for external VBUS power switch and overcurrent detect on " Enric Balletbo i Serra
2010-09-25 18:19   ` Enric Balletbo i Serra
2010-09-25 18:19 ` [PATCH 2/6] omap3: fix and improve the LED handling " Enric Balletbo i Serra
2010-09-25 18:19   ` Enric Balletbo i Serra
2010-09-25 18:19 ` Enric Balletbo i Serra [this message]
2010-09-25 18:19   ` [PATCH 3/6] omap3: Introduce function to detect the IGEP v2 hardware revision Enric Balletbo i Serra
2010-09-25 18:19 ` [PATCH 4/6] omap3: Fix handling some GPIO's for WLAN-BT combo on IGEP v2 Enric Balletbo i Serra
2010-09-25 18:19   ` Enric Balletbo i Serra
2010-09-25 18:19 ` [PATCH 5/6] omap3: Add i2c eeprom driver to read EDID " Enric Balletbo i Serra
2010-09-25 18:19   ` Enric Balletbo i Serra
2010-09-25 18:19 ` [PATCH 6/6] omap3: Remove VMMC2 regulator on IGEP v2 because it's not used Enric Balletbo i Serra
2010-09-25 18:19   ` Enric Balletbo i Serra
2010-09-27 22:34 ` [PATCH 0/6] omap3: Various fixes and improvements for IGEP v2 board Tony Lindgren
2010-09-27 22:34   ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1285438746-7311-4-git-send-email-eballetbo@gmail.com \
    --to=eballetbo@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.