i2c: lpc32xx: use api to get hclk instead of fix value
authorSylvain Lemieux <slemieux@tycoint.com>
Mon, 27 Jul 2015 17:37:37 +0000 (13:37 -0400)
committerTom Rini <trini@konsulko.com>
Mon, 17 Aug 2015 12:11:49 +0000 (08:11 -0400)
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: Sylvain Lemieux <slemieux@tycoint.com>
drivers/i2c/lpc32xx_i2c.c

index 78d26e48c3c72f588942ede3c4a862865bf7d5ee..98106fa988287a3b108391e677f2ee8ab429007d 100644 (file)
@@ -72,7 +72,7 @@ static unsigned int lpc32xx_i2c_set_bus_speed(struct i2c_adapter *adap,
        if (speed == 0)
                return -EINVAL;
 
-       half_period = (105000000 / speed) / 2;
+       half_period = (get_hclk_clk_rate() / speed) / 2;
 
        if ((half_period > 255) || (half_period < 0))
                return -EINVAL;