Skip to contentSkip to conversation

omap3: Various fixes for IGEP platforms.

PATCH New Enric Balletbo i Serra 1 participant 5 messages Aug 3, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover omap3: Various fixes for IGEP platforms.

Hello,

Please consider to add these patch which improves the support for IGEP v2 platform and adds support for the new IGEP OMAP3 module.

$ git diff --stat origin/master
 arch/arm/mach-omap2/Kconfig          |    5 +
 arch/arm/mach-omap2/Makefile         |    2 +
 arch/arm/mach-omap2/board-igep0020.c |  212 ++++++++++++-----
 arch/arm/mach-omap2/board-igep0030.c |  436 ++++++++++++++++++++++++++++++++++
 4 files changed, 594 insertions(+), 61 deletions(-)

Thanks in advance,

Enric

#1 lore raw

PATCH 1/4 omap3: GPIO's for W-LAN + Bluetooth combo depends on IGEP v2 hardware revision.

From: Enric Balletbo i Serra <[email protected]>

This patch adds support to detect IGEP v2 hardware revision and configure GPIO's for W-LAN + Bluetooth combo which depends on hardware revision.

---
 arch/arm/mach-omap2/board-igep0020.c |   99 +++++++++++++++++++++++++++-------
 1 files changed, 80 insertions(+), 19 deletions(-)
arch/arm/mach-omap2/board-igep0020.c +80 -19
index d55c57b..6b5f9c8 100644
@@ -42,8 +42,19 @@
 #define IGEP2_GPIO_LED0_RED 	27
 #define IGEP2_GPIO_LED1_RED   	28
 #define IGEP2_GPIO_DVI_PUP	170
-#define IGEP2_GPIO_WIFI_NPD 	94
-#define IGEP2_GPIO_WIFI_NRESET 	95
+
+/*  HIGH : It is a rev. B or C (B-compatible) board
+    LOW  : It is a rev. C (B-NON compatible) board */
+#define IGEP2_GPIO_HW_REV		28
+
+/* Platform: IGEP v2 Hw Rev. B / C (B-compatible) */
+#define IGEP2_RB_GPIO_WIFI_NPD		94
+#define IGEP2_RB_GPIO_WIFI_NRESET	95
+#define IGEP2_RB_GPIO_BT_NRESET		137
+/* Platform: IGEP v2 Hw Rev. C (B-non compatible) */
+#define IGEP2_RC_GPIO_WIFI_NPD		138
+#define IGEP2_RC_GPIO_WIFI_NRESET	139
+#define IGEP2_RC_GPIO_BT_NRESET		137
 
 #if defined(CONFIG_MTD_ONENAND_OMAP2) || \
 	defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
