diff options
Diffstat (limited to 'arch/arm/mach-davinci/dm365.c')
-rw-r--r-- | arch/arm/mach-davinci/dm365.c | 111 |
1 files changed, 108 insertions, 3 deletions
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c index ce9da43a628b..27772e18e45b 100644 --- a/arch/arm/mach-davinci/dm365.c +++ b/arch/arm/mach-davinci/dm365.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
19 | #include <linux/dma-mapping.h> | 19 | #include <linux/dma-mapping.h> |
20 | #include <linux/gpio.h> | 20 | #include <linux/gpio.h> |
21 | #include <linux/spi/spi.h> | ||
21 | 22 | ||
22 | #include <asm/mach/map.h> | 23 | #include <asm/mach/map.h> |
23 | 24 | ||
@@ -32,6 +33,8 @@ | |||
32 | #include <mach/common.h> | 33 | #include <mach/common.h> |
33 | #include <mach/asp.h> | 34 | #include <mach/asp.h> |
34 | #include <mach/keyscan.h> | 35 | #include <mach/keyscan.h> |
36 | #include <mach/spi.h> | ||
37 | |||
35 | 38 | ||
36 | #include "clock.h" | 39 | #include "clock.h" |
37 | #include "mux.h" | 40 | #include "mux.h" |
@@ -403,7 +406,7 @@ static struct clk mjcp_clk = { | |||
403 | .lpsc = DM365_LPSC_MJCP, | 406 | .lpsc = DM365_LPSC_MJCP, |
404 | }; | 407 | }; |
405 | 408 | ||
406 | static struct davinci_clk dm365_clks[] = { | 409 | static struct clk_lookup dm365_clks[] = { |
407 | CLK(NULL, "ref", &ref_clk), | 410 | CLK(NULL, "ref", &ref_clk), |
408 | CLK(NULL, "pll1", &pll1_clk), | 411 | CLK(NULL, "pll1", &pll1_clk), |
409 | CLK(NULL, "pll1_aux", &pll1_aux_clk), | 412 | CLK(NULL, "pll1_aux", &pll1_aux_clk), |
@@ -455,7 +458,7 @@ static struct davinci_clk dm365_clks[] = { | |||
455 | CLK(NULL, "timer3", &timer3_clk), | 458 | CLK(NULL, "timer3", &timer3_clk), |
456 | CLK(NULL, "usb", &usb_clk), | 459 | CLK(NULL, "usb", &usb_clk), |
457 | CLK("davinci_emac.1", NULL, &emac_clk), | 460 | CLK("davinci_emac.1", NULL, &emac_clk), |
458 | CLK("voice_codec", NULL, &voicecodec_clk), | 461 | CLK("davinci_voicecodec", NULL, &voicecodec_clk), |
459 | CLK("davinci-asp.0", NULL, &asp0_clk), | 462 | CLK("davinci-asp.0", NULL, &asp0_clk), |
460 | CLK(NULL, "rto", &rto_clk), | 463 | CLK(NULL, "rto", &rto_clk), |
461 | CLK(NULL, "mjcp", &mjcp_clk), | 464 | CLK(NULL, "mjcp", &mjcp_clk), |
@@ -606,9 +609,78 @@ INT_CFG(DM365, INT_NSF_DISABLE, 25, 1, 0, false) | |||
606 | 609 | ||
607 | EVT_CFG(DM365, EVT2_ASP_TX, 0, 1, 0, false) | 610 | EVT_CFG(DM365, EVT2_ASP_TX, 0, 1, 0, false) |
608 | EVT_CFG(DM365, EVT3_ASP_RX, 1, 1, 0, false) | 611 | EVT_CFG(DM365, EVT3_ASP_RX, 1, 1, 0, false) |
612 | EVT_CFG(DM365, EVT2_VC_TX, 0, 1, 1, false) | ||
613 | EVT_CFG(DM365, EVT3_VC_RX, 1, 1, 1, false) | ||
609 | #endif | 614 | #endif |
610 | }; | 615 | }; |
611 | 616 | ||
617 | static u64 dm365_spi0_dma_mask = DMA_BIT_MASK(32); | ||
618 | |||
619 | static struct davinci_spi_platform_data dm365_spi0_pdata = { | ||
620 | .version = SPI_VERSION_1, | ||
621 | .num_chipselect = 2, | ||
622 | .clk_internal = 1, | ||
623 | .cs_hold = 1, | ||
624 | .intr_level = 0, | ||
625 | .poll_mode = 1, /* 0 -> interrupt mode 1-> polling mode */ | ||
626 | .c2tdelay = 0, | ||
627 | .t2cdelay = 0, | ||
628 | }; | ||
629 | |||
630 | static struct resource dm365_spi0_resources[] = { | ||
631 | { | ||
632 | .start = 0x01c66000, | ||
633 | .end = 0x01c667ff, | ||
634 | .flags = IORESOURCE_MEM, | ||
635 | }, | ||
636 | { | ||
637 | .start = IRQ_DM365_SPIINT0_0, | ||
638 | .flags = IORESOURCE_IRQ, | ||
639 | }, | ||
640 | { | ||
641 | .start = 17, | ||
642 | .flags = IORESOURCE_DMA, | ||
643 | }, | ||
644 | { | ||
645 | .start = 16, | ||
646 | .flags = IORESOURCE_DMA, | ||
647 | }, | ||
648 | { | ||
649 | .start = EVENTQ_3, | ||
650 | .flags = IORESOURCE_DMA, | ||
651 | }, | ||
652 | }; | ||
653 | |||
654 | static struct platform_device dm365_spi0_device = { | ||
655 | .name = "spi_davinci", | ||
656 | .id = 0, | ||
657 | .dev = { | ||
658 | .dma_mask = &dm365_spi0_dma_mask, | ||
659 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
660 | .platform_data = &dm365_spi0_pdata, | ||
661 | }, | ||
662 | .num_resources = ARRAY_SIZE(dm365_spi0_resources), | ||
663 | .resource = dm365_spi0_resources, | ||
664 | }; | ||
665 | |||
666 | void __init dm365_init_spi0(unsigned chipselect_mask, | ||
667 | struct spi_board_info *info, unsigned len) | ||
668 | { | ||
669 | davinci_cfg_reg(DM365_SPI0_SCLK); | ||
670 | davinci_cfg_reg(DM365_SPI0_SDI); | ||
671 | davinci_cfg_reg(DM365_SPI0_SDO); | ||
672 | |||
673 | /* not all slaves will be wired up */ | ||
674 | if (chipselect_mask & BIT(0)) | ||
675 | davinci_cfg_reg(DM365_SPI0_SDENA0); | ||
676 | if (chipselect_mask & BIT(1)) | ||
677 | davinci_cfg_reg(DM365_SPI0_SDENA1); | ||
678 | |||
679 | spi_register_board_info(info, len); | ||
680 | |||
681 | platform_device_register(&dm365_spi0_device); | ||
682 | } | ||
683 | |||
612 | static struct emac_platform_data dm365_emac_pdata = { | 684 | static struct emac_platform_data dm365_emac_pdata = { |
613 | .ctrl_reg_offset = DM365_EMAC_CNTRL_OFFSET, | 685 | .ctrl_reg_offset = DM365_EMAC_CNTRL_OFFSET, |
614 | .ctrl_mod_reg_offset = DM365_EMAC_CNTRL_MOD_OFFSET, | 686 | .ctrl_mod_reg_offset = DM365_EMAC_CNTRL_MOD_OFFSET, |
@@ -754,7 +826,7 @@ static struct edma_soc_info dm365_edma_info[] = { | |||
754 | .n_cc = 1, | 826 | .n_cc = 1, |
755 | .queue_tc_mapping = dm365_queue_tc_mapping, | 827 | .queue_tc_mapping = dm365_queue_tc_mapping, |
756 | .queue_priority_mapping = dm365_queue_priority_mapping, | 828 | .queue_priority_mapping = dm365_queue_priority_mapping, |
757 | .default_queue = EVENTQ_2, | 829 | .default_queue = EVENTQ_3, |
758 | }, | 830 | }, |
759 | }; | 831 | }; |
760 | 832 | ||
@@ -835,6 +907,31 @@ static struct platform_device dm365_asp_device = { | |||
835 | .resource = dm365_asp_resources, | 907 | .resource = dm365_asp_resources, |
836 | }; | 908 | }; |
837 | 909 | ||
910 | static struct resource dm365_vc_resources[] = { | ||
911 | { | ||
912 | .start = DAVINCI_DM365_VC_BASE, | ||
913 | .end = DAVINCI_DM365_VC_BASE + SZ_1K - 1, | ||
914 | .flags = IORESOURCE_MEM, | ||
915 | }, | ||
916 | { | ||
917 | .start = DAVINCI_DMA_VC_TX, | ||
918 | .end = DAVINCI_DMA_VC_TX, | ||
919 | .flags = IORESOURCE_DMA, | ||
920 | }, | ||
921 | { | ||
922 | .start = DAVINCI_DMA_VC_RX, | ||
923 | .end = DAVINCI_DMA_VC_RX, | ||
924 | .flags = IORESOURCE_DMA, | ||
925 | }, | ||
926 | }; | ||
927 | |||
928 | static struct platform_device dm365_vc_device = { | ||
929 | .name = "davinci_voicecodec", | ||
930 | .id = -1, | ||
931 | .num_resources = ARRAY_SIZE(dm365_vc_resources), | ||
932 | .resource = dm365_vc_resources, | ||
933 | }; | ||
934 | |||
838 | static struct resource dm365_rtc_resources[] = { | 935 | static struct resource dm365_rtc_resources[] = { |
839 | { | 936 | { |
840 | .start = DM365_RTC_BASE, | 937 | .start = DM365_RTC_BASE, |
@@ -991,6 +1088,14 @@ void __init dm365_init_asp(struct snd_platform_data *pdata) | |||
991 | platform_device_register(&dm365_asp_device); | 1088 | platform_device_register(&dm365_asp_device); |
992 | } | 1089 | } |
993 | 1090 | ||
1091 | void __init dm365_init_vc(struct snd_platform_data *pdata) | ||
1092 | { | ||
1093 | davinci_cfg_reg(DM365_EVT2_VC_TX); | ||
1094 | davinci_cfg_reg(DM365_EVT3_VC_RX); | ||
1095 | dm365_vc_device.dev.platform_data = pdata; | ||
1096 | platform_device_register(&dm365_vc_device); | ||
1097 | } | ||
1098 | |||
994 | void __init dm365_init_ks(struct davinci_ks_platform_data *pdata) | 1099 | void __init dm365_init_ks(struct davinci_ks_platform_data *pdata) |
995 | { | 1100 | { |
996 | dm365_ks_device.dev.platform_data = pdata; | 1101 | dm365_ks_device.dev.platform_data = pdata; |