From patchwork Mon Sep 20 07:45:15 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sugumar Natarajan X-Patchwork-Id: 194472 Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o8K8LsfP005146 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 20 Sep 2010 08:22:30 GMT Received: from dlep36.itg.ti.com ([157.170.170.91]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id o8K8K823001502 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 20 Sep 2010 03:20:08 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep36.itg.ti.com (8.13.8/8.13.8) with ESMTP id o8K8K8MZ011640; Mon, 20 Sep 2010 03:20:08 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 025B380628; Mon, 20 Sep 2010 03:20:08 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp53.itg.ti.com (dflp53.itg.ti.com [128.247.5.6]) by linux.omap.com (Postfix) with ESMTP id D4D7680626 for ; Mon, 20 Sep 2010 03:20:05 -0500 (CDT) Received: from tidmzi-ftp.india.ext.ti.com (localhost [127.0.0.1]) by dflp53.itg.ti.com (8.13.8/8.13.8) with SMTP id o8K8K4S5008938 for ; Mon, 20 Sep 2010 03:20:04 -0500 (CDT) Received: from symphonyindia.ti.com (symphony-ftp [192.168.247.11]) by tidmzi-ftp.india.ext.ti.com (Postfix) with SMTP id C9D2E3887A for ; Mon, 20 Sep 2010 13:49:59 +0530 (IST) Received: from localhost.localdomain ([192.168.247.76]) by symphonyindia.ti.com (8.13.1/8.12.10) with ESMTP id o8K8D0Vd022804; Mon, 20 Sep 2010 13:43:00 +0530 From: Sugumar Natarajan To: davinci-linux-open-source@linux.davincidsp.com Subject: [PATCH 2/2] davinci: Add platform specific support for eHRPWM driver Date: Mon, 20 Sep 2010 13:15:15 +0530 Message-Id: <1284968715-17272-1-git-send-email-sugumar@ti.com> X-Mailer: git-send-email 1.5.6 X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: davinci-linux-open-source-bounces@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com X-Greylist: Sender succeeded STARTTLS authentication, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Mon, 20 Sep 2010 08:22:30 +0000 (UTC) diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c index 7bc51f1..ab1758e 100644 --- a/arch/arm/mach-davinci/da850.c +++ b/arch/arm/mach-davinci/da850.c @@ -352,6 +352,13 @@ static struct clk ecap_clk = { .gpsc = 1, }; +static struct clk ehrpwm_clk = { + .name = "ehrpwm", + .parent = &pll0_sysclk2, + .lpsc = DA8XX_LPSC1_PWM, + .gpsc = 1, +}; + static struct clk_lookup da850_clks[] = { CLK(NULL, "ref", &ref_clk), CLK(NULL, "pll0", &pll0_clk), @@ -395,6 +402,7 @@ static struct clk_lookup da850_clks[] = { CLK("davinci_mmc.1", NULL, &mmcsd1_clk), CLK(NULL, "aemif", &aemif_clk), CLK(NULL, "ecap", &ecap_clk), + CLK(NULL, "ehrpwm", &ehrpwm_clk), CLK(NULL, NULL, NULL), }; @@ -558,6 +566,7 @@ static const struct mux_config da850_pins[] = { 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) + MUX_CFG(DA850, EHRPWM1_A, 5, 0, 15, 2, false) #endif }; @@ -1015,6 +1024,22 @@ static int da850_round_armrate(struct clk *clk, unsigned long rate) } #endif +#define DA8XX_EHRPWM1_BASE 0x01F02000 + +static struct resource da850_ehrpwm_resource[] = { + { + .start = DA8XX_EHRPWM1_BASE, + .end = DA8XX_EHRPWM1_BASE + 0xfff, + .flags = IORESOURCE_MEM, + }, +}; + +static struct platform_device da850_ehrpwm_dev = { + .name = "ehrpwm", + .id = 1, + .resource = da850_ehrpwm_resource, + .num_resources = ARRAY_SIZE(da850_ehrpwm_resource), +}; #define DA8XX_ECAP2_BASE 0x01F08000 @@ -1038,6 +1063,15 @@ int __init da850_register_ecap(void) return platform_device_register(&da850_ecap_dev); } + +#define DA8XX_CHIPCFG1 DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP1_REG) + +int __init da850_register_ehrpwm(void) +{ + __raw_writew(__raw_readw(DA8XX_CHIPCFG1) | BIT(12), DA8XX_CHIPCFG1); + return platform_device_register(&da850_ehrpwm_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 3b6e399..2ccfa85 100644 --- a/arch/arm/mach-davinci/include/mach/da8xx.h +++ b/arch/arm/mach-davinci/include/mach/da8xx.h @@ -42,6 +42,7 @@ extern void __iomem *da8xx_syscfg1_base; #define DA8XX_SYSCFG0_VIRT(x) (da8xx_syscfg0_base + (x)) #define DA8XX_JTAG_ID_REG 0x18 #define DA8XX_CFGCHIP0_REG 0x17c +#define DA8XX_CFGCHIP1_REG 0x180 #define DA8XX_CFGCHIP2_REG 0x184 #define DA8XX_CFGCHIP3_REG 0x188 @@ -84,6 +85,7 @@ 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); +int __init da850_register_ehrpwm(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 b3c23ee..416d935 100644 --- a/arch/arm/mach-davinci/include/mach/mux.h +++ b/arch/arm/mach-davinci/include/mach/mux.h @@ -917,6 +917,8 @@ enum davinci_da850_index { /* eCAP Module */ DA850_ECAP2_APWM2, + /* eHRPWM Module */ + DA850_EHRPWM1_A, }; enum davinci_tnetv107x_index {