20 #include <linux/kernel.h>
21 #include <linux/sched.h>
23 #include <linux/module.h>
26 #include <linux/compiler.h>
28 #include <mach/hardware.h>
36 #define DM644X_SBL_PCR_VPSS (4)
38 #define DM355_VPSSBL_INTSEL 0x10
39 #define DM355_VPSSBL_EVTSEL 0x14
41 #define DM355_VPSSBL_CCDCMUX 0x1c
43 #define DM355_VPSSCLK_CLKCTRL 0x04
45 #define VPSS_HSSISEL_SHIFT 4
50 #define DM355_VPSSBL_INTSEL_DEFAULT 0xff83ff10
52 #define DM355_VPSSBL_EVTSEL_DEFAULT 0x4
54 #define DM365_ISP5_PCCR 0x04
55 #define DM365_ISP5_INTSEL1 0x10
56 #define DM365_ISP5_INTSEL2 0x14
57 #define DM365_ISP5_INTSEL3 0x18
58 #define DM365_ISP5_CCDCMUX 0x20
59 #define DM365_ISP5_PG_FRAME_SIZE 0x28
60 #define DM365_VPBE_CLK_CTRL 0x00
65 #define DM365_ISP5_INTSEL1_DEFAULT 0x0b1f0100
67 #define DM365_ISP5_INTSEL2_DEFAULT 0x1f0a0f1f
69 #define DM365_ISP5_INTSEL3_DEFAULT 0x00000015
72 #define DM365_CCDC_PG_VD_POL_SHIFT 0
73 #define DM365_CCDC_PG_HD_POL_SHIFT 1
75 #define CCD_SRC_SEL_MASK (BIT_MASK(5) | BIT_MASK(4))
76 #define CCD_SRC_SEL_SHIFT 4
114 return __raw_readl(oper_cfg.vpss_regs_base0 + offset);
124 return __raw_readl(oper_cfg.vpss_regs_base1 + offset);
135 return __raw_readl(oper_cfg.vpss_regs_base0 + offset);
163 if (!oper_cfg.hw_ops.select_ccdc_source)
166 oper_cfg.hw_ops.select_ccdc_source(src_sel);
171 static int dm644x_clear_wbl_overflow(
enum vpss_wbl_sel wbl_sel)
180 mask = ~(mask << wbl_sel);
188 if (!oper_cfg.hw_ops.clear_wbl_overflow)
191 return oper_cfg.hw_ops.clear_wbl_overflow(wbl_sel);
202 static int dm355_enable_clock(
enum vpss_clock_sel clock_sel,
int en)
205 u32 utemp, mask = 0x1, shift = 0;
228 " Invalid selector: %d\n", clock_sel);
235 utemp &= ~(mask << shift);
237 utemp |= (mask << shift);
240 spin_unlock_irqrestore(&oper_cfg.vpss_lock, flags);
244 static int dm365_enable_clock(
enum vpss_clock_sel clock_sel,
int en)
320 utemp &= (mask << shift);
322 utemp |= (mask << shift);
325 spin_unlock_irqrestore(&oper_cfg.vpss_lock, flags);
332 if (!oper_cfg.hw_ops.enable_clock)
335 return oper_cfg.hw_ops.enable_clock(clock_sel, en);
353 int current_reg = ((frame_size.
hlpfr >> 1) - 1) << 16;
355 current_reg |= (frame_size.
pplen - 1);
366 if (!pdev->
dev.platform_data) {
371 platform_name = pdev->
dev.platform_data;
372 if (!
strcmp(platform_name,
"dm355_vpss"))
373 oper_cfg.platform =
DM355;
374 else if (!
strcmp(platform_name,
"dm365_vpss"))
375 oper_cfg.platform =
DM365;
376 else if (!
strcmp(platform_name,
"dm644x_vpss"))
377 oper_cfg.platform =
DM644X;
379 dev_err(&pdev->
dev,
"vpss driver not supported on"
384 dev_info(&pdev->
dev,
"%s vpss probed\n", platform_name);
393 oper_cfg.vpss_regs_base0 =
ioremap(r1->
start, resource_size(r1));
394 if (!oper_cfg.vpss_regs_base0) {
399 if (oper_cfg.platform ==
DM355 || oper_cfg.platform ==
DM365) {
413 if (!oper_cfg.vpss_regs_base1) {
419 if (oper_cfg.platform ==
DM355) {
420 oper_cfg.hw_ops.enable_clock = dm355_enable_clock;
421 oper_cfg.hw_ops.select_ccdc_source = dm355_select_ccdc_source;
425 }
else if (oper_cfg.platform ==
DM365) {
426 oper_cfg.hw_ops.enable_clock = dm365_enable_clock;
427 oper_cfg.hw_ops.select_ccdc_source = dm365_select_ccdc_source;
433 oper_cfg.hw_ops.clear_wbl_overflow = dm644x_clear_wbl_overflow;
436 dev_info(&pdev->
dev,
"%s vpss probe success\n", platform_name);
442 iounmap(oper_cfg.vpss_regs_base0);
452 iounmap(oper_cfg.vpss_regs_base0);
455 if (oper_cfg.platform ==
DM355 || oper_cfg.platform ==
DM365) {
456 iounmap(oper_cfg.vpss_regs_base1);
472 static void vpss_exit(
void)
477 static int __init vpss_init(
void)