[patch 1/1] mx51: add support for pwm

STALE5724d

4 messages, 4 authors, 2011-01-07 · open the first message on its own page

[patch 1/1] mx51: add support for pwm

From: Arnaud Patard Rtp <hidden>
Date: 2011-01-07 09:06:45

An embedded and charset-unspecified text was scrubbed...
Name: mx51_pwm.patch
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110107/2599c43b/attachment.ksh>

[patch 1/1] mx51: add support for pwm

From: Jason Liu <hidden>
Date: 2011-01-07 09:30:28

Hi, Arnaud,

2011/1/7 Arnaud Patard [off-list ref]:
quoted hunk
This patch is adding support for pwm1 and pwm2 devices found
on mx51.
[ this patch has been tested with pwm-backlight driver ]

Signed-off-by: Arnaud Patard <redacted>
Index: linux-2.6-submit/arch/arm/mach-mx5/clock-mx51-mx53.c
===================================================================
--- linux-2.6-submit.orig/arch/arm/mach-mx5/clock-mx51-mx53.c ? 2011-01-04 11:36:15.000000000 +0100
+++ linux-2.6-submit/arch/arm/mach-mx5/clock-mx51-mx53.c ? ? ? ?2011-01-04 11:39:55.000000000 +0100
@@ -1206,6 +1206,11 @@
?DEFINE_CLOCK(gpt_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG9_OFFSET,
? ? ? ?NULL, ?NULL, &ipg_clk, &gpt_ipg_clk);

+DEFINE_CLOCK(pwm1_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG6_OFFSET,
+ ? ? ? NULL, NULL, &ipg_clk, NULL);
+DEFINE_CLOCK(pwm2_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG8_OFFSET,
+ ? ? ? NULL, NULL, &ipg_clk, NULL);
+
?/* I2C */
?DEFINE_CLOCK(i2c1_clk, 0, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG9_OFFSET,
? ? ? ?NULL, NULL, &ipg_clk, NULL);
@@ -1298,6 +1303,8 @@
? ? ? ?_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("imx-i2c.0", NULL, i2c1_clk)
? ? ? ?_REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk)
? ? ? ?_REGISTER_CLOCK("imx-i2c.2", NULL, hsi2c_clk)
Index: linux-2.6-submit/arch/arm/mach-mx5/devices.c
===================================================================
--- linux-2.6-submit.orig/arch/arm/mach-mx5/devices.c ? 2011-01-04 11:11:43.000000000 +0100
+++ linux-2.6-submit/arch/arm/mach-mx5/devices.c ? ? ? ?2011-01-04 11:39:55.000000000 +0100
@@ -120,6 +120,44 @@
? ? ? ?},
?};
[...]
+struct platform_device mxc_pwm2_device = {
+ ? ? ? .name = "mxc_pwm",
+ ? ? ? .id = 1,
+ ? ? ? .num_resources = ARRAY_SIZE(pwm2_resources),
+ ? ? ? .resource = pwm2_resources,
+};
+
Why not follow the arch/arm/plat-mxc/devices/platform-imx-xxx to add
devices support?
I saw that some devices was added in arch/arm/mach-mx5/devices.c, but
most are in
 arch/arm/plat-mxc/devices/xx, what's the rule for it when we add
device support?

[...]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

[patch 1/1] mx51: add support for pwm

From: Uwe Kleine-König <hidden>
Date: 2011-01-07 09:58:39

Hello Jason,

On Fri, Jan 07, 2011 at 05:30:28PM +0800, Jason Liu wrote:
2011/1/7 Arnaud Patard [off-list ref]:
quoted
This patch is adding support for pwm1 and pwm2 devices found
on mx51.
[ this patch has been tested with pwm-backlight driver ]

Signed-off-by: Arnaud Patard <redacted>
Index: linux-2.6-submit/arch/arm/mach-mx5/clock-mx51-mx53.c
===================================================================
--- linux-2.6-submit.orig/arch/arm/mach-mx5/clock-mx51-mx53.c ? 2011-01-04 11:36:15.000000000 +0100
+++ linux-2.6-submit/arch/arm/mach-mx5/clock-mx51-mx53.c ? ? ? ?2011-01-04 11:39:55.000000000 +0100
@@ -1206,6 +1206,11 @@
?DEFINE_CLOCK(gpt_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG9_OFFSET,
? ? ? ?NULL, ?NULL, &ipg_clk, &gpt_ipg_clk);

+DEFINE_CLOCK(pwm1_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG6_OFFSET,
+ ? ? ? NULL, NULL, &ipg_clk, NULL);
+DEFINE_CLOCK(pwm2_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG8_OFFSET,
+ ? ? ? NULL, NULL, &ipg_clk, NULL);
+
?/* I2C */
?DEFINE_CLOCK(i2c1_clk, 0, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG9_OFFSET,
? ? ? ?NULL, NULL, &ipg_clk, NULL);
@@ -1298,6 +1303,8 @@
? ? ? ?_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("imx-i2c.0", NULL, i2c1_clk)
? ? ? ?_REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk)
? ? ? ?_REGISTER_CLOCK("imx-i2c.2", NULL, hsi2c_clk)
Index: linux-2.6-submit/arch/arm/mach-mx5/devices.c
===================================================================
--- linux-2.6-submit.orig/arch/arm/mach-mx5/devices.c ? 2011-01-04 11:11:43.000000000 +0100
+++ linux-2.6-submit/arch/arm/mach-mx5/devices.c ? ? ? ?2011-01-04 11:39:55.000000000 +0100
@@ -120,6 +120,44 @@
? ? ? ?},
?};
[...]
quoted
+struct platform_device mxc_pwm2_device = {
+ ? ? ? .name = "mxc_pwm",
+ ? ? ? .id = 1,
+ ? ? ? .num_resources = ARRAY_SIZE(pwm2_resources),
+ ? ? ? .resource = pwm2_resources,
+};
+
Why not follow the arch/arm/plat-mxc/devices/platform-imx-xxx to add
devices support?
good question.  Note that arch/arm/plat-mxc/devices/platform-mxc_pwm.c
already exists in Sascha's tree.  (Maybe now even Linus'.)
I saw that some devices was added in arch/arm/mach-mx5/devices.c, but
most are in
 arch/arm/plat-mxc/devices/xx, what's the rule for it when we add
device support?
devices.c was used traditionally and isn't yet completely converted.
Mostly due to lack of time for such things.
So I'd say: for new things use the dynamic stuff in
arch/arm/plat-mxc/devices and if you're motivated help converting the
existing devices to it, too.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[patch 1/1] mx51: add support for pwm

From: festevam@gmail.com (Fabio Estevam)
Date: 2011-01-07 16:55:50

Arnaud,

2011/1/7 Uwe Kleine-K?nig [off-list ref]:
...
quoted
Why not follow the arch/arm/plat-mxc/devices/platform-imx-xxx to add
devices support?
good question. ?Note that arch/arm/plat-mxc/devices/platform-mxc_pwm.c
already exists in Sascha's tree. ?(Maybe now even Linus'.)
I have submitted the following patch for dynamically registering the
PWM on MX51:
http://www.spinics.net/lists/arm-kernel/msg105828.html

I got an ack from Uwe, so it should hit Sascha?s tree soon.

Regards,

Fabio Estevam
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help