Skip to content
Snippets Groups Projects
Commit b395a996 authored by Sylvain Lemieux's avatar Sylvain Lemieux Committed by Tom Rini
Browse files

i2c: lpc32xx: use api to get hclk instead of fix value


The HCLK is not constant and can take different value; use the api function to get the value of the HCLK for the I2C clock high and low computation.

Signed-off-by: default avatarSylvain Lemieux <slemieux@tycoint.com>
parent 2783fe69
No related branches found
No related tags found
No related merge requests found
...@@ -72,7 +72,7 @@ static unsigned int lpc32xx_i2c_set_bus_speed(struct i2c_adapter *adap, ...@@ -72,7 +72,7 @@ static unsigned int lpc32xx_i2c_set_bus_speed(struct i2c_adapter *adap,
if (speed == 0) if (speed == 0)
return -EINVAL; return -EINVAL;
half_period = (105000000 / speed) / 2; half_period = (get_hclk_clk_rate() / speed) / 2;
if ((half_period > 255) || (half_period < 0)) if ((half_period > 255) || (half_period < 0))
return -EINVAL; return -EINVAL;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment