aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/board-igep0020.c
diff options
context:
space:
mode:
authorEnric Balletbo i Serra <eballetbo@gmail.com>2010-10-08 13:22:35 -0400
committerTony Lindgren <tony@atomide.com>2010-10-08 13:22:35 -0400
commit3f8c48d95f8e4ed3ea241c3e8704b5ff6c423fa4 (patch)
treedebe39539ac5bde2ce59dbd7e11ab5e86d88bb85 /arch/arm/mach-omap2/board-igep0020.c
parentbee153906424f3bf669afec397c810b76117e22b (diff)
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/board-igep0020.c')
-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 d7a0db7058e1..e70bc872bc26 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -46,6 +46,49 @@
46#define IGEP2_GPIO_WIFI_NPD 94 46#define IGEP2_GPIO_WIFI_NPD 94
47#define IGEP2_GPIO_WIFI_NRESET 95 47#define IGEP2_GPIO_WIFI_NRESET 95
48 48
49/*
50 * IGEP2 Hardware Revision Table
51 *
52 * --------------------------
53 * | Id. | Hw Rev. | HW0 (28) |
54 * --------------------------
55 * | 0 | B/C | high |
56 * | 1 | C | low |
57 * --------------------------
58 */
59
60#define IGEP2_BOARD_HWREV_B 0
61#define IGEP2_BOARD_HWREV_C 1
62
63static u8 hwrev;
64
65static void __init igep2_get_revision(void)
66{
67 u8 ret;
68
69 omap_mux_init_gpio(IGEP2_GPIO_LED1_RED, OMAP_PIN_INPUT);
70
71 if ((gpio_request(IGEP2_GPIO_LED1_RED, "GPIO_HW0_REV") == 0) &&
72 (gpio_direction_input(IGEP2_GPIO_LED1_RED) == 0)) {
73 ret = gpio_get_value(IGEP2_GPIO_LED1_RED);
74 if (ret == 0) {
75 pr_info("IGEP2: Hardware Revision C (B-NON compatible)\n");
76 hwrev = IGEP2_BOARD_HWREV_C;
77 } else if (ret == 1) {
78 pr_info("IGEP2: Hardware Revision B/C (B compatible)\n");
79 hwrev = IGEP2_BOARD_HWREV_B;
80 } else {
81 pr_err("IGEP2: Unknown Hardware Revision\n");
82 hwrev = -1;
83 }
84 } else {
85 pr_warning("IGEP2: Could not obtain gpio GPIO_HW0_REV\n");
86 pr_err("IGEP2: Unknown Hardware Revision\n");
87 }
88
89 gpio_free(IGEP2_GPIO_LED1_RED);
90}
91
49#if defined(CONFIG_MTD_ONENAND_OMAP2) || \ 92#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
50 defined(CONFIG_MTD_ONENAND_OMAP2_MODULE) 93 defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
51 94
@@ -538,6 +581,10 @@ static struct omap_board_mux board_mux[] __initdata = {
538static void __init igep2_init(void) 581static void __init igep2_init(void)
539{ 582{
540 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 583 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
584
585 /* Get IGEP2 hardware revision */
586 igep2_get_revision();
587
541 igep2_i2c_init(); 588 igep2_i2c_init();
542 platform_add_devices(igep2_devices, ARRAY_SIZE(igep2_devices)); 589 platform_add_devices(igep2_devices, ARRAY_SIZE(igep2_devices));
543 omap_serial_init(); 590 omap_serial_init();