From: Mike Frysinger Date: Sun, 20 Apr 2008 07:11:53 +0000 (-0400) Subject: Blackfin: make baud calculation more accurate X-Git-Tag: v2009.01-rc1~102^2~6 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=25cd33d82ea521b7bd90ca858f8919fae1e9732b;p=oweals%2Fu-boot.git Blackfin: make baud calculation more accurate We should use the algorithm in the Linux kernel so that the UART divisor calculation is more accurate. It also fixes problems on some picky UARTs that have sampling anomalies. Signed-off-by: Mike Frysinger --- diff --git a/cpu/blackfin/serial.h b/cpu/blackfin/serial.h index 1f0f4b46c7..ec40c266ac 100644 --- a/cpu/blackfin/serial.h +++ b/cpu/blackfin/serial.h @@ -175,11 +175,11 @@ static inline uint32_t serial_early_get_baud(void) __attribute__((always_inline)) static inline void serial_early_set_baud(uint32_t baud) { - /* Translate from baud into divisor in terms of SCLK. - * The +1 is to make sure we over sample just a little - * rather than under sample the incoming signals. + /* Translate from baud into divisor in terms of SCLK. The + * weird multiplication is to make sure we over sample just + * a little rather than under sample the incoming signals. */ - uint16_t divisor = (get_sclk() / (baud * 16)) + 1; + uint16_t divisor = (get_sclk() + (baud * 8)) / (baud * 16) - ANOMALY_05000230; /* Set DLAB in LCR to Access DLL and DLH */ ACCESS_LATCH();