diff options
author | Alexander Sverdlin <alexander.sverdlin@nokia.com> | 2018-07-13 11:20:17 -0400 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2018-07-23 14:04:35 -0400 |
commit | cc8de9a68599b261244ea453b38678229f06ada7 (patch) | |
tree | 6a044d0fa318471d034ee0fc011fa1b745290c53 | |
parent | d72e90f33aa4709ebecc5005562f52335e106a60 (diff) |
i2c: davinci: Avoid zero value of CLKH
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: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Acked-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-rw-r--r-- | drivers/i2c/busses/i2c-davinci.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index 75d6ab177055..7379043711df 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c | |||
@@ -237,12 +237,16 @@ static void i2c_davinci_calc_clk_dividers(struct davinci_i2c_dev *dev) | |||
237 | /* | 237 | /* |
238 | * It's not always possible to have 1 to 2 ratio when d=7, so fall back | 238 | * It's not always possible to have 1 to 2 ratio when d=7, so fall back |
239 | * to minimal possible clkh in this case. | 239 | * to minimal possible clkh in this case. |
240 | * | ||
241 | * Note: | ||
242 | * CLKH is not allowed to be 0, in this case I2C clock is not generated | ||
243 | * at all | ||
240 | */ | 244 | */ |
241 | if (clk >= clkl + d) { | 245 | if (clk > clkl + d) { |
242 | clkh = clk - clkl - d; | 246 | clkh = clk - clkl - d; |
243 | clkl -= d; | 247 | clkl -= d; |
244 | } else { | 248 | } else { |
245 | clkh = 0; | 249 | clkh = 1; |
246 | clkl = clk - (d << 1); | 250 | clkl = clk - (d << 1); |
247 | } | 251 | } |
248 | 252 | ||