summaryrefslogtreecommitdiff
path: root/cpu/mpc8260/i2c.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpu/mpc8260/i2c.c')
-rw-r--r--cpu/mpc8260/i2c.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/cpu/mpc8260/i2c.c b/cpu/mpc8260/i2c.c
index 789c514..e0ac684 100644
--- a/cpu/mpc8260/i2c.c
+++ b/cpu/mpc8260/i2c.c
@@ -149,7 +149,7 @@ i2c_roundrate(int hz, int speed, int filter, int modval,
PRINTD(("\t\tmoddiv=%d, brgdiv=%d\n", moddiv, brgdiv));
- *brgval = (brgdiv / 2) - 3 - (2*filter);
+ *brgval = ((brgdiv + 1) / 2) - 3 - (2*filter);
if ((*brgval < 0) || (*brgval > 255)) {
PRINTD(("\t\trejected brgval=%d\n", *brgval));
@@ -158,7 +158,7 @@ i2c_roundrate(int hz, int speed, int filter, int modval,
brgdiv = 2 * (*brgval + 3 + (2 * filter));
div = moddiv * brgdiv ;
- *totspeed = (hz + div - 1) / div;
+ *totspeed = hz / div;
PRINTD(("\t\taccepted brgval=%d, totspeed=%d\n", *brgval, *totspeed));