diff options
Diffstat (limited to 'arch/arm/mach-omap2/board-n8x0.c')
-rw-r--r-- | arch/arm/mach-omap2/board-n8x0.c | 234 |
1 files changed, 49 insertions, 185 deletions
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c index 827d15009a86..aead77a4bc6d 100644 --- a/arch/arm/mach-omap2/board-n8x0.c +++ b/arch/arm/mach-omap2/board-n8x0.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/i2c.h> | 21 | #include <linux/i2c.h> |
22 | #include <linux/spi/spi.h> | 22 | #include <linux/spi/spi.h> |
23 | #include <linux/usb/musb.h> | 23 | #include <linux/usb/musb.h> |
24 | #include <linux/platform_data/i2c-cbus-gpio.h> | ||
25 | #include <linux/platform_data/spi-omap2-mcspi.h> | 24 | #include <linux/platform_data/spi-omap2-mcspi.h> |
26 | #include <linux/platform_data/mtd-onenand-omap2.h> | 25 | #include <linux/platform_data/mtd-onenand-omap2.h> |
27 | #include <linux/mfd/menelaus.h> | 26 | #include <linux/mfd/menelaus.h> |
@@ -32,8 +31,7 @@ | |||
32 | 31 | ||
33 | #include "common.h" | 32 | #include "common.h" |
34 | #include "mmc.h" | 33 | #include "mmc.h" |
35 | 34 | #include "soc.h" | |
36 | #include "mux.h" | ||
37 | #include "gpmc-onenand.h" | 35 | #include "gpmc-onenand.h" |
38 | 36 | ||
39 | #define TUSB6010_ASYNC_CS 1 | 37 | #define TUSB6010_ASYNC_CS 1 |
@@ -42,44 +40,30 @@ | |||
42 | #define TUSB6010_GPIO_ENABLE 0 | 40 | #define TUSB6010_GPIO_ENABLE 0 |
43 | #define TUSB6010_DMACHAN 0x3f | 41 | #define TUSB6010_DMACHAN 0x3f |
44 | 42 | ||
45 | #if defined(CONFIG_I2C_CBUS_GPIO) || defined(CONFIG_I2C_CBUS_GPIO_MODULE) | 43 | #define NOKIA_N810_WIMAX (1 << 2) |
46 | static struct i2c_cbus_platform_data n8x0_cbus_data = { | 44 | #define NOKIA_N810 (1 << 1) |
47 | .clk_gpio = 66, | 45 | #define NOKIA_N800 (1 << 0) |
48 | .dat_gpio = 65, | ||
49 | .sel_gpio = 64, | ||
50 | }; | ||
51 | 46 | ||
52 | static struct platform_device n8x0_cbus_device = { | 47 | static u32 board_caps; |
53 | .name = "i2c-cbus-gpio", | ||
54 | .id = 3, | ||
55 | .dev = { | ||
56 | .platform_data = &n8x0_cbus_data, | ||
57 | }, | ||
58 | }; | ||
59 | 48 | ||
60 | static struct i2c_board_info n8x0_i2c_board_info_3[] __initdata = { | 49 | #define board_is_n800() (board_caps & NOKIA_N800) |
61 | { | 50 | #define board_is_n810() (board_caps & NOKIA_N810) |
62 | I2C_BOARD_INFO("retu-mfd", 0x01), | 51 | #define board_is_n810_wimax() (board_caps & NOKIA_N810_WIMAX) |
63 | }, | ||
64 | }; | ||
65 | 52 | ||
66 | static void __init n8x0_cbus_init(void) | 53 | static void board_check_revision(void) |
67 | { | 54 | { |
68 | const int retu_irq_gpio = 108; | 55 | if (of_have_populated_dt()) { |
56 | if (of_machine_is_compatible("nokia,n800")) | ||
57 | board_caps = NOKIA_N800; | ||
58 | else if (of_machine_is_compatible("nokia,n810")) | ||
59 | board_caps = NOKIA_N810; | ||
60 | else if (of_machine_is_compatible("nokia,n810-wimax")) | ||
61 | board_caps = NOKIA_N810_WIMAX; | ||
62 | } | ||
69 | 63 | ||
70 | if (gpio_request_one(retu_irq_gpio, GPIOF_IN, "Retu IRQ")) | 64 | if (!board_caps) |
71 | return; | 65 | pr_err("Unknown board\n"); |
72 | irq_set_irq_type(gpio_to_irq(retu_irq_gpio), IRQ_TYPE_EDGE_RISING); | ||
73 | n8x0_i2c_board_info_3[0].irq = gpio_to_irq(retu_irq_gpio); | ||
74 | i2c_register_board_info(3, n8x0_i2c_board_info_3, | ||
75 | ARRAY_SIZE(n8x0_i2c_board_info_3)); | ||
76 | platform_device_register(&n8x0_cbus_device); | ||
77 | } | ||
78 | #else /* CONFIG_I2C_CBUS_GPIO */ | ||
79 | static void __init n8x0_cbus_init(void) | ||
80 | { | ||
81 | } | 66 | } |
82 | #endif /* CONFIG_I2C_CBUS_GPIO */ | ||
83 | 67 | ||
84 | #if defined(CONFIG_USB_MUSB_TUSB6010) || defined(CONFIG_USB_MUSB_TUSB6010_MODULE) | 68 | #if defined(CONFIG_USB_MUSB_TUSB6010) || defined(CONFIG_USB_MUSB_TUSB6010_MODULE) |
85 | /* | 69 | /* |
@@ -178,49 +162,6 @@ static struct spi_board_info n800_spi_board_info[] __initdata = { | |||
178 | }, | 162 | }, |
179 | }; | 163 | }; |
180 | 164 | ||
181 | #if defined(CONFIG_MTD_ONENAND_OMAP2) || \ | ||
182 | defined(CONFIG_MTD_ONENAND_OMAP2_MODULE) | ||
183 | |||
184 | static struct mtd_partition onenand_partitions[] = { | ||
185 | { | ||
186 | .name = "bootloader", | ||
187 | .offset = 0, | ||
188 | .size = 0x20000, | ||
189 | .mask_flags = MTD_WRITEABLE, /* Force read-only */ | ||
190 | }, | ||
191 | { | ||
192 | .name = "config", | ||
193 | .offset = MTDPART_OFS_APPEND, | ||
194 | .size = 0x60000, | ||
195 | }, | ||
196 | { | ||
197 | .name = "kernel", | ||
198 | .offset = MTDPART_OFS_APPEND, | ||
199 | .size = 0x200000, | ||
200 | }, | ||
201 | { | ||
202 | .name = "initfs", | ||
203 | .offset = MTDPART_OFS_APPEND, | ||
204 | .size = 0x400000, | ||
205 | }, | ||
206 | { | ||
207 | .name = "rootfs", | ||
208 | .offset = MTDPART_OFS_APPEND, | ||
209 | .size = MTDPART_SIZ_FULL, | ||
210 | }, | ||
211 | }; | ||
212 | |||
213 | static struct omap_onenand_platform_data board_onenand_data[] = { | ||
214 | { | ||
215 | .cs = 0, | ||
216 | .gpio_irq = 26, | ||
217 | .parts = onenand_partitions, | ||
218 | .nr_parts = ARRAY_SIZE(onenand_partitions), | ||
219 | .flags = ONENAND_SYNC_READ, | ||
220 | } | ||
221 | }; | ||
222 | #endif | ||
223 | |||
224 | #if defined(CONFIG_MENELAUS) && \ | 165 | #if defined(CONFIG_MENELAUS) && \ |
225 | (defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)) | 166 | (defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)) |
226 | 167 | ||
@@ -342,7 +283,7 @@ static void n810_set_power_emmc(struct device *dev, | |||
342 | static int n8x0_mmc_set_power(struct device *dev, int slot, int power_on, | 283 | static int n8x0_mmc_set_power(struct device *dev, int slot, int power_on, |
343 | int vdd) | 284 | int vdd) |
344 | { | 285 | { |
345 | if (machine_is_nokia_n800() || slot == 0) | 286 | if (board_is_n800() || slot == 0) |
346 | return n8x0_mmc_set_power_menelaus(dev, slot, power_on, vdd); | 287 | return n8x0_mmc_set_power_menelaus(dev, slot, power_on, vdd); |
347 | 288 | ||
348 | n810_set_power_emmc(dev, power_on); | 289 | n810_set_power_emmc(dev, power_on); |
@@ -388,7 +329,7 @@ static void n8x0_mmc_callback(void *data, u8 card_mask) | |||
388 | { | 329 | { |
389 | int bit, *openp, index; | 330 | int bit, *openp, index; |
390 | 331 | ||
391 | if (machine_is_nokia_n800()) { | 332 | if (board_is_n800()) { |
392 | bit = 1 << 1; | 333 | bit = 1 << 1; |
393 | openp = &slot2_cover_open; | 334 | openp = &slot2_cover_open; |
394 | index = 1; | 335 | index = 1; |
@@ -421,7 +362,7 @@ static int n8x0_mmc_late_init(struct device *dev) | |||
421 | if (r < 0) | 362 | if (r < 0) |
422 | return r; | 363 | return r; |
423 | 364 | ||
424 | if (machine_is_nokia_n800()) | 365 | if (board_is_n800()) |
425 | vs2sel = 0; | 366 | vs2sel = 0; |
426 | else | 367 | else |
427 | vs2sel = 2; | 368 | vs2sel = 2; |
@@ -444,7 +385,7 @@ static int n8x0_mmc_late_init(struct device *dev) | |||
444 | if (r < 0) | 385 | if (r < 0) |
445 | return r; | 386 | return r; |
446 | 387 | ||
447 | if (machine_is_nokia_n800()) { | 388 | if (board_is_n800()) { |
448 | bit = 1 << 1; | 389 | bit = 1 << 1; |
449 | openp = &slot2_cover_open; | 390 | openp = &slot2_cover_open; |
450 | } else { | 391 | } else { |
@@ -471,7 +412,7 @@ static void n8x0_mmc_shutdown(struct device *dev) | |||
471 | { | 412 | { |
472 | int vs2sel; | 413 | int vs2sel; |
473 | 414 | ||
474 | if (machine_is_nokia_n800()) | 415 | if (board_is_n800()) |
475 | vs2sel = 0; | 416 | vs2sel = 0; |
476 | else | 417 | else |
477 | vs2sel = 2; | 418 | vs2sel = 2; |
@@ -486,7 +427,7 @@ static void n8x0_mmc_cleanup(struct device *dev) | |||
486 | 427 | ||
487 | gpio_free(N8X0_SLOT_SWITCH_GPIO); | 428 | gpio_free(N8X0_SLOT_SWITCH_GPIO); |
488 | 429 | ||
489 | if (machine_is_nokia_n810()) { | 430 | if (board_is_n810()) { |
490 | gpio_free(N810_EMMC_VSD_GPIO); | 431 | gpio_free(N810_EMMC_VSD_GPIO); |
491 | gpio_free(N810_EMMC_VIO_GPIO); | 432 | gpio_free(N810_EMMC_VIO_GPIO); |
492 | } | 433 | } |
@@ -497,7 +438,7 @@ static void n8x0_mmc_cleanup(struct device *dev) | |||
497 | * MMC controller2 is not in use. | 438 | * MMC controller2 is not in use. |
498 | */ | 439 | */ |
499 | static struct omap_mmc_platform_data mmc1_data = { | 440 | static struct omap_mmc_platform_data mmc1_data = { |
500 | .nr_slots = 2, | 441 | .nr_slots = 0, |
501 | .switch_slot = n8x0_mmc_switch_slot, | 442 | .switch_slot = n8x0_mmc_switch_slot, |
502 | .init = n8x0_mmc_late_init, | 443 | .init = n8x0_mmc_late_init, |
503 | .cleanup = n8x0_mmc_cleanup, | 444 | .cleanup = n8x0_mmc_cleanup, |
@@ -537,7 +478,7 @@ static void __init n8x0_mmc_init(void) | |||
537 | { | 478 | { |
538 | int err; | 479 | int err; |
539 | 480 | ||
540 | if (machine_is_nokia_n810()) { | 481 | if (board_is_n810()) { |
541 | mmc1_data.slots[0].name = "external"; | 482 | mmc1_data.slots[0].name = "external"; |
542 | 483 | ||
543 | /* | 484 | /* |
@@ -555,7 +496,7 @@ static void __init n8x0_mmc_init(void) | |||
555 | if (err) | 496 | if (err) |
556 | return; | 497 | return; |
557 | 498 | ||
558 | if (machine_is_nokia_n810()) { | 499 | if (board_is_n810()) { |
559 | err = gpio_request_array(n810_emmc_gpios, | 500 | err = gpio_request_array(n810_emmc_gpios, |
560 | ARRAY_SIZE(n810_emmc_gpios)); | 501 | ARRAY_SIZE(n810_emmc_gpios)); |
561 | if (err) { | 502 | if (err) { |
@@ -564,11 +505,11 @@ static void __init n8x0_mmc_init(void) | |||
564 | } | 505 | } |
565 | } | 506 | } |
566 | 507 | ||
508 | mmc1_data.nr_slots = 2; | ||
567 | mmc_data[0] = &mmc1_data; | 509 | mmc_data[0] = &mmc1_data; |
568 | omap242x_init_mmc(mmc_data); | ||
569 | } | 510 | } |
570 | #else | 511 | #else |
571 | 512 | static struct omap_mmc_platform_data mmc1_data; | |
572 | void __init n8x0_mmc_init(void) | 513 | void __init n8x0_mmc_init(void) |
573 | { | 514 | { |
574 | } | 515 | } |
@@ -650,109 +591,32 @@ static struct i2c_board_info n810_i2c_board_info_2[] __initdata = { | |||
650 | }, | 591 | }, |
651 | }; | 592 | }; |
652 | 593 | ||
653 | #ifdef CONFIG_OMAP_MUX | 594 | static int __init n8x0_late_initcall(void) |
654 | static struct omap_board_mux board_mux[] __initdata = { | ||
655 | /* I2S codec port pins for McBSP block */ | ||
656 | OMAP2420_MUX(EAC_AC_SCLK, OMAP_MUX_MODE1 | OMAP_PIN_INPUT), | ||
657 | OMAP2420_MUX(EAC_AC_FS, OMAP_MUX_MODE1 | OMAP_PIN_INPUT), | ||
658 | OMAP2420_MUX(EAC_AC_DIN, OMAP_MUX_MODE1 | OMAP_PIN_INPUT), | ||
659 | OMAP2420_MUX(EAC_AC_DOUT, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT), | ||
660 | { .reg_offset = OMAP_MUX_TERMINATOR }, | ||
661 | }; | ||
662 | |||
663 | static struct omap_device_pad serial2_pads[] __initdata = { | ||
664 | { | ||
665 | .name = "uart3_rx_irrx.uart3_rx_irrx", | ||
666 | .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, | ||
667 | .enable = OMAP_MUX_MODE0, | ||
668 | .idle = OMAP_MUX_MODE3 /* Mux as GPIO for idle */ | ||
669 | }, | ||
670 | }; | ||
671 | |||
672 | static inline void board_serial_init(void) | ||
673 | { | 595 | { |
674 | struct omap_board_data bdata; | 596 | if (!board_caps) |
675 | 597 | return -ENODEV; | |
676 | bdata.flags = 0; | ||
677 | bdata.pads = NULL; | ||
678 | bdata.pads_cnt = 0; | ||
679 | |||
680 | bdata.id = 0; | ||
681 | omap_serial_init_port(&bdata, NULL); | ||
682 | |||
683 | bdata.id = 1; | ||
684 | omap_serial_init_port(&bdata, NULL); | ||
685 | |||
686 | bdata.id = 2; | ||
687 | bdata.pads = serial2_pads; | ||
688 | bdata.pads_cnt = ARRAY_SIZE(serial2_pads); | ||
689 | omap_serial_init_port(&bdata, NULL); | ||
690 | } | ||
691 | 598 | ||
692 | #else | 599 | n8x0_mmc_init(); |
600 | n8x0_usb_init(); | ||
693 | 601 | ||
694 | static inline void board_serial_init(void) | 602 | return 0; |
695 | { | ||
696 | omap_serial_init(); | ||
697 | } | 603 | } |
604 | omap_late_initcall(n8x0_late_initcall); | ||
698 | 605 | ||
699 | #endif | 606 | /* |
700 | 607 | * Legacy init pdata init for n8x0. Note that we want to follow the | |
701 | static void __init n8x0_init_machine(void) | 608 | * I2C bus numbering starting at 0 for device tree like other omaps. |
609 | */ | ||
610 | void * __init n8x0_legacy_init(void) | ||
702 | { | 611 | { |
703 | omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAC); | 612 | board_check_revision(); |
704 | /* FIXME: add n810 spi devices */ | ||
705 | spi_register_board_info(n800_spi_board_info, | 613 | spi_register_board_info(n800_spi_board_info, |
706 | ARRAY_SIZE(n800_spi_board_info)); | 614 | ARRAY_SIZE(n800_spi_board_info)); |
707 | omap_register_i2c_bus(1, 400, n8x0_i2c_board_info_1, | 615 | i2c_register_board_info(0, n8x0_i2c_board_info_1, |
708 | ARRAY_SIZE(n8x0_i2c_board_info_1)); | 616 | ARRAY_SIZE(n8x0_i2c_board_info_1)); |
709 | omap_register_i2c_bus(2, 400, NULL, 0); | 617 | if (board_is_n810()) |
710 | if (machine_is_nokia_n810()) | 618 | i2c_register_board_info(1, n810_i2c_board_info_2, |
711 | i2c_register_board_info(2, n810_i2c_board_info_2, | ||
712 | ARRAY_SIZE(n810_i2c_board_info_2)); | 619 | ARRAY_SIZE(n810_i2c_board_info_2)); |
713 | board_serial_init(); | ||
714 | omap_sdrc_init(NULL, NULL); | ||
715 | gpmc_onenand_init(board_onenand_data); | ||
716 | n8x0_mmc_init(); | ||
717 | n8x0_usb_init(); | ||
718 | n8x0_cbus_init(); | ||
719 | } | ||
720 | 620 | ||
721 | MACHINE_START(NOKIA_N800, "Nokia N800") | 621 | return &mmc1_data; |
722 | .atag_offset = 0x100, | 622 | } |
723 | .reserve = omap_reserve, | ||
724 | .map_io = omap242x_map_io, | ||
725 | .init_early = omap2420_init_early, | ||
726 | .init_irq = omap2_init_irq, | ||
727 | .handle_irq = omap2_intc_handle_irq, | ||
728 | .init_machine = n8x0_init_machine, | ||
729 | .init_late = omap2420_init_late, | ||
730 | .init_time = omap2_sync32k_timer_init, | ||
731 | .restart = omap2xxx_restart, | ||
732 | MACHINE_END | ||
733 | |||
734 | MACHINE_START(NOKIA_N810, "Nokia N810") | ||
735 | .atag_offset = 0x100, | ||
736 | .reserve = omap_reserve, | ||
737 | .map_io = omap242x_map_io, | ||
738 | .init_early = omap2420_init_early, | ||
739 | .init_irq = omap2_init_irq, | ||
740 | .handle_irq = omap2_intc_handle_irq, | ||
741 | .init_machine = n8x0_init_machine, | ||
742 | .init_late = omap2420_init_late, | ||
743 | .init_time = omap2_sync32k_timer_init, | ||
744 | .restart = omap2xxx_restart, | ||
745 | MACHINE_END | ||
746 | |||
747 | MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX") | ||
748 | .atag_offset = 0x100, | ||
749 | .reserve = omap_reserve, | ||
750 | .map_io = omap242x_map_io, | ||
751 | .init_early = omap2420_init_early, | ||
752 | .init_irq = omap2_init_irq, | ||
753 | .handle_irq = omap2_intc_handle_irq, | ||
754 | .init_machine = n8x0_init_machine, | ||
755 | .init_late = omap2420_init_late, | ||
756 | .init_time = omap2_sync32k_timer_init, | ||
757 | .restart = omap2xxx_restart, | ||
758 | MACHINE_END | ||