[PATCH RFC] i2c: rk3x: handle dynamic clock rate changes correctly
Max Schwarz
max.schwarz at online.de
Sat Sep 13 04:26:48 PDT 2014
Hello Addy,
On Wednesday 10 September 2014 at 16:16:10, Addy wrote:
> > @@ -724,16 +816,28 @@ static int rk3x_i2c_probe(struct platform_device
> > *pdev)
> >
> > return ret;
> >
> > }
> >
> > + i2c->clk_rate_nb.notifier_call = rk3x_i2c_clk_notifier_cb;
> > + ret = clk_notifier_register(i2c->clk, &i2c->clk_rate_nb);
> > + if (ret != 0) {
> > + dev_err(&pdev->dev, "Unable to register clock notifier\n");
> > + goto err_clk;
> > + }
> > +
> > + i2c->clk_freq = clk_get_rate(i2c->clk);
> > + rk3x_i2c_set_scl_rate(i2c, i2c->scl_frequency);
>
> I have tested on rk3288-pinky board:
> I2c clock must be enabled before driver call rk3x_i2c_set_scl_rate()
> to write div value to CLKDIV register. If not, system will crash.
>
> So we need call clk_enable() before rk3x_i2c_set_scl_rate().
Interesting. It works without problems on RK3188. Do you know if the clock has
to be kept enabled for some time? Or is it okay to do it like this?
clk_enable(i2c->clk);
rk3x_i2c_set_scl_rate(i2c, i2c->scl_frequency);
clk_disable(i2c->clk);
Cheers,
Max
More information about the Linux-rockchip
mailing list