From: Kevin Wells Date: Tue, 16 Mar 2010 22:55:36 +0000 (-0700) Subject: i2c-pnx: Limit maximum divider to 1023 X-Git-Tag: v2.6.34-rc6~71^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=be80dbaa3ed64337693be58fb2f3808e78911ba6;p=platform%2Fkernel%2Flinux-exynos.git 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 Signed-off-by: Ben Dooks --- diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c index 2471033..68fa415 100644 --- a/drivers/i2c/busses/i2c-pnx.c +++ b/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));