forked from Mirrors/opensbi
lib: utils/serial: support 'reg-offset' property
reg-offset property is used for offset to apply to the mapbase from the start of the registers in 8250 UART. In Linux kernel, it has been handled in 8250 UART driver. dt-bindings: <linux>/Documentation/devicetree/bindings/serial/8250.yaml Signed-off-by: Zong Li <zong.li@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#define DEFAULT_UART_BAUD 115200
|
||||
#define DEFAULT_UART_REG_SHIFT 0
|
||||
#define DEFAULT_UART_REG_IO_WIDTH 1
|
||||
#define DEFAULT_UART_REG_OFFSET 0
|
||||
|
||||
#define DEFAULT_SIFIVE_UART_FREQ 0
|
||||
#define DEFAULT_SIFIVE_UART_BAUD 115200
|
||||
@@ -449,6 +450,12 @@ int fdt_parse_uart8250_node(void *fdt, int nodeoffset,
|
||||
else
|
||||
uart->reg_io_width = DEFAULT_UART_REG_IO_WIDTH;
|
||||
|
||||
val = (fdt32_t *)fdt_getprop(fdt, nodeoffset, "reg-offset", &len);
|
||||
if (len > 0 && val)
|
||||
uart->reg_offset = fdt32_to_cpu(*val);
|
||||
else
|
||||
uart->reg_offset = DEFAULT_UART_REG_OFFSET;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user