From patchwork Tue Mar 1 09:38:22 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Chen X-Patchwork-Id: 257 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:41:15 -0000 Delivered-To: patches@linaro.org Received: by 10.224.19.208 with SMTP id c16cs130154qab; Tue, 1 Mar 2011 01:38:32 -0800 (PST) Received: by 10.52.169.161 with SMTP id af1mr10897017vdc.56.1298972312441; Tue, 01 Mar 2011 01:38:32 -0800 (PST) Received: from ch1outboundpool.messaging.microsoft.com (ch1outboundpool.messaging.microsoft.com [216.32.181.186]) by mx.google.com with ESMTPS id ca4si942976vdb.199.2011.03.01.01.38.32 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 01 Mar 2011 01:38:32 -0800 (PST) Received-SPF: neutral (google.com: 216.32.181.186 is neither permitted nor denied by best guess record for domain of b02280@freescale.com) client-ip=216.32.181.186; Authentication-Results: mx.google.com; spf=neutral (google.com: 216.32.181.186 is neither permitted nor denied by best guess record for domain of b02280@freescale.com) smtp.mail=b02280@freescale.com Received: from mail138-ch1-R.bigfish.com (216.32.181.172) by CH1EHSOBE017.bigfish.com (10.43.70.67) with Microsoft SMTP Server id 14.1.225.8; Tue, 1 Mar 2011 09:38:31 +0000 Received: from mail138-ch1 (localhost.localdomain [127.0.0.1]) by mail138-ch1-R.bigfish.com (Postfix) with ESMTP id 7D7349F8303; Tue, 1 Mar 2011 09:38:31 +0000 (UTC) X-SpamScore: 0 X-BigFish: VS0(zzbb2cKzz1202h1082kzz8275bhz2dh2a8h668h61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: KIP:(null); UIP:(null); IPVD:NLI; H:de01egw01.freescale.net; RD:de01egw01.freescale.net; EFVD:NLI Received: from mail138-ch1 (localhost.localdomain [127.0.0.1]) by mail138-ch1 (MessageSwitch) id 1298972311253255_2315; Tue, 1 Mar 2011 09:38:31 +0000 (UTC) Received: from CH1EHSMHS009.bigfish.com (snatpool1.int.messaging.microsoft.com [10.43.68.248]) by mail138-ch1.bigfish.com (Postfix) with ESMTP id 2FC0B1690053; Tue, 1 Mar 2011 09:38:31 +0000 (UTC) Received: from de01egw01.freescale.net (192.88.165.102) by CH1EHSMHS009.bigfish.com (10.43.70.9) with Microsoft SMTP Server (TLS) id 14.1.225.8; Tue, 1 Mar 2011 09:38:30 +0000 Received: from az33smr01.freescale.net (az33smr01.freescale.net [10.64.34.199]) by de01egw01.freescale.net (8.14.3/8.14.3) with ESMTP id p219cTLD008818; Tue, 1 Mar 2011 02:38:29 -0700 (MST) Received: from weitway.ap.freescale.net (weitway.ap.freescale.net [10.192.242.83]) by az33smr01.freescale.net (8.13.1/8.13.0) with ESMTP id p219cPAW013614; Tue, 1 Mar 2011 03:38:26 -0600 (CST) From: Jason Chen To: CC: , , Jason Chen Subject: [PATCH 1/2] ARM imx53: add pwm devices support Date: Tue, 1 Mar 2011 17:38:22 +0800 Message-ID: <1298972303-1010-1-git-send-email-b02280@freescale.com> X-Mailer: git-send-email 1.7.1 MIME-Version: 1.0 X-OriginatorOrg: freescale.com Signed-off-by: Jason Chen --- arch/arm/mach-mx5/clock-mx51-mx53.c | 2 ++ arch/arm/mach-mx5/devices-imx53.h | 4 ++++ arch/arm/plat-mxc/devices/platform-mxc_pwm.c | 9 +++++++++ arch/arm/plat-mxc/pwm.c | 3 ++- 4 files changed, 17 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-mx5/clock-mx51-mx53.c b/arch/arm/mach-mx5/clock-mx51-mx53.c index 8164b1d..8a2b8de 100644 --- a/arch/arm/mach-mx5/clock-mx51-mx53.c +++ b/arch/arm/mach-mx5/clock-mx51-mx53.c @@ -1338,6 +1338,8 @@ static struct clk_lookup mx53_lookups[] = { _REGISTER_CLOCK("imx53-cspi.0", NULL, cspi_clk) _REGISTER_CLOCK("imx2-wdt.0", NULL, dummy_clk) _REGISTER_CLOCK("imx2-wdt.1", NULL, dummy_clk) + _REGISTER_CLOCK("mxc_pwm.0", NULL, pwm1_clk) + _REGISTER_CLOCK("mxc_pwm.1", NULL, pwm2_clk) }; static void clk_tree_init(void) diff --git a/arch/arm/mach-mx5/devices-imx53.h b/arch/arm/mach-mx5/devices-imx53.h index 9251008..5a1d6c9 100644 --- a/arch/arm/mach-mx5/devices-imx53.h +++ b/arch/arm/mach-mx5/devices-imx53.h @@ -33,3 +33,7 @@ extern const struct imx_spi_imx_data imx53_ecspi_data[] __initconst; extern const struct imx_imx2_wdt_data imx53_imx2_wdt_data[] __initconst; #define imx53_add_imx2_wdt(id, pdata) \ imx_add_imx2_wdt(&imx53_imx2_wdt_data[id]) + +extern const struct imx_mxc_pwm_data imx53_mxc_pwm_data[] __initconst; +#define imx53_add_mxc_pwm(id) \ + imx_add_mxc_pwm(&imx53_mxc_pwm_data[id]) diff --git a/arch/arm/plat-mxc/devices/platform-mxc_pwm.c b/arch/arm/plat-mxc/devices/platform-mxc_pwm.c index b0c4ae2..18cfd07 100644 --- a/arch/arm/plat-mxc/devices/platform-mxc_pwm.c +++ b/arch/arm/plat-mxc/devices/platform-mxc_pwm.c @@ -49,6 +49,15 @@ const struct imx_mxc_pwm_data imx51_mxc_pwm_data[] __initconst = { }; #endif /* ifdef CONFIG_SOC_IMX51 */ +#ifdef CONFIG_SOC_IMX53 +const struct imx_mxc_pwm_data imx53_mxc_pwm_data[] __initconst = { +#define imx53_mxc_pwm_data_entry(_id, _hwid) \ + imx_mxc_pwm_data_entry(MX53, _id, _hwid, SZ_16K) + imx53_mxc_pwm_data_entry(0, 1), + imx53_mxc_pwm_data_entry(1, 2), +}; +#endif /* ifdef CONFIG_SOC_IMX53 */ + struct platform_device *__init imx_add_mxc_pwm( const struct imx_mxc_pwm_data *data) { diff --git a/arch/arm/plat-mxc/pwm.c b/arch/arm/plat-mxc/pwm.c index 7a61ef8..61dd8fb 100644 --- a/arch/arm/plat-mxc/pwm.c +++ b/arch/arm/plat-mxc/pwm.c @@ -57,7 +57,8 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns) if (pwm == NULL || period_ns == 0 || duty_ns > period_ns) return -EINVAL; - if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51()) { + if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51() || + cpu_is_mx53()) { unsigned long long c; unsigned long period_cycles, duty_cycles, prescale; u32 cr;