diff options
Diffstat (limited to 'arch/arm/mach-pxa/tosa.c')
-rw-r--r-- | arch/arm/mach-pxa/tosa.c | 382 |
1 files changed, 335 insertions, 47 deletions
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c index ab4a9f579913..fea17ce6b55f 100644 --- a/arch/arm/mach-pxa/tosa.c +++ b/arch/arm/mach-pxa/tosa.c | |||
@@ -18,30 +18,31 @@ | |||
18 | #include <linux/major.h> | 18 | #include <linux/major.h> |
19 | #include <linux/fs.h> | 19 | #include <linux/fs.h> |
20 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
21 | #include <linux/delay.h> | ||
22 | #include <linux/fb.h> | ||
21 | #include <linux/mmc/host.h> | 23 | #include <linux/mmc/host.h> |
24 | #include <linux/mfd/tc6393xb.h> | ||
25 | #include <linux/mfd/tmio.h> | ||
26 | #include <linux/mtd/nand.h> | ||
27 | #include <linux/mtd/partitions.h> | ||
22 | #include <linux/pm.h> | 28 | #include <linux/pm.h> |
23 | #include <linux/delay.h> | ||
24 | #include <linux/gpio_keys.h> | 29 | #include <linux/gpio_keys.h> |
25 | #include <linux/input.h> | 30 | #include <linux/input.h> |
26 | #include <linux/gpio.h> | 31 | #include <linux/gpio.h> |
32 | #include <linux/pda_power.h> | ||
33 | #include <linux/rfkill.h> | ||
27 | 34 | ||
28 | #include <asm/setup.h> | 35 | #include <asm/setup.h> |
29 | #include <asm/memory.h> | ||
30 | #include <asm/mach-types.h> | 36 | #include <asm/mach-types.h> |
31 | #include <asm/hardware.h> | ||
32 | #include <asm/irq.h> | ||
33 | #include <asm/system.h> | ||
34 | #include <asm/arch/pxa-regs.h> | ||
35 | #include <asm/arch/pxa2xx-regs.h> | 37 | #include <asm/arch/pxa2xx-regs.h> |
36 | #include <asm/arch/mfp-pxa25x.h> | 38 | #include <asm/arch/mfp-pxa25x.h> |
37 | #include <asm/arch/irda.h> | 39 | #include <asm/arch/irda.h> |
38 | #include <asm/arch/i2c.h> | 40 | #include <asm/arch/i2c.h> |
39 | #include <asm/arch/mmc.h> | 41 | #include <asm/arch/mmc.h> |
40 | #include <asm/arch/udc.h> | 42 | #include <asm/arch/udc.h> |
43 | #include <asm/arch/tosa_bt.h> | ||
41 | 44 | ||
42 | #include <asm/mach/arch.h> | 45 | #include <asm/mach/arch.h> |
43 | #include <asm/mach/map.h> | ||
44 | #include <asm/mach/irq.h> | ||
45 | #include <asm/arch/tosa.h> | 46 | #include <asm/arch/tosa.h> |
46 | 47 | ||
47 | #include <asm/hardware/scoop.h> | 48 | #include <asm/hardware/scoop.h> |
@@ -86,7 +87,7 @@ static unsigned long tosa_pin_config[] = { | |||
86 | GPIO6_MMC_CLK, | 87 | GPIO6_MMC_CLK, |
87 | GPIO8_MMC_CS0, | 88 | GPIO8_MMC_CS0, |
88 | GPIO9_GPIO, /* Detect */ | 89 | GPIO9_GPIO, /* Detect */ |
89 | // GPIO10 nSD_INT | 90 | GPIO10_GPIO, /* nSD_INT */ |
90 | 91 | ||
91 | /* CF */ | 92 | /* CF */ |
92 | GPIO13_GPIO, /* CD_IRQ */ | 93 | GPIO13_GPIO, /* CD_IRQ */ |
@@ -124,34 +125,34 @@ static unsigned long tosa_pin_config[] = { | |||
124 | GPIO44_BTUART_CTS, | 125 | GPIO44_BTUART_CTS, |
125 | GPIO45_BTUART_RTS, | 126 | GPIO45_BTUART_RTS, |
126 | 127 | ||
127 | /* IrDA */ | ||
128 | GPIO46_STUART_RXD, | ||
129 | GPIO47_STUART_TXD, | ||
130 | |||
131 | /* Keybd */ | 128 | /* Keybd */ |
132 | GPIO58_GPIO, | 129 | GPIO58_GPIO | MFP_LPM_DRIVE_LOW, |
133 | GPIO59_GPIO, | 130 | GPIO59_GPIO | MFP_LPM_DRIVE_LOW, |
134 | GPIO60_GPIO, | 131 | GPIO60_GPIO | MFP_LPM_DRIVE_LOW, |
135 | GPIO61_GPIO, | 132 | GPIO61_GPIO | MFP_LPM_DRIVE_LOW, |
136 | GPIO62_GPIO, | 133 | GPIO62_GPIO | MFP_LPM_DRIVE_LOW, |
137 | GPIO63_GPIO, | 134 | GPIO63_GPIO | MFP_LPM_DRIVE_LOW, |
138 | GPIO64_GPIO, | 135 | GPIO64_GPIO | MFP_LPM_DRIVE_LOW, |
139 | GPIO65_GPIO, | 136 | GPIO65_GPIO | MFP_LPM_DRIVE_LOW, |
140 | GPIO66_GPIO, | 137 | GPIO66_GPIO | MFP_LPM_DRIVE_LOW, |
141 | GPIO67_GPIO, | 138 | GPIO67_GPIO | MFP_LPM_DRIVE_LOW, |
142 | GPIO68_GPIO, | 139 | GPIO68_GPIO | MFP_LPM_DRIVE_LOW, |
143 | GPIO69_GPIO, | 140 | GPIO69_GPIO | MFP_LPM_DRIVE_LOW, |
144 | GPIO70_GPIO, | 141 | GPIO70_GPIO | MFP_LPM_DRIVE_LOW, |
145 | GPIO71_GPIO, | 142 | GPIO71_GPIO | MFP_LPM_DRIVE_LOW, |
146 | GPIO72_GPIO, | 143 | GPIO72_GPIO | MFP_LPM_DRIVE_LOW, |
147 | GPIO73_GPIO, | 144 | GPIO73_GPIO | MFP_LPM_DRIVE_LOW, |
148 | GPIO74_GPIO, | 145 | GPIO74_GPIO | MFP_LPM_DRIVE_LOW, |
149 | GPIO75_GPIO, | 146 | GPIO75_GPIO | MFP_LPM_DRIVE_LOW, |
150 | 147 | ||
151 | /* SPI */ | 148 | /* SPI */ |
152 | GPIO81_SSP2_CLK_OUT, | 149 | GPIO81_SSP2_CLK_OUT, |
153 | GPIO82_SSP2_FRM_OUT, | 150 | GPIO82_SSP2_FRM_OUT, |
154 | GPIO83_SSP2_TXD, | 151 | GPIO83_SSP2_TXD, |
152 | |||
153 | /* IrDA is managed in other way */ | ||
154 | GPIO46_GPIO, | ||
155 | GPIO47_GPIO, | ||
155 | }; | 156 | }; |
156 | 157 | ||
157 | /* | 158 | /* |
@@ -249,6 +250,15 @@ static int tosa_mci_init(struct device *dev, irq_handler_t tosa_detect_int, void | |||
249 | 250 | ||
250 | tosa_mci_platform_data.detect_delay = msecs_to_jiffies(250); | 251 | tosa_mci_platform_data.detect_delay = msecs_to_jiffies(250); |
251 | 252 | ||
253 | err = gpio_request(TOSA_GPIO_nSD_DETECT, "MMC/SD card detect"); | ||
254 | if (err) { | ||
255 | printk(KERN_ERR "tosa_mci_init: can't request nSD_DETECT gpio\n"); | ||
256 | goto err_gpio_detect; | ||
257 | } | ||
258 | err = gpio_direction_input(TOSA_GPIO_nSD_DETECT); | ||
259 | if (err) | ||
260 | goto err_gpio_detect_dir; | ||
261 | |||
252 | err = request_irq(TOSA_IRQ_GPIO_nSD_DETECT, tosa_detect_int, | 262 | err = request_irq(TOSA_IRQ_GPIO_nSD_DETECT, tosa_detect_int, |
253 | IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | 263 | IRQF_DISABLED | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
254 | "MMC/SD card detect", data); | 264 | "MMC/SD card detect", data); |
@@ -257,7 +267,7 @@ static int tosa_mci_init(struct device *dev, irq_handler_t tosa_detect_int, void | |||
257 | goto err_irq; | 267 | goto err_irq; |
258 | } | 268 | } |
259 | 269 | ||
260 | err = gpio_request(TOSA_GPIO_SD_WP, "sd_wp"); | 270 | err = gpio_request(TOSA_GPIO_SD_WP, "SD Write Protect"); |
261 | if (err) { | 271 | if (err) { |
262 | printk(KERN_ERR "tosa_mci_init: can't request SD_WP gpio\n"); | 272 | printk(KERN_ERR "tosa_mci_init: can't request SD_WP gpio\n"); |
263 | goto err_gpio_wp; | 273 | goto err_gpio_wp; |
@@ -266,7 +276,7 @@ static int tosa_mci_init(struct device *dev, irq_handler_t tosa_detect_int, void | |||
266 | if (err) | 276 | if (err) |
267 | goto err_gpio_wp_dir; | 277 | goto err_gpio_wp_dir; |
268 | 278 | ||
269 | err = gpio_request(TOSA_GPIO_PWR_ON, "sd_pwr"); | 279 | err = gpio_request(TOSA_GPIO_PWR_ON, "SD Power"); |
270 | if (err) { | 280 | if (err) { |
271 | printk(KERN_ERR "tosa_mci_init: can't request SD_PWR gpio\n"); | 281 | printk(KERN_ERR "tosa_mci_init: can't request SD_PWR gpio\n"); |
272 | goto err_gpio_pwr; | 282 | goto err_gpio_pwr; |
@@ -275,8 +285,20 @@ static int tosa_mci_init(struct device *dev, irq_handler_t tosa_detect_int, void | |||
275 | if (err) | 285 | if (err) |
276 | goto err_gpio_pwr_dir; | 286 | goto err_gpio_pwr_dir; |
277 | 287 | ||
288 | err = gpio_request(TOSA_GPIO_nSD_INT, "SD Int"); | ||
289 | if (err) { | ||
290 | printk(KERN_ERR "tosa_mci_init: can't request SD_PWR gpio\n"); | ||
291 | goto err_gpio_int; | ||
292 | } | ||
293 | err = gpio_direction_input(TOSA_GPIO_nSD_INT); | ||
294 | if (err) | ||
295 | goto err_gpio_int_dir; | ||
296 | |||
278 | return 0; | 297 | return 0; |
279 | 298 | ||
299 | err_gpio_int_dir: | ||
300 | gpio_free(TOSA_GPIO_nSD_INT); | ||
301 | err_gpio_int: | ||
280 | err_gpio_pwr_dir: | 302 | err_gpio_pwr_dir: |
281 | gpio_free(TOSA_GPIO_PWR_ON); | 303 | gpio_free(TOSA_GPIO_PWR_ON); |
282 | err_gpio_pwr: | 304 | err_gpio_pwr: |
@@ -285,6 +307,9 @@ err_gpio_wp_dir: | |||
285 | err_gpio_wp: | 307 | err_gpio_wp: |
286 | free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data); | 308 | free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data); |
287 | err_irq: | 309 | err_irq: |
310 | err_gpio_detect_dir: | ||
311 | gpio_free(TOSA_GPIO_nSD_DETECT); | ||
312 | err_gpio_detect: | ||
288 | return err; | 313 | return err; |
289 | } | 314 | } |
290 | 315 | ||
@@ -306,9 +331,11 @@ static int tosa_mci_get_ro(struct device *dev) | |||
306 | 331 | ||
307 | static void tosa_mci_exit(struct device *dev, void *data) | 332 | static void tosa_mci_exit(struct device *dev, void *data) |
308 | { | 333 | { |
334 | gpio_free(TOSA_GPIO_nSD_INT); | ||
309 | gpio_free(TOSA_GPIO_PWR_ON); | 335 | gpio_free(TOSA_GPIO_PWR_ON); |
310 | gpio_free(TOSA_GPIO_SD_WP); | 336 | gpio_free(TOSA_GPIO_SD_WP); |
311 | free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data); | 337 | free_irq(TOSA_IRQ_GPIO_nSD_DETECT, data); |
338 | gpio_free(TOSA_GPIO_nSD_DETECT); | ||
312 | } | 339 | } |
313 | 340 | ||
314 | static struct pxamci_platform_data tosa_mci_platform_data = { | 341 | static struct pxamci_platform_data tosa_mci_platform_data = { |
@@ -322,29 +349,55 @@ static struct pxamci_platform_data tosa_mci_platform_data = { | |||
322 | /* | 349 | /* |
323 | * Irda | 350 | * Irda |
324 | */ | 351 | */ |
352 | static void tosa_irda_transceiver_mode(struct device *dev, int mode) | ||
353 | { | ||
354 | if (mode & IR_OFF) { | ||
355 | gpio_set_value(TOSA_GPIO_IR_POWERDWN, 0); | ||
356 | pxa2xx_transceiver_mode(dev, mode); | ||
357 | gpio_direction_output(TOSA_GPIO_IRDA_TX, 0); | ||
358 | } else { | ||
359 | pxa2xx_transceiver_mode(dev, mode); | ||
360 | gpio_set_value(TOSA_GPIO_IR_POWERDWN, 1); | ||
361 | } | ||
362 | } | ||
363 | |||
325 | static int tosa_irda_startup(struct device *dev) | 364 | static int tosa_irda_startup(struct device *dev) |
326 | { | 365 | { |
327 | int ret; | 366 | int ret; |
328 | 367 | ||
368 | ret = gpio_request(TOSA_GPIO_IRDA_TX, "IrDA TX"); | ||
369 | if (ret) | ||
370 | goto err_tx; | ||
371 | ret = gpio_direction_output(TOSA_GPIO_IRDA_TX, 0); | ||
372 | if (ret) | ||
373 | goto err_tx_dir; | ||
374 | |||
329 | ret = gpio_request(TOSA_GPIO_IR_POWERDWN, "IrDA powerdown"); | 375 | ret = gpio_request(TOSA_GPIO_IR_POWERDWN, "IrDA powerdown"); |
330 | if (ret) | 376 | if (ret) |
331 | return ret; | 377 | goto err_pwr; |
332 | 378 | ||
333 | ret = gpio_direction_output(TOSA_GPIO_IR_POWERDWN, 0); | 379 | ret = gpio_direction_output(TOSA_GPIO_IR_POWERDWN, 0); |
334 | if (ret) | 380 | if (ret) |
335 | gpio_free(TOSA_GPIO_IR_POWERDWN); | 381 | goto err_pwr_dir; |
336 | 382 | ||
337 | return ret; | 383 | tosa_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF); |
338 | } | ||
339 | 384 | ||
340 | static void tosa_irda_shutdown(struct device *dev) | 385 | return 0; |
341 | { | 386 | |
387 | err_pwr_dir: | ||
342 | gpio_free(TOSA_GPIO_IR_POWERDWN); | 388 | gpio_free(TOSA_GPIO_IR_POWERDWN); |
389 | err_pwr: | ||
390 | err_tx_dir: | ||
391 | gpio_free(TOSA_GPIO_IRDA_TX); | ||
392 | err_tx: | ||
393 | return ret; | ||
343 | } | 394 | } |
344 | 395 | ||
345 | static void tosa_irda_transceiver_mode(struct device *dev, int mode) | 396 | static void tosa_irda_shutdown(struct device *dev) |
346 | { | 397 | { |
347 | gpio_set_value(TOSA_GPIO_IR_POWERDWN, !(mode & IR_OFF)); | 398 | tosa_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF); |
399 | gpio_free(TOSA_GPIO_IR_POWERDWN); | ||
400 | gpio_free(TOSA_GPIO_IRDA_TX); | ||
348 | } | 401 | } |
349 | 402 | ||
350 | static struct pxaficp_platform_data tosa_ficp_platform_data = { | 403 | static struct pxaficp_platform_data tosa_ficp_platform_data = { |
@@ -355,6 +408,70 @@ static struct pxaficp_platform_data tosa_ficp_platform_data = { | |||
355 | }; | 408 | }; |
356 | 409 | ||
357 | /* | 410 | /* |
411 | * Tosa AC IN | ||
412 | */ | ||
413 | static int tosa_power_init(struct device *dev) | ||
414 | { | ||
415 | int ret = gpio_request(TOSA_GPIO_AC_IN, "ac in"); | ||
416 | if (ret) | ||
417 | goto err_gpio_req; | ||
418 | |||
419 | ret = gpio_direction_input(TOSA_GPIO_AC_IN); | ||
420 | if (ret) | ||
421 | goto err_gpio_in; | ||
422 | |||
423 | return 0; | ||
424 | |||
425 | err_gpio_in: | ||
426 | gpio_free(TOSA_GPIO_AC_IN); | ||
427 | err_gpio_req: | ||
428 | return ret; | ||
429 | } | ||
430 | |||
431 | static void tosa_power_exit(struct device *dev) | ||
432 | { | ||
433 | gpio_free(TOSA_GPIO_AC_IN); | ||
434 | } | ||
435 | |||
436 | static int tosa_power_ac_online(void) | ||
437 | { | ||
438 | return gpio_get_value(TOSA_GPIO_AC_IN) == 0; | ||
439 | } | ||
440 | |||
441 | static char *tosa_ac_supplied_to[] = { | ||
442 | "main-battery", | ||
443 | "backup-battery", | ||
444 | "jacket-battery", | ||
445 | }; | ||
446 | |||
447 | static struct pda_power_pdata tosa_power_data = { | ||
448 | .init = tosa_power_init, | ||
449 | .is_ac_online = tosa_power_ac_online, | ||
450 | .exit = tosa_power_exit, | ||
451 | .supplied_to = tosa_ac_supplied_to, | ||
452 | .num_supplicants = ARRAY_SIZE(tosa_ac_supplied_to), | ||
453 | }; | ||
454 | |||
455 | static struct resource tosa_power_resource[] = { | ||
456 | { | ||
457 | .name = "ac", | ||
458 | .start = gpio_to_irq(TOSA_GPIO_AC_IN), | ||
459 | .end = gpio_to_irq(TOSA_GPIO_AC_IN), | ||
460 | .flags = IORESOURCE_IRQ | | ||
461 | IORESOURCE_IRQ_HIGHEDGE | | ||
462 | IORESOURCE_IRQ_LOWEDGE, | ||
463 | }, | ||
464 | }; | ||
465 | |||
466 | static struct platform_device tosa_power_device = { | ||
467 | .name = "pda-power", | ||
468 | .id = -1, | ||
469 | .dev.platform_data = &tosa_power_data, | ||
470 | .resource = tosa_power_resource, | ||
471 | .num_resources = ARRAY_SIZE(tosa_power_resource), | ||
472 | }; | ||
473 | |||
474 | /* | ||
358 | * Tosa Keyboard | 475 | * Tosa Keyboard |
359 | */ | 476 | */ |
360 | static struct platform_device tosakbd_device = { | 477 | static struct platform_device tosakbd_device = { |
@@ -439,7 +556,7 @@ static struct gpio_led tosa_gpio_leds[] = { | |||
439 | }, | 556 | }, |
440 | { | 557 | { |
441 | .name = "tosa:blue:bluetooth", | 558 | .name = "tosa:blue:bluetooth", |
442 | .default_trigger = "none", | 559 | .default_trigger = "tosa-bt", |
443 | .gpio = TOSA_GPIO_BT_LED, | 560 | .gpio = TOSA_GPIO_BT_LED, |
444 | }, | 561 | }, |
445 | }; | 562 | }; |
@@ -457,21 +574,184 @@ static struct platform_device tosaled_device = { | |||
457 | }, | 574 | }, |
458 | }; | 575 | }; |
459 | 576 | ||
577 | /* | ||
578 | * Toshiba Mobile IO Controller | ||
579 | */ | ||
580 | static struct resource tc6393xb_resources[] = { | ||
581 | [0] = { | ||
582 | .start = TOSA_LCDC_PHYS, | ||
583 | .end = TOSA_LCDC_PHYS + 0x3ffffff, | ||
584 | .flags = IORESOURCE_MEM, | ||
585 | }, | ||
586 | |||
587 | [1] = { | ||
588 | .start = TOSA_IRQ_GPIO_TC6393XB_INT, | ||
589 | .end = TOSA_IRQ_GPIO_TC6393XB_INT, | ||
590 | .flags = IORESOURCE_IRQ, | ||
591 | }, | ||
592 | }; | ||
593 | |||
594 | |||
595 | static int tosa_tc6393xb_enable(struct platform_device *dev) | ||
596 | { | ||
597 | int rc; | ||
598 | |||
599 | rc = gpio_request(TOSA_GPIO_TC6393XB_REST_IN, "tc6393xb #pclr"); | ||
600 | if (rc) | ||
601 | goto err_req_pclr; | ||
602 | rc = gpio_request(TOSA_GPIO_TC6393XB_SUSPEND, "tc6393xb #suspend"); | ||
603 | if (rc) | ||
604 | goto err_req_suspend; | ||
605 | rc = gpio_request(TOSA_GPIO_TC6393XB_L3V_ON, "l3v"); | ||
606 | if (rc) | ||
607 | goto err_req_l3v; | ||
608 | rc = gpio_direction_output(TOSA_GPIO_TC6393XB_L3V_ON, 0); | ||
609 | if (rc) | ||
610 | goto err_dir_l3v; | ||
611 | rc = gpio_direction_output(TOSA_GPIO_TC6393XB_SUSPEND, 0); | ||
612 | if (rc) | ||
613 | goto err_dir_suspend; | ||
614 | rc = gpio_direction_output(TOSA_GPIO_TC6393XB_REST_IN, 0); | ||
615 | if (rc) | ||
616 | goto err_dir_pclr; | ||
617 | |||
618 | mdelay(1); | ||
619 | |||
620 | gpio_set_value(TOSA_GPIO_TC6393XB_SUSPEND, 1); | ||
621 | |||
622 | mdelay(10); | ||
623 | |||
624 | gpio_set_value(TOSA_GPIO_TC6393XB_REST_IN, 1); | ||
625 | gpio_set_value(TOSA_GPIO_TC6393XB_L3V_ON, 1); | ||
626 | |||
627 | return 0; | ||
628 | err_dir_pclr: | ||
629 | err_dir_suspend: | ||
630 | err_dir_l3v: | ||
631 | gpio_free(TOSA_GPIO_TC6393XB_L3V_ON); | ||
632 | err_req_l3v: | ||
633 | gpio_free(TOSA_GPIO_TC6393XB_SUSPEND); | ||
634 | err_req_suspend: | ||
635 | gpio_free(TOSA_GPIO_TC6393XB_REST_IN); | ||
636 | err_req_pclr: | ||
637 | return rc; | ||
638 | } | ||
639 | |||
640 | static int tosa_tc6393xb_disable(struct platform_device *dev) | ||
641 | { | ||
642 | gpio_free(TOSA_GPIO_TC6393XB_L3V_ON); | ||
643 | gpio_free(TOSA_GPIO_TC6393XB_SUSPEND); | ||
644 | gpio_free(TOSA_GPIO_TC6393XB_REST_IN); | ||
645 | |||
646 | return 0; | ||
647 | } | ||
648 | |||
649 | static int tosa_tc6393xb_resume(struct platform_device *dev) | ||
650 | { | ||
651 | gpio_set_value(TOSA_GPIO_TC6393XB_SUSPEND, 1); | ||
652 | mdelay(10); | ||
653 | gpio_set_value(TOSA_GPIO_TC6393XB_L3V_ON, 1); | ||
654 | mdelay(10); | ||
655 | |||
656 | return 0; | ||
657 | } | ||
658 | |||
659 | static int tosa_tc6393xb_suspend(struct platform_device *dev) | ||
660 | { | ||
661 | gpio_set_value(TOSA_GPIO_TC6393XB_L3V_ON, 0); | ||
662 | gpio_set_value(TOSA_GPIO_TC6393XB_SUSPEND, 0); | ||
663 | return 0; | ||
664 | } | ||
665 | |||
666 | static struct mtd_partition tosa_nand_partition[] = { | ||
667 | { | ||
668 | .name = "smf", | ||
669 | .offset = 0, | ||
670 | .size = 7 * 1024 * 1024, | ||
671 | }, | ||
672 | { | ||
673 | .name = "root", | ||
674 | .offset = MTDPART_OFS_APPEND, | ||
675 | .size = 28 * 1024 * 1024, | ||
676 | }, | ||
677 | { | ||
678 | .name = "home", | ||
679 | .offset = MTDPART_OFS_APPEND, | ||
680 | .size = MTDPART_SIZ_FULL, | ||
681 | }, | ||
682 | }; | ||
683 | |||
684 | static uint8_t scan_ff_pattern[] = { 0xff, 0xff }; | ||
685 | |||
686 | static struct nand_bbt_descr tosa_tc6393xb_nand_bbt = { | ||
687 | .options = 0, | ||
688 | .offs = 4, | ||
689 | .len = 2, | ||
690 | .pattern = scan_ff_pattern | ||
691 | }; | ||
692 | |||
693 | static struct tmio_nand_data tosa_tc6393xb_nand_config = { | ||
694 | .num_partitions = ARRAY_SIZE(tosa_nand_partition), | ||
695 | .partition = tosa_nand_partition, | ||
696 | .badblock_pattern = &tosa_tc6393xb_nand_bbt, | ||
697 | }; | ||
698 | |||
699 | static struct tc6393xb_platform_data tosa_tc6393xb_setup = { | ||
700 | .scr_pll2cr = 0x0cc1, | ||
701 | .scr_gper = 0x3300, | ||
702 | .scr_gpo_dsr = | ||
703 | TOSA_TC6393XB_GPIO_BIT(TOSA_GPIO_CARD_VCC_ON), | ||
704 | .scr_gpo_doecr = | ||
705 | TOSA_TC6393XB_GPIO_BIT(TOSA_GPIO_CARD_VCC_ON), | ||
706 | |||
707 | .irq_base = IRQ_BOARD_START, | ||
708 | .gpio_base = TOSA_TC6393XB_GPIO_BASE, | ||
709 | |||
710 | .enable = tosa_tc6393xb_enable, | ||
711 | .disable = tosa_tc6393xb_disable, | ||
712 | .suspend = tosa_tc6393xb_suspend, | ||
713 | .resume = tosa_tc6393xb_resume, | ||
714 | |||
715 | .nand_data = &tosa_tc6393xb_nand_config, | ||
716 | }; | ||
717 | |||
718 | |||
719 | static struct platform_device tc6393xb_device = { | ||
720 | .name = "tc6393xb", | ||
721 | .id = -1, | ||
722 | .dev = { | ||
723 | .platform_data = &tosa_tc6393xb_setup, | ||
724 | }, | ||
725 | .num_resources = ARRAY_SIZE(tc6393xb_resources), | ||
726 | .resource = tc6393xb_resources, | ||
727 | }; | ||
728 | |||
729 | static struct tosa_bt_data tosa_bt_data = { | ||
730 | .gpio_pwr = TOSA_GPIO_BT_PWR_EN, | ||
731 | .gpio_reset = TOSA_GPIO_BT_RESET, | ||
732 | }; | ||
733 | |||
734 | static struct platform_device tosa_bt_device = { | ||
735 | .name = "tosa-bt", | ||
736 | .id = -1, | ||
737 | .dev.platform_data = &tosa_bt_data, | ||
738 | }; | ||
739 | |||
740 | |||
460 | static struct platform_device *devices[] __initdata = { | 741 | static struct platform_device *devices[] __initdata = { |
461 | &tosascoop_device, | 742 | &tosascoop_device, |
462 | &tosascoop_jc_device, | 743 | &tosascoop_jc_device, |
744 | &tc6393xb_device, | ||
745 | &tosa_power_device, | ||
463 | &tosakbd_device, | 746 | &tosakbd_device, |
464 | &tosa_gpio_keys_device, | 747 | &tosa_gpio_keys_device, |
465 | &tosaled_device, | 748 | &tosaled_device, |
749 | &tosa_bt_device, | ||
466 | }; | 750 | }; |
467 | 751 | ||
468 | static void tosa_poweroff(void) | 752 | static void tosa_poweroff(void) |
469 | { | 753 | { |
470 | gpio_direction_output(TOSA_GPIO_ON_RESET, 0); | 754 | arm_machine_restart('g'); |
471 | gpio_set_value(TOSA_GPIO_ON_RESET, 1); | ||
472 | |||
473 | mdelay(1000); | ||
474 | arm_machine_restart('h'); | ||
475 | } | 755 | } |
476 | 756 | ||
477 | static void tosa_restart(char mode) | 757 | static void tosa_restart(char mode) |
@@ -485,10 +765,14 @@ static void tosa_restart(char mode) | |||
485 | 765 | ||
486 | static void __init tosa_init(void) | 766 | static void __init tosa_init(void) |
487 | { | 767 | { |
768 | int dummy; | ||
769 | |||
488 | pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_config)); | 770 | pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_config)); |
489 | gpio_set_wake(MFP_PIN_GPIO1, 1); | 771 | gpio_set_wake(MFP_PIN_GPIO1, 1); |
490 | /* We can't pass to gpio-keys since it will drop the Reset altfunc */ | 772 | /* We can't pass to gpio-keys since it will drop the Reset altfunc */ |
491 | 773 | ||
774 | init_gpio_reset(TOSA_GPIO_ON_RESET); | ||
775 | |||
492 | pm_power_off = tosa_poweroff; | 776 | pm_power_off = tosa_poweroff; |
493 | arm_pm_restart = tosa_restart; | 777 | arm_pm_restart = tosa_restart; |
494 | 778 | ||
@@ -497,6 +781,10 @@ static void __init tosa_init(void) | |||
497 | /* enable batt_fault */ | 781 | /* enable batt_fault */ |
498 | PMCR = 0x01; | 782 | PMCR = 0x01; |
499 | 783 | ||
784 | dummy = gpiochip_reserve(TOSA_SCOOP_GPIO_BASE, 12); | ||
785 | dummy = gpiochip_reserve(TOSA_SCOOP_JC_GPIO_BASE, 12); | ||
786 | dummy = gpiochip_reserve(TOSA_TC6393XB_GPIO_BASE, 16); | ||
787 | |||
500 | pxa_set_mci_info(&tosa_mci_platform_data); | 788 | pxa_set_mci_info(&tosa_mci_platform_data); |
501 | pxa_set_udc_info(&udc_info); | 789 | pxa_set_udc_info(&udc_info); |
502 | pxa_set_ficp_info(&tosa_ficp_platform_data); | 790 | pxa_set_ficp_info(&tosa_ficp_platform_data); |