soc/sifive/fu540: Add helper function to get tlclk frequency
tlclk is not specific to the UART block in the FU540, so let's calculate its frequency in clock.c. Change-Id: I270920027f1132253e413a1bf9feb4fe279b651a Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net> Reviewed-on: https://review.coreboot.org/c/29335 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Philipp Hug <philipp@hug.cx>
This commit is contained in:
parent
042772a6bd
commit
97ca02cb17
|
@ -250,3 +250,14 @@ int clock_get_coreclk_khz(void)
|
|||
/ (divr + 1)
|
||||
/ (1ul << divq);
|
||||
}
|
||||
|
||||
/* Get the TileLink clock's frequency, in KHz */
|
||||
int clock_get_tlclk_khz(void)
|
||||
{
|
||||
/*
|
||||
* The TileLink bus and most peripherals use tlclk, which is coreclk/2,
|
||||
* as input.
|
||||
*/
|
||||
|
||||
return clock_get_coreclk_khz() / 2;
|
||||
}
|
||||
|
|
|
@ -18,5 +18,6 @@
|
|||
|
||||
void clock_init(void);
|
||||
int clock_get_coreclk_khz(void);
|
||||
int clock_get_tlclk_khz(void);
|
||||
|
||||
#endif /* __SOC_SIFIVE_HIFIFE_U_CLOCK_H__ */
|
||||
|
|
|
@ -29,9 +29,5 @@ uintptr_t uart_platform_base(int idx)
|
|||
|
||||
unsigned int uart_platform_refclk(void)
|
||||
{
|
||||
/*
|
||||
* The SiFive UART uses tlclk, which is coreclk/2, as input
|
||||
*/
|
||||
|
||||
return clock_get_coreclk_khz() * KHz / 2;
|
||||
return clock_get_tlclk_khz() * KHz;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue