summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
diff options
context:
space:
mode:
authorEnric Balletbo i Serra <eballetbo@gmail.com>2010-10-08 10:22:35 -0700
committerTony Lindgren <tony@atomide.com>2010-10-08 10:22:35 -0700
commit3f8c48d95f8e4ed3ea241c3e8704b5ff6c423fa4 (patch)
treedebe39539ac5bde2ce59dbd7e11ab5e86d88bb85 /arch/arm/mach-omap2
parentbee153906424f3bf669afec397c810b76117e22b (diff)
downloadop-kernel-dev-3f8c48d95f8e4ed3ea241c3e8704b5ff6c423fa4.zip
op-kernel-dev-3f8c48d95f8e4ed3ea241c3e8704b5ff6c423fa4.tar.gz
omap3: Introduce function to detect the IGEP v2 hardwarerevision
There are currently two versions of IGEP v2 board, this patch introduces a function to detect the hardware revision of IGEP board. -------------------------- | Id. | Hw Rev. | GPIO 28 | -------------------------- | 0 | B/C | high | | 1 | C | low | -------------------------- Signed-off-by: Enric Balletbo i Serra <eballetbo@gmail.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r--arch/arm/mach-omap2/board-igep0020.c47
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 d7a0db7..e70bc87 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -46,6 +46,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 (ret == 0) {
+ pr_info("IGEP2: Hardware Revision C (B-NON compatible)\n");
+ hwrev = IGEP2_BOARD_HWREV_C;
+ } else if (ret == 1) {
+ pr_info("IGEP2: Hardware Revision B/C (B compatible)\n");
+ hwrev = IGEP2_BOARD_HWREV_B;
+ } else {
+ pr_err("IGEP2: Unknown Hardware Revision\n");
+ hwrev = -1;
+ }
+ } else {
+ pr_warning("IGEP2: Could not obtain gpio GPIO_HW0_REV\n");
+ pr_err("IGEP2: Unknown Hardware Revision\n");
+ }
+
+ gpio_free(IGEP2_GPIO_LED1_RED);
+}
+
#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
@@ -538,6 +581,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();
OpenPOWER on IntegriCloud