[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD=FV=WwCTRh44jTvTZoeFFACmWKeGyu=zWb1=BeimGMuT9r2Q@mail.gmail.com>
Date: Fri, 5 Sep 2014 08:20:23 -0700
From: Doug Anderson <dianders@...omium.org>
To: addy ke <addy.ke@...k-chips.com>
Cc: Wolfram Sang <wsa@...-dreams.de>, max.schwarz@...ine.de,
Heiko Stübner <heiko@...ech.de>,
Olof Johansson <olof@...om.net>,
"linux-i2c@...r.kernel.org" <linux-i2c@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
linux-rockchip@...ts.infradead.org, Eddie Cai <cf@...k-chips.com>,
Jianqun Xu <xjq@...k-chips.com>,
Tao Huang <huangtao@...k-chips.com>,
Chris <zyw@...k-chips.com>,
姚智情 <yzq@...k-chips.com>,
han jiang <hj@...k-chips.com>,
Kever Yang <kever.yang@...k-chips.com>,
Lin Huang <hl@...k-chips.com>,
晓腾王 <caesar.wang@...k-chips.com>,
Shunqian Zheng <zhengsq@...k-chips.com>
Subject: Re: [PATCH] i2c: rk3x: fix divisor calculation for SCL frequency
Addy,
On Fri, Sep 5, 2014 at 3:17 AM, addy ke <addy.ke@...k-chips.com> 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 DIV = DIVH = DIVL
> * SCL rate = (clk rate) / (8 * (DIVH + 1 + DIVL + 1))
> * = (clk rate) / (16 * (DIV + 1))
> */
> div = DIV_ROUND_UP(i2c_rate, scl_rate * 16) - 1;
>
> i2c_writel(i2c, (div << 16) | (div & 0xffff), REG_CLKDIV);
> }
Yes, that looks much cleaner and is a nice solution, thanks! Can you
send up a new patch version?
-Doug
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists