drivers: serial: uart_sifive: Get clock frequency from device tree
Move to getting the clock frequency of the uart from the device tree instead of a define in the board file. Cleaned up hifive1 board code to reflect this change in addition to the driver. Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
3b70fb8e6b
commit
5a24afadb8
4 changed files with 9 additions and 12 deletions
|
@ -10,14 +10,4 @@
|
|||
|
||||
#include <soc.h>
|
||||
|
||||
/*
|
||||
* UART clock configurations
|
||||
*
|
||||
* Define them here so that it can be replaced by global variables
|
||||
* on other boards where the uart clock is determined dynamically
|
||||
* following the PLL configuration
|
||||
*/
|
||||
#define uart_sifive_port_0_clk_freq 16000000
|
||||
#define uart_sifive_port_1_clk_freq 16000000
|
||||
|
||||
#endif /* __INC_BOARD_H */
|
||||
|
|
|
@ -46,10 +46,12 @@
|
|||
#define CONFIG_SIFIVE_UART_0_IRQ_0 SIFIVE_UART0_10013000_IRQ_0
|
||||
#define CONFIG_SIFIVE_UART_0_LABEL SIFIVE_UART0_10013000_LABEL
|
||||
#define CONFIG_SIFIVE_UART_0_SIZE SIFIVE_UART0_10013000_SIZE
|
||||
#define CONFIG_SIFIVE_UART_0_CLK_FREQ SIFIVE_UART0_10013000_CLOCK_FREQUENCY
|
||||
|
||||
/* UART 1 */
|
||||
#define CONFIG_SIFIVE_UART_1_BASE_ADDR SIFIVE_UART0_10023000_BASE_ADDRESS
|
||||
#define CONFIG_SIFIVE_UART_1_CURRENT_SPEED SIFIVE_UART0_10023000_CURRENT_SPEED
|
||||
#define CONFIG_SIFIVE_UART_1_IRQ_0 SIFIVE_UART0_10023000_IRQ_0
|
||||
#define CONFIG_SIFIVE_UART_1_SIZE SIFIVE_UART0_10023000_SIZE
|
||||
#define CONFIG_SIFIVE_UART_1_CLK_FREQ SIFIVE_UART0_10023000_CLOCK_FREQUENCY
|
||||
|
||||
|
|
|
@ -39,6 +39,11 @@
|
|||
&uart0 {
|
||||
status = "ok";
|
||||
current-speed = <115200>;
|
||||
clock-frequency = <16000000>;
|
||||
};
|
||||
|
||||
&uart1 {
|
||||
clock-frequency = <16000000>;
|
||||
};
|
||||
|
||||
&spi0 {
|
||||
|
|
|
@ -386,7 +386,7 @@ static void uart_sifive_irq_cfg_func_0(void);
|
|||
|
||||
static const struct uart_sifive_device_config uart_sifive_dev_cfg_0 = {
|
||||
.port = CONFIG_SIFIVE_UART_0_BASE_ADDR,
|
||||
.sys_clk_freq = uart_sifive_port_0_clk_freq,
|
||||
.sys_clk_freq = CONFIG_SIFIVE_UART_0_CLK_FREQ,
|
||||
.baud_rate = CONFIG_SIFIVE_UART_0_CURRENT_SPEED,
|
||||
.rxcnt_irq = CONFIG_UART_SIFIVE_PORT_0_RXCNT_IRQ,
|
||||
.txcnt_irq = CONFIG_UART_SIFIVE_PORT_0_TXCNT_IRQ,
|
||||
|
@ -425,7 +425,7 @@ static void uart_sifive_irq_cfg_func_1(void);
|
|||
|
||||
static const struct uart_sifive_device_config uart_sifive_dev_cfg_1 = {
|
||||
.port = CONFIG_SIFIVE_UART_1_BASE_ADDR,
|
||||
.sys_clk_freq = uart_sifive_port_1_clk_freq,
|
||||
.sys_clk_freq = CONFIG_SIFIVE_UART_1_CLK_FREQ,
|
||||
.baud_rate = CONFIG_SIFIVE_UART_1_CURRENT_SPEED,
|
||||
.rxcnt_irq = CONFIG_UART_SIFIVE_PORT_1_RXCNT_IRQ,
|
||||
.txcnt_irq = CONFIG_UART_SIFIVE_PORT_1_TXCNT_IRQ,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue