]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
arm: mx28: check for gated clocks when setting saif divider
authorWolfram Sang <w.sang@pengutronix.de>
Sat, 10 Sep 2011 10:29:43 +0000 (12:29 +0200)
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tue, 13 Sep 2011 09:09:57 +0000 (11:09 +0200)
Like with all other clocks, the divider for the SAIF devices should not
be altered when the clock is gated. Bail out when this is the case like
the other clocks do.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
arch/arm/mach-mxs/clock-mx28.c

index b3a71245f385810e687129a90c0db84bca60ea09..f81ec1f59ab9d542546ba0137c85bfa8c9edbec8 100644 (file)
@@ -448,6 +448,10 @@ static int name##_set_rate(struct clk *clk, unsigned long rate)            \
        reg = __raw_readl(CLKCTRL_BASE_ADDR + HW_CLKCTRL_##rs);         \
        reg &= ~BM_CLKCTRL_##rs##_DIV;                                  \
        reg |= div << BP_CLKCTRL_##rs##_DIV;                            \
+       if (reg & (1 << clk->enable_shift)) {                           \
+               pr_err("%s: clock is gated\n", __func__);               \
+               return -EINVAL;                                         \
+       }                                                               \
        __raw_writel(reg, CLKCTRL_BASE_ADDR + HW_CLKCTRL_##rs);         \
                                                                        \
        for (i = 10000; i; i--)                                         \