mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-21 22:51:37 +00:00
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 <vapier@gentoo.org>
This commit is contained in:
parent
0ba1da116e
commit
25cd33d82e
1 changed files with 4 additions and 4 deletions
|
@ -175,11 +175,11 @@ static inline uint32_t serial_early_get_baud(void)
|
||||||
__attribute__((always_inline))
|
__attribute__((always_inline))
|
||||||
static inline void serial_early_set_baud(uint32_t baud)
|
static inline void serial_early_set_baud(uint32_t baud)
|
||||||
{
|
{
|
||||||
/* Translate from baud into divisor in terms of SCLK.
|
/* Translate from baud into divisor in terms of SCLK. The
|
||||||
* The +1 is to make sure we over sample just a little
|
* weird multiplication is to make sure we over sample just
|
||||||
* rather than under sample the incoming signals.
|
* 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 */
|
/* Set DLAB in LCR to Access DLL and DLH */
|
||||||
ACCESS_LATCH();
|
ACCESS_LATCH();
|
||||||
|
|
Loading…
Add table
Reference in a new issue