Skip to content

Commit

Permalink
i2c: uniphier: fix violation of tLOW requirement for Fast-mode
Browse files Browse the repository at this point in the history
Currently, the clock duty is set as tLOW/tHIGH = 1/1. For Fast-mode,
tLOW is set to 1.25 us while the I2C spec requires tLOW >= 1.3 us.

tLOW/tHIGH = 5/4 would meet both Standard-mode and Fast-mode:
  Standard-mode: tLOW = 5.56 us, tHIGH = 4.44 us
  Fast-mode:     tLOW = 1.39 us, tHIGH = 1.11 us

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
  • Loading branch information
Masahiro Yamada authored and Wolfram Sang committed Dec 6, 2018
1 parent cd8843f commit 8469636
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/i2c/busses/i2c-uniphier.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,13 @@ static void uniphier_i2c_hw_init(struct uniphier_i2c_priv *priv)

uniphier_i2c_reset(priv, true);

writel((cyc / 2 << 16) | cyc, priv->membase + UNIPHIER_I2C_CLK);
/*
* Bit30-16: clock cycles of tLOW.
* Standard-mode: tLOW = 4.7 us, tHIGH = 4.0 us
* Fast-mode: tLOW = 1.3 us, tHIGH = 0.6 us
* "tLow/tHIGH = 5/4" meets both.
*/
writel((cyc * 5 / 9 << 16) | cyc, priv->membase + UNIPHIER_I2C_CLK);

uniphier_i2c_reset(priv, false);
}
Expand Down

0 comments on commit 8469636

Please sign in to comment.