diff mbox

[3/4] davinci: da850/omap-l138: Add platform specific support for eCAP driver

Message ID 1284968514-17065-1-git-send-email-sugumar@ti.com (mailing list archive)
State Superseded
Headers show

Commit Message

Sugumar Natarajan Sept. 20, 2010, 7:41 a.m. UTC
None
diff mbox

Patch

diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
index c9634c7..8192866 100644
--- a/arch/arm/mach-davinci/Kconfig
+++ b/arch/arm/mach-davinci/Kconfig
@@ -40,6 +40,7 @@  config ARCH_DAVINCI_DA850
 	select CP_INTC
 	select ARCH_DAVINCI_DA8XX
 	select ARCH_HAS_CPUFREQ
+	select HAVE_PWM
 
 config ARCH_DAVINCI_DA8XX
 	select CPU_ARM926T
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 63916b9..7bc51f1 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -345,6 +345,13 @@  static struct clk aemif_clk = {
 	.flags		= ALWAYS_ENABLED,
 };
 
+static struct clk ecap_clk = {
+	.name		= "ecap",
+	.parent		= &pll0_sysclk2,
+	.lpsc		= DA8XX_LPSC1_ECAP,
+	.gpsc		= 1,
+};
+
 static struct clk_lookup da850_clks[] = {
 	CLK(NULL,		"ref",		&ref_clk),
 	CLK(NULL,		"pll0",		&pll0_clk),
@@ -387,6 +394,7 @@  static struct clk_lookup da850_clks[] = {
 	CLK("davinci_mmc.0",	NULL,		&mmcsd0_clk),
 	CLK("davinci_mmc.1",	NULL,		&mmcsd1_clk),
 	CLK(NULL,		"aemif",	&aemif_clk),
+	CLK(NULL,		"ecap",		&ecap_clk),
 	CLK(NULL,		NULL,		NULL),
 };
 
@@ -549,6 +557,7 @@  static const struct mux_config da850_pins[] = {
 	MUX_CFG(DA850, GPIO4_0,		10,	28,	15,	8,	false)
 	MUX_CFG(DA850, GPIO4_1,		10,	24,	15,	8,	false)
 	MUX_CFG(DA850, RTC_ALARM,	0,	28,	15,	2,	false)
+	MUX_CFG(DA850, ECAP2_APWM2,	1,	0,	15,	4,	false)
 #endif
 };
 
@@ -1006,6 +1015,29 @@  static int da850_round_armrate(struct clk *clk, unsigned long rate)
 }
 #endif
 
+
+#define DA8XX_ECAP2_BASE	0x01F08000
+
+static struct resource da850_ecap_resource[] = {
+	{
+	.start		= DA8XX_ECAP2_BASE,
+	.end		= DA8XX_ECAP2_BASE + 0xfff,
+	.flags		= IORESOURCE_MEM,
+	},
+};
+
+static struct platform_device da850_ecap_dev = {
+	.name		= "ecap",
+	.id		= 0,
+	.resource	= da850_ecap_resource,
+	.num_resources	= ARRAY_SIZE(da850_ecap_resource),
+};
+
+int __init da850_register_ecap(void)
+{
+	return platform_device_register(&da850_ecap_dev);
+}
+
 int da850_register_pm(struct platform_device *pdev)
 {
 	int ret;
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index 4247b3f..3b6e399 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -83,6 +83,7 @@  int da850_register_cpufreq(char *async_clk);
 int da8xx_register_cpuidle(void);
 void __iomem * __init da8xx_get_mem_ctlr(void);
 int da850_register_pm(struct platform_device *pdev);
+int __init da850_register_ecap(void);
 
 extern struct platform_device da8xx_serial_device;
 extern struct emac_platform_data da8xx_emac_pdata;
diff --git a/arch/arm/mach-davinci/include/mach/mux.h b/arch/arm/mach-davinci/include/mach/mux.h
index de11aac..b3c23ee 100644
--- a/arch/arm/mach-davinci/include/mach/mux.h
+++ b/arch/arm/mach-davinci/include/mach/mux.h
@@ -914,6 +914,9 @@  enum davinci_da850_index {
 	DA850_GPIO4_0,
 	DA850_GPIO4_1,
 	DA850_RTC_ALARM,
+
+	/* eCAP Module */
+	DA850_ECAP2_APWM2,
 };
 
 enum davinci_tnetv107x_index {