From patchwork Wed Apr 13 15:53:35 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: weitway@gmail.com X-Patchwork-Id: 1005 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:48:12 -0000 Delivered-To: patches@linaro.org Received: by 10.68.59.138 with SMTP id z10cs327086pbq; Wed, 13 Apr 2011 08:55:39 -0700 (PDT) Received: by 10.151.3.2 with SMTP id f2mr674907ybi.47.1302710138998; Wed, 13 Apr 2011 08:55:38 -0700 (PDT) Received: from mail-yi0-f50.google.com (mail-yi0-f50.google.com [209.85.218.50]) by mx.google.com with ESMTPS id v41si12452933yba.56.2011.04.13.08.55.38 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 13 Apr 2011 08:55:38 -0700 (PDT) Received-SPF: pass (google.com: domain of weitway@gmail.com designates 209.85.218.50 as permitted sender) client-ip=209.85.218.50; Authentication-Results: mx.google.com; spf=pass (google.com: domain of weitway@gmail.com designates 209.85.218.50 as permitted sender) smtp.mail=weitway@gmail.com; dkim=pass (test mode) header.i=@gmail.com Received: by yie30 with SMTP id 30so622943yie.37 for ; Wed, 13 Apr 2011 08:55:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=qgAD0mOMnX646AfBc4tFvkBndXK76zX+vcoEhjza9fY=; b=A+1obByix8Sw7foDiMQ8dM2VDkx5XVtlDu1WPFAAks4t07X/TBfpzmxvj1PDSIFxUL xLJWZRYUB6bbie27si31HB3vZKHuv222MwU3r/lcpU75oRlAMkvg5R0jAtDkGhrXx3MU immzopasuh6UEPRRrvkt4HGqL1asFj5GgnOcA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=JMl5cj3inEhENKwgOGUw2JGrdRcT11lGu47/rPdd09JPDKM5mkd88PYGmCezbgLDoo kZ5UU7CfVFhE/TrSjPgFRzxBCog65XpApTqraNJeuVRKFbg8RuQ+8XCacASyb2NyvEbK Eecxko8sR2yYF9sYsuJfm+/zGnTSoSwDJYMIg= Received: by 10.42.138.67 with SMTP id b3mr11903163icu.490.1302710138359; Wed, 13 Apr 2011 08:55:38 -0700 (PDT) Received: from localhost.localdomain ([116.235.131.170]) by mx.google.com with ESMTPS id f28sm513868ibh.50.2011.04.13.08.55.28 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 13 Apr 2011 08:55:37 -0700 (PDT) From: weitway@gmail.com To: linux-arm-kernel@lists.infradead.org Cc: u.kleine-koenig@pengutronix.de, s.hauer@pengutronix.de, eric.miao@linaro.org, Jason Chen Subject: [PATCH 6/7] ARM i.MX53: add pwm devices support Date: Wed, 13 Apr 2011 23:53:35 +0800 Message-Id: <1302710016-3569-6-git-send-email-weitway@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1302710016-3569-1-git-send-email-weitway@gmail.com> References: <1302710016-3569-1-git-send-email-weitway@gmail.com> From: Jason Chen Signed-off-by: Jason Chen --- arch/arm/mach-mx5/clock-mx51-mx53.c | 6 ++++-- arch/arm/mach-mx5/devices-imx53.h | 4 ++++ arch/arm/plat-mxc/devices/platform-mxc_pwm.c | 13 +++++++++---- arch/arm/plat-mxc/pwm.c | 3 ++- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/arch/arm/mach-mx5/clock-mx51-mx53.c b/arch/arm/mach-mx5/clock-mx51-mx53.c index 213ec33..2d22031 100644 --- a/arch/arm/mach-mx5/clock-mx51-mx53.c +++ b/arch/arm/mach-mx5/clock-mx51-mx53.c @@ -1410,8 +1410,8 @@ static struct clk_lookup mx51_lookups[] = { _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk) _REGISTER_CLOCK(NULL, "gpt", gpt_clk) _REGISTER_CLOCK("fec.0", NULL, fec_clk) - _REGISTER_CLOCK("mxc_pwm.0", "pwm", pwm1_clk) - _REGISTER_CLOCK("mxc_pwm.1", "pwm", pwm2_clk) + _REGISTER_CLOCK("mxc_pwm.0", NULL, pwm1_clk) + _REGISTER_CLOCK("mxc_pwm.1", NULL, pwm2_clk) _REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk) _REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk) _REGISTER_CLOCK("imx-i2c.2", NULL, hsi2c_clk) @@ -1468,6 +1468,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) _REGISTER_CLOCK("imx-ipuv3", NULL, ipu_clk) _REGISTER_CLOCK("imx-ipuv3", "di0", ipu_di0_clk) _REGISTER_CLOCK("imx-ipuv3", "di1", ipu_di1_clk) diff --git a/arch/arm/mach-mx5/devices-imx53.h b/arch/arm/mach-mx5/devices-imx53.h index 8049039..fd591ff 100644 --- a/arch/arm/mach-mx5/devices-imx53.h +++ b/arch/arm/mach-mx5/devices-imx53.h @@ -34,6 +34,10 @@ 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]) + extern const struct imx_ipuv3_data imx53_ipuv3_data __initconst; #define imx53_add_ipuv3(pdata) \ imx_add_ipuv3(&imx53_ipuv3_data, pdata) diff --git a/arch/arm/plat-mxc/devices/platform-mxc_pwm.c b/arch/arm/plat-mxc/devices/platform-mxc_pwm.c index b0c4ae2..e610c5b 100644 --- a/arch/arm/plat-mxc/devices/platform-mxc_pwm.c +++ b/arch/arm/plat-mxc/devices/platform-mxc_pwm.c @@ -42,13 +42,18 @@ const struct imx_mxc_pwm_data imx27_mxc_pwm_data __initconst = #ifdef CONFIG_SOC_IMX51 const struct imx_mxc_pwm_data imx51_mxc_pwm_data[] __initconst = { -#define imx51_mxc_pwm_data_entry(_id, _hwid) \ - imx_mxc_pwm_data_entry(MX51, _id, _hwid, SZ_16K) - imx51_mxc_pwm_data_entry(0, 1), - imx51_mxc_pwm_data_entry(1, 2), + imx_mxc_pwm_data_entry(MX51, 0, 1, SZ_16K), + imx_mxc_pwm_data_entry(MX51, 1, 2, SZ_16K), }; #endif /* ifdef CONFIG_SOC_IMX51 */ +#ifdef CONFIG_SOC_IMX53 +const struct imx_mxc_pwm_data imx53_mxc_pwm_data[] __initconst = { + imx_mxc_pwm_data_entry(MX53, 0, 1, SZ_16K), + imx_mxc_pwm_data_entry(MX53, 1, 2, SZ_16K), +}; +#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..5230413 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;