Commit 266d576d authored by Alexander Sverdlin's avatar Alexander Sverdlin Committed by Kleber Sacilotto de Souza

i2c: davinci: Avoid zero value of CLKH

BugLink: https://bugs.launchpad.net/bugs/1792392

[ Upstream commit cc8de9a6 ]

If CLKH is set to 0 I2C clock is not generated at all, so avoid this value
and stretch the clock in this case.
Signed-off-by: default avatarAlexander Sverdlin <alexander.sverdlin@nokia.com>
Acked-by: default avatarSekhar Nori <nsekhar@ti.com>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 10ee229c
...@@ -234,12 +234,16 @@ static void i2c_davinci_calc_clk_dividers(struct davinci_i2c_dev *dev) ...@@ -234,12 +234,16 @@ static void i2c_davinci_calc_clk_dividers(struct davinci_i2c_dev *dev)
/* /*
* It's not always possible to have 1 to 2 ratio when d=7, so fall back * It's not always possible to have 1 to 2 ratio when d=7, so fall back
* to minimal possible clkh in this case. * to minimal possible clkh in this case.
*
* Note:
* CLKH is not allowed to be 0, in this case I2C clock is not generated
* at all
*/ */
if (clk >= clkl + d) { if (clk > clkl + d) {
clkh = clk - clkl - d; clkh = clk - clkl - d;
clkl -= d; clkl -= d;
} else { } else {
clkh = 0; clkh = 1;
clkl = clk - (d << 1); clkl = clk - (d << 1);
} }
......
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