diff --git a/src/soc/sifive/fu540/uart.c b/src/soc/sifive/fu540/uart.c index c53f42d9d8..b563be13b1 100644 --- a/src/soc/sifive/fu540/uart.c +++ b/src/soc/sifive/fu540/uart.c @@ -13,8 +13,11 @@ * GNU General Public License for more details. */ +#include +#include #include #include +#include uintptr_t uart_platform_base(int idx) { @@ -29,5 +32,9 @@ unsigned int uart_platform_refclk(void) /* * The SiFive UART uses tlclk, which is coreclk/2 as input */ - return 33330000 / 2; + + if (ENV_BOOTBLOCK) + return 33330000 / 2; + else + return clock_get_coreclk_khz() * KHz / 2; }