소스 검색

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: Sylvain Lemieux <slemieux@tycoint.com>
Sylvain Lemieux 9 년 전
부모
커밋
b395a996a6
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      drivers/i2c/lpc32xx_i2c.c

+ 1 - 1
drivers/i2c/lpc32xx_i2c.c

@@ -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;