[PATCH] ARM: OMAP: Auto-detect Apollon Plus support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
---
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 71f0cdd..6208147 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -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
diff --git a/arch/arm/mach-omap2/board-apollon-keys.c b/arch/arm/mach-omap2/board-apollon-keys.c
index b6fa4ea..adc4ee6 100644
--- a/arch/arm/mach-omap2/board-apollon-keys.c
+++ b/arch/arm/mach-omap2/board-apollon-keys.c
@@ -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)
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c
index ae07665..24d3b9a 100644
--- a/arch/arm/mach-omap2/board-apollon.c
+++ b/arch/arm/mach-omap2/board-apollon.c
@@ -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)
diff --git a/include/asm-arm/arch-omap/board-apollon.h b/include/asm-arm/arch-omap/board-apollon.h
index 547125a..720335f 100644
--- a/include/asm-arm/arch-omap/board-apollon.h
+++ b/include/asm-arm/arch-omap/board-apollon.h
@@ -31,6 +31,12 @@
 
 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
 
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux