diff options
author | Grazvydas Ignotas <notasas@gmail.com> | 2010-08-02 06:18:01 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2010-08-02 06:18:01 -0400 |
commit | 79ccf549b33c613b57eebcb03f8b24644c545a88 (patch) | |
tree | 6794006bdf1b234e81a684be699bf6a0037db335 /arch/arm/mach-omap2/board-omap3pandora.c | |
parent | ad74db60418fcb5946529816b54b6f3ceeff3d6d (diff) |
omap3: pandora: add NAND and wifi support
Add platform data for NAND and wifi, also setup all GPIOs
needed to use the wifi chip.
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/board-omap3pandora.c')
-rw-r--r-- | arch/arm/mach-omap2/board-omap3pandora.c | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c index 7a127291b7da..a58bdef1b4da 100644 --- a/arch/arm/mach-omap2/board-omap3pandora.c +++ b/arch/arm/mach-omap2/board-omap3pandora.c | |||
@@ -25,6 +25,9 @@ | |||
25 | #include <linux/spi/ads7846.h> | 25 | #include <linux/spi/ads7846.h> |
26 | #include <linux/regulator/machine.h> | 26 | #include <linux/regulator/machine.h> |
27 | #include <linux/i2c/twl.h> | 27 | #include <linux/i2c/twl.h> |
28 | #include <linux/spi/wl12xx.h> | ||
29 | #include <linux/mtd/partitions.h> | ||
30 | #include <linux/mtd/nand.h> | ||
28 | #include <linux/leds.h> | 31 | #include <linux/leds.h> |
29 | #include <linux/input.h> | 32 | #include <linux/input.h> |
30 | #include <linux/input/matrix_keypad.h> | 33 | #include <linux/input/matrix_keypad.h> |
@@ -41,13 +44,50 @@ | |||
41 | #include <plat/mcspi.h> | 44 | #include <plat/mcspi.h> |
42 | #include <plat/usb.h> | 45 | #include <plat/usb.h> |
43 | #include <plat/display.h> | 46 | #include <plat/display.h> |
47 | #include <plat/nand.h> | ||
44 | 48 | ||
45 | #include "mux.h" | 49 | #include "mux.h" |
46 | #include "sdram-micron-mt46h32m32lf-6.h" | 50 | #include "sdram-micron-mt46h32m32lf-6.h" |
47 | #include "hsmmc.h" | 51 | #include "hsmmc.h" |
48 | 52 | ||
53 | #define PANDORA_WIFI_IRQ_GPIO 21 | ||
54 | #define PANDORA_WIFI_NRESET_GPIO 23 | ||
49 | #define OMAP3_PANDORA_TS_GPIO 94 | 55 | #define OMAP3_PANDORA_TS_GPIO 94 |
50 | 56 | ||
57 | #define NAND_BLOCK_SIZE SZ_128K | ||
58 | |||
59 | static struct mtd_partition omap3pandora_nand_partitions[] = { | ||
60 | { | ||
61 | .name = "xloader", | ||
62 | .offset = 0, | ||
63 | .size = 4 * NAND_BLOCK_SIZE, | ||
64 | .mask_flags = MTD_WRITEABLE | ||
65 | }, { | ||
66 | .name = "uboot", | ||
67 | .offset = MTDPART_OFS_APPEND, | ||
68 | .size = 15 * NAND_BLOCK_SIZE, | ||
69 | }, { | ||
70 | .name = "uboot-env", | ||
71 | .offset = MTDPART_OFS_APPEND, | ||
72 | .size = 1 * NAND_BLOCK_SIZE, | ||
73 | }, { | ||
74 | .name = "boot", | ||
75 | .offset = MTDPART_OFS_APPEND, | ||
76 | .size = 80 * NAND_BLOCK_SIZE, | ||
77 | }, { | ||
78 | .name = "rootfs", | ||
79 | .offset = MTDPART_OFS_APPEND, | ||
80 | .size = MTDPART_SIZ_FULL, | ||
81 | }, | ||
82 | }; | ||
83 | |||
84 | static struct omap_nand_platform_data pandora_nand_data = { | ||
85 | .cs = 0, | ||
86 | .devsize = 1, /* '0' for 8-bit, '1' for 16-bit device */ | ||
87 | .parts = omap3pandora_nand_partitions, | ||
88 | .nr_parts = ARRAY_SIZE(omap3pandora_nand_partitions), | ||
89 | }; | ||
90 | |||
51 | static struct gpio_led pandora_gpio_leds[] = { | 91 | static struct gpio_led pandora_gpio_leds[] = { |
52 | { | 92 | { |
53 | .name = "pandora::sd1", | 93 | .name = "pandora::sd1", |
@@ -246,12 +286,33 @@ static struct omap2_hsmmc_info omap3pandora_mmc[] = { | |||
246 | static int omap3pandora_twl_gpio_setup(struct device *dev, | 286 | static int omap3pandora_twl_gpio_setup(struct device *dev, |
247 | unsigned gpio, unsigned ngpio) | 287 | unsigned gpio, unsigned ngpio) |
248 | { | 288 | { |
289 | int ret, gpio_32khz; | ||
290 | |||
249 | /* gpio + {0,1} is "mmc{0,1}_cd" (input/IRQ) */ | 291 | /* gpio + {0,1} is "mmc{0,1}_cd" (input/IRQ) */ |
250 | omap3pandora_mmc[0].gpio_cd = gpio + 0; | 292 | omap3pandora_mmc[0].gpio_cd = gpio + 0; |
251 | omap3pandora_mmc[1].gpio_cd = gpio + 1; | 293 | omap3pandora_mmc[1].gpio_cd = gpio + 1; |
252 | omap2_hsmmc_init(omap3pandora_mmc); | 294 | omap2_hsmmc_init(omap3pandora_mmc); |
253 | 295 | ||
296 | /* gpio + 13 drives 32kHz buffer for wifi module */ | ||
297 | gpio_32khz = gpio + 13; | ||
298 | ret = gpio_request(gpio_32khz, "wifi 32kHz"); | ||
299 | if (ret < 0) { | ||
300 | pr_err("Cannot get GPIO line %d, ret=%d\n", gpio_32khz, ret); | ||
301 | goto fail; | ||
302 | } | ||
303 | |||
304 | ret = gpio_direction_output(gpio_32khz, 1); | ||
305 | if (ret < 0) { | ||
306 | pr_err("Cannot set GPIO line %d, ret=%d\n", gpio_32khz, ret); | ||
307 | goto fail_direction; | ||
308 | } | ||
309 | |||
254 | return 0; | 310 | return 0; |
311 | |||
312 | fail_direction: | ||
313 | gpio_free(gpio_32khz); | ||
314 | fail: | ||
315 | return -ENODEV; | ||
255 | } | 316 | } |
256 | 317 | ||
257 | static struct twl4030_gpio_platform_data omap3pandora_gpio_data = { | 318 | static struct twl4030_gpio_platform_data omap3pandora_gpio_data = { |
@@ -530,10 +591,67 @@ static void __init omap3pandora_init_irq(void) | |||
530 | omap_gpio_init(); | 591 | omap_gpio_init(); |
531 | } | 592 | } |
532 | 593 | ||
594 | static void pandora_wl1251_set_power(bool enable) | ||
595 | { | ||
596 | /* | ||
597 | * Keep power always on until wl1251_sdio driver learns to re-init | ||
598 | * the chip after powering it down and back up. | ||
599 | */ | ||
600 | } | ||
601 | |||
602 | static struct wl12xx_platform_data pandora_wl1251_pdata = { | ||
603 | .set_power = pandora_wl1251_set_power, | ||
604 | .use_eeprom = true, | ||
605 | }; | ||
606 | |||
607 | static struct platform_device pandora_wl1251_data = { | ||
608 | .name = "wl1251_data", | ||
609 | .id = -1, | ||
610 | .dev = { | ||
611 | .platform_data = &pandora_wl1251_pdata, | ||
612 | }, | ||
613 | }; | ||
614 | |||
615 | static void pandora_wl1251_init(void) | ||
616 | { | ||
617 | int ret; | ||
618 | |||
619 | ret = gpio_request(PANDORA_WIFI_IRQ_GPIO, "wl1251 irq"); | ||
620 | if (ret < 0) | ||
621 | goto fail; | ||
622 | |||
623 | ret = gpio_direction_input(PANDORA_WIFI_IRQ_GPIO); | ||
624 | if (ret < 0) | ||
625 | goto fail_irq; | ||
626 | |||
627 | pandora_wl1251_pdata.irq = gpio_to_irq(PANDORA_WIFI_IRQ_GPIO); | ||
628 | if (pandora_wl1251_pdata.irq < 0) | ||
629 | goto fail_irq; | ||
630 | |||
631 | ret = gpio_request(PANDORA_WIFI_NRESET_GPIO, "wl1251 nreset"); | ||
632 | if (ret < 0) | ||
633 | goto fail_irq; | ||
634 | |||
635 | /* start powered so that it probes with MMC subsystem */ | ||
636 | ret = gpio_direction_output(PANDORA_WIFI_NRESET_GPIO, 1); | ||
637 | if (ret < 0) | ||
638 | goto fail_nreset; | ||
639 | |||
640 | return; | ||
641 | |||
642 | fail_nreset: | ||
643 | gpio_free(PANDORA_WIFI_NRESET_GPIO); | ||
644 | fail_irq: | ||
645 | gpio_free(PANDORA_WIFI_IRQ_GPIO); | ||
646 | fail: | ||
647 | printk(KERN_ERR "wl1251 board initialisation failed\n"); | ||
648 | } | ||
649 | |||
533 | static struct platform_device *omap3pandora_devices[] __initdata = { | 650 | static struct platform_device *omap3pandora_devices[] __initdata = { |
534 | &pandora_leds_gpio, | 651 | &pandora_leds_gpio, |
535 | &pandora_keys_gpio, | 652 | &pandora_keys_gpio, |
536 | &pandora_dss_device, | 653 | &pandora_dss_device, |
654 | &pandora_wl1251_data, | ||
537 | }; | 655 | }; |
538 | 656 | ||
539 | static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { | 657 | static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { |
@@ -566,6 +684,7 @@ static void __init omap3pandora_init(void) | |||
566 | { | 684 | { |
567 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); | 685 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
568 | omap3pandora_i2c_init(); | 686 | omap3pandora_i2c_init(); |
687 | pandora_wl1251_init(); | ||
569 | platform_add_devices(omap3pandora_devices, | 688 | platform_add_devices(omap3pandora_devices, |
570 | ARRAY_SIZE(omap3pandora_devices)); | 689 | ARRAY_SIZE(omap3pandora_devices)); |
571 | omap_serial_init(); | 690 | omap_serial_init(); |
@@ -574,6 +693,7 @@ static void __init omap3pandora_init(void) | |||
574 | omap3pandora_ads7846_init(); | 693 | omap3pandora_ads7846_init(); |
575 | usb_ehci_init(&ehci_pdata); | 694 | usb_ehci_init(&ehci_pdata); |
576 | usb_musb_init(&musb_board_data); | 695 | usb_musb_init(&musb_board_data); |
696 | gpmc_nand_init(&pandora_nand_data); | ||
577 | 697 | ||
578 | /* Ensure SDRC pins are mux'd for self-refresh */ | 698 | /* Ensure SDRC pins are mux'd for self-refresh */ |
579 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); | 699 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); |