@@ -476,8 +487,66 @@ static struct omap_board_mux board_mux[] __initdata = {
 #define board_mux	NULL
 #endif
 
+static int igep2_get_hw_rev(void)
+{
+	int ret = -1;
+
+	if ((gpio_request(IGEP2_GPIO_HW_REV, "GPIO_HW_REV") == 0) &&
+	    (gpio_direction_input(IGEP2_GPIO_HW_REV) == 0))
+		ret = gpio_get_value(IGEP2_GPIO_HW_REV);
+	else
+		pr_warning("IGEP v2: Could not obtain gpio GPIO_HW_REV\n");
+
+	gpio_free(IGEP2_GPIO_HW_REV);
+
+	return ret;
+}
+
+static void __init igep2_init_wifi_bt(void)
+{
+	int hwrev;
+	unsigned npd, wreset, btreset;
+
+	hwrev = igep2_get_hw_rev();
+
+	/* GPIO's for W-LAN + Bluetooth combo depends on hardware revision */
+	if (hwrev) {
+		npd = IGEP2_RB_GPIO_WIFI_NPD;
+		wreset = IGEP2_RB_GPIO_WIFI_NRESET;
+		btreset = IGEP2_RB_GPIO_BT_NRESET;
+	} else {
+		npd = IGEP2_RC_GPIO_WIFI_NPD;
+		wreset = IGEP2_RC_GPIO_WIFI_NRESET;
+		btreset = IGEP2_RC_GPIO_BT_NRESET;
+	}
+
+	/* Set GPIO's for  W-LAN + Bluetooth combo module */
+	if ((gpio_request(npd, "GPIO_WIFI_NPD") == 0) &&
+	    (gpio_direction_output(npd, 1) == 0)) {
+		gpio_export(npd, 0);
+	} else
+		pr_warning("IGEP v2: Could not obtain gpio GPIO_WIFI_NPD\n");
+
+	if ((gpio_request(wreset, "GPIO_WIFI_NRESET") == 0) &&
+	    (gpio_direction_output(wreset, 1) == 0)) {
+		gpio_export(wreset, 0);
+		gpio_set_value(wreset, 0);
+		udelay(10);
+		gpio_set_value(wreset, 1);
+	} else
+		pr_warning("IGEP v2: Could not obtain gpio GPIO_WIFI_NRESET\n");
+
+	if ((gpio_request(btreset, "GPIO_BT_NRESET") == 0) &&
+	    (gpio_direction_output(btreset, 1) == 0)) {
+		gpio_export(btreset, 0);
+	} else
+		pr_warning("IGEP v2: Could not obtain gpio GPIO_BT_NRESET\n");
+}
+
 static void __init igep2_init(void)
 {
+	int hwrev;
+
 	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
 	igep2_i2c_init();
 	platform_add_devices(igep2_devices, ARRAY_SIZE(igep2_devices));
@@ -485,10 +554,19 @@ static void __init igep2_init(void)
 	usb_musb_init(&musb_board_data);
 	usb_ehci_init(&ehci_pdata);
 
+	hwrev = igep2_get_hw_rev();
+	if (hwrev == 0)
+		pr_info("IGEP platform: IGEP v2 Hw Rev. C (B-NON compatible)\n");
+	else if (hwrev ==  1)
+		pr_info("IGEP platform: IGEP v2 Hw Rev. B/C (B compatible)\n");
+	else
+		pr_err("IGEP platform: Unknow\n");
+
 	igep2_flash_init();
 	igep2_init_led();
 	igep2_display_init();
 	igep2_init_smsc911x();
+	igep2_init_wifi_bt();
 
 	/* GPIO userspace leds */
 #if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE)
@@ -513,23 +591,6 @@ static void __init igep2_init(void)
 	} else
 		pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_RED\n");
 #endif
-
-	/* GPIO W-LAN + Bluetooth combo module */
-	if ((gpio_request(IGEP2_GPIO_WIFI_NPD, "GPIO_WIFI_NPD") == 0) &&
-	    (gpio_direction_output(IGEP2_GPIO_WIFI_NPD, 1) == 0)) {
-		gpio_export(IGEP2_GPIO_WIFI_NPD, 0);
-/* 		gpio_set_value(IGEP2_GPIO_WIFI_NPD, 0); */
-	} else
-		pr_warning("IGEP v2: Could not obtain gpio GPIO_WIFI_NPD\n");
-
-	if ((gpio_request(IGEP2_GPIO_WIFI_NRESET, "GPIO_WIFI_NRESET") == 0) &&
-	    (gpio_direction_output(IGEP2_GPIO_WIFI_NRESET, 1) == 0)) {
-		gpio_export(IGEP2_GPIO_WIFI_NRESET, 0);
-		gpio_set_value(IGEP2_GPIO_WIFI_NRESET, 0);
-		udelay(10);
-		gpio_set_value(IGEP2_GPIO_WIFI_NRESET, 1);
-	} else
-		pr_warning("IGEP v2: Could not obtain gpio GPIO_WIFI_NRESET\n");
 }
 
 static void __init igep2_map_io(void)
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH 2/4 omap3: configure GPIO's for external VBUS power switch and overcurrent detect on IGEP v2 board.

In reply to Enric Balletbo i Serra

From: Enric Balletbo i Serra <[email protected]>

---
 arch/arm/mach-omap2/board-igep0020.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-igep0020.c +10 -0
