diff options
Diffstat (limited to 'arch/arm/mach-omap2/board-igep0020.c')
-rw-r--r-- | arch/arm/mach-omap2/board-igep0020.c | 449 |
1 files changed, 227 insertions, 222 deletions
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c index 3da64d361651..0c1bfca3f731 100644 --- a/arch/arm/mach-omap2/board-igep0020.c +++ b/arch/arm/mach-omap2/board-igep0020.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include "mux.h" | 38 | #include "mux.h" |
39 | #include "hsmmc.h" | 39 | #include "hsmmc.h" |
40 | #include "sdram-numonyx-m65kxxxxam.h" | 40 | #include "sdram-numonyx-m65kxxxxam.h" |
41 | #include "common-board-devices.h" | ||
41 | 42 | ||
42 | #define IGEP2_SMSC911X_CS 5 | 43 | #define IGEP2_SMSC911X_CS 5 |
43 | #define IGEP2_SMSC911X_GPIO 176 | 44 | #define IGEP2_SMSC911X_GPIO 176 |
@@ -54,6 +55,11 @@ | |||
54 | #define IGEP2_RC_GPIO_WIFI_NRESET 139 | 55 | #define IGEP2_RC_GPIO_WIFI_NRESET 139 |
55 | #define IGEP2_RC_GPIO_BT_NRESET 137 | 56 | #define IGEP2_RC_GPIO_BT_NRESET 137 |
56 | 57 | ||
58 | #define IGEP3_GPIO_LED0_GREEN 54 | ||
59 | #define IGEP3_GPIO_LED0_RED 53 | ||
60 | #define IGEP3_GPIO_LED1_RED 16 | ||
61 | #define IGEP3_GPIO_USBH_NRESET 183 | ||
62 | |||
57 | /* | 63 | /* |
58 | * IGEP2 Hardware Revision Table | 64 | * IGEP2 Hardware Revision Table |
59 | * | 65 | * |
@@ -68,6 +74,7 @@ | |||
68 | 74 | ||
69 | #define IGEP2_BOARD_HWREV_B 0 | 75 | #define IGEP2_BOARD_HWREV_B 0 |
70 | #define IGEP2_BOARD_HWREV_C 1 | 76 | #define IGEP2_BOARD_HWREV_C 1 |
77 | #define IGEP3_BOARD_HWREV 2 | ||
71 | 78 | ||
72 | static u8 hwrev; | 79 | static u8 hwrev; |
73 | 80 | ||
@@ -75,24 +82,29 @@ static void __init igep2_get_revision(void) | |||
75 | { | 82 | { |
76 | u8 ret; | 83 | u8 ret; |
77 | 84 | ||
85 | if (machine_is_igep0030()) { | ||
86 | hwrev = IGEP3_BOARD_HWREV; | ||
87 | return; | ||
88 | } | ||
89 | |||
78 | omap_mux_init_gpio(IGEP2_GPIO_LED1_RED, OMAP_PIN_INPUT); | 90 | omap_mux_init_gpio(IGEP2_GPIO_LED1_RED, OMAP_PIN_INPUT); |
79 | 91 | ||
80 | if ((gpio_request(IGEP2_GPIO_LED1_RED, "GPIO_HW0_REV") == 0) && | 92 | if (gpio_request_one(IGEP2_GPIO_LED1_RED, GPIOF_IN, "GPIO_HW0_REV")) { |
81 | (gpio_direction_input(IGEP2_GPIO_LED1_RED) == 0)) { | ||
82 | ret = gpio_get_value(IGEP2_GPIO_LED1_RED); | ||
83 | if (ret == 0) { | ||
84 | pr_info("IGEP2: Hardware Revision C (B-NON compatible)\n"); | ||
85 | hwrev = IGEP2_BOARD_HWREV_C; | ||
86 | } else if (ret == 1) { | ||
87 | pr_info("IGEP2: Hardware Revision B/C (B compatible)\n"); | ||
88 | hwrev = IGEP2_BOARD_HWREV_B; | ||
89 | } else { | ||
90 | pr_err("IGEP2: Unknown Hardware Revision\n"); | ||
91 | hwrev = -1; | ||
92 | } | ||
93 | } else { | ||
94 | pr_warning("IGEP2: Could not obtain gpio GPIO_HW0_REV\n"); | 93 | pr_warning("IGEP2: Could not obtain gpio GPIO_HW0_REV\n"); |
95 | pr_err("IGEP2: Unknown Hardware Revision\n"); | 94 | pr_err("IGEP2: Unknown Hardware Revision\n"); |
95 | return; | ||
96 | } | ||
97 | |||
98 | ret = gpio_get_value(IGEP2_GPIO_LED1_RED); | ||
99 | if (ret == 0) { | ||
100 | pr_info("IGEP2: Hardware Revision C (B-NON compatible)\n"); | ||
101 | hwrev = IGEP2_BOARD_HWREV_C; | ||
102 | } else if (ret == 1) { | ||
103 | pr_info("IGEP2: Hardware Revision B/C (B compatible)\n"); | ||
104 | hwrev = IGEP2_BOARD_HWREV_B; | ||
105 | } else { | ||
106 | pr_err("IGEP2: Unknown Hardware Revision\n"); | ||
107 | hwrev = -1; | ||
96 | } | 108 | } |
97 | 109 | ||
98 | gpio_free(IGEP2_GPIO_LED1_RED); | 110 | gpio_free(IGEP2_GPIO_LED1_RED); |
@@ -111,7 +123,7 @@ static void __init igep2_get_revision(void) | |||
111 | * So MTD regards it as 4KiB page size and 256KiB block size 64*(2*2048) | 123 | * So MTD regards it as 4KiB page size and 256KiB block size 64*(2*2048) |
112 | */ | 124 | */ |
113 | 125 | ||
114 | static struct mtd_partition igep2_onenand_partitions[] = { | 126 | static struct mtd_partition igep_onenand_partitions[] = { |
115 | { | 127 | { |
116 | .name = "X-Loader", | 128 | .name = "X-Loader", |
117 | .offset = 0, | 129 | .offset = 0, |
@@ -139,21 +151,21 @@ static struct mtd_partition igep2_onenand_partitions[] = { | |||
139 | }, | 151 | }, |
140 | }; | 152 | }; |
141 | 153 | ||
142 | static struct omap_onenand_platform_data igep2_onenand_data = { | 154 | static struct omap_onenand_platform_data igep_onenand_data = { |
143 | .parts = igep2_onenand_partitions, | 155 | .parts = igep_onenand_partitions, |
144 | .nr_parts = ARRAY_SIZE(igep2_onenand_partitions), | 156 | .nr_parts = ARRAY_SIZE(igep_onenand_partitions), |
145 | .dma_channel = -1, /* disable DMA in OMAP OneNAND driver */ | 157 | .dma_channel = -1, /* disable DMA in OMAP OneNAND driver */ |
146 | }; | 158 | }; |
147 | 159 | ||
148 | static struct platform_device igep2_onenand_device = { | 160 | static struct platform_device igep_onenand_device = { |
149 | .name = "omap2-onenand", | 161 | .name = "omap2-onenand", |
150 | .id = -1, | 162 | .id = -1, |
151 | .dev = { | 163 | .dev = { |
152 | .platform_data = &igep2_onenand_data, | 164 | .platform_data = &igep_onenand_data, |
153 | }, | 165 | }, |
154 | }; | 166 | }; |
155 | 167 | ||
156 | static void __init igep2_flash_init(void) | 168 | static void __init igep_flash_init(void) |
157 | { | 169 | { |
158 | u8 cs = 0; | 170 | u8 cs = 0; |
159 | u8 onenandcs = GPMC_CS_NUM + 1; | 171 | u8 onenandcs = GPMC_CS_NUM + 1; |
@@ -165,7 +177,7 @@ static void __init igep2_flash_init(void) | |||
165 | /* Check if NAND/oneNAND is configured */ | 177 | /* Check if NAND/oneNAND is configured */ |
166 | if ((ret & 0xC00) == 0x800) | 178 | if ((ret & 0xC00) == 0x800) |
167 | /* NAND found */ | 179 | /* NAND found */ |
168 | pr_err("IGEP2: Unsupported NAND found\n"); | 180 | pr_err("IGEP: Unsupported NAND found\n"); |
169 | else { | 181 | else { |
170 | ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7); | 182 | ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7); |
171 | if ((ret & 0x3F) == (ONENAND_MAP >> 24)) | 183 | if ((ret & 0x3F) == (ONENAND_MAP >> 24)) |
@@ -175,85 +187,46 @@ static void __init igep2_flash_init(void) | |||
175 | } | 187 | } |
176 | 188 | ||
177 | if (onenandcs > GPMC_CS_NUM) { | 189 | if (onenandcs > GPMC_CS_NUM) { |
178 | pr_err("IGEP2: Unable to find configuration in GPMC\n"); | 190 | pr_err("IGEP: Unable to find configuration in GPMC\n"); |
179 | return; | 191 | return; |
180 | } | 192 | } |
181 | 193 | ||
182 | igep2_onenand_data.cs = onenandcs; | 194 | igep_onenand_data.cs = onenandcs; |
183 | 195 | ||
184 | if (platform_device_register(&igep2_onenand_device) < 0) | 196 | if (platform_device_register(&igep_onenand_device) < 0) |
185 | pr_err("IGEP2: Unable to register OneNAND device\n"); | 197 | pr_err("IGEP: Unable to register OneNAND device\n"); |
186 | } | 198 | } |
187 | 199 | ||
188 | #else | 200 | #else |
189 | static void __init igep2_flash_init(void) {} | 201 | static void __init igep_flash_init(void) {} |
190 | #endif | 202 | #endif |
191 | 203 | ||
192 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) | 204 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) |
193 | 205 | ||
194 | #include <linux/smsc911x.h> | 206 | #include <linux/smsc911x.h> |
207 | #include <plat/gpmc-smsc911x.h> | ||
195 | 208 | ||
196 | static struct smsc911x_platform_config igep2_smsc911x_config = { | 209 | static struct omap_smsc911x_platform_data smsc911x_cfg = { |
197 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, | 210 | .cs = IGEP2_SMSC911X_CS, |
198 | .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, | 211 | .gpio_irq = IGEP2_SMSC911X_GPIO, |
199 | .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS , | 212 | .gpio_reset = -EINVAL, |
200 | .phy_interface = PHY_INTERFACE_MODE_MII, | 213 | .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS, |
201 | }; | ||
202 | |||
203 | static struct resource igep2_smsc911x_resources[] = { | ||
204 | { | ||
205 | .flags = IORESOURCE_MEM, | ||
206 | }, | ||
207 | { | ||
208 | .start = OMAP_GPIO_IRQ(IGEP2_SMSC911X_GPIO), | ||
209 | .end = OMAP_GPIO_IRQ(IGEP2_SMSC911X_GPIO), | ||
210 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, | ||
211 | }, | ||
212 | }; | ||
213 | |||
214 | static struct platform_device igep2_smsc911x_device = { | ||
215 | .name = "smsc911x", | ||
216 | .id = 0, | ||
217 | .num_resources = ARRAY_SIZE(igep2_smsc911x_resources), | ||
218 | .resource = igep2_smsc911x_resources, | ||
219 | .dev = { | ||
220 | .platform_data = &igep2_smsc911x_config, | ||
221 | }, | ||
222 | }; | 214 | }; |
223 | 215 | ||
224 | static inline void __init igep2_init_smsc911x(void) | 216 | static inline void __init igep2_init_smsc911x(void) |
225 | { | 217 | { |
226 | unsigned long cs_mem_base; | 218 | gpmc_smsc911x_init(&smsc911x_cfg); |
227 | |||
228 | if (gpmc_cs_request(IGEP2_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) { | ||
229 | pr_err("IGEP v2: Failed request for GPMC mem for smsc911x\n"); | ||
230 | gpmc_cs_free(IGEP2_SMSC911X_CS); | ||
231 | return; | ||
232 | } | ||
233 | |||
234 | igep2_smsc911x_resources[0].start = cs_mem_base + 0x0; | ||
235 | igep2_smsc911x_resources[0].end = cs_mem_base + 0xff; | ||
236 | |||
237 | if ((gpio_request(IGEP2_SMSC911X_GPIO, "SMSC911X IRQ") == 0) && | ||
238 | (gpio_direction_input(IGEP2_SMSC911X_GPIO) == 0)) { | ||
239 | gpio_export(IGEP2_SMSC911X_GPIO, 0); | ||
240 | } else { | ||
241 | pr_err("IGEP v2: Could not obtain gpio for for SMSC911X IRQ\n"); | ||
242 | return; | ||
243 | } | ||
244 | |||
245 | platform_device_register(&igep2_smsc911x_device); | ||
246 | } | 219 | } |
247 | 220 | ||
248 | #else | 221 | #else |
249 | static inline void __init igep2_init_smsc911x(void) { } | 222 | static inline void __init igep2_init_smsc911x(void) { } |
250 | #endif | 223 | #endif |
251 | 224 | ||
252 | static struct regulator_consumer_supply igep2_vmmc1_supply = | 225 | static struct regulator_consumer_supply igep_vmmc1_supply = |
253 | REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"); | 226 | REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"); |
254 | 227 | ||
255 | /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */ | 228 | /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */ |
256 | static struct regulator_init_data igep2_vmmc1 = { | 229 | static struct regulator_init_data igep_vmmc1 = { |
257 | .constraints = { | 230 | .constraints = { |
258 | .min_uV = 1850000, | 231 | .min_uV = 1850000, |
259 | .max_uV = 3150000, | 232 | .max_uV = 3150000, |
@@ -264,13 +237,13 @@ static struct regulator_init_data igep2_vmmc1 = { | |||
264 | | REGULATOR_CHANGE_STATUS, | 237 | | REGULATOR_CHANGE_STATUS, |
265 | }, | 238 | }, |
266 | .num_consumer_supplies = 1, | 239 | .num_consumer_supplies = 1, |
267 | .consumer_supplies = &igep2_vmmc1_supply, | 240 | .consumer_supplies = &igep_vmmc1_supply, |
268 | }; | 241 | }; |
269 | 242 | ||
270 | static struct regulator_consumer_supply igep2_vio_supply = | 243 | static struct regulator_consumer_supply igep_vio_supply = |
271 | REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.1"); | 244 | REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.1"); |
272 | 245 | ||
273 | static struct regulator_init_data igep2_vio = { | 246 | static struct regulator_init_data igep_vio = { |
274 | .constraints = { | 247 | .constraints = { |
275 | .min_uV = 1800000, | 248 | .min_uV = 1800000, |
276 | .max_uV = 1800000, | 249 | .max_uV = 1800000, |
@@ -282,34 +255,34 @@ static struct regulator_init_data igep2_vio = { | |||
282 | | REGULATOR_CHANGE_STATUS, | 255 | | REGULATOR_CHANGE_STATUS, |
283 | }, | 256 | }, |
284 | .num_consumer_supplies = 1, | 257 | .num_consumer_supplies = 1, |
285 | .consumer_supplies = &igep2_vio_supply, | 258 | .consumer_supplies = &igep_vio_supply, |
286 | }; | 259 | }; |
287 | 260 | ||
288 | static struct regulator_consumer_supply igep2_vmmc2_supply = | 261 | static struct regulator_consumer_supply igep_vmmc2_supply = |
289 | REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"); | 262 | REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"); |
290 | 263 | ||
291 | static struct regulator_init_data igep2_vmmc2 = { | 264 | static struct regulator_init_data igep_vmmc2 = { |
292 | .constraints = { | 265 | .constraints = { |
293 | .valid_modes_mask = REGULATOR_MODE_NORMAL, | 266 | .valid_modes_mask = REGULATOR_MODE_NORMAL, |
294 | .always_on = 1, | 267 | .always_on = 1, |
295 | }, | 268 | }, |
296 | .num_consumer_supplies = 1, | 269 | .num_consumer_supplies = 1, |
297 | .consumer_supplies = &igep2_vmmc2_supply, | 270 | .consumer_supplies = &igep_vmmc2_supply, |
298 | }; | 271 | }; |
299 | 272 | ||
300 | static struct fixed_voltage_config igep2_vwlan = { | 273 | static struct fixed_voltage_config igep_vwlan = { |
301 | .supply_name = "vwlan", | 274 | .supply_name = "vwlan", |
302 | .microvolts = 3300000, | 275 | .microvolts = 3300000, |
303 | .gpio = -EINVAL, | 276 | .gpio = -EINVAL, |
304 | .enabled_at_boot = 1, | 277 | .enabled_at_boot = 1, |
305 | .init_data = &igep2_vmmc2, | 278 | .init_data = &igep_vmmc2, |
306 | }; | 279 | }; |
307 | 280 | ||
308 | static struct platform_device igep2_vwlan_device = { | 281 | static struct platform_device igep_vwlan_device = { |
309 | .name = "reg-fixed-voltage", | 282 | .name = "reg-fixed-voltage", |
310 | .id = 0, | 283 | .id = 0, |
311 | .dev = { | 284 | .dev = { |
312 | .platform_data = &igep2_vwlan, | 285 | .platform_data = &igep_vwlan, |
313 | }, | 286 | }, |
314 | }; | 287 | }; |
315 | 288 | ||
@@ -334,20 +307,17 @@ static struct omap2_hsmmc_info mmc[] = { | |||
334 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) | 307 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) |
335 | #include <linux/leds.h> | 308 | #include <linux/leds.h> |
336 | 309 | ||
337 | static struct gpio_led igep2_gpio_leds[] = { | 310 | static struct gpio_led igep_gpio_leds[] = { |
338 | [0] = { | 311 | [0] = { |
339 | .name = "gpio-led:red:d0", | 312 | .name = "gpio-led:red:d0", |
340 | .gpio = IGEP2_GPIO_LED0_RED, | ||
341 | .default_trigger = "default-off" | 313 | .default_trigger = "default-off" |
342 | }, | 314 | }, |
343 | [1] = { | 315 | [1] = { |
344 | .name = "gpio-led:green:d0", | 316 | .name = "gpio-led:green:d0", |
345 | .gpio = IGEP2_GPIO_LED0_GREEN, | ||
346 | .default_trigger = "default-off", | 317 | .default_trigger = "default-off", |
347 | }, | 318 | }, |
348 | [2] = { | 319 | [2] = { |
349 | .name = "gpio-led:red:d1", | 320 | .name = "gpio-led:red:d1", |
350 | .gpio = IGEP2_GPIO_LED1_RED, | ||
351 | .default_trigger = "default-off", | 321 | .default_trigger = "default-off", |
352 | }, | 322 | }, |
353 | [3] = { | 323 | [3] = { |
@@ -358,94 +328,119 @@ static struct gpio_led igep2_gpio_leds[] = { | |||
358 | }, | 328 | }, |
359 | }; | 329 | }; |
360 | 330 | ||
361 | static struct gpio_led_platform_data igep2_led_pdata = { | 331 | static struct gpio_led_platform_data igep_led_pdata = { |
362 | .leds = igep2_gpio_leds, | 332 | .leds = igep_gpio_leds, |
363 | .num_leds = ARRAY_SIZE(igep2_gpio_leds), | 333 | .num_leds = ARRAY_SIZE(igep_gpio_leds), |
364 | }; | 334 | }; |
365 | 335 | ||
366 | static struct platform_device igep2_led_device = { | 336 | static struct platform_device igep_led_device = { |
367 | .name = "leds-gpio", | 337 | .name = "leds-gpio", |
368 | .id = -1, | 338 | .id = -1, |
369 | .dev = { | 339 | .dev = { |
370 | .platform_data = &igep2_led_pdata, | 340 | .platform_data = &igep_led_pdata, |
371 | }, | 341 | }, |
372 | }; | 342 | }; |
373 | 343 | ||
374 | static void __init igep2_leds_init(void) | 344 | static void __init igep_leds_init(void) |
375 | { | 345 | { |
376 | platform_device_register(&igep2_led_device); | 346 | if (machine_is_igep0020()) { |
347 | igep_gpio_leds[0].gpio = IGEP2_GPIO_LED0_RED; | ||
348 | igep_gpio_leds[1].gpio = IGEP2_GPIO_LED0_GREEN; | ||
349 | igep_gpio_leds[2].gpio = IGEP2_GPIO_LED1_RED; | ||
350 | } else { | ||
351 | igep_gpio_leds[0].gpio = IGEP3_GPIO_LED0_RED; | ||
352 | igep_gpio_leds[1].gpio = IGEP3_GPIO_LED0_GREEN; | ||
353 | igep_gpio_leds[2].gpio = IGEP3_GPIO_LED1_RED; | ||
354 | } | ||
355 | |||
356 | platform_device_register(&igep_led_device); | ||
377 | } | 357 | } |
378 | 358 | ||
379 | #else | 359 | #else |
380 | static inline void igep2_leds_init(void) | 360 | static struct gpio igep_gpio_leds[] __initdata = { |
361 | { -EINVAL, GPIOF_OUT_INIT_LOW, "gpio-led:red:d0" }, | ||
362 | { -EINVAL, GPIOF_OUT_INIT_LOW, "gpio-led:green:d0" }, | ||
363 | { -EINVAL, GPIOF_OUT_INIT_LOW, "gpio-led:red:d1" }, | ||
364 | }; | ||
365 | |||
366 | static inline void igep_leds_init(void) | ||
381 | { | 367 | { |
382 | if ((gpio_request(IGEP2_GPIO_LED0_RED, "gpio-led:red:d0") == 0) && | 368 | int i; |
383 | (gpio_direction_output(IGEP2_GPIO_LED0_RED, 0) == 0)) | ||
384 | gpio_export(IGEP2_GPIO_LED0_RED, 0); | ||
385 | else | ||
386 | pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_RED\n"); | ||
387 | 369 | ||
388 | if ((gpio_request(IGEP2_GPIO_LED0_GREEN, "gpio-led:green:d0") == 0) && | 370 | if (machine_is_igep0020()) { |
389 | (gpio_direction_output(IGEP2_GPIO_LED0_GREEN, 0) == 0)) | 371 | igep_gpio_leds[0].gpio = IGEP2_GPIO_LED0_RED; |
390 | gpio_export(IGEP2_GPIO_LED0_GREEN, 0); | 372 | igep_gpio_leds[1].gpio = IGEP2_GPIO_LED0_GREEN; |
391 | else | 373 | igep_gpio_leds[2].gpio = IGEP2_GPIO_LED1_RED; |
392 | pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_GREEN\n"); | 374 | } else { |
375 | igep_gpio_leds[0].gpio = IGEP3_GPIO_LED0_RED; | ||
376 | igep_gpio_leds[1].gpio = IGEP3_GPIO_LED0_GREEN; | ||
377 | igep_gpio_leds[2].gpio = IGEP3_GPIO_LED1_RED; | ||
378 | } | ||
393 | 379 | ||
394 | if ((gpio_request(IGEP2_GPIO_LED1_RED, "gpio-led:red:d1") == 0) && | 380 | if (gpio_request_array(igep_gpio_leds, ARRAY_SIZE(igep_gpio_leds))) { |
395 | (gpio_direction_output(IGEP2_GPIO_LED1_RED, 0) == 0)) | 381 | pr_warning("IGEP v2: Could not obtain leds gpios\n"); |
396 | gpio_export(IGEP2_GPIO_LED1_RED, 0); | 382 | return; |
397 | else | 383 | } |
398 | pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_RED\n"); | ||
399 | 384 | ||
385 | for (i = 0; i < ARRAY_SIZE(igep_gpio_leds); i++) | ||
386 | gpio_export(igep_gpio_leds[i].gpio, 0); | ||
400 | } | 387 | } |
401 | #endif | 388 | #endif |
402 | 389 | ||
403 | static int igep2_twl_gpio_setup(struct device *dev, | 390 | static struct gpio igep2_twl_gpios[] = { |
391 | { -EINVAL, GPIOF_IN, "GPIO_EHCI_NOC" }, | ||
392 | { -EINVAL, GPIOF_OUT_INIT_LOW, "GPIO_USBH_CPEN" }, | ||
393 | }; | ||
394 | |||
395 | static int igep_twl_gpio_setup(struct device *dev, | ||
404 | unsigned gpio, unsigned ngpio) | 396 | unsigned gpio, unsigned ngpio) |
405 | { | 397 | { |
398 | int ret; | ||
399 | |||
406 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ | 400 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ |
407 | mmc[0].gpio_cd = gpio + 0; | 401 | mmc[0].gpio_cd = gpio + 0; |
408 | omap2_hsmmc_init(mmc); | 402 | omap2_hsmmc_init(mmc); |
409 | 403 | ||
410 | /* | ||
411 | * REVISIT: need ehci-omap hooks for external VBUS | ||
412 | * power switch and overcurrent detect | ||
413 | */ | ||
414 | if ((gpio_request(gpio + 1, "GPIO_EHCI_NOC") < 0) || | ||
415 | (gpio_direction_input(gpio + 1) < 0)) | ||
416 | pr_err("IGEP2: Could not obtain gpio for EHCI NOC"); | ||
417 | |||
418 | /* | ||
419 | * TWL4030_GPIO_MAX + 0 == ledA, GPIO_USBH_CPEN | ||
420 | * (out, active low) | ||
421 | */ | ||
422 | if ((gpio_request(gpio + TWL4030_GPIO_MAX, "GPIO_USBH_CPEN") < 0) || | ||
423 | (gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0) < 0)) | ||
424 | pr_err("IGEP2: Could not obtain gpio for USBH_CPEN"); | ||
425 | |||
426 | /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */ | 404 | /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */ |
427 | #if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE) | 405 | #if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE) |
428 | if ((gpio_request(gpio+TWL4030_GPIO_MAX+1, "gpio-led:green:d1") == 0) | 406 | ret = gpio_request_one(gpio + TWL4030_GPIO_MAX + 1, GPIOF_OUT_INIT_HIGH, |
429 | && (gpio_direction_output(gpio + TWL4030_GPIO_MAX + 1, 1) == 0)) | 407 | "gpio-led:green:d1"); |
408 | if (ret == 0) | ||
430 | gpio_export(gpio + TWL4030_GPIO_MAX + 1, 0); | 409 | gpio_export(gpio + TWL4030_GPIO_MAX + 1, 0); |
431 | else | 410 | else |
432 | pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_GREEN\n"); | 411 | pr_warning("IGEP: Could not obtain gpio GPIO_LED1_GREEN\n"); |
433 | #else | 412 | #else |
434 | igep2_gpio_leds[3].gpio = gpio + TWL4030_GPIO_MAX + 1; | 413 | igep_gpio_leds[3].gpio = gpio + TWL4030_GPIO_MAX + 1; |
435 | #endif | 414 | #endif |
436 | 415 | ||
416 | if (machine_is_igep0030()) | ||
417 | return 0; | ||
418 | |||
419 | /* | ||
420 | * REVISIT: need ehci-omap hooks for external VBUS | ||
421 | * power switch and overcurrent detect | ||
422 | */ | ||
423 | igep2_twl_gpios[0].gpio = gpio + 1; | ||
424 | |||
425 | /* TWL4030_GPIO_MAX + 0 == ledA, GPIO_USBH_CPEN (out, active low) */ | ||
426 | igep2_twl_gpios[1].gpio = gpio + TWL4030_GPIO_MAX; | ||
427 | |||
428 | ret = gpio_request_array(igep2_twl_gpios, ARRAY_SIZE(igep2_twl_gpios)); | ||
429 | if (ret < 0) | ||
430 | pr_err("IGEP2: Could not obtain gpio for USBH_CPEN"); | ||
431 | |||
437 | return 0; | 432 | return 0; |
438 | }; | 433 | }; |
439 | 434 | ||
440 | static struct twl4030_gpio_platform_data igep2_twl4030_gpio_pdata = { | 435 | static struct twl4030_gpio_platform_data igep_twl4030_gpio_pdata = { |
441 | .gpio_base = OMAP_MAX_GPIO_LINES, | 436 | .gpio_base = OMAP_MAX_GPIO_LINES, |
442 | .irq_base = TWL4030_GPIO_IRQ_BASE, | 437 | .irq_base = TWL4030_GPIO_IRQ_BASE, |
443 | .irq_end = TWL4030_GPIO_IRQ_END, | 438 | .irq_end = TWL4030_GPIO_IRQ_END, |
444 | .use_leds = true, | 439 | .use_leds = true, |
445 | .setup = igep2_twl_gpio_setup, | 440 | .setup = igep_twl_gpio_setup, |
446 | }; | 441 | }; |
447 | 442 | ||
448 | static struct twl4030_usb_data igep2_usb_data = { | 443 | static struct twl4030_usb_data igep_usb_data = { |
449 | .usb_mode = T2_USB_MODE_ULPI, | 444 | .usb_mode = T2_USB_MODE_ULPI, |
450 | }; | 445 | }; |
451 | 446 | ||
@@ -507,16 +502,17 @@ static struct regulator_init_data igep2_vpll2 = { | |||
507 | 502 | ||
508 | static void __init igep2_display_init(void) | 503 | static void __init igep2_display_init(void) |
509 | { | 504 | { |
510 | if (gpio_request(IGEP2_GPIO_DVI_PUP, "GPIO_DVI_PUP") && | 505 | int err = gpio_request_one(IGEP2_GPIO_DVI_PUP, GPIOF_OUT_INIT_HIGH, |
511 | gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1)) | 506 | "GPIO_DVI_PUP"); |
507 | if (err) | ||
512 | pr_err("IGEP v2: Could not obtain gpio GPIO_DVI_PUP\n"); | 508 | pr_err("IGEP v2: Could not obtain gpio GPIO_DVI_PUP\n"); |
513 | } | 509 | } |
514 | 510 | ||
515 | static struct platform_device *igep2_devices[] __initdata = { | 511 | static struct platform_device *igep_devices[] __initdata = { |
516 | &igep2_vwlan_device, | 512 | &igep_vwlan_device, |
517 | }; | 513 | }; |
518 | 514 | ||
519 | static void __init igep2_init_early(void) | 515 | static void __init igep_init_early(void) |
520 | { | 516 | { |
521 | omap2_init_common_infrastructure(); | 517 | omap2_init_common_infrastructure(); |
522 | omap2_init_common_devices(m65kxxxxam_sdrc_params, | 518 | omap2_init_common_devices(m65kxxxxam_sdrc_params, |
@@ -561,27 +557,15 @@ static struct twl4030_keypad_data igep2_keypad_pdata = { | |||
561 | .rep = 1, | 557 | .rep = 1, |
562 | }; | 558 | }; |
563 | 559 | ||
564 | static struct twl4030_platform_data igep2_twldata = { | 560 | static struct twl4030_platform_data igep_twldata = { |
565 | .irq_base = TWL4030_IRQ_BASE, | 561 | .irq_base = TWL4030_IRQ_BASE, |
566 | .irq_end = TWL4030_IRQ_END, | 562 | .irq_end = TWL4030_IRQ_END, |
567 | 563 | ||
568 | /* platform_data for children goes here */ | 564 | /* platform_data for children goes here */ |
569 | .usb = &igep2_usb_data, | 565 | .usb = &igep_usb_data, |
570 | .codec = &igep2_codec_data, | 566 | .gpio = &igep_twl4030_gpio_pdata, |
571 | .gpio = &igep2_twl4030_gpio_pdata, | 567 | .vmmc1 = &igep_vmmc1, |
572 | .keypad = &igep2_keypad_pdata, | 568 | .vio = &igep_vio, |
573 | .vmmc1 = &igep2_vmmc1, | ||
574 | .vpll2 = &igep2_vpll2, | ||
575 | .vio = &igep2_vio, | ||
576 | }; | ||
577 | |||
578 | static struct i2c_board_info __initdata igep2_i2c1_boardinfo[] = { | ||
579 | { | ||
580 | I2C_BOARD_INFO("twl4030", 0x48), | ||
581 | .flags = I2C_CLIENT_WAKE, | ||
582 | .irq = INT_34XX_SYS_NIRQ, | ||
583 | .platform_data = &igep2_twldata, | ||
584 | }, | ||
585 | }; | 569 | }; |
586 | 570 | ||
587 | static struct i2c_board_info __initdata igep2_i2c3_boardinfo[] = { | 571 | static struct i2c_board_info __initdata igep2_i2c3_boardinfo[] = { |
@@ -590,32 +574,29 @@ static struct i2c_board_info __initdata igep2_i2c3_boardinfo[] = { | |||
590 | }, | 574 | }, |
591 | }; | 575 | }; |
592 | 576 | ||
593 | static void __init igep2_i2c_init(void) | 577 | static void __init igep_i2c_init(void) |
594 | { | 578 | { |
595 | int ret; | 579 | int ret; |
596 | 580 | ||
597 | ret = omap_register_i2c_bus(1, 2600, igep2_i2c1_boardinfo, | 581 | if (machine_is_igep0020()) { |
598 | ARRAY_SIZE(igep2_i2c1_boardinfo)); | 582 | /* |
599 | if (ret) | 583 | * Bus 3 is attached to the DVI port where devices like the |
600 | pr_warning("IGEP2: Could not register I2C1 bus (%d)\n", ret); | 584 | * pico DLP projector don't work reliably with 400kHz |
585 | */ | ||
586 | ret = omap_register_i2c_bus(3, 100, igep2_i2c3_boardinfo, | ||
587 | ARRAY_SIZE(igep2_i2c3_boardinfo)); | ||
588 | if (ret) | ||
589 | pr_warning("IGEP2: Could not register I2C3 bus (%d)\n", ret); | ||
590 | |||
591 | igep_twldata.codec = &igep2_codec_data; | ||
592 | igep_twldata.keypad = &igep2_keypad_pdata; | ||
593 | igep_twldata.vpll2 = &igep2_vpll2; | ||
594 | } | ||
601 | 595 | ||
602 | /* | 596 | omap3_pmic_init("twl4030", &igep_twldata); |
603 | * Bus 3 is attached to the DVI port where devices like the pico DLP | ||
604 | * projector don't work reliably with 400kHz | ||
605 | */ | ||
606 | ret = omap_register_i2c_bus(3, 100, igep2_i2c3_boardinfo, | ||
607 | ARRAY_SIZE(igep2_i2c3_boardinfo)); | ||
608 | if (ret) | ||
609 | pr_warning("IGEP2: Could not register I2C3 bus (%d)\n", ret); | ||
610 | } | 597 | } |
611 | 598 | ||
612 | static struct omap_musb_board_data musb_board_data = { | 599 | static const struct usbhs_omap_board_data igep2_usbhs_bdata __initconst = { |
613 | .interface_type = MUSB_INTERFACE_ULPI, | ||
614 | .mode = MUSB_OTG, | ||
615 | .power = 100, | ||
616 | }; | ||
617 | |||
618 | static const struct usbhs_omap_board_data usbhs_bdata __initconst = { | ||
619 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, | 600 | .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY, |
620 | .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED, | 601 | .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED, |
621 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | 602 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, |
@@ -626,6 +607,17 @@ static const struct usbhs_omap_board_data usbhs_bdata __initconst = { | |||
626 | .reset_gpio_port[2] = -EINVAL, | 607 | .reset_gpio_port[2] = -EINVAL, |
627 | }; | 608 | }; |
628 | 609 | ||
610 | static const struct usbhs_omap_board_data igep3_usbhs_bdata __initconst = { | ||
611 | .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
612 | .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY, | ||
613 | .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED, | ||
614 | |||
615 | .phy_reset = true, | ||
616 | .reset_gpio_port[0] = -EINVAL, | ||
617 | .reset_gpio_port[1] = IGEP3_GPIO_USBH_NRESET, | ||
618 | .reset_gpio_port[2] = -EINVAL, | ||
619 | }; | ||
620 | |||
629 | #ifdef CONFIG_OMAP_MUX | 621 | #ifdef CONFIG_OMAP_MUX |
630 | static struct omap_board_mux board_mux[] __initdata = { | 622 | static struct omap_board_mux board_mux[] __initdata = { |
631 | { .reg_offset = OMAP_MUX_TERMINATOR }, | 623 | { .reg_offset = OMAP_MUX_TERMINATOR }, |
@@ -633,82 +625,95 @@ static struct omap_board_mux board_mux[] __initdata = { | |||
633 | #endif | 625 | #endif |
634 | 626 | ||
635 | #if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE) | 627 | #if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE) |
628 | static struct gpio igep_wlan_bt_gpios[] __initdata = { | ||
629 | { -EINVAL, GPIOF_OUT_INIT_HIGH, "GPIO_WIFI_NPD" }, | ||
630 | { -EINVAL, GPIOF_OUT_INIT_HIGH, "GPIO_WIFI_NRESET" }, | ||
631 | { -EINVAL, GPIOF_OUT_INIT_HIGH, "GPIO_BT_NRESET" }, | ||
632 | }; | ||
636 | 633 | ||
637 | static void __init igep2_wlan_bt_init(void) | 634 | static void __init igep_wlan_bt_init(void) |
638 | { | 635 | { |
639 | unsigned npd, wreset, btreset; | 636 | int err; |
640 | 637 | ||
641 | /* GPIO's for WLAN-BT combo depends on hardware revision */ | 638 | /* GPIO's for WLAN-BT combo depends on hardware revision */ |
642 | if (hwrev == IGEP2_BOARD_HWREV_B) { | 639 | if (hwrev == IGEP2_BOARD_HWREV_B) { |
643 | npd = IGEP2_RB_GPIO_WIFI_NPD; | 640 | igep_wlan_bt_gpios[0].gpio = IGEP2_RB_GPIO_WIFI_NPD; |
644 | wreset = IGEP2_RB_GPIO_WIFI_NRESET; | 641 | igep_wlan_bt_gpios[1].gpio = IGEP2_RB_GPIO_WIFI_NRESET; |
645 | btreset = IGEP2_RB_GPIO_BT_NRESET; | 642 | igep_wlan_bt_gpios[2].gpio = IGEP2_RB_GPIO_BT_NRESET; |
646 | } else if (hwrev == IGEP2_BOARD_HWREV_C) { | 643 | } else if (hwrev == IGEP2_BOARD_HWREV_C || machine_is_igep0030()) { |
647 | npd = IGEP2_RC_GPIO_WIFI_NPD; | 644 | igep_wlan_bt_gpios[0].gpio = IGEP2_RC_GPIO_WIFI_NPD; |
648 | wreset = IGEP2_RC_GPIO_WIFI_NRESET; | 645 | igep_wlan_bt_gpios[1].gpio = IGEP2_RC_GPIO_WIFI_NRESET; |
649 | btreset = IGEP2_RC_GPIO_BT_NRESET; | 646 | igep_wlan_bt_gpios[2].gpio = IGEP2_RC_GPIO_BT_NRESET; |
650 | } else | 647 | } else |
651 | return; | 648 | return; |
652 | 649 | ||
653 | /* Set GPIO's for WLAN-BT combo module */ | 650 | err = gpio_request_array(igep_wlan_bt_gpios, |
654 | if ((gpio_request(npd, "GPIO_WIFI_NPD") == 0) && | 651 | ARRAY_SIZE(igep_wlan_bt_gpios)); |
655 | (gpio_direction_output(npd, 1) == 0)) { | 652 | if (err) { |
656 | gpio_export(npd, 0); | 653 | pr_warning("IGEP2: Could not obtain WIFI/BT gpios\n"); |
657 | } else | 654 | return; |
658 | pr_warning("IGEP2: Could not obtain gpio GPIO_WIFI_NPD\n"); | 655 | } |
659 | 656 | ||
660 | if ((gpio_request(wreset, "GPIO_WIFI_NRESET") == 0) && | 657 | gpio_export(igep_wlan_bt_gpios[0].gpio, 0); |
661 | (gpio_direction_output(wreset, 1) == 0)) { | 658 | gpio_export(igep_wlan_bt_gpios[1].gpio, 0); |
662 | gpio_export(wreset, 0); | 659 | gpio_export(igep_wlan_bt_gpios[2].gpio, 0); |
663 | gpio_set_value(wreset, 0); | 660 | |
664 | udelay(10); | 661 | gpio_set_value(igep_wlan_bt_gpios[1].gpio, 0); |
665 | gpio_set_value(wreset, 1); | 662 | udelay(10); |
666 | } else | 663 | gpio_set_value(igep_wlan_bt_gpios[1].gpio, 1); |
667 | pr_warning("IGEP2: Could not obtain gpio GPIO_WIFI_NRESET\n"); | ||
668 | 664 | ||
669 | if ((gpio_request(btreset, "GPIO_BT_NRESET") == 0) && | ||
670 | (gpio_direction_output(btreset, 1) == 0)) { | ||
671 | gpio_export(btreset, 0); | ||
672 | } else | ||
673 | pr_warning("IGEP2: Could not obtain gpio GPIO_BT_NRESET\n"); | ||
674 | } | 665 | } |
675 | #else | 666 | #else |
676 | static inline void __init igep2_wlan_bt_init(void) { } | 667 | static inline void __init igep_wlan_bt_init(void) { } |
677 | #endif | 668 | #endif |
678 | 669 | ||
679 | static void __init igep2_init(void) | 670 | static void __init igep_init(void) |
680 | { | 671 | { |
681 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); | 672 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
682 | 673 | ||
683 | /* Get IGEP2 hardware revision */ | 674 | /* Get IGEP2 hardware revision */ |
684 | igep2_get_revision(); | 675 | igep2_get_revision(); |
685 | /* Register I2C busses and drivers */ | 676 | /* Register I2C busses and drivers */ |
686 | igep2_i2c_init(); | 677 | igep_i2c_init(); |
687 | platform_add_devices(igep2_devices, ARRAY_SIZE(igep2_devices)); | 678 | platform_add_devices(igep_devices, ARRAY_SIZE(igep_devices)); |
688 | omap_display_init(&igep2_dss_data); | ||
689 | omap_serial_init(); | 679 | omap_serial_init(); |
690 | usb_musb_init(&musb_board_data); | 680 | usb_musb_init(NULL); |
691 | usbhs_init(&usbhs_bdata); | ||
692 | 681 | ||
693 | igep2_flash_init(); | 682 | igep_flash_init(); |
694 | igep2_leds_init(); | 683 | igep_leds_init(); |
695 | igep2_display_init(); | ||
696 | igep2_init_smsc911x(); | ||
697 | 684 | ||
698 | /* | 685 | /* |
699 | * WLAN-BT combo module from MuRata which has a Marvell WLAN | 686 | * WLAN-BT combo module from MuRata which has a Marvell WLAN |
700 | * (88W8686) + CSR Bluetooth chipset. Uses SDIO interface. | 687 | * (88W8686) + CSR Bluetooth chipset. Uses SDIO interface. |
701 | */ | 688 | */ |
702 | igep2_wlan_bt_init(); | 689 | igep_wlan_bt_init(); |
703 | 690 | ||
691 | if (machine_is_igep0020()) { | ||
692 | omap_display_init(&igep2_dss_data); | ||
693 | igep2_display_init(); | ||
694 | igep2_init_smsc911x(); | ||
695 | usbhs_init(&igep2_usbhs_bdata); | ||
696 | } else { | ||
697 | usbhs_init(&igep3_usbhs_bdata); | ||
698 | } | ||
704 | } | 699 | } |
705 | 700 | ||
706 | MACHINE_START(IGEP0020, "IGEP v2 board") | 701 | MACHINE_START(IGEP0020, "IGEP v2 board") |
707 | .boot_params = 0x80000100, | 702 | .boot_params = 0x80000100, |
708 | .reserve = omap_reserve, | 703 | .reserve = omap_reserve, |
709 | .map_io = omap3_map_io, | 704 | .map_io = omap3_map_io, |
710 | .init_early = igep2_init_early, | 705 | .init_early = igep_init_early, |
706 | .init_irq = omap_init_irq, | ||
707 | .init_machine = igep_init, | ||
708 | .timer = &omap_timer, | ||
709 | MACHINE_END | ||
710 | |||
711 | MACHINE_START(IGEP0030, "IGEP OMAP3 module") | ||
712 | .boot_params = 0x80000100, | ||
713 | .reserve = omap_reserve, | ||
714 | .map_io = omap3_map_io, | ||
715 | .init_early = igep_init_early, | ||
711 | .init_irq = omap_init_irq, | 716 | .init_irq = omap_init_irq, |
712 | .init_machine = igep2_init, | 717 | .init_machine = igep_init, |
713 | .timer = &omap_timer, | 718 | .timer = &omap_timer, |
714 | MACHINE_END | 719 | MACHINE_END |