diff options
author | Kevin Wells <wellsk40@gmail.com> | 2010-03-16 18:55:36 -0400 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2010-04-19 20:16:57 -0400 |
commit | be80dbaa3ed64337693be58fb2f3808e78911ba6 (patch) | |
tree | 0fd671b707e584ac7cedf4166063b7185d620fa4 /drivers/i2c/busses | |
parent | 7c6bd2010fced38444c9fd658f4c6ce61bd185bf (diff) |
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>
Diffstat (limited to 'drivers/i2c/busses')
-rw-r--r-- | drivers/i2c/busses/i2c-pnx.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c index 247103372a06..68fa415d9ad5 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) | |||
633 | */ | 633 | */ |
634 | 634 | ||
635 | tmp = ((freq / 1000) / I2C_PNX_SPEED_KHZ) / 2 - 2; | 635 | tmp = ((freq / 1000) / I2C_PNX_SPEED_KHZ) / 2 - 2; |
636 | if (tmp > 0x3FF) | ||
637 | tmp = 0x3FF; | ||
636 | iowrite32(tmp, I2C_REG_CKH(alg_data)); | 638 | iowrite32(tmp, I2C_REG_CKH(alg_data)); |
637 | iowrite32(tmp, I2C_REG_CKL(alg_data)); | 639 | iowrite32(tmp, I2C_REG_CKL(alg_data)); |
638 | 640 | ||