diff options
Diffstat (limited to 'arch/arm/mach-davinci/dm365.c')
-rw-r--r-- | arch/arm/mach-davinci/dm365.c | 213 |
1 files changed, 209 insertions, 4 deletions
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c index f53735cb922e..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; |
@@ -1008,6 +1113,97 @@ void __init dm365_init(void) | |||
1008 | davinci_common_init(&davinci_soc_info_dm365); | 1113 | davinci_common_init(&davinci_soc_info_dm365); |
1009 | } | 1114 | } |
1010 | 1115 | ||
1116 | static struct resource dm365_vpss_resources[] = { | ||
1117 | { | ||
1118 | /* VPSS ISP5 Base address */ | ||
1119 | .name = "isp5", | ||
1120 | .start = 0x01c70000, | ||
1121 | .end = 0x01c70000 + 0xff, | ||
1122 | .flags = IORESOURCE_MEM, | ||
1123 | }, | ||
1124 | { | ||
1125 | /* VPSS CLK Base address */ | ||
1126 | .name = "vpss", | ||
1127 | .start = 0x01c70200, | ||
1128 | .end = 0x01c70200 + 0xff, | ||
1129 | .flags = IORESOURCE_MEM, | ||
1130 | }, | ||
1131 | }; | ||
1132 | |||
1133 | static struct platform_device dm365_vpss_device = { | ||
1134 | .name = "vpss", | ||
1135 | .id = -1, | ||
1136 | .dev.platform_data = "dm365_vpss", | ||
1137 | .num_resources = ARRAY_SIZE(dm365_vpss_resources), | ||
1138 | .resource = dm365_vpss_resources, | ||
1139 | }; | ||
1140 | |||
1141 | static struct resource vpfe_resources[] = { | ||
1142 | { | ||
1143 | .start = IRQ_VDINT0, | ||
1144 | .end = IRQ_VDINT0, | ||
1145 | .flags = IORESOURCE_IRQ, | ||
1146 | }, | ||
1147 | { | ||
1148 | .start = IRQ_VDINT1, | ||
1149 | .end = IRQ_VDINT1, | ||
1150 | .flags = IORESOURCE_IRQ, | ||
1151 | }, | ||
1152 | }; | ||
1153 | |||
1154 | static u64 vpfe_capture_dma_mask = DMA_BIT_MASK(32); | ||
1155 | static struct platform_device vpfe_capture_dev = { | ||
1156 | .name = CAPTURE_DRV_NAME, | ||
1157 | .id = -1, | ||
1158 | .num_resources = ARRAY_SIZE(vpfe_resources), | ||
1159 | .resource = vpfe_resources, | ||
1160 | .dev = { | ||
1161 | .dma_mask = &vpfe_capture_dma_mask, | ||
1162 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
1163 | }, | ||
1164 | }; | ||
1165 | |||
1166 | static void dm365_isif_setup_pinmux(void) | ||
1167 | { | ||
1168 | davinci_cfg_reg(DM365_VIN_CAM_WEN); | ||
1169 | davinci_cfg_reg(DM365_VIN_CAM_VD); | ||
1170 | davinci_cfg_reg(DM365_VIN_CAM_HD); | ||
1171 | davinci_cfg_reg(DM365_VIN_YIN4_7_EN); | ||
1172 | davinci_cfg_reg(DM365_VIN_YIN0_3_EN); | ||
1173 | } | ||
1174 | |||
1175 | static struct resource isif_resource[] = { | ||
1176 | /* ISIF Base address */ | ||
1177 | { | ||
1178 | .start = 0x01c71000, | ||
1179 | .end = 0x01c71000 + 0x1ff, | ||
1180 | .flags = IORESOURCE_MEM, | ||
1181 | }, | ||
1182 | /* ISIF Linearization table 0 */ | ||
1183 | { | ||
1184 | .start = 0x1C7C000, | ||
1185 | .end = 0x1C7C000 + 0x2ff, | ||
1186 | .flags = IORESOURCE_MEM, | ||
1187 | }, | ||
1188 | /* ISIF Linearization table 1 */ | ||
1189 | { | ||
1190 | .start = 0x1C7C400, | ||
1191 | .end = 0x1C7C400 + 0x2ff, | ||
1192 | .flags = IORESOURCE_MEM, | ||
1193 | }, | ||
1194 | }; | ||
1195 | static struct platform_device dm365_isif_dev = { | ||
1196 | .name = "isif", | ||
1197 | .id = -1, | ||
1198 | .num_resources = ARRAY_SIZE(isif_resource), | ||
1199 | .resource = isif_resource, | ||
1200 | .dev = { | ||
1201 | .dma_mask = &vpfe_capture_dma_mask, | ||
1202 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
1203 | .platform_data = dm365_isif_setup_pinmux, | ||
1204 | }, | ||
1205 | }; | ||
1206 | |||
1011 | static int __init dm365_init_devices(void) | 1207 | static int __init dm365_init_devices(void) |
1012 | { | 1208 | { |
1013 | if (!cpu_is_davinci_dm365()) | 1209 | if (!cpu_is_davinci_dm365()) |
@@ -1016,7 +1212,16 @@ static int __init dm365_init_devices(void) | |||
1016 | davinci_cfg_reg(DM365_INT_EDMA_CC); | 1212 | davinci_cfg_reg(DM365_INT_EDMA_CC); |
1017 | platform_device_register(&dm365_edma_device); | 1213 | platform_device_register(&dm365_edma_device); |
1018 | platform_device_register(&dm365_emac_device); | 1214 | platform_device_register(&dm365_emac_device); |
1019 | 1215 | /* Add isif clock alias */ | |
1216 | clk_add_alias("master", dm365_isif_dev.name, "vpss_master", NULL); | ||
1217 | platform_device_register(&dm365_vpss_device); | ||
1218 | platform_device_register(&dm365_isif_dev); | ||
1219 | platform_device_register(&vpfe_capture_dev); | ||
1020 | return 0; | 1220 | return 0; |
1021 | } | 1221 | } |
1022 | postcore_initcall(dm365_init_devices); | 1222 | postcore_initcall(dm365_init_devices); |
1223 | |||
1224 | void dm365_set_vpfe_config(struct vpfe_config *cfg) | ||
1225 | { | ||
1226 | vpfe_capture_dev.dev.platform_data = cfg; | ||
1227 | } | ||