diff options
| author | Anup Patel <[email protected]> | 2020-04-24 15:21:34 +0530 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2020-05-01 09:36:13 +0530 |
| commit | 01a8c8eebb6f219afb3873fce82a11a7cf49a03e (patch) | |
| tree | af88966d45c52d7a5a919bb35dc647e3ca30d3b3 /lib/utils | |
| parent | e6c1345f89f0c2fa5d8b0dde733eb80366056632 (diff) | |
lib: utils: Improve fdt_parse_uart8250() API
The information parsed by fdt_parse_uart8250() API is not complete.
We need to parse reg-shift and reg-io-width for UART 8520 as well.
Signed-off-by: Anup Patel <[email protected]>
Reviewed-by: Atish Patra <[email protected]>
Reviewed-by: Alistair Francis <[email protected]>
Diffstat (limited to 'lib/utils')
| -rw-r--r-- | lib/utils/fdt/fdt_helper.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/utils/fdt/fdt_helper.c b/lib/utils/fdt/fdt_helper.c index 07f72212..f620e742 100644 --- a/lib/utils/fdt/fdt_helper.c +++ b/lib/utils/fdt/fdt_helper.c @@ -13,6 +13,11 @@ #include <sbi/sbi_scratch.h> #include <sbi_utils/fdt/fdt_helper.h> +#define DEFAULT_UART_FREQ 0 +#define DEFAULT_UART_BAUD 115200 +#define DEFAULT_UART_REG_SHIFT 0 +#define DEFAULT_UART_REG_IO_WIDTH 1 + static int fdt_get_node_addr_size(void *fdt, int node, unsigned long *addr, unsigned long *size) { @@ -81,10 +86,26 @@ int fdt_parse_uart8250(void *fdt, struct platform_uart_data *uart, val = (fdt32_t *)fdt_getprop(fdt, nodeoffset, "clock-frequency", &len); if (len > 0 && val) uart->freq = fdt32_to_cpu(*val); + else + uart->freq = DEFAULT_UART_FREQ; val = (fdt32_t *)fdt_getprop(fdt, nodeoffset, "current-speed", &len); if (len > 0 && val) uart->baud = fdt32_to_cpu(*val); + else + uart->baud = DEFAULT_UART_BAUD; + + val = (fdt32_t *)fdt_getprop(fdt, nodeoffset, "reg-shift", &len); + if (len > 0 && val) + uart->reg_shift = fdt32_to_cpu(*val); + else + uart->reg_shift = DEFAULT_UART_REG_SHIFT; + + val = (fdt32_t *)fdt_getprop(fdt, nodeoffset, "reg-io-width", &len); + if (len > 0 && val) + uart->reg_io_width = fdt32_to_cpu(*val); + else + uart->reg_io_width = DEFAULT_UART_REG_IO_WIDTH; return 0; } |
