drivers: serial: uart_miv: Convert to use DTS

Update the uart_miv driver to get params like name, addr, baud-rate,
clock freq from DTS generated defines.  Fixup related board and soc code
as needed.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2018-11-02 13:36:49 -05:00 committed by Kumar Gala
commit 751b02a49c
5 changed files with 4 additions and 33 deletions

View file

@ -9,6 +9,4 @@
#include <soc.h>
#define uart_miv_port_0_clk_freq 66000000
#endif /* __INC_BOARD_H */

View file

@ -6,10 +6,7 @@ CONFIG_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_UART_MIV=y
CONFIG_UART_MIV_PORT_0=y
CONFIG_UART_MIV_PORT_0_BAUD_RATE=115200
CONFIG_UART_MIV_PORT_0_NAME="uart0"
CONFIG_UART_CONSOLE=y
CONFIG_UART_CONSOLE_ON_DEV_NAME="uart0"
CONFIG_PLIC=y
CONFIG_RISCV_MACHINE_TIMER=y
CONFIG_GPIO=n

View file

@ -16,25 +16,3 @@ menuconfig UART_MIV_PORT_0
help
This tells the driver to configure the UART port at boot, depending on
the additional configuration options below.
config UART_MIV_PORT_0_NAME
string "Port 0 Device Name"
default "uart0"
depends on UART_MIV_PORT_0
help
This is the device name for UART, and is included in the device
struct.
config UART_MIV_PORT_0_BAUD_RATE
int "Port 0 Baud Rate"
default 0
depends on UART_MIV_PORT_0
help
The baud rate for UART port to be set to at boot.
config UART_MIV_PORT_0_IRQ_PRIORITY
int "Port 0 Interrupt Priority"
default 1
depends on UART_MIV_PORT_0
help
Port 0 Interrupt Priority

View file

@ -7,7 +7,6 @@
#include <kernel.h>
#include <arch/cpu.h>
#include <uart.h>
#include <board.h>
/* UART REGISTERS DEFINITIONS */
@ -391,16 +390,16 @@ static void uart_miv_irq_cfg_func_0(struct device *dev);
#endif
static const struct uart_miv_device_config uart_miv_dev_cfg_0 = {
.uart_addr = MIV_UART_0_BASE_ADDR,
.sys_clk_freq = uart_miv_port_0_clk_freq,
.uart_addr = CONFIG_MIV_UART_0_BASE_ADDR,
.sys_clk_freq = CONFIG_MIV_UART_0_CLOCK_FREQUENCY,
.line_config = MIV_UART_0_LINECFG,
.baud_rate = CONFIG_UART_MIV_PORT_0_BAUD_RATE,
.baud_rate = CONFIG_MIV_UART_0_BAUD_RATE,
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
.cfg_func = uart_miv_irq_cfg_func_0,
#endif
};
DEVICE_AND_API_INIT(uart_miv_0, CONFIG_UART_MIV_PORT_0_NAME,
DEVICE_AND_API_INIT(uart_miv_0, CONFIG_MIV_UART_0_NAME,
uart_miv_init, &uart_miv_data_0, &uart_miv_dev_cfg_0,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
(void *)&uart_miv_driver_api);

View file

@ -38,7 +38,6 @@
#define MIV_GPIO_31_IRQ (RISCV_MAX_GENERIC_IRQ + 31)
/* UART Configuration */
#define MIV_UART_0_BASE_ADDR 0x70001000
#define MIV_UART_0_LINECFG 0x1
/* GPIO Configuration */