浏览代码

i2c-pnx: Limit maximum divider to 1023

Limit maximum divider to 0x3ff to divider computations. On high I2C
parent clock rates, the divider can exceed 0x3ff. This will help
prevent some very odd clock rates.

Signed-off-by: Kevin Wells <wellsk40@gmail.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Kevin Wells 15 年之前
父节点
当前提交
be80dbaa3e
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      drivers/i2c/busses/i2c-pnx.c

+ 2 - 0
drivers/i2c/busses/i2c-pnx.c

@@ -633,6 +633,8 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
 	 */
 
 	tmp = ((freq / 1000) / I2C_PNX_SPEED_KHZ) / 2 - 2;
+	if (tmp > 0x3FF)
+		tmp = 0x3FF;
 	iowrite32(tmp, I2C_REG_CKH(alg_data));
 	iowrite32(tmp, I2C_REG_CKL(alg_data));