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 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 @@ }, }; +static struct resource pwm1_resources[] = { + { + .start = MX51_PWM1_BASE_ADDR, + .end = MX51_PWM1_BASE_ADDR + 0x14, + .flags = IORESOURCE_MEM, + }, { + .start = MX51_MXC_INT_PWM1, + .end = MX51_MXC_INT_PWM1, + .flags = IORESOURCE_IRQ, + }, +}; + +struct platform_device mxc_pwm1_device = { + .name = "mxc_pwm", + .id = 0, + .num_resources = ARRAY_SIZE(pwm1_resources), + .resource = pwm1_resources, +}; + +static struct resource pwm2_resources[] = { + { + .start = MX51_PWM2_BASE_ADDR, + .end = MX51_PWM2_BASE_ADDR + 0x14, + .flags = IORESOURCE_MEM, + }, { + .start = MX51_MXC_INT_PWM2, + .end = MX51_MXC_INT_PWM2, + .flags = IORESOURCE_IRQ, + }, +}; + +struct platform_device mxc_pwm2_device = { + .name = "mxc_pwm", + .id = 1, + .num_resources = ARRAY_SIZE(pwm2_resources), + .resource = pwm2_resources, +}; + static struct resource mxc_kpp_resources[] = { { .start = MX51_MXC_INT_KPP, Index: linux-2.6-submit/arch/arm/mach-mx5/devices.h =================================================================== --- linux-2.6-submit.orig/arch/arm/mach-mx5/devices.h 2011-01-04 11:11:43.000000000 +0100 +++ linux-2.6-submit/arch/arm/mach-mx5/devices.h 2011-01-04 11:39:55.000000000 +0100 @@ -4,3 +4,5 @@ extern struct platform_device mxc_usbdr_udc_device; extern struct platform_device mxc_hsi2c_device; extern struct platform_device mxc_keypad_device; +extern struct platform_device mxc_pwm1_device; +extern struct platform_device mxc_pwm2_device; Index: linux-2.6-submit/arch/arm/plat-mxc/pwm.c =================================================================== --- linux-2.6-submit.orig/arch/arm/plat-mxc/pwm.c 2011-01-04 11:09:58.000000000 +0100 +++ linux-2.6-submit/arch/arm/plat-mxc/pwm.c 2011-01-04 11:39:55.000000000 +0100 @@ -57,7 +57,7 @@ if (pwm == NULL || period_ns == 0 || duty_ns > period_ns) return -EINVAL; - if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25()) { + if (cpu_is_mx27() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51()) { unsigned long long c; unsigned long period_cycles, duty_cycles, prescale; u32 cr;