Re: [PATCH] i2c: rk3x: fix divisor calculation for SCL frequency

2014-09-05 Thread Doug Anderson
Addy, On Fri, Sep 5, 2014 at 3:17 AM, addy ke wrote: > The following modifications is reasonable? > > static void rk3x_i2c_set_scl_rate(struct rk3x_i2c *i2c, unsigned long > scl_rate) > { > unsigned long i2c_rate = clk_get_rate(i2c->clk); > unsigned int div; > > /* set D

Re: [PATCH] i2c: rk3x: fix divisor calculation for SCL frequency

2014-09-05 Thread addy ke
> Addy, > > On Thu, Sep 4, 2014 at 7:32 PM, Addy Ke wrote: >> I2C_CLKDIV register descripted in the previous version of >> RK3x chip manual is incorrect. Plus 1 is required. >> >> The correct formula: >> - T(SCL_HIGH) = T(PCLK) * (CLKDIVH + 1) * 8 >> - T(SCL_LOW) = T(PCLK) * (CLKDIVL + 1) * 8 >>

Re: [PATCH] i2c: rk3x: fix divisor calculation for SCL frequency

2014-09-04 Thread Doug Anderson
Addy, On Thu, Sep 4, 2014 at 7:32 PM, Addy Ke wrote: > I2C_CLKDIV register descripted in the previous version of > RK3x chip manual is incorrect. Plus 1 is required. > > The correct formula: > - T(SCL_HIGH) = T(PCLK) * (CLKDIVH + 1) * 8 > - T(SCL_LOW) = T(PCLK) * (CLKDIVL + 1) * 8 > - (SCL Divsor

[PATCH] i2c: rk3x: fix divisor calculation for SCL frequency

2014-09-04 Thread Addy Ke
I2C_CLKDIV register descripted in the previous version of RK3x chip manual is incorrect. Plus 1 is required. The correct formula: - T(SCL_HIGH) = T(PCLK) * (CLKDIVH + 1) * 8 - T(SCL_LOW) = T(PCLK) * (CLKDIVL + 1) * 8 - (SCL Divsor) = 8 * ((CLKDIVL + 1) + (CLKDIVH + 1)) - SCL = PCLK / (CLK Divsor)