index 6b5f9c8..d88fc08 100644
@@ -285,6 +285,16 @@ static int igep2_twl_gpio_setup(struct device *dev,
 	igep2_vmmc1_supply.dev = mmc[0].dev;
 	igep2_vmmc2_supply.dev = mmc[1].dev;
 
+	/* REVISIT: need ehci-omap hooks for external VBUS
+	 * power switch and overcurrent detect
+	 */
+	gpio_request(gpio + 1, "GPIO_EHCI_NOC");
+	gpio_direction_input(gpio + 1);
+
+	/* TWL4030_GPIO_MAX + 0 == ledA, GPIO_USBH_CPEN (out, active low) */
+	gpio_request(gpio + TWL4030_GPIO_MAX, "GPIO_USB_CPEN");
+	gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0);
+
 	return 0;
 };
 
Signature · 1 line
1.7.0.4
#3 lore raw

PATCH 3/4 omap3: fix and improve the LED handling on IGEP v2 board.

In reply to Enric Balletbo i Serra

From: Enric Balletbo i Serra <[email protected]>

The IGEP v2 board has four leds, this patch allows control all of these LEDs using the LED class if CONFIG_LEDS_GPIO is selected or using the General Purpose Input/Output (GPIO) interface if CONFIG_LEDS_GPIO is not selected.

---
 arch/arm/mach-omap2/board-igep0020.c |  103 ++++++++++++++++++++--------------
 1 files changed, 61 insertions(+), 42 deletions(-)
arch/arm/mach-omap2/board-igep0020.c +61 -42
index d88fc08..6868dda 100644
@@ -272,6 +272,54 @@ static struct omap2_hsmmc_info mmc[] = {
 	{}      /* Terminator */
 };
 
