aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/board-n8x0.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /arch/arm/mach-omap2/board-n8x0.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'arch/arm/mach-omap2/board-n8x0.c')
-rw-r--r--arch/arm/mach-omap2/board-n8x0.c192
1 files changed, 105 insertions, 87 deletions
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index a3e2b49aa39f..8d74318ed495 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -20,6 +20,7 @@
20#include <linux/i2c.h> 20#include <linux/i2c.h>
21#include <linux/spi/spi.h> 21#include <linux/spi/spi.h>
22#include <linux/usb/musb.h> 22#include <linux/usb/musb.h>
23#include <sound/tlv320aic3x.h>
23 24
24#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
25#include <asm/mach-types.h> 26#include <asm/mach-types.h>
@@ -45,8 +46,7 @@ static struct device *mmc_device;
45#define TUSB6010_GPIO_ENABLE 0 46#define TUSB6010_GPIO_ENABLE 0
46#define TUSB6010_DMACHAN 0x3f 47#define TUSB6010_DMACHAN 0x3f
47 48
48#if defined(CONFIG_USB_TUSB6010) || \ 49#ifdef CONFIG_USB_MUSB_TUSB6010
49 defined(CONFIG_USB_TUSB6010_MODULE)
50/* 50/*
51 * Enable or disable power to TUSB6010. When enabling, turn on 3.3 V and 51 * Enable or disable power to TUSB6010. When enabling, turn on 3.3 V and
52 * 1.5 V voltage regulators of PM companion chip. Companion chip will then 52 * 1.5 V voltage regulators of PM companion chip. Companion chip will then
@@ -106,14 +106,13 @@ static void __init n8x0_usb_init(void)
106 static char announce[] __initdata = KERN_INFO "TUSB 6010\n"; 106 static char announce[] __initdata = KERN_INFO "TUSB 6010\n";
107 107
108 /* PM companion chip power control pin */ 108 /* PM companion chip power control pin */
109 ret = gpio_request(TUSB6010_GPIO_ENABLE, "TUSB6010 enable"); 109 ret = gpio_request_one(TUSB6010_GPIO_ENABLE, GPIOF_OUT_INIT_LOW,
110 "TUSB6010 enable");
110 if (ret != 0) { 111 if (ret != 0) {
111 printk(KERN_ERR "Could not get TUSB power GPIO%i\n", 112 printk(KERN_ERR "Could not get TUSB power GPIO%i\n",
112 TUSB6010_GPIO_ENABLE); 113 TUSB6010_GPIO_ENABLE);
113 return; 114 return;
114 } 115 }
115 gpio_direction_output(TUSB6010_GPIO_ENABLE, 0);
116
117 tusb_set_power(0); 116 tusb_set_power(0);
118 117
119 ret = tusb6010_setup_interface(&tusb_data, TUSB6010_REFCLK_19, 2, 118 ret = tusb6010_setup_interface(&tusb_data, TUSB6010_REFCLK_19, 2,
@@ -133,7 +132,7 @@ err:
133 132
134static void __init n8x0_usb_init(void) {} 133static void __init n8x0_usb_init(void) {}
135 134
136#endif /*CONFIG_USB_TUSB6010 */ 135#endif /*CONFIG_USB_MUSB_TUSB6010 */
137 136
138 137
139static struct omap2_mcspi_device_config p54spi_mcspi_config = { 138static struct omap2_mcspi_device_config p54spi_mcspi_config = {
@@ -183,23 +182,15 @@ static struct mtd_partition onenand_partitions[] = {
183 }, 182 },
184}; 183};
185 184
186static struct omap_onenand_platform_data board_onenand_data = { 185static struct omap_onenand_platform_data board_onenand_data[] = {
187 .cs = 0, 186 {
188 .gpio_irq = 26, 187 .cs = 0,
189 .parts = onenand_partitions, 188 .gpio_irq = 26,
190 .nr_parts = ARRAY_SIZE(onenand_partitions), 189 .parts = onenand_partitions,
191 .flags = ONENAND_SYNC_READ, 190 .nr_parts = ARRAY_SIZE(onenand_partitions),
191 .flags = ONENAND_SYNC_READ,
192 }
192}; 193};
193
194static void __init n8x0_onenand_init(void)
195{
196 gpmc_onenand_init(&board_onenand_data);
197}
198
199#else
200
201static void __init n8x0_onenand_init(void) {}
202
203#endif 194#endif
204 195
205#if defined(CONFIG_MENELAUS) && \ 196#if defined(CONFIG_MENELAUS) && \
@@ -383,15 +374,6 @@ static void n8x0_mmc_callback(void *data, u8 card_mask)
383 omap_mmc_notify_cover_event(mmc_device, index, *openp); 374 omap_mmc_notify_cover_event(mmc_device, index, *openp);
384} 375}
385 376
386void n8x0_mmc_slot1_cover_handler(void *arg, int closed_state)
387{
388 if (mmc_device == NULL)
389 return;
390
391 slot1_cover_open = !closed_state;
392 omap_mmc_notify_cover_event(mmc_device, 0, closed_state);
393}
394
395static int n8x0_mmc_late_init(struct device *dev) 377static int n8x0_mmc_late_init(struct device *dev)
396{ 378{
397 int r, bit, *openp; 379 int r, bit, *openp;
@@ -511,8 +493,12 @@ static struct omap_mmc_platform_data mmc1_data = {
511 493
512static struct omap_mmc_platform_data *mmc_data[OMAP24XX_NR_MMC]; 494static struct omap_mmc_platform_data *mmc_data[OMAP24XX_NR_MMC];
513 495
514void __init n8x0_mmc_init(void) 496static struct gpio n810_emmc_gpios[] __initdata = {
497 { N810_EMMC_VSD_GPIO, GPIOF_OUT_INIT_LOW, "MMC slot 2 Vddf" },
498 { N810_EMMC_VIO_GPIO, GPIOF_OUT_INIT_LOW, "MMC slot 2 Vdd" },
499};
515 500
501static void __init n8x0_mmc_init(void)
516{ 502{
517 int err; 503 int err;
518 504
@@ -529,42 +515,28 @@ void __init n8x0_mmc_init(void)
529 mmc1_data.slots[1].ban_openended = 1; 515 mmc1_data.slots[1].ban_openended = 1;
530 } 516 }
531 517
532 err = gpio_request(N8X0_SLOT_SWITCH_GPIO, "MMC slot switch"); 518 err = gpio_request_one(N8X0_SLOT_SWITCH_GPIO, GPIOF_OUT_INIT_LOW,
519 "MMC slot switch");
533 if (err) 520 if (err)
534 return; 521 return;
535 522
536 gpio_direction_output(N8X0_SLOT_SWITCH_GPIO, 0);
537
538 if (machine_is_nokia_n810()) { 523 if (machine_is_nokia_n810()) {
539 err = gpio_request(N810_EMMC_VSD_GPIO, "MMC slot 2 Vddf"); 524 err = gpio_request_array(n810_emmc_gpios,
525 ARRAY_SIZE(n810_emmc_gpios));
540 if (err) { 526 if (err) {
541 gpio_free(N8X0_SLOT_SWITCH_GPIO); 527 gpio_free(N8X0_SLOT_SWITCH_GPIO);
542 return; 528 return;
543 } 529 }
544 gpio_direction_output(N810_EMMC_VSD_GPIO, 0);
545
546 err = gpio_request(N810_EMMC_VIO_GPIO, "MMC slot 2 Vdd");
547 if (err) {
548 gpio_free(N8X0_SLOT_SWITCH_GPIO);
549 gpio_free(N810_EMMC_VSD_GPIO);
550 return;
551 }
552 gpio_direction_output(N810_EMMC_VIO_GPIO, 0);
553 } 530 }
554 531
555 mmc_data[0] = &mmc1_data; 532 mmc_data[0] = &mmc1_data;
556 omap2_init_mmc(mmc_data, OMAP24XX_NR_MMC); 533 omap242x_init_mmc(mmc_data);
557} 534}
558#else 535#else
559 536
560void __init n8x0_mmc_init(void) 537void __init n8x0_mmc_init(void)
561{ 538{
562} 539}
563
564void n8x0_mmc_slot1_cover_handler(void *arg, int state)
565{
566}
567
568#endif /* CONFIG_MMC_OMAP */ 540#endif /* CONFIG_MMC_OMAP */
569 541
570#ifdef CONFIG_MENELAUS 542#ifdef CONFIG_MENELAUS
@@ -614,29 +586,35 @@ static int n8x0_menelaus_late_init(struct device *dev)
614 return 0; 586 return 0;
615} 587}
616 588
617static struct i2c_board_info __initdata n8x0_i2c_board_info_1[] = { 589#else
590static int n8x0_menelaus_late_init(struct device *dev)
591{
592 return 0;
593}
594#endif
595
596static struct menelaus_platform_data n8x0_menelaus_platform_data __initdata = {
597 .late_init = n8x0_menelaus_late_init,
598};
599
600static struct i2c_board_info __initdata n8x0_i2c_board_info_1[] __initdata = {
618 { 601 {
619 I2C_BOARD_INFO("menelaus", 0x72), 602 I2C_BOARD_INFO("menelaus", 0x72),
620 .irq = INT_24XX_SYS_NIRQ, 603 .irq = INT_24XX_SYS_NIRQ,
604 .platform_data = &n8x0_menelaus_platform_data,
621 }, 605 },
622}; 606};
623 607
624static struct menelaus_platform_data n8x0_menelaus_platform_data = { 608static struct aic3x_pdata n810_aic33_data __initdata = {
625 .late_init = n8x0_menelaus_late_init, 609 .gpio_reset = 118,
626}; 610};
627 611
628static void __init n8x0_menelaus_init(void) 612static struct i2c_board_info n810_i2c_board_info_2[] __initdata = {
629{ 613 {
630 n8x0_i2c_board_info_1[0].platform_data = &n8x0_menelaus_platform_data; 614 I2C_BOARD_INFO("tlv320aic3x", 0x18),
631 omap_register_i2c_bus(1, 400, n8x0_i2c_board_info_1, 615 .platform_data = &n810_aic33_data,
632 ARRAY_SIZE(n8x0_i2c_board_info_1)); 616 },
633} 617};
634
635#else
636static inline void __init n8x0_menelaus_init(void)
637{
638}
639#endif
640 618
641static void __init n8x0_map_io(void) 619static void __init n8x0_map_io(void)
642{ 620{
@@ -644,19 +622,58 @@ static void __init n8x0_map_io(void)
644 omap242x_map_common_io(); 622 omap242x_map_common_io();
645} 623}
646 624
647static void __init n8x0_init_irq(void) 625static void __init n8x0_init_early(void)
648{ 626{
649 omap2_init_common_hw(NULL, NULL); 627 omap2_init_common_infrastructure();
650 omap_init_irq(); 628 omap2_init_common_devices(NULL, NULL);
651 omap_gpio_init();
652} 629}
653 630
654#ifdef CONFIG_OMAP_MUX 631#ifdef CONFIG_OMAP_MUX
655static struct omap_board_mux board_mux[] __initdata = { 632static struct omap_board_mux board_mux[] __initdata = {
633 /* I2S codec port pins for McBSP block */
634 OMAP2420_MUX(EAC_AC_SCLK, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
635 OMAP2420_MUX(EAC_AC_FS, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
636 OMAP2420_MUX(EAC_AC_DIN, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
637 OMAP2420_MUX(EAC_AC_DOUT, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT),
656 { .reg_offset = OMAP_MUX_TERMINATOR }, 638 { .reg_offset = OMAP_MUX_TERMINATOR },
657}; 639};
640
641static struct omap_device_pad serial2_pads[] __initdata = {
642 {
643 .name = "uart3_rx_irrx.uart3_rx_irrx",
644 .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP,
645 .enable = OMAP_MUX_MODE0,
646 .idle = OMAP_MUX_MODE3 /* Mux as GPIO for idle */
647 },
648};
649
650static inline void board_serial_init(void)
651{
652 struct omap_board_data bdata;
653
654 bdata.flags = 0;
655 bdata.pads = NULL;
656 bdata.pads_cnt = 0;
657
658 bdata.id = 0;
659 omap_serial_init_port(&bdata);
660
661 bdata.id = 1;
662 omap_serial_init_port(&bdata);
663
664 bdata.id = 2;
665 bdata.pads = serial2_pads;
666 bdata.pads_cnt = ARRAY_SIZE(serial2_pads);
667 omap_serial_init_port(&bdata);
668}
669
658#else 670#else
659#define board_mux NULL 671
672static inline void board_serial_init(void)
673{
674 omap_serial_init();
675}
676
660#endif 677#endif
661 678
662static void __init n8x0_init_machine(void) 679static void __init n8x0_init_machine(void)
@@ -665,43 +682,44 @@ static void __init n8x0_init_machine(void)
665 /* FIXME: add n810 spi devices */ 682 /* FIXME: add n810 spi devices */
666 spi_register_board_info(n800_spi_board_info, 683 spi_register_board_info(n800_spi_board_info,
667 ARRAY_SIZE(n800_spi_board_info)); 684 ARRAY_SIZE(n800_spi_board_info));
668 685 omap_register_i2c_bus(1, 400, n8x0_i2c_board_info_1,
669 omap_serial_init(); 686 ARRAY_SIZE(n8x0_i2c_board_info_1));
670 n8x0_menelaus_init(); 687 omap_register_i2c_bus(2, 400, NULL, 0);
671 n8x0_onenand_init(); 688 if (machine_is_nokia_n810())
689 i2c_register_board_info(2, n810_i2c_board_info_2,
690 ARRAY_SIZE(n810_i2c_board_info_2));
691 board_serial_init();
692 gpmc_onenand_init(board_onenand_data);
672 n8x0_mmc_init(); 693 n8x0_mmc_init();
673 n8x0_usb_init(); 694 n8x0_usb_init();
674} 695}
675 696
676MACHINE_START(NOKIA_N800, "Nokia N800") 697MACHINE_START(NOKIA_N800, "Nokia N800")
677 .phys_io = 0x48000000,
678 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
679 .boot_params = 0x80000100, 698 .boot_params = 0x80000100,
680 .map_io = n8x0_map_io,
681 .reserve = omap_reserve, 699 .reserve = omap_reserve,
682 .init_irq = n8x0_init_irq, 700 .map_io = n8x0_map_io,
701 .init_early = n8x0_init_early,
702 .init_irq = omap_init_irq,
683 .init_machine = n8x0_init_machine, 703 .init_machine = n8x0_init_machine,
684 .timer = &omap_timer, 704 .timer = &omap_timer,
685MACHINE_END 705MACHINE_END
686 706
687MACHINE_START(NOKIA_N810, "Nokia N810") 707MACHINE_START(NOKIA_N810, "Nokia N810")
688 .phys_io = 0x48000000,
689 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
690 .boot_params = 0x80000100, 708 .boot_params = 0x80000100,
691 .map_io = n8x0_map_io,
692 .reserve = omap_reserve, 709 .reserve = omap_reserve,
693 .init_irq = n8x0_init_irq, 710 .map_io = n8x0_map_io,
711 .init_early = n8x0_init_early,
712 .init_irq = omap_init_irq,
694 .init_machine = n8x0_init_machine, 713 .init_machine = n8x0_init_machine,
695 .timer = &omap_timer, 714 .timer = &omap_timer,
696MACHINE_END 715MACHINE_END
697 716
698MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX") 717MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX")
699 .phys_io = 0x48000000,
700 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
701 .boot_params = 0x80000100, 718 .boot_params = 0x80000100,
702 .map_io = n8x0_map_io,
703 .reserve = omap_reserve, 719 .reserve = omap_reserve,
704 .init_irq = n8x0_init_irq, 720 .map_io = n8x0_map_io,
721 .init_early = n8x0_init_early,
722 .init_irq = omap_init_irq,
705 .init_machine = n8x0_init_machine, 723 .init_machine = n8x0_init_machine,
706 .timer = &omap_timer, 724 .timer = &omap_timer,
707MACHINE_END 725MACHINE_END