aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@arm.com>2020-04-09 11:27:21 +0100
committerAndre Przywara <andre.przywara@arm.com>2020-05-05 15:36:51 +0100
commit7a61114da619f3d0fe0d068f879ad2f7f99ee3c4 (patch)
tree81e1f9deb4f6977de573a6f2fe040432253aadf6
parent60e2e27db51df2b819ad10521a0821544f2f8ce0 (diff)
downloadtrusted-firmware-a-7a61114da619f3d0fe0d068f879ad2f7f99ee3c4.tar.gz
plat/stm32: Use generic fdt_get_stdout_node_offset()
Now that we have an implementation for getting the node offset of the stdout-path property in the generic fdt_wrappers code, use that to replace the current ST platform specific implementation. Change-Id: I5dd05684e7ca3cb563b5f71c885e1066393e057e Signed-off-by: Andre Przywara <andre.przywara@arm.com>
-rw-r--r--plat/st/common/stm32mp_dt.c50
1 files changed, 2 insertions, 48 deletions
diff --git a/plat/st/common/stm32mp_dt.c b/plat/st/common/stm32mp_dt.c
index 356af0bbcf..155f784040 100644
--- a/plat/st/common/stm32mp_dt.c
+++ b/plat/st/common/stm32mp_dt.c
@@ -136,52 +136,6 @@ static int fdt_get_node_parent_size_cells(int node)
#endif
/*******************************************************************************
- * This function gets the stdout path node.
- * It reads the value indicated inside the device tree.
- * Returns node offset on success and a negative FDT error code on failure.
- ******************************************************************************/
-static int dt_get_stdout_node_offset(void)
-{
- int node;
- const char *cchar;
-
- node = fdt_path_offset(fdt, "/secure-chosen");
- if (node < 0) {
- node = fdt_path_offset(fdt, "/chosen");
- if (node < 0) {
- return -FDT_ERR_NOTFOUND;
- }
- }
-
- cchar = fdt_getprop(fdt, node, "stdout-path", NULL);
- if (cchar == NULL) {
- return -FDT_ERR_NOTFOUND;
- }
-
- node = -FDT_ERR_NOTFOUND;
- if (strchr(cchar, (int)':') != NULL) {
- const char *name;
- char *str = (char *)cchar;
- int len = 0;
-
- while (strncmp(":", str, 1)) {
- len++;
- str++;
- }
-
- name = fdt_get_alias_namelen(fdt, cchar, len);
-
- if (name != NULL) {
- node = fdt_path_offset(fdt, name);
- }
- } else {
- node = fdt_path_offset(fdt, cchar);
- }
-
- return node;
-}
-
-/*******************************************************************************
* This function gets the stdout pin configuration information from the DT.
* And then calls the sub-function to treat it and set GPIO registers.
* Returns 0 on success and a negative FDT error code on failure.
@@ -190,7 +144,7 @@ int dt_set_stdout_pinctrl(void)
{
int node;
- node = dt_get_stdout_node_offset();
+ node = fdt_get_stdout_node_offset(fdt);
if (node < 0) {
return -FDT_ERR_NOTFOUND;
}
@@ -259,7 +213,7 @@ int dt_get_stdout_uart_info(struct dt_node_info *info)
{
int node;
- node = dt_get_stdout_node_offset();
+ node = fdt_get_stdout_node_offset(fdt);
if (node < 0) {
return -FDT_ERR_NOTFOUND;
}