diff options
author | Sonic Zhang <sonic.zhang@analog.com> | 2013-02-05 19:10:34 +0800 |
---|---|---|
committer | Sonic Zhang <sonic.zhang@analog.com> | 2013-05-13 15:47:24 +0800 |
commit | 79f2b3992f52334b510214c6b1b60c4200133658 (patch) | |
tree | a839a67095de369dc074303ec81c493de42df0e5 /arch/blackfin/cpu/serial.c | |
parent | f4d8038439fb372c91c3a27121a911c359603bcf (diff) | |
download | u-boot-imx-79f2b3992f52334b510214c6b1b60c4200133658.zip u-boot-imx-79f2b3992f52334b510214c6b1b60c4200133658.tar.gz u-boot-imx-79f2b3992f52334b510214c6b1b60c4200133658.tar.bz2 |
blackfin: Set correct early debug serial baudrate.
Calculate the early uart clock from the system clock registers set by
the bootrom other than the predefine uboot clock macros.
Split the early baudrate setting function and the normal baudrate
setting one.
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Diffstat (limited to 'arch/blackfin/cpu/serial.c')
-rw-r--r-- | arch/blackfin/cpu/serial.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/arch/blackfin/cpu/serial.c b/arch/blackfin/cpu/serial.c index 9847e9f..36d2a5c 100644 --- a/arch/blackfin/cpu/serial.c +++ b/arch/blackfin/cpu/serial.c @@ -195,6 +195,14 @@ static void uart_loop(uint32_t uart_base, int state) #endif +static inline void __serial_set_baud(uint32_t uart_base, uint32_t baud) +{ + uint16_t divisor = (get_uart_clk() + (baud * 8)) / (baud * 16) + - ANOMALY_05000230; + + /* Program the divisor to get the baud rate we want */ + serial_set_divisor(uart_base, divisor); +} #ifdef CONFIG_SYS_BFIN_UART static void uart_puts(uint32_t uart_base, const char *s) @@ -209,7 +217,7 @@ static int uart##n##_init(void) \ const unsigned short pins[] = { _P_UART(n, RX), _P_UART(n, TX), 0, }; \ peripheral_request_list(pins, "bfin-uart"); \ uart_init(MMR_UART(n)); \ - serial_early_set_baud(MMR_UART(n), gd->baudrate); \ + __serial_set_baud(MMR_UART(n), gd->baudrate); \ uart_lsr_clear(MMR_UART(n)); \ return 0; \ } \ @@ -221,7 +229,7 @@ static int uart##n##_uninit(void) \ \ static void uart##n##_setbrg(void) \ { \ - serial_early_set_baud(MMR_UART(n), gd->baudrate); \ + __serial_set_baud(MMR_UART(n), gd->baudrate); \ } \ \ static int uart##n##_getc(void) \ |