Commit 5ef881bb authored by Sascha Hauer's avatar Sascha Hauer

MXC: pwm driver fixes

- fix off-by-one error in divider calculation
- disable pwm in pwm_disable
Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
parent 494f22dd
...@@ -72,7 +72,7 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns) ...@@ -72,7 +72,7 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
writel(duty_cycles, pwm->mmio_base + MX3_PWMSAR); writel(duty_cycles, pwm->mmio_base + MX3_PWMSAR);
writel(period_cycles, pwm->mmio_base + MX3_PWMPR); writel(period_cycles, pwm->mmio_base + MX3_PWMPR);
writel(MX3_PWMCR_PRESCALER(prescale - 1) | writel(MX3_PWMCR_PRESCALER(prescale) |
MX3_PWMCR_CLKSRC_IPG_HIGH | MX3_PWMCR_EN, MX3_PWMCR_CLKSRC_IPG_HIGH | MX3_PWMCR_EN,
pwm->mmio_base + MX3_PWMCR); pwm->mmio_base + MX3_PWMCR);
} else if (cpu_is_mx1() || cpu_is_mx21()) { } else if (cpu_is_mx1() || cpu_is_mx21()) {
...@@ -118,6 +118,8 @@ EXPORT_SYMBOL(pwm_enable); ...@@ -118,6 +118,8 @@ EXPORT_SYMBOL(pwm_enable);
void pwm_disable(struct pwm_device *pwm) void pwm_disable(struct pwm_device *pwm)
{ {
writel(0, pwm->mmio_base + MX3_PWMCR);
if (pwm->clk_enabled) { if (pwm->clk_enabled) {
clk_disable(pwm->clk); clk_disable(pwm->clk);
pwm->clk_enabled = 0; pwm->clk_enabled = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment