Skip to content

Commit

Permalink
i2c-pnx: Limit maximum divider to 1023
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kevin Wells authored and Ben Dooks committed Apr 20, 2010
1 parent 7c6bd20 commit be80dba
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/i2c/busses/i2c-pnx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down

0 comments on commit be80dba

Please sign in to comment.