From: Mike Frysinger Date: Wed, 9 Apr 2008 02:06:21 -0400 Subject: [U-Boot-Users] [PATCH/review] Blackfin: make baud calculation more accurate Message-ID: <1207721182-29697-1-git-send-email-vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- cpu/blackfin/serial.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/cpu/blackfin/serial.h b/cpu/blackfin/serial.h index 1f0f4b4..d268da5 100644 --- a/cpu/blackfin/serial.h +++ b/cpu/blackfin/serial.h @@ -179,7 +179,7 @@ static inline void serial_early_set_baud(uint32_t baud) * The +1 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); /* Set DLAB in LCR to Access DLL and DLH */ ACCESS_LATCH(); -- 1.5.4.4