diff options
Diffstat (limited to 'arch/arm/mach-davinci/dm646x.c')
-rw-r--r-- | arch/arm/mach-davinci/dm646x.c | 321 |
1 files changed, 310 insertions, 11 deletions
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c index 334f0711e0f5..0976049c7b3b 100644 --- a/arch/arm/mach-davinci/dm646x.c +++ b/arch/arm/mach-davinci/dm646x.c | |||
@@ -27,10 +27,20 @@ | |||
27 | #include <mach/time.h> | 27 | #include <mach/time.h> |
28 | #include <mach/serial.h> | 28 | #include <mach/serial.h> |
29 | #include <mach/common.h> | 29 | #include <mach/common.h> |
30 | #include <mach/asp.h> | ||
30 | 31 | ||
31 | #include "clock.h" | 32 | #include "clock.h" |
32 | #include "mux.h" | 33 | #include "mux.h" |
33 | 34 | ||
35 | #define DAVINCI_VPIF_BASE (0x01C12000) | ||
36 | #define VDD3P3V_PWDN_OFFSET (0x48) | ||
37 | #define VSCLKDIS_OFFSET (0x6C) | ||
38 | |||
39 | #define VDD3P3V_VID_MASK (BIT_MASK(3) | BIT_MASK(2) | BIT_MASK(1) |\ | ||
40 | BIT_MASK(0)) | ||
41 | #define VSCLKDIS_MASK (BIT_MASK(11) | BIT_MASK(10) | BIT_MASK(9) |\ | ||
42 | BIT_MASK(8)) | ||
43 | |||
34 | /* | 44 | /* |
35 | * Device specific clocks | 45 | * Device specific clocks |
36 | */ | 46 | */ |
@@ -162,6 +172,41 @@ static struct clk arm_clk = { | |||
162 | .flags = ALWAYS_ENABLED, | 172 | .flags = ALWAYS_ENABLED, |
163 | }; | 173 | }; |
164 | 174 | ||
175 | static struct clk edma_cc_clk = { | ||
176 | .name = "edma_cc", | ||
177 | .parent = &pll1_sysclk2, | ||
178 | .lpsc = DM646X_LPSC_TPCC, | ||
179 | .flags = ALWAYS_ENABLED, | ||
180 | }; | ||
181 | |||
182 | static struct clk edma_tc0_clk = { | ||
183 | .name = "edma_tc0", | ||
184 | .parent = &pll1_sysclk2, | ||
185 | .lpsc = DM646X_LPSC_TPTC0, | ||
186 | .flags = ALWAYS_ENABLED, | ||
187 | }; | ||
188 | |||
189 | static struct clk edma_tc1_clk = { | ||
190 | .name = "edma_tc1", | ||
191 | .parent = &pll1_sysclk2, | ||
192 | .lpsc = DM646X_LPSC_TPTC1, | ||
193 | .flags = ALWAYS_ENABLED, | ||
194 | }; | ||
195 | |||
196 | static struct clk edma_tc2_clk = { | ||
197 | .name = "edma_tc2", | ||
198 | .parent = &pll1_sysclk2, | ||
199 | .lpsc = DM646X_LPSC_TPTC2, | ||
200 | .flags = ALWAYS_ENABLED, | ||
201 | }; | ||
202 | |||
203 | static struct clk edma_tc3_clk = { | ||
204 | .name = "edma_tc3", | ||
205 | .parent = &pll1_sysclk2, | ||
206 | .lpsc = DM646X_LPSC_TPTC3, | ||
207 | .flags = ALWAYS_ENABLED, | ||
208 | }; | ||
209 | |||
165 | static struct clk uart0_clk = { | 210 | static struct clk uart0_clk = { |
166 | .name = "uart0", | 211 | .name = "uart0", |
167 | .parent = &aux_clkin, | 212 | .parent = &aux_clkin, |
@@ -192,6 +237,18 @@ static struct clk gpio_clk = { | |||
192 | .lpsc = DM646X_LPSC_GPIO, | 237 | .lpsc = DM646X_LPSC_GPIO, |
193 | }; | 238 | }; |
194 | 239 | ||
240 | static struct clk mcasp0_clk = { | ||
241 | .name = "mcasp0", | ||
242 | .parent = &pll1_sysclk3, | ||
243 | .lpsc = DM646X_LPSC_McASP0, | ||
244 | }; | ||
245 | |||
246 | static struct clk mcasp1_clk = { | ||
247 | .name = "mcasp1", | ||
248 | .parent = &pll1_sysclk3, | ||
249 | .lpsc = DM646X_LPSC_McASP1, | ||
250 | }; | ||
251 | |||
195 | static struct clk aemif_clk = { | 252 | static struct clk aemif_clk = { |
196 | .name = "aemif", | 253 | .name = "aemif", |
197 | .parent = &pll1_sysclk3, | 254 | .parent = &pll1_sysclk3, |
@@ -237,6 +294,13 @@ static struct clk timer2_clk = { | |||
237 | .flags = ALWAYS_ENABLED, /* no LPSC, always enabled; c.f. spruep9a */ | 294 | .flags = ALWAYS_ENABLED, /* no LPSC, always enabled; c.f. spruep9a */ |
238 | }; | 295 | }; |
239 | 296 | ||
297 | |||
298 | static struct clk ide_clk = { | ||
299 | .name = "ide", | ||
300 | .parent = &pll1_sysclk4, | ||
301 | .lpsc = DAVINCI_LPSC_ATA, | ||
302 | }; | ||
303 | |||
240 | static struct clk vpif0_clk = { | 304 | static struct clk vpif0_clk = { |
241 | .name = "vpif0", | 305 | .name = "vpif0", |
242 | .parent = &ref_clk, | 306 | .parent = &ref_clk, |
@@ -269,11 +333,18 @@ struct davinci_clk dm646x_clks[] = { | |||
269 | CLK(NULL, "pll2_sysclk1", &pll2_sysclk1), | 333 | CLK(NULL, "pll2_sysclk1", &pll2_sysclk1), |
270 | CLK(NULL, "dsp", &dsp_clk), | 334 | CLK(NULL, "dsp", &dsp_clk), |
271 | CLK(NULL, "arm", &arm_clk), | 335 | CLK(NULL, "arm", &arm_clk), |
336 | CLK(NULL, "edma_cc", &edma_cc_clk), | ||
337 | CLK(NULL, "edma_tc0", &edma_tc0_clk), | ||
338 | CLK(NULL, "edma_tc1", &edma_tc1_clk), | ||
339 | CLK(NULL, "edma_tc2", &edma_tc2_clk), | ||
340 | CLK(NULL, "edma_tc3", &edma_tc3_clk), | ||
272 | CLK(NULL, "uart0", &uart0_clk), | 341 | CLK(NULL, "uart0", &uart0_clk), |
273 | CLK(NULL, "uart1", &uart1_clk), | 342 | CLK(NULL, "uart1", &uart1_clk), |
274 | CLK(NULL, "uart2", &uart2_clk), | 343 | CLK(NULL, "uart2", &uart2_clk), |
275 | CLK("i2c_davinci.1", NULL, &i2c_clk), | 344 | CLK("i2c_davinci.1", NULL, &i2c_clk), |
276 | CLK(NULL, "gpio", &gpio_clk), | 345 | CLK(NULL, "gpio", &gpio_clk), |
346 | CLK("davinci-mcasp.0", NULL, &mcasp0_clk), | ||
347 | CLK("davinci-mcasp.1", NULL, &mcasp1_clk), | ||
277 | CLK(NULL, "aemif", &aemif_clk), | 348 | CLK(NULL, "aemif", &aemif_clk), |
278 | CLK("davinci_emac.1", NULL, &emac_clk), | 349 | CLK("davinci_emac.1", NULL, &emac_clk), |
279 | CLK(NULL, "pwm0", &pwm0_clk), | 350 | CLK(NULL, "pwm0", &pwm0_clk), |
@@ -281,6 +352,7 @@ struct davinci_clk dm646x_clks[] = { | |||
281 | CLK(NULL, "timer0", &timer0_clk), | 352 | CLK(NULL, "timer0", &timer0_clk), |
282 | CLK(NULL, "timer1", &timer1_clk), | 353 | CLK(NULL, "timer1", &timer1_clk), |
283 | CLK("watchdog", NULL, &timer2_clk), | 354 | CLK("watchdog", NULL, &timer2_clk), |
355 | CLK("palm_bk3710", NULL, &ide_clk), | ||
284 | CLK(NULL, "vpif0", &vpif0_clk), | 356 | CLK(NULL, "vpif0", &vpif0_clk), |
285 | CLK(NULL, "vpif1", &vpif1_clk), | 357 | CLK(NULL, "vpif1", &vpif1_clk), |
286 | CLK(NULL, NULL, NULL), | 358 | CLK(NULL, NULL, NULL), |
@@ -344,7 +416,7 @@ static struct platform_device dm646x_emac_device = { | |||
344 | */ | 416 | */ |
345 | static const struct mux_config dm646x_pins[] = { | 417 | static const struct mux_config dm646x_pins[] = { |
346 | #ifdef CONFIG_DAVINCI_MUX | 418 | #ifdef CONFIG_DAVINCI_MUX |
347 | MUX_CFG(DM646X, ATAEN, 0, 0, 1, 1, true) | 419 | MUX_CFG(DM646X, ATAEN, 0, 0, 5, 1, true) |
348 | 420 | ||
349 | MUX_CFG(DM646X, AUDCK1, 0, 29, 1, 0, false) | 421 | MUX_CFG(DM646X, AUDCK1, 0, 29, 1, 0, false) |
350 | 422 | ||
@@ -451,17 +523,43 @@ static const s8 dma_chan_dm646x_no_event[] = { | |||
451 | -1 | 523 | -1 |
452 | }; | 524 | }; |
453 | 525 | ||
454 | static struct edma_soc_info dm646x_edma_info = { | 526 | /* Four Transfer Controllers on DM646x */ |
455 | .n_channel = 64, | 527 | static const s8 |
456 | .n_region = 6, /* 0-1, 4-7 */ | 528 | dm646x_queue_tc_mapping[][2] = { |
457 | .n_slot = 512, | 529 | /* {event queue no, TC no} */ |
458 | .n_tc = 4, | 530 | {0, 0}, |
459 | .noevent = dma_chan_dm646x_no_event, | 531 | {1, 1}, |
532 | {2, 2}, | ||
533 | {3, 3}, | ||
534 | {-1, -1}, | ||
535 | }; | ||
536 | |||
537 | static const s8 | ||
538 | dm646x_queue_priority_mapping[][2] = { | ||
539 | /* {event queue no, Priority} */ | ||
540 | {0, 4}, | ||
541 | {1, 0}, | ||
542 | {2, 5}, | ||
543 | {3, 1}, | ||
544 | {-1, -1}, | ||
545 | }; | ||
546 | |||
547 | static struct edma_soc_info dm646x_edma_info[] = { | ||
548 | { | ||
549 | .n_channel = 64, | ||
550 | .n_region = 6, /* 0-1, 4-7 */ | ||
551 | .n_slot = 512, | ||
552 | .n_tc = 4, | ||
553 | .n_cc = 1, | ||
554 | .noevent = dma_chan_dm646x_no_event, | ||
555 | .queue_tc_mapping = dm646x_queue_tc_mapping, | ||
556 | .queue_priority_mapping = dm646x_queue_priority_mapping, | ||
557 | }, | ||
460 | }; | 558 | }; |
461 | 559 | ||
462 | static struct resource edma_resources[] = { | 560 | static struct resource edma_resources[] = { |
463 | { | 561 | { |
464 | .name = "edma_cc", | 562 | .name = "edma_cc0", |
465 | .start = 0x01c00000, | 563 | .start = 0x01c00000, |
466 | .end = 0x01c00000 + SZ_64K - 1, | 564 | .end = 0x01c00000 + SZ_64K - 1, |
467 | .flags = IORESOURCE_MEM, | 565 | .flags = IORESOURCE_MEM, |
@@ -491,10 +589,12 @@ static struct resource edma_resources[] = { | |||
491 | .flags = IORESOURCE_MEM, | 589 | .flags = IORESOURCE_MEM, |
492 | }, | 590 | }, |
493 | { | 591 | { |
592 | .name = "edma0", | ||
494 | .start = IRQ_CCINT0, | 593 | .start = IRQ_CCINT0, |
495 | .flags = IORESOURCE_IRQ, | 594 | .flags = IORESOURCE_IRQ, |
496 | }, | 595 | }, |
497 | { | 596 | { |
597 | .name = "edma0_err", | ||
498 | .start = IRQ_CCERRINT, | 598 | .start = IRQ_CCERRINT, |
499 | .flags = IORESOURCE_IRQ, | 599 | .flags = IORESOURCE_IRQ, |
500 | }, | 600 | }, |
@@ -503,12 +603,167 @@ static struct resource edma_resources[] = { | |||
503 | 603 | ||
504 | static struct platform_device dm646x_edma_device = { | 604 | static struct platform_device dm646x_edma_device = { |
505 | .name = "edma", | 605 | .name = "edma", |
506 | .id = -1, | 606 | .id = 0, |
507 | .dev.platform_data = &dm646x_edma_info, | 607 | .dev.platform_data = dm646x_edma_info, |
508 | .num_resources = ARRAY_SIZE(edma_resources), | 608 | .num_resources = ARRAY_SIZE(edma_resources), |
509 | .resource = edma_resources, | 609 | .resource = edma_resources, |
510 | }; | 610 | }; |
511 | 611 | ||
612 | static struct resource ide_resources[] = { | ||
613 | { | ||
614 | .start = DM646X_ATA_REG_BASE, | ||
615 | .end = DM646X_ATA_REG_BASE + 0x7ff, | ||
616 | .flags = IORESOURCE_MEM, | ||
617 | }, | ||
618 | { | ||
619 | .start = IRQ_DM646X_IDE, | ||
620 | .end = IRQ_DM646X_IDE, | ||
621 | .flags = IORESOURCE_IRQ, | ||
622 | }, | ||
623 | }; | ||
624 | |||
625 | static u64 ide_dma_mask = DMA_BIT_MASK(32); | ||
626 | |||
627 | static struct platform_device ide_dev = { | ||
628 | .name = "palm_bk3710", | ||
629 | .id = -1, | ||
630 | .resource = ide_resources, | ||
631 | .num_resources = ARRAY_SIZE(ide_resources), | ||
632 | .dev = { | ||
633 | .dma_mask = &ide_dma_mask, | ||
634 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
635 | }, | ||
636 | }; | ||
637 | |||
638 | static struct resource dm646x_mcasp0_resources[] = { | ||
639 | { | ||
640 | .name = "mcasp0", | ||
641 | .start = DAVINCI_DM646X_MCASP0_REG_BASE, | ||
642 | .end = DAVINCI_DM646X_MCASP0_REG_BASE + (SZ_1K << 1) - 1, | ||
643 | .flags = IORESOURCE_MEM, | ||
644 | }, | ||
645 | /* first TX, then RX */ | ||
646 | { | ||
647 | .start = DAVINCI_DM646X_DMA_MCASP0_AXEVT0, | ||
648 | .end = DAVINCI_DM646X_DMA_MCASP0_AXEVT0, | ||
649 | .flags = IORESOURCE_DMA, | ||
650 | }, | ||
651 | { | ||
652 | .start = DAVINCI_DM646X_DMA_MCASP0_AREVT0, | ||
653 | .end = DAVINCI_DM646X_DMA_MCASP0_AREVT0, | ||
654 | .flags = IORESOURCE_DMA, | ||
655 | }, | ||
656 | }; | ||
657 | |||
658 | static struct resource dm646x_mcasp1_resources[] = { | ||
659 | { | ||
660 | .name = "mcasp1", | ||
661 | .start = DAVINCI_DM646X_MCASP1_REG_BASE, | ||
662 | .end = DAVINCI_DM646X_MCASP1_REG_BASE + (SZ_1K << 1) - 1, | ||
663 | .flags = IORESOURCE_MEM, | ||
664 | }, | ||
665 | /* DIT mode, only TX event */ | ||
666 | { | ||
667 | .start = DAVINCI_DM646X_DMA_MCASP1_AXEVT1, | ||
668 | .end = DAVINCI_DM646X_DMA_MCASP1_AXEVT1, | ||
669 | .flags = IORESOURCE_DMA, | ||
670 | }, | ||
671 | /* DIT mode, dummy entry */ | ||
672 | { | ||
673 | .start = -1, | ||
674 | .end = -1, | ||
675 | .flags = IORESOURCE_DMA, | ||
676 | }, | ||
677 | }; | ||
678 | |||
679 | static struct platform_device dm646x_mcasp0_device = { | ||
680 | .name = "davinci-mcasp", | ||
681 | .id = 0, | ||
682 | .num_resources = ARRAY_SIZE(dm646x_mcasp0_resources), | ||
683 | .resource = dm646x_mcasp0_resources, | ||
684 | }; | ||
685 | |||
686 | static struct platform_device dm646x_mcasp1_device = { | ||
687 | .name = "davinci-mcasp", | ||
688 | .id = 1, | ||
689 | .num_resources = ARRAY_SIZE(dm646x_mcasp1_resources), | ||
690 | .resource = dm646x_mcasp1_resources, | ||
691 | }; | ||
692 | |||
693 | static struct platform_device dm646x_dit_device = { | ||
694 | .name = "spdif-dit", | ||
695 | .id = -1, | ||
696 | }; | ||
697 | |||
698 | static u64 vpif_dma_mask = DMA_BIT_MASK(32); | ||
699 | |||
700 | static struct resource vpif_resource[] = { | ||
701 | { | ||
702 | .start = DAVINCI_VPIF_BASE, | ||
703 | .end = DAVINCI_VPIF_BASE + 0x03ff, | ||
704 | .flags = IORESOURCE_MEM, | ||
705 | } | ||
706 | }; | ||
707 | |||
708 | static struct platform_device vpif_dev = { | ||
709 | .name = "vpif", | ||
710 | .id = -1, | ||
711 | .dev = { | ||
712 | .dma_mask = &vpif_dma_mask, | ||
713 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
714 | }, | ||
715 | .resource = vpif_resource, | ||
716 | .num_resources = ARRAY_SIZE(vpif_resource), | ||
717 | }; | ||
718 | |||
719 | static struct resource vpif_display_resource[] = { | ||
720 | { | ||
721 | .start = IRQ_DM646X_VP_VERTINT2, | ||
722 | .end = IRQ_DM646X_VP_VERTINT2, | ||
723 | .flags = IORESOURCE_IRQ, | ||
724 | }, | ||
725 | { | ||
726 | .start = IRQ_DM646X_VP_VERTINT3, | ||
727 | .end = IRQ_DM646X_VP_VERTINT3, | ||
728 | .flags = IORESOURCE_IRQ, | ||
729 | }, | ||
730 | }; | ||
731 | |||
732 | static struct platform_device vpif_display_dev = { | ||
733 | .name = "vpif_display", | ||
734 | .id = -1, | ||
735 | .dev = { | ||
736 | .dma_mask = &vpif_dma_mask, | ||
737 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
738 | }, | ||
739 | .resource = vpif_display_resource, | ||
740 | .num_resources = ARRAY_SIZE(vpif_display_resource), | ||
741 | }; | ||
742 | |||
743 | static struct resource vpif_capture_resource[] = { | ||
744 | { | ||
745 | .start = IRQ_DM646X_VP_VERTINT0, | ||
746 | .end = IRQ_DM646X_VP_VERTINT0, | ||
747 | .flags = IORESOURCE_IRQ, | ||
748 | }, | ||
749 | { | ||
750 | .start = IRQ_DM646X_VP_VERTINT1, | ||
751 | .end = IRQ_DM646X_VP_VERTINT1, | ||
752 | .flags = IORESOURCE_IRQ, | ||
753 | }, | ||
754 | }; | ||
755 | |||
756 | static struct platform_device vpif_capture_dev = { | ||
757 | .name = "vpif_capture", | ||
758 | .id = -1, | ||
759 | .dev = { | ||
760 | .dma_mask = &vpif_dma_mask, | ||
761 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
762 | }, | ||
763 | .resource = vpif_capture_resource, | ||
764 | .num_resources = ARRAY_SIZE(vpif_capture_resource), | ||
765 | }; | ||
766 | |||
512 | /*----------------------------------------------------------------------*/ | 767 | /*----------------------------------------------------------------------*/ |
513 | 768 | ||
514 | static struct map_desc dm646x_io_desc[] = { | 769 | static struct map_desc dm646x_io_desc[] = { |
@@ -609,7 +864,6 @@ static struct davinci_soc_info davinci_soc_info_dm646x = { | |||
609 | .intc_irq_prios = dm646x_default_priorities, | 864 | .intc_irq_prios = dm646x_default_priorities, |
610 | .intc_irq_num = DAVINCI_N_AINTC_IRQ, | 865 | .intc_irq_num = DAVINCI_N_AINTC_IRQ, |
611 | .timer_info = &dm646x_timer_info, | 866 | .timer_info = &dm646x_timer_info, |
612 | .wdt_base = IO_ADDRESS(DAVINCI_WDOG_BASE), | ||
613 | .gpio_base = IO_ADDRESS(DAVINCI_GPIO_BASE), | 867 | .gpio_base = IO_ADDRESS(DAVINCI_GPIO_BASE), |
614 | .gpio_num = 43, /* Only 33 usable */ | 868 | .gpio_num = 43, /* Only 33 usable */ |
615 | .gpio_irq = IRQ_DM646X_GPIOBNK0, | 869 | .gpio_irq = IRQ_DM646X_GPIOBNK0, |
@@ -619,6 +873,51 @@ static struct davinci_soc_info davinci_soc_info_dm646x = { | |||
619 | .sram_len = SZ_32K, | 873 | .sram_len = SZ_32K, |
620 | }; | 874 | }; |
621 | 875 | ||
876 | void __init dm646x_init_ide() | ||
877 | { | ||
878 | davinci_cfg_reg(DM646X_ATAEN); | ||
879 | platform_device_register(&ide_dev); | ||
880 | } | ||
881 | |||
882 | void __init dm646x_init_mcasp0(struct snd_platform_data *pdata) | ||
883 | { | ||
884 | dm646x_mcasp0_device.dev.platform_data = pdata; | ||
885 | platform_device_register(&dm646x_mcasp0_device); | ||
886 | } | ||
887 | |||
888 | void __init dm646x_init_mcasp1(struct snd_platform_data *pdata) | ||
889 | { | ||
890 | dm646x_mcasp1_device.dev.platform_data = pdata; | ||
891 | platform_device_register(&dm646x_mcasp1_device); | ||
892 | platform_device_register(&dm646x_dit_device); | ||
893 | } | ||
894 | |||
895 | void dm646x_setup_vpif(struct vpif_display_config *display_config, | ||
896 | struct vpif_capture_config *capture_config) | ||
897 | { | ||
898 | unsigned int value; | ||
899 | void __iomem *base = IO_ADDRESS(DAVINCI_SYSTEM_MODULE_BASE); | ||
900 | |||
901 | value = __raw_readl(base + VSCLKDIS_OFFSET); | ||
902 | value &= ~VSCLKDIS_MASK; | ||
903 | __raw_writel(value, base + VSCLKDIS_OFFSET); | ||
904 | |||
905 | value = __raw_readl(base + VDD3P3V_PWDN_OFFSET); | ||
906 | value &= ~VDD3P3V_VID_MASK; | ||
907 | __raw_writel(value, base + VDD3P3V_PWDN_OFFSET); | ||
908 | |||
909 | davinci_cfg_reg(DM646X_STSOMUX_DISABLE); | ||
910 | davinci_cfg_reg(DM646X_STSIMUX_DISABLE); | ||
911 | davinci_cfg_reg(DM646X_PTSOMUX_DISABLE); | ||
912 | davinci_cfg_reg(DM646X_PTSIMUX_DISABLE); | ||
913 | |||
914 | vpif_display_dev.dev.platform_data = display_config; | ||
915 | vpif_capture_dev.dev.platform_data = capture_config; | ||
916 | platform_device_register(&vpif_dev); | ||
917 | platform_device_register(&vpif_display_dev); | ||
918 | platform_device_register(&vpif_capture_dev); | ||
919 | } | ||
920 | |||
622 | void __init dm646x_init(void) | 921 | void __init dm646x_init(void) |
623 | { | 922 | { |
624 | davinci_common_init(&davinci_soc_info_dm646x); | 923 | davinci_common_init(&davinci_soc_info_dm646x); |