blackfin: the sclk MHz in i2c driver should be divided by 1000 other than 1024
authorSonic Zhang <sonic.zhang@analog.com>
Tue, 28 Jan 2014 05:53:33 +0000 (13:53 +0800)
committerHeiko Schocher <hs@denx.de>
Thu, 20 Feb 2014 05:46:55 +0000 (06:46 +0100)
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
drivers/i2c/bfin-twi_i2c.c

index b3a04d32074a2242d5f647e592083f47b09d865a..5c372809c918b2ee169a8670880ceb90b8147c76 100644 (file)
@@ -274,7 +274,7 @@ unsigned int i2c_get_bus_speed(void)
  */
 void i2c_init(int speed, int slaveaddr)
 {
-       uint8_t prescale = ((get_sclk() / 1024 / 1024 + 5) / 10) & 0x7F;
+       uint8_t prescale = ((get_sclk() / 1000 / 1000 + 5) / 10) & 0x7F;
 
        /* Set TWI internal clock as 10MHz */
        twi->control = prescale;