diff options
Diffstat (limited to 'arch/arm/mach-omap1/board-osk.c')
-rw-r--r-- | arch/arm/mach-omap1/board-osk.c | 138 |
1 files changed, 87 insertions, 51 deletions
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c index 5279e35a8aec..4f9baba7d893 100644 --- a/arch/arm/mach-omap1/board-osk.c +++ b/arch/arm/mach-omap1/board-osk.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/interrupt.h> | 32 | #include <linux/interrupt.h> |
33 | #include <linux/irq.h> | 33 | #include <linux/irq.h> |
34 | #include <linux/i2c.h> | 34 | #include <linux/i2c.h> |
35 | #include <linux/leds.h> | ||
35 | 36 | ||
36 | #include <linux/mtd/mtd.h> | 37 | #include <linux/mtd/mtd.h> |
37 | #include <linux/mtd/partitions.h> | 38 | #include <linux/mtd/partitions.h> |
@@ -183,11 +184,80 @@ static struct platform_device *osk5912_devices[] __initdata = { | |||
183 | &osk5912_mcbsp1_device, | 184 | &osk5912_mcbsp1_device, |
184 | }; | 185 | }; |
185 | 186 | ||
187 | static struct gpio_led tps_leds[] = { | ||
188 | /* NOTE: D9 and D2 have hardware blink support. | ||
189 | * Also, D9 requires non-battery power. | ||
190 | */ | ||
191 | { .gpio = OSK_TPS_GPIO_LED_D9, .name = "d9", }, | ||
192 | { .gpio = OSK_TPS_GPIO_LED_D2, .name = "d2", }, | ||
193 | { .gpio = OSK_TPS_GPIO_LED_D3, .name = "d3", .active_low = 1, | ||
194 | .default_trigger = "heartbeat", }, | ||
195 | }; | ||
196 | |||
197 | static struct gpio_led_platform_data tps_leds_data = { | ||
198 | .num_leds = 3, | ||
199 | .leds = tps_leds, | ||
200 | }; | ||
201 | |||
202 | static struct platform_device osk5912_tps_leds = { | ||
203 | .name = "leds-gpio", | ||
204 | .id = 0, | ||
205 | .dev.platform_data = &tps_leds_data, | ||
206 | }; | ||
207 | |||
208 | static int osk_tps_setup(struct i2c_client *client, void *context) | ||
209 | { | ||
210 | /* Set GPIO 1 HIGH to disable VBUS power supply; | ||
211 | * OHCI driver powers it up/down as needed. | ||
212 | */ | ||
213 | gpio_request(OSK_TPS_GPIO_USB_PWR_EN, "n_vbus_en"); | ||
214 | gpio_direction_output(OSK_TPS_GPIO_USB_PWR_EN, 1); | ||
215 | |||
216 | /* Set GPIO 2 high so LED D3 is off by default */ | ||
217 | tps65010_set_gpio_out_value(GPIO2, HIGH); | ||
218 | |||
219 | /* Set GPIO 3 low to take ethernet out of reset */ | ||
220 | gpio_request(OSK_TPS_GPIO_LAN_RESET, "smc_reset"); | ||
221 | gpio_direction_output(OSK_TPS_GPIO_LAN_RESET, 0); | ||
222 | |||
223 | /* GPIO4 is VDD_DSP */ | ||
224 | gpio_request(OSK_TPS_GPIO_DSP_PWR_EN, "dsp_power"); | ||
225 | gpio_direction_output(OSK_TPS_GPIO_DSP_PWR_EN, 1); | ||
226 | /* REVISIT if DSP support isn't configured, power it off ... */ | ||
227 | |||
228 | /* Let LED1 (D9) blink; leds-gpio may override it */ | ||
229 | tps65010_set_led(LED1, BLINK); | ||
230 | |||
231 | /* Set LED2 off by default */ | ||
232 | tps65010_set_led(LED2, OFF); | ||
233 | |||
234 | /* Enable LOW_PWR handshake */ | ||
235 | tps65010_set_low_pwr(ON); | ||
236 | |||
237 | /* Switch VLDO2 to 3.0V for AIC23 */ | ||
238 | tps65010_config_vregs1(TPS_LDO2_ENABLE | TPS_VLDO2_3_0V | ||
239 | | TPS_LDO1_ENABLE); | ||
240 | |||
241 | /* register these three LEDs */ | ||
242 | osk5912_tps_leds.dev.parent = &client->dev; | ||
243 | platform_device_register(&osk5912_tps_leds); | ||
244 | |||
245 | return 0; | ||
246 | } | ||
247 | |||
248 | static struct tps65010_board tps_board = { | ||
249 | .base = OSK_TPS_GPIO_BASE, | ||
250 | .outmask = 0x0f, | ||
251 | .setup = osk_tps_setup, | ||
252 | }; | ||
253 | |||
186 | static struct i2c_board_info __initdata osk_i2c_board_info[] = { | 254 | static struct i2c_board_info __initdata osk_i2c_board_info[] = { |
187 | { | 255 | { |
188 | I2C_BOARD_INFO("tps65010", 0x48), | 256 | I2C_BOARD_INFO("tps65010", 0x48), |
189 | .type = "tps65010", | 257 | .type = "tps65010", |
190 | .irq = OMAP_GPIO_IRQ(OMAP_MPUIO(1)), | 258 | .irq = OMAP_GPIO_IRQ(OMAP_MPUIO(1)), |
259 | .platform_data = &tps_board, | ||
260 | |||
191 | }, | 261 | }, |
192 | /* TODO when driver support is ready: | 262 | /* TODO when driver support is ready: |
193 | * - aic23 audio chip at 0x1a | 263 | * - aic23 audio chip at 0x1a |
@@ -198,7 +268,7 @@ static struct i2c_board_info __initdata osk_i2c_board_info[] = { | |||
198 | 268 | ||
199 | static void __init osk_init_smc91x(void) | 269 | static void __init osk_init_smc91x(void) |
200 | { | 270 | { |
201 | if ((omap_request_gpio(0)) < 0) { | 271 | if ((gpio_request(0, "smc_irq")) < 0) { |
202 | printk("Error requesting gpio 0 for smc91x irq\n"); | 272 | printk("Error requesting gpio 0 for smc91x irq\n"); |
203 | return; | 273 | return; |
204 | } | 274 | } |
@@ -210,7 +280,7 @@ static void __init osk_init_smc91x(void) | |||
210 | static void __init osk_init_cf(void) | 280 | static void __init osk_init_cf(void) |
211 | { | 281 | { |
212 | omap_cfg_reg(M7_1610_GPIO62); | 282 | omap_cfg_reg(M7_1610_GPIO62); |
213 | if ((omap_request_gpio(62)) < 0) { | 283 | if ((gpio_request(62, "cf_irq")) < 0) { |
214 | printk("Error requesting gpio 62 for CF irq\n"); | 284 | printk("Error requesting gpio 62 for CF irq\n"); |
215 | return; | 285 | return; |
216 | } | 286 | } |
@@ -334,7 +404,7 @@ static struct platform_device *mistral_devices[] __initdata = { | |||
334 | 404 | ||
335 | static int mistral_get_pendown_state(void) | 405 | static int mistral_get_pendown_state(void) |
336 | { | 406 | { |
337 | return !omap_get_gpio_datain(4); | 407 | return !gpio_get_value(4); |
338 | } | 408 | } |
339 | 409 | ||
340 | static const struct ads7846_platform_data mistral_ts_info = { | 410 | static const struct ads7846_platform_data mistral_ts_info = { |
@@ -396,25 +466,31 @@ static void __init osk_mistral_init(void) | |||
396 | omap_cfg_reg(W14_1610_CCP_DATAP); | 466 | omap_cfg_reg(W14_1610_CCP_DATAP); |
397 | 467 | ||
398 | /* CAM_PWDN */ | 468 | /* CAM_PWDN */ |
399 | if (omap_request_gpio(11) == 0) { | 469 | if (gpio_request(11, "cam_pwdn") == 0) { |
400 | omap_cfg_reg(N20_1610_GPIO11); | 470 | omap_cfg_reg(N20_1610_GPIO11); |
401 | omap_set_gpio_direction(11, 0 /* out */); | 471 | gpio_direction_output(11, 0); |
402 | omap_set_gpio_dataout(11, 0 /* off */); | ||
403 | } else | 472 | } else |
404 | pr_debug("OSK+Mistral: CAM_PWDN is awol\n"); | 473 | pr_debug("OSK+Mistral: CAM_PWDN is awol\n"); |
405 | 474 | ||
406 | 475 | ||
407 | /* omap_cfg_reg(P19_1610_GPIO6); */ /* BUSY */ | 476 | /* omap_cfg_reg(P19_1610_GPIO6); */ /* BUSY */ |
477 | gpio_request(6, "ts_busy"); | ||
478 | gpio_direction_input(6); | ||
479 | |||
408 | omap_cfg_reg(P20_1610_GPIO4); /* PENIRQ */ | 480 | omap_cfg_reg(P20_1610_GPIO4); /* PENIRQ */ |
481 | gpio_request(4, "ts_int"); | ||
482 | gpio_direction_input(4); | ||
409 | set_irq_type(OMAP_GPIO_IRQ(4), IRQT_FALLING); | 483 | set_irq_type(OMAP_GPIO_IRQ(4), IRQT_FALLING); |
484 | |||
410 | spi_register_board_info(mistral_boardinfo, | 485 | spi_register_board_info(mistral_boardinfo, |
411 | ARRAY_SIZE(mistral_boardinfo)); | 486 | ARRAY_SIZE(mistral_boardinfo)); |
412 | 487 | ||
413 | /* the sideways button (SW1) is for use as a "wakeup" button */ | 488 | /* the sideways button (SW1) is for use as a "wakeup" button */ |
414 | omap_cfg_reg(N15_1610_MPUIO2); | 489 | omap_cfg_reg(N15_1610_MPUIO2); |
415 | if (omap_request_gpio(OMAP_MPUIO(2)) == 0) { | 490 | if (gpio_request(OMAP_MPUIO(2), "wakeup") == 0) { |
416 | int ret = 0; | 491 | int ret = 0; |
417 | omap_set_gpio_direction(OMAP_MPUIO(2), 1); | 492 | |
493 | gpio_direction_input(OMAP_MPUIO(2)); | ||
418 | set_irq_type(OMAP_GPIO_IRQ(OMAP_MPUIO(2)), IRQT_RISING); | 494 | set_irq_type(OMAP_GPIO_IRQ(OMAP_MPUIO(2)), IRQT_RISING); |
419 | #ifdef CONFIG_PM | 495 | #ifdef CONFIG_PM |
420 | /* share the IRQ in case someone wants to use the | 496 | /* share the IRQ in case someone wants to use the |
@@ -425,7 +501,7 @@ static void __init osk_mistral_init(void) | |||
425 | IRQF_SHARED, "mistral_wakeup", | 501 | IRQF_SHARED, "mistral_wakeup", |
426 | &osk_mistral_wake_interrupt); | 502 | &osk_mistral_wake_interrupt); |
427 | if (ret != 0) { | 503 | if (ret != 0) { |
428 | omap_free_gpio(OMAP_MPUIO(2)); | 504 | gpio_free(OMAP_MPUIO(2)); |
429 | printk(KERN_ERR "OSK+Mistral: no wakeup irq, %d?\n", | 505 | printk(KERN_ERR "OSK+Mistral: no wakeup irq, %d?\n", |
430 | ret); | 506 | ret); |
431 | } else | 507 | } else |
@@ -438,10 +514,8 @@ static void __init osk_mistral_init(void) | |||
438 | * board, like the touchscreen, EEPROM, and wakeup (!) switch. | 514 | * board, like the touchscreen, EEPROM, and wakeup (!) switch. |
439 | */ | 515 | */ |
440 | omap_cfg_reg(PWL); | 516 | omap_cfg_reg(PWL); |
441 | if (omap_request_gpio(2) == 0) { | 517 | if (gpio_request(2, "lcd_pwr") == 0) |
442 | omap_set_gpio_direction(2, 0 /* out */); | 518 | gpio_direction_output(2, 1); |
443 | omap_set_gpio_dataout(2, 1 /* on */); | ||
444 | } | ||
445 | 519 | ||
446 | platform_add_devices(mistral_devices, ARRAY_SIZE(mistral_devices)); | 520 | platform_add_devices(mistral_devices, ARRAY_SIZE(mistral_devices)); |
447 | } | 521 | } |
@@ -484,44 +558,6 @@ static void __init osk_map_io(void) | |||
484 | omap1_map_common_io(); | 558 | omap1_map_common_io(); |
485 | } | 559 | } |
486 | 560 | ||
487 | #ifdef CONFIG_TPS65010 | ||
488 | static int __init osk_tps_init(void) | ||
489 | { | ||
490 | if (!machine_is_omap_osk()) | ||
491 | return 0; | ||
492 | |||
493 | /* Let LED1 (D9) blink */ | ||
494 | tps65010_set_led(LED1, BLINK); | ||
495 | |||
496 | /* Disable LED 2 (D2) */ | ||
497 | tps65010_set_led(LED2, OFF); | ||
498 | |||
499 | /* Set GPIO 1 HIGH to disable VBUS power supply; | ||
500 | * OHCI driver powers it up/down as needed. | ||
501 | */ | ||
502 | tps65010_set_gpio_out_value(GPIO1, HIGH); | ||
503 | |||
504 | /* Set GPIO 2 low to turn on LED D3 */ | ||
505 | tps65010_set_gpio_out_value(GPIO2, HIGH); | ||
506 | |||
507 | /* Set GPIO 3 low to take ethernet out of reset */ | ||
508 | tps65010_set_gpio_out_value(GPIO3, LOW); | ||
509 | |||
510 | /* gpio4 for VDD_DSP */ | ||
511 | /* FIXME send power to DSP iff it's configured */ | ||
512 | |||
513 | /* Enable LOW_PWR */ | ||
514 | tps65010_set_low_pwr(ON); | ||
515 | |||
516 | /* Switch VLDO2 to 3.0V for AIC23 */ | ||
517 | tps65010_config_vregs1(TPS_LDO2_ENABLE | TPS_VLDO2_3_0V | ||
518 | | TPS_LDO1_ENABLE); | ||
519 | |||
520 | return 0; | ||
521 | } | ||
522 | fs_initcall(osk_tps_init); | ||
523 | #endif | ||
524 | |||
525 | MACHINE_START(OMAP_OSK, "TI-OSK") | 561 | MACHINE_START(OMAP_OSK, "TI-OSK") |
526 | /* Maintainer: Dirk Behme <dirk.behme@de.bosch.com> */ | 562 | /* Maintainer: Dirk Behme <dirk.behme@de.bosch.com> */ |
527 | .phys_io = 0xfff00000, | 563 | .phys_io = 0xfff00000, |