imx: PWM module on mx35
Subsystems (3)
Hello,
I am trying to use the PWM module on a Freescale MX35 SOC but all writes to the PWM module registers seem to be ignored.
I have found two issues reported as fixed in the changelog of Freescales's Linux BSP for the i.MX31ADS (with similar PWM module) at
http://www.freescale.com/files/soft_dev_tools/doc/support_info/BSPIMX31ADSLTIB__RN.txt
851 Unable to write to PWM registers
1438 Cannot write to PWM registers
Unfortunately I couldn't find any more info about how/where these issues were fixed or find the issues in some public issue tracking system.
I added this code to the plat-mxc/pwm.c module after request_mem and ioremap of the PWM registers to make a simple test writing to the period register:
//read value of period register and print to console reg=ioread32(pwm->mmio_base+0x10); printk("PWMPR1: %lx \n", reg);
//write new valueiowrite32(0x123, pwm->mmio_base+0x10);
//read value and print to console
reg=ioread32(pwm->mmio_base + 0x10);printk("PWMPR2: %lx \n", reg);
Which yields the following output:
PWMPR1: fffe
PWMPR2: fffe
According to the MX35 reference manual 0xfffe is exactly the default reset value of the PWM period register, so it seems I'm accessing the right register and reads work fine, but all writes are ignored. It is the same with other registers like PWM control register.
Any ideas, pointers to possible cause of this problem or just sharing if you have been (un)successful using the PWM module on the MX35 will be greatly appreciated.
Best regards,
Radoslav Kolev
Fabio Estevam
reviewerHi Radoslav,
Quoted 11 lines · Radoslav Kolev
Hello,
I am trying to use the PWM module on a Freescale MX35 SOC but all writes to the PWM module registers seem to be ignored.
I have found two issues reported as fixed in the changelog of Freescales's Linux BSP for the i.MX31ADS (with similar PWM module) at
http://www.freescale.com/files/soft_dev_tools/doc/support_info/BSPIMX31ADSLTIB__RN.txt851 ? ? Unable to write to PWM registers
1438 ? ?Cannot write to PWM registers
These patches fixed the MXC_CCM_CGR1 offset for the pwm_clk in the Freescale kernel.
Another thing that was needed was to enable the PWM clock.
Please try the patch below.
Regards,
Fabio Estevam
Subject: [PATCH] Enable PWM clocks on MX31 and MX35
--- arch/arm/mach-mx3/clock-imx31.c | 1 + arch/arm/mach-mx3/clock-imx35.c | 1 + 2 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/mach-mx3/clock-imx31.c +1 -0
@@ -612,6 +612,7 @@ int __init mx31_clocks_init(unsigned long fref)clk_enable (&iim_clk);clk_enable (&serial_pll_clk); +clk_enable (&pwm_clk);mx31_read_cpu_rev ();
arch/arm/mach-mx3/clock-imx35.c +1 -0
@@ -536,6 +536,7 @@ int __init mx35_clocks_init()__raw_writel (cgr3,CCM_BASE +CCM_CGR3 );clk_enable (&iim_clk); +clk_enable (&pwm_clk);mx35_read_cpu_rev ();#ifdef CONFIG_MXC_USE_EPIT
--
Quoted 15 lines · Fabio Estevam
Hi Radoslav,
Quoted 11 lines · Radoslav Kolev
Hello,
I am trying to use the PWM module on a Freescale MX35 SOC but all writes to the PWM module registers seem to be ignored.
I have found two issues reported as fixed in the changelog of Freescales's Linux BSP for the i.MX31ADS (with similar PWM module) at
http://www.freescale.com/files/soft_dev_tools/doc/support_info/BSPIMX31ADSLTIB__RN.txt851 Unable to write to PWM registers
1438 Cannot write to PWM registers
Quoted 7 lines
These patches fixed the
MXC_CCM_CGR1offset for thepwm_clkin the Freescale kernel.Another thing that was needed was to enable the PWM clock.
Please try the patch below.
Thanks, Fabio!
That solved the register writing problem.
Regards,
Radoslav Kolev