Skip to content

Commit 751b02a

Browse files
committed
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 <[email protected]>
1 parent 11cb877 commit 751b02a

File tree

5 files changed

+4
-33
lines changed

5 files changed

+4
-33
lines changed

boards/riscv32/m2gl025_miv/board.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,4 @@
99

1010
#include <soc.h>
1111

12-
#define uart_miv_port_0_clk_freq 66000000
13-
1412
#endif /* __INC_BOARD_H */

boards/riscv32/m2gl025_miv/m2gl025_miv_defconfig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ CONFIG_CONSOLE=y
66
CONFIG_SERIAL=y
77
CONFIG_UART_MIV=y
88
CONFIG_UART_MIV_PORT_0=y
9-
CONFIG_UART_MIV_PORT_0_BAUD_RATE=115200
10-
CONFIG_UART_MIV_PORT_0_NAME="uart0"
119
CONFIG_UART_CONSOLE=y
12-
CONFIG_UART_CONSOLE_ON_DEV_NAME="uart0"
1310
CONFIG_PLIC=y
1411
CONFIG_RISCV_MACHINE_TIMER=y
1512
CONFIG_GPIO=n

drivers/serial/Kconfig.miv

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,3 @@ menuconfig UART_MIV_PORT_0
1616
help
1717
This tells the driver to configure the UART port at boot, depending on
1818
the additional configuration options below.
19-
20-
config UART_MIV_PORT_0_NAME
21-
string "Port 0 Device Name"
22-
default "uart0"
23-
depends on UART_MIV_PORT_0
24-
help
25-
This is the device name for UART, and is included in the device
26-
struct.
27-
28-
config UART_MIV_PORT_0_BAUD_RATE
29-
int "Port 0 Baud Rate"
30-
default 0
31-
depends on UART_MIV_PORT_0
32-
help
33-
The baud rate for UART port to be set to at boot.
34-
35-
config UART_MIV_PORT_0_IRQ_PRIORITY
36-
int "Port 0 Interrupt Priority"
37-
default 1
38-
depends on UART_MIV_PORT_0
39-
help
40-
Port 0 Interrupt Priority

drivers/serial/uart_miv.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include <kernel.h>
88
#include <arch/cpu.h>
99
#include <uart.h>
10-
#include <board.h>
1110

1211

1312
/* UART REGISTERS DEFINITIONS */
@@ -391,16 +390,16 @@ static void uart_miv_irq_cfg_func_0(struct device *dev);
391390
#endif
392391

393392
static const struct uart_miv_device_config uart_miv_dev_cfg_0 = {
394-
.uart_addr = MIV_UART_0_BASE_ADDR,
395-
.sys_clk_freq = uart_miv_port_0_clk_freq,
393+
.uart_addr = CONFIG_MIV_UART_0_BASE_ADDR,
394+
.sys_clk_freq = CONFIG_MIV_UART_0_CLOCK_FREQUENCY,
396395
.line_config = MIV_UART_0_LINECFG,
397-
.baud_rate = CONFIG_UART_MIV_PORT_0_BAUD_RATE,
396+
.baud_rate = CONFIG_MIV_UART_0_BAUD_RATE,
398397
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
399398
.cfg_func = uart_miv_irq_cfg_func_0,
400399
#endif
401400
};
402401

403-
DEVICE_AND_API_INIT(uart_miv_0, CONFIG_UART_MIV_PORT_0_NAME,
402+
DEVICE_AND_API_INIT(uart_miv_0, CONFIG_MIV_UART_0_NAME,
404403
uart_miv_init, &uart_miv_data_0, &uart_miv_dev_cfg_0,
405404
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
406405
(void *)&uart_miv_driver_api);

soc/riscv32/riscv-privilege/miv/soc.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#define MIV_GPIO_31_IRQ (RISCV_MAX_GENERIC_IRQ + 31)
3939

4040
/* UART Configuration */
41-
#define MIV_UART_0_BASE_ADDR 0x70001000
4241
#define MIV_UART_0_LINECFG 0x1
4342

4443
/* GPIO Configuration */

0 commit comments

Comments
 (0)