aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMurali Karicheri <m-karicheri2@ti.com>2010-02-01 17:38:53 -0500
committerKevin Hilman <khilman@deeprootsystems.com>2010-02-04 16:28:46 -0500
commitf2a4c59df62f4493c7cf7dfd349ec66bdd4b9fec (patch)
tree179a5d04ef3034d82da2299ef2478e05bd5247f2
parentabe94c756c08d50566c09a65b9c7fe72f83071c5 (diff)
DaVinci - Adding platform & board changes for vpfe capture on DM365
This patch adds following changes:- 1) add sub device configuration data for TVP5146 used by vpfe capture 2) registers platform devices for vpfe_capture, isif and vpss 3) defines hardware resources for the devices listed under 2) 4) defines clock aliase for isif driver 5) adding setup_pinmux() for isif Signed-off-by: Murali Karicheri <m-karicheri2@ti.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
-rw-r--r--arch/arm/mach-davinci/board-dm365-evm.c71
-rw-r--r--arch/arm/mach-davinci/dm365.c102
-rw-r--r--arch/arm/mach-davinci/include/mach/dm365.h2
3 files changed, 174 insertions, 1 deletions
diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c
index b476395d2cd4..38e9033d2e86 100644
--- a/arch/arm/mach-davinci/board-dm365-evm.c
+++ b/arch/arm/mach-davinci/board-dm365-evm.c
@@ -37,6 +37,8 @@
37#include <mach/nand.h> 37#include <mach/nand.h>
38#include <mach/keyscan.h> 38#include <mach/keyscan.h>
39 39
40#include <media/tvp514x.h>
41
40static inline int have_imager(void) 42static inline int have_imager(void)
41{ 43{
42 /* REVISIT when it's supported, trigger via Kconfig */ 44 /* REVISIT when it's supported, trigger via Kconfig */
@@ -306,6 +308,73 @@ static void dm365evm_mmc_configure(void)
306 davinci_cfg_reg(DM365_SD1_DATA0); 308 davinci_cfg_reg(DM365_SD1_DATA0);
307} 309}
308 310
311static struct tvp514x_platform_data tvp5146_pdata = {
312 .clk_polarity = 0,
313 .hs_polarity = 1,
314 .vs_polarity = 1
315};
316
317#define TVP514X_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL)
318/* Inputs available at the TVP5146 */
319static struct v4l2_input tvp5146_inputs[] = {
320 {
321 .index = 0,
322 .name = "Composite",
323 .type = V4L2_INPUT_TYPE_CAMERA,
324 .std = TVP514X_STD_ALL,
325 },
326 {
327 .index = 1,
328 .name = "S-Video",
329 .type = V4L2_INPUT_TYPE_CAMERA,
330 .std = TVP514X_STD_ALL,
331 },
332};
333
334/*
335 * this is the route info for connecting each input to decoder
336 * ouput that goes to vpfe. There is a one to one correspondence
337 * with tvp5146_inputs
338 */
339static struct vpfe_route tvp5146_routes[] = {
340 {
341 .input = INPUT_CVBS_VI2B,
342 .output = OUTPUT_10BIT_422_EMBEDDED_SYNC,
343 },
344{
345 .input = INPUT_SVIDEO_VI2C_VI1C,
346 .output = OUTPUT_10BIT_422_EMBEDDED_SYNC,
347 },
348};
349
350static struct vpfe_subdev_info vpfe_sub_devs[] = {
351 {
352 .name = "tvp5146",
353 .grp_id = 0,
354 .num_inputs = ARRAY_SIZE(tvp5146_inputs),
355 .inputs = tvp5146_inputs,
356 .routes = tvp5146_routes,
357 .can_route = 1,
358 .ccdc_if_params = {
359 .if_type = VPFE_BT656,
360 .hdpol = VPFE_PINPOL_POSITIVE,
361 .vdpol = VPFE_PINPOL_POSITIVE,
362 },
363 .board_info = {
364 I2C_BOARD_INFO("tvp5146", 0x5d),
365 .platform_data = &tvp5146_pdata,
366 },
367 },
368};
369
370static struct vpfe_config vpfe_cfg = {
371 .num_subdevs = ARRAY_SIZE(vpfe_sub_devs),
372 .sub_devs = vpfe_sub_devs,
373 .i2c_adapter_id = 1,
374 .card_name = "DM365 EVM",
375 .ccdc = "ISIF",
376};
377
309static void __init evm_init_i2c(void) 378static void __init evm_init_i2c(void)
310{ 379{
311 davinci_init_i2c(&i2c_pdata); 380 davinci_init_i2c(&i2c_pdata);
@@ -497,6 +566,8 @@ static struct davinci_uart_config uart_config __initdata = {
497 566
498static void __init dm365_evm_map_io(void) 567static void __init dm365_evm_map_io(void)
499{ 568{
569 /* setup input configuration for VPFE input devices */
570 dm365_set_vpfe_config(&vpfe_cfg);
500 dm365_init(); 571 dm365_init();
501} 572}
502 573
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index f53735cb922e..ce9da43a628b 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -1008,6 +1008,97 @@ void __init dm365_init(void)
1008 davinci_common_init(&davinci_soc_info_dm365); 1008 davinci_common_init(&davinci_soc_info_dm365);
1009} 1009}
1010 1010
1011static struct resource dm365_vpss_resources[] = {
1012 {
1013 /* VPSS ISP5 Base address */
1014 .name = "isp5",
1015 .start = 0x01c70000,
1016 .end = 0x01c70000 + 0xff,
1017 .flags = IORESOURCE_MEM,
1018 },
1019 {
1020 /* VPSS CLK Base address */
1021 .name = "vpss",
1022 .start = 0x01c70200,
1023 .end = 0x01c70200 + 0xff,
1024 .flags = IORESOURCE_MEM,
1025 },
1026};
1027
1028static struct platform_device dm365_vpss_device = {
1029 .name = "vpss",
1030 .id = -1,
1031 .dev.platform_data = "dm365_vpss",
1032 .num_resources = ARRAY_SIZE(dm365_vpss_resources),
1033 .resource = dm365_vpss_resources,
1034};
1035
1036static struct resource vpfe_resources[] = {
1037 {
1038 .start = IRQ_VDINT0,
1039 .end = IRQ_VDINT0,
1040 .flags = IORESOURCE_IRQ,
1041 },
1042 {
1043 .start = IRQ_VDINT1,
1044 .end = IRQ_VDINT1,
1045 .flags = IORESOURCE_IRQ,
1046 },
1047};
1048
1049static u64 vpfe_capture_dma_mask = DMA_BIT_MASK(32);
1050static struct platform_device vpfe_capture_dev = {
1051 .name = CAPTURE_DRV_NAME,
1052 .id = -1,
1053 .num_resources = ARRAY_SIZE(vpfe_resources),
1054 .resource = vpfe_resources,
1055 .dev = {
1056 .dma_mask = &vpfe_capture_dma_mask,
1057 .coherent_dma_mask = DMA_BIT_MASK(32),
1058 },
1059};
1060
1061static void dm365_isif_setup_pinmux(void)
1062{
1063 davinci_cfg_reg(DM365_VIN_CAM_WEN);
1064 davinci_cfg_reg(DM365_VIN_CAM_VD);
1065 davinci_cfg_reg(DM365_VIN_CAM_HD);
1066 davinci_cfg_reg(DM365_VIN_YIN4_7_EN);
1067 davinci_cfg_reg(DM365_VIN_YIN0_3_EN);
1068}
1069
1070static struct resource isif_resource[] = {
1071 /* ISIF Base address */
1072 {
1073 .start = 0x01c71000,
1074 .end = 0x01c71000 + 0x1ff,
1075 .flags = IORESOURCE_MEM,
1076 },
1077 /* ISIF Linearization table 0 */
1078 {
1079 .start = 0x1C7C000,
1080 .end = 0x1C7C000 + 0x2ff,
1081 .flags = IORESOURCE_MEM,
1082 },
1083 /* ISIF Linearization table 1 */
1084 {
1085 .start = 0x1C7C400,
1086 .end = 0x1C7C400 + 0x2ff,
1087 .flags = IORESOURCE_MEM,
1088 },
1089};
1090static struct platform_device dm365_isif_dev = {
1091 .name = "isif",
1092 .id = -1,
1093 .num_resources = ARRAY_SIZE(isif_resource),
1094 .resource = isif_resource,
1095 .dev = {
1096 .dma_mask = &vpfe_capture_dma_mask,
1097 .coherent_dma_mask = DMA_BIT_MASK(32),
1098 .platform_data = dm365_isif_setup_pinmux,
1099 },
1100};
1101
1011static int __init dm365_init_devices(void) 1102static int __init dm365_init_devices(void)
1012{ 1103{
1013 if (!cpu_is_davinci_dm365()) 1104 if (!cpu_is_davinci_dm365())
@@ -1016,7 +1107,16 @@ static int __init dm365_init_devices(void)
1016 davinci_cfg_reg(DM365_INT_EDMA_CC); 1107 davinci_cfg_reg(DM365_INT_EDMA_CC);
1017 platform_device_register(&dm365_edma_device); 1108 platform_device_register(&dm365_edma_device);
1018 platform_device_register(&dm365_emac_device); 1109 platform_device_register(&dm365_emac_device);
1019 1110 /* Add isif clock alias */
1111 clk_add_alias("master", dm365_isif_dev.name, "vpss_master", NULL);
1112 platform_device_register(&dm365_vpss_device);
1113 platform_device_register(&dm365_isif_dev);
1114 platform_device_register(&vpfe_capture_dev);
1020 return 0; 1115 return 0;
1021} 1116}
1022postcore_initcall(dm365_init_devices); 1117postcore_initcall(dm365_init_devices);
1118
1119void dm365_set_vpfe_config(struct vpfe_config *cfg)
1120{
1121 vpfe_capture_dev.dev.platform_data = cfg;
1122}
diff --git a/arch/arm/mach-davinci/include/mach/dm365.h b/arch/arm/mach-davinci/include/mach/dm365.h
index f1710a30e7ba..9fc5a64a5364 100644
--- a/arch/arm/mach-davinci/include/mach/dm365.h
+++ b/arch/arm/mach-davinci/include/mach/dm365.h
@@ -18,6 +18,7 @@
18#include <mach/emac.h> 18#include <mach/emac.h>
19#include <mach/asp.h> 19#include <mach/asp.h>
20#include <mach/keyscan.h> 20#include <mach/keyscan.h>
21#include <media/davinci/vpfe_capture.h>
21 22
22#define DM365_EMAC_BASE (0x01D07000) 23#define DM365_EMAC_BASE (0x01D07000)
23#define DM365_EMAC_CNTRL_OFFSET (0x0000) 24#define DM365_EMAC_CNTRL_OFFSET (0x0000)
@@ -36,4 +37,5 @@ void __init dm365_init_asp(struct snd_platform_data *pdata);
36void __init dm365_init_ks(struct davinci_ks_platform_data *pdata); 37void __init dm365_init_ks(struct davinci_ks_platform_data *pdata);
37void __init dm365_init_rtc(void); 38void __init dm365_init_rtc(void);
38 39
40void dm365_set_vpfe_config(struct vpfe_config *cfg);
39#endif /* __ASM_ARCH_DM365_H */ 41#endif /* __ASM_ARCH_DM365_H */