+#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
+#include <linux/leds.h>
+
+static struct gpio_led igep2_gpio_leds[] = {
+	[0] = {
+		.name = "led0:red",
+		.gpio = IGEP2_GPIO_LED0_RED,
+		.default_trigger = "default-off",
+	},
+	[1] = {
+		.name = "led0:green",
+		.gpio = IGEP2_GPIO_LED0_GREEN,
+		.default_trigger = "default-off",
+	},
+	[2] = {
+		.name = "led1:red",
+		.gpio = IGEP2_GPIO_LED1_RED,
+		.default_trigger = "default-off",
+	},
+	[3] = {
+		.name = "led1:green",
+		.default_trigger = "heartbeat",
+		.gpio = -EINVAL, /* gets replaced */
+	},
+};
+
+static struct gpio_led_platform_data igep2_led_pdata = {
+	.leds           = igep2_gpio_leds,
+	.num_leds       = ARRAY_SIZE(igep2_gpio_leds),
+};
+
+static struct platform_device igep2_led_device = {
+	 .name   = "leds-gpio",
+	 .id     = -1,
+	 .dev    = {
+		 .platform_data  =  &igep2_led_pdata,
+	},
+};
+
+static void __init igep2_init_led(void)
+{
+	platform_device_register(&igep2_led_device);
+}
+
+#else
+static inline void igep2_init_led(void) {}
+#endif
+
 static int igep2_twl_gpio_setup(struct device *dev,
 		unsigned gpio, unsigned ngpio)
 {
@@ -295,6 +343,18 @@ static int igep2_twl_gpio_setup(struct device *dev,
 	gpio_request(gpio + TWL4030_GPIO_MAX, "GPIO_USB_CPEN");
 	gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0);
 
+	/* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
+#if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE)
+	if ((gpio_request(gpio + TWL4030_GPIO_MAX + 1, "led1:green") == 0) &&
+	    (gpio_direction_output(gpio + TWL4030_GPIO_MAX + 1, 1) == 0)) {
+		gpio_export(gpio + TWL4030_GPIO_MAX + 1, 0);
+		gpio_set_value(gpio + TWL4030_GPIO_MAX + 1, 0);
+	} else
+		pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_GREEN\n");
+#else
+	igep2_gpio_leds[3].gpio = gpio + TWL4030_GPIO_MAX + 1;
+#endif
+
 	return 0;
 };
 
@@ -302,7 +362,7 @@ static struct twl4030_gpio_platform_data igep2_gpio_data = {
 	.gpio_base	= OMAP_MAX_GPIO_LINES,
 	.irq_base	= TWL4030_GPIO_IRQ_BASE,
 	.irq_end	= TWL4030_GPIO_IRQ_END,
-	.use_leds	= false,
+	.use_leds	= true,
 	.setup		= igep2_twl_gpio_setup,
 };
 
@@ -376,47 +436,6 @@ static void __init igep2_display_init(void)
 		pr_err("IGEP v2: Could not obtain gpio GPIO_DVI_PUP\n");
 }
 
-#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
-#include <linux/leds.h>
-
-static struct gpio_led igep2_gpio_leds[] = {
-	{
-		.name = "led0:red",
-		.gpio = IGEP2_GPIO_LED0_RED,
-	},
-	{
-		.name = "led0:green",
-		.default_trigger = "heartbeat",
-		.gpio = IGEP2_GPIO_LED0_GREEN,
-	},
-	{
-		.name = "led1:red",
-		.gpio = IGEP2_GPIO_LED1_RED,
-	},
-};
-
-static struct gpio_led_platform_data igep2_led_pdata = {
-	.leds           = igep2_gpio_leds,
-	.num_leds       = ARRAY_SIZE(igep2_gpio_leds),
-};
-
-static struct platform_device igep2_led_device = {
-	 .name   = "leds-gpio",
-	 .id     = -1,
-	 .dev    = {
-		 .platform_data  =  &igep2_led_pdata,
-	},
-};
-
-static void __init igep2_init_led(void)
-{
-	platform_device_register(&igep2_led_device);
-}
-
-#else
-static inline void igep2_init_led(void) {}
-#endif
-
 static struct platform_device *igep2_devices[] __initdata = {
 	&igep2_dss_device,
 };
Signature · 1 line
1.7.0.4
#4 lore raw

PATCH 4/4 omap3: Add minimal OMAP3 IGEP module support.

In reply to Enric Balletbo i Serra

The OMAP3 IGEP module is a low-power, high performance production-ready system-on-module (SOM) based on TI's OMAP3 family.

---
 arch/arm/mach-omap2/Kconfig          |    5 +
 arch/arm/mach-omap2/Makefile         |    2 +
 arch/arm/mach-omap2/board-igep0030.c |  436 ++++++++++++++++++++++++++++++++++
 3 files changed, 443 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/board-igep0030.c
arch/arm/mach-omap2/Kconfig +5 -0
index b31b6f1..db8bd18 100644
@@ -142,6 +142,11 @@ config MACH_IGEP0020
 	depends on ARCH_OMAP3
 	select OMAP_PACKAGE_CBB
 
+config MACH_IGEP0030
+	bool "IGEP OMAP3 module"
+	depends on ARCH_OMAP3
+	select OMAP_PACKAGE_CBB
+
 config MACH_SBC3530
 	bool "OMAP3 SBC STALKER board"
 	depends on ARCH_OMAP3
arch/arm/mach-omap2/Makefile +2 -0
index ea52b03..fab0222 100644
@@ -136,6 +136,8 @@ obj-$(CONFIG_MACH_CM_T35)		+= board-cm-t35.o \
 					   hsmmc.o
 obj-$(CONFIG_MACH_IGEP0020)		+= board-igep0020.o \
 					   hsmmc.o
+obj-$(CONFIG_MACH_IGEP0030)		+= board-igep0030.o \
+					   hsmmc.o
 obj-$(CONFIG_MACH_OMAP3_TOUCHBOOK)	+= board-omap3touchbook.o \
 					   hsmmc.o
 obj-$(CONFIG_MACH_OMAP_4430SDP)		+= board-4430sdp.o \
arch/arm/mach-omap2/board-igep0030.c new file +436 -0

436 lines not on this page · raw message

Signature · 1 line
1.7.0.4