Skip to contentSkip to conversation

mx51: add support for pwm

PATCH New Arnaud Patard (Rtp) 4 participants 4 messages Jan 7, 2011

lore
Share & tools
lore
#1 lore raw

PATCH 1/1 mx51: add support for pwm

Hi, Arnaud,

2011/1/7 Arnaud Patard <[email protected]>:

Quoted 37 lines

This patch is adding support for pwm1 and pwm2 devices found on mx51.
[ this patch has been tested with pwm-backlight driver ]

Index: linux-2.6-submit/arch/arm/mach-mx5/clock-mx51-mx53.c
===================================================================

arch/arm/mach-mx5/clock-mx51-mx53.c ? ? ? ?2011-01-04 11:39:55.000000000 +0100 renamed from arch/arm/mach-mx5/clock-mx51-mx53.c ? 2011-01-04 11:36:15.000000000 +0100 +5 -0
@@ -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);

arch/arm/mach-mx5/clock-mx51-mx53.c ? ? ? ?2011-01-04 11:39:55.000000000 +0100 renamed from arch/arm/mach-mx5/clock-mx51-mx53.c ? 2011-01-04 11:36:15.000000000 +0100 +2 -0
@@ -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
===================================================================

arch/arm/mach-mx5/devices.c ? ? ? ?2011-01-04 11:39:55.000000000 +0100 renamed from arch/arm/mach-mx5/devices.c ? 2011-01-04 11:11:43.000000000 +0100 +0 -0
@@ -120,6 +120,44 @@
 ? ? ? ?},
 ?};

[...]

arch/arm/mach-mx5/devices.c ? ? ? ?2011-01-04 11:39:55.000000000 +0100

Quoted 7 lines
arch/arm/mach-mx5/devices.c ? ? ? ?2011-01-04 11:39:55.000000000 +0100 renamed from arch/arm/mach-mx5/devices.c ? 2011-01-04 11:11:43.000000000 +0100 +7 -0
+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?

[...]

Quoted 6 lines

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

#2 lore raw

PATCH 1/1 mx51: add support for pwm

Hello Jason,

Quoted 39 lines · Jason Liu

2011/1/7 Arnaud Patard <[email protected]>:

Quoted 37 lines

This patch is adding support for pwm1 and pwm2 devices found on mx51.
[ this patch has been tested with pwm-backlight driver ]

Index: linux-2.6-submit/arch/arm/mach-mx5/clock-mx51-mx53.c
===================================================================

arch/arm/mach-mx5/clock-mx51-mx53.c ? ? ? ?2011-01-04 11:39:55.000000000 +0100 renamed from arch/arm/mach-mx5/clock-mx51-mx53.c ? 2011-01-04 11:36:15.000000000 +0100 +5 -0
@@ -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);

arch/arm/mach-mx5/clock-mx51-mx53.c ? ? ? ?2011-01-04 11:39:55.000000000 +0100 renamed from arch/arm/mach-mx5/clock-mx51-mx53.c ? 2011-01-04 11:36:15.000000000 +0100 +2 -0
@@ -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
===================================================================

arch/arm/mach-mx5/devices.c ? ? ? ?2011-01-04 11:39:55.000000000 +0100 renamed from arch/arm/mach-mx5/devices.c ? 2011-01-04 11:11:43.000000000 +0100 +0 -0
@@ -120,6 +120,44 @@
 ? ? ? ?},
 ?};

[...]

Quoted 10 lines

arch/arm/mach-mx5/devices.c ? ? ? ?2011-01-04 11:39:55.000000000 +0100

Quoted 7 lines
arch/arm/mach-mx5/devices.c ? ? ? ?2011-01-04 11:39:55.000000000 +0100 renamed from arch/arm/mach-mx5/devices.c ? 2011-01-04 11:11:43.000000000 +0100 +7 -0
+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'.)

Quoted 4 lines

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

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#3 lore raw

PATCH 1/1 mx51: add support for pwm

Arnaud,

2011/1/7 Uwe Kleine-K?nig <[email protected]>:
...

Quoted 4 lines
Quoted 2 lines

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