]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
ARM: OMAP: Auto-detect Apollon Plus support
authorKyungmin Park <kyungmin.park@samsung.com>
Thu, 6 Mar 2008 01:40:59 +0000 (10:40 +0900)
committerTony Lindgren <tony@atomide.com>
Thu, 6 Mar 2008 11:52:52 +0000 (13:52 +0200)
The Apollon Plus has more LEDs, SWs and so on.
Now it is configured by compile time, but it has different IDCODE revision 5.
so It can detect at runtime.

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap2/Kconfig
arch/arm/mach-omap2/board-apollon-keys.c
arch/arm/mach-omap2/board-apollon.c
include/asm-arm/arch-omap/board-apollon.h

index 71f0cddc9a51c186c533d859f4838454321dfd8c..6208147f4210431f4b2d74ad1134c0f384214693 100644 (file)
@@ -94,16 +94,6 @@ config MACH_OMAP_APOLLON
        bool "OMAP 2420 Apollon board"
        depends on ARCH_OMAP2 && ARCH_OMAP2420
 
-config MACH_OMAP_APOLLON_PLUS
-       bool "OMAP 2420 Apollon Plus board"
-       depends on ARCH_OMAP2 && ARCH_OMAP2420
-       select MACH_OMAP_APOLLON
-       help
-         It contains more LEDs, SWs, and so on
-
-         Note that it is only tested with version 1.1 and more
-         We have to test the version 1.0
-
 config MACH_OMAP_2430SDP
        bool "OMAP 2430 SDP board"
        depends on ARCH_OMAP2 && ARCH_OMAP2430
index b6fa4eaa1fe96d1d4311a62bd37743f02a2851ce..adc4ee649fde0a84fdc116a9cf597d109f8d5485 100644 (file)
@@ -41,7 +41,6 @@ static struct gpio_keys_button apollon_gpio_keys_buttons[] = {
                .gpio           = SW_DOWN_GPIO58,
                .desc           = "down sw",
        },
-#ifdef CONFIG_MACH_OMAP_APOLLON_PLUS
        [3] = {
                .code           = KEY_LEFT,
                .gpio           = SW_LEFT_GPIO95,
@@ -57,7 +56,6 @@ static struct gpio_keys_button apollon_gpio_keys_buttons[] = {
                .gpio           = SW_ESC_GPIO97,
                .desc           = "esc sw",
        },
-#endif
 };
 
 static struct gpio_keys_platform_data apollon_gpio_keys = {
@@ -81,14 +79,16 @@ static void __init apollon_sw_init(void)
        omap_cfg_reg(AA12_242X_GPIO17);
        /* Down SW - AA8 */
        omap_cfg_reg(AA8_242X_GPIO58);
-#ifdef CONFIG_MACH_OMAP_APOLLON_PLUS
-       /* Left SW - P18 */
-       omap_cfg_reg(P18_24XX_GPIO95);
-       /* Right SW - M18 */
-       omap_cfg_reg(M18_24XX_GPIO96);
-       /* Esc SW - L14 */
-       omap_cfg_reg(L14_24XX_GPIO97);
-#endif
+
+       if (apollon_plus()) {
+               /* Left SW - P18 */
+               omap_cfg_reg(P18_24XX_GPIO95);
+               /* Right SW - M18 */
+               omap_cfg_reg(M18_24XX_GPIO96);
+               /* Esc SW - L14 */
+               omap_cfg_reg(L14_24XX_GPIO97);
+       } else
+               apollon_gpio_keys.nbuttons = 3;
 }
 
 static int __init omap_apollon_keys_init(void)
index ae0766586e84139daae4784fb32c9173dffca40b..24d3b9ab6e50cf1ab4219908329081ea084587bb 100644 (file)
@@ -227,7 +227,6 @@ static struct gpio_led apollon_led_config[] = {
                .name                   = "d4",
                .gpio                   = LED2_GPIO15,
        },
-#ifdef CONFIG_MACH_OMAP_APOLLON_PLUS
        {
                .name                   = "d5",
                .gpio                   = LED3_GPIO92,
@@ -236,7 +235,6 @@ static struct gpio_led apollon_led_config[] = {
                .name                   = "d6",
                .gpio                   = LED4_GPIO93,
        },
-#endif
 };
 
 static struct gpio_led_platform_data apollon_led_data = {
@@ -384,12 +382,14 @@ static void __init apollon_led_init(void)
        omap_cfg_reg(AA6_242X_GPIO14);
        /* LED2  - AA4 */
        omap_cfg_reg(AA4_242X_GPIO15);
-#ifdef CONFIG_MACH_OMAP_APOLLON_PLUS
-       /* LED3 - M15 */
-       omap_cfg_reg(M15_24XX_GPIO92);
-       /* LED4 - P20 */
-       omap_cfg_reg(P20_24XX_GPIO93);
-#endif
+
+       if (apollon_plus()) {
+               /* LED3 - M15 */
+               omap_cfg_reg(M15_24XX_GPIO92);
+               /* LED4 - P20 */
+               omap_cfg_reg(P20_24XX_GPIO93);
+       } else
+               apollon_led_data.num_leds = 3;
 }
 
 static void __init apollon_usb_init(void)
index 547125a4695e0bbf94c503c2ad6414f64009616b..720335f0d7bbebacc7dd0f8b80eef89baa4a63da 100644 (file)
 
 extern void apollon_mmc_init(void);
 
+static inline int apollon_plus(void)
+{
+        /* The apollon plus has IDCODE revision 5 */
+        return system_rev & 0xc0;
+}
+
 /* Placeholder for APOLLON specific defines */
 #define APOLLON_ETHR_GPIO_IRQ          74