summaryrefslogtreecommitdiff
path: root/plat/rockchip/common/params_setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'plat/rockchip/common/params_setup.c')
-rw-r--r--plat/rockchip/common/params_setup.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/plat/rockchip/common/params_setup.c b/plat/rockchip/common/params_setup.c
index 3943c1f0..ad5588af 100644
--- a/plat/rockchip/common/params_setup.c
+++ b/plat/rockchip/common/params_setup.c
@@ -117,6 +117,56 @@ void dt_relocate_pmu_firmware(void)
INFO("%s: relocated PMU firmware\n", __func__);
}
+static void plat_rockchip_dt_process_fdt_uart(void *fdt)
+{
+ const char *path_name = "/chosen";
+ const char *prop_name = "stdout-path";
+ int node_offset;
+ int stdout_path_len;
+ const char *stdout_path;
+ char serial_char;
+ int serial_no;
+ uint32_t uart_base;
+
+ node_offset = fdt_path_offset(fdt, path_name);
+ if (node_offset < 0)
+ return;
+
+ stdout_path = fdt_getprop(fdt, node_offset, prop_name,
+ &stdout_path_len);
+ if (stdout_path == NULL)
+ return;
+
+ /*
+ * We expect something like:
+ * "serial0:...""
+ */
+ if (strncmp("serial", stdout_path, 6) != 0)
+ return;
+
+ serial_char = stdout_path[6];
+ serial_no = serial_char - '0';
+
+ switch (serial_no) {
+ case 0:
+ uart_base = UART0_BASE;
+ break;
+ case 1:
+ uart_base = UART1_BASE;
+ break;
+ case 2:
+ uart_base = UART2_BASE;
+ break;
+ case 3:
+ uart_base = UART3_BASE;
+ break;
+ default:
+ return;
+ }
+
+ rockchip_set_uart_base(uart_base);
+}
+
bool dt_board_is_compatible(const char *board)
{
void *fdt = plat_get_fdt();
@@ -135,6 +185,7 @@ static int dt_process_fdt(void* blob)
}
INFO("%s: opened FDT at %p\n", __func__, blob);
+ plat_rockchip_dt_process_fdt_uart(fdt);
dt_relocate_pmu_firmware();
dt_get_reset_gpio();