From: Roger Blofeld
This patch modifies uart_get_divisor to select the nearest baud rate
divider rather than the lowest. It minimizes baud rate errors.
For example, if uartclk is
33000000 and baud is 115200 the ratio is about
17.9 The current code selects 17 (5% error) but should select 18 (0.5%
error)
Signed-off-by: Andrew Morton
Signed-off-by: Russell King
if (baud == 38400 && (port->flags & UPF_SPD_MASK) == UPF_SPD_CUST)
quot = port->custom_divisor;
else
- quot = port->uartclk / (16 * baud);
+ quot = (port->uartclk + (8 * baud)) / (16 * baud);
return quot;
}