diff options
Diffstat (limited to 'drivers/serial/serial.c')
-rw-r--r-- | drivers/serial/serial.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c index 182ca2d..8bbfcf9 100644 --- a/drivers/serial/serial.c +++ b/drivers/serial/serial.c @@ -147,10 +147,11 @@ static int calc_divisor (NS16550_t port) /* Compute divisor value. Normally, we should simply return: * CFG_NS16550_CLK) / MODE_X_DIV / gd->baudrate - * but we need to round that value by adding 0.5 or 8/16. + * but we need to round that value by adding 0.5. * Rounding is especially important at high baud rates. */ - return (((16 * CFG_NS16550_CLK) / MODE_X_DIV / gd->baudrate) + 8) / 16; + return (CFG_NS16550_CLK + (gd->baudrate * (MODE_X_DIV / 2))) / + (MODE_X_DIV * gd->baudrate); } #if !defined(CONFIG_SERIAL_MULTI) |