aboutsummaryrefslogtreecommitdiff
path: root/drivers/core
diff options
context:
space:
mode:
authorAlgapally Santosh Sagar <santoshsagar.algapally@amd.com>2023-09-21 16:50:43 +0530
committerMichal Simek <michal.simek@amd.com>2023-11-07 13:47:08 +0100
commitbd9ff681bdd1893d11ab8d4ea79a9f74d0fffdb7 (patch)
tree8f568d750fa208e7086c4f3aa83c13370140e675 /drivers/core
parent8819892bdbcfe8797bb1ebf45806d9b5ebb86674 (diff)
downloadu-boot-bd9ff681bdd1893d11ab8d4ea79a9f74d0fffdb7.zip
u-boot-bd9ff681bdd1893d11ab8d4ea79a9f74d0fffdb7.tar.gz
u-boot-bd9ff681bdd1893d11ab8d4ea79a9f74d0fffdb7.tar.bz2
serial: zynqmp: Fetch baudrate from dtb and update
The baudrate configured in .config is taken by default by serial. If change of baudrate is required then the .config needs to changed and u-boot recompilation is required or the u-boot environment needs to be updated. To avoid this, support is added to fetch the baudrate directly from the device tree file and update. The serial, prints the log with the configured baudrate in the dtb. The commit c4df0f6f315c ("arm: mvebu: Espressobin: Set default value for $fdtfile env variable") is taken as reference for changing the default environment variable. The default environment stores the default baudrate value, When default baudrate and dtb baudrate are not same glitches are seen on the serial. So, the environment also needs to be updated with the dtb baudrate to avoid the glitches on the serial. Also add test to cover this new function. Signed-off-by: Algapally Santosh Sagar <santoshsagar.algapally@amd.com> Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com> Link: https://lore.kernel.org/r/20230921112043.3144726-3-venkatesh.abbarapu@amd.com Signed-off-by: Michal Simek <michal.simek@amd.com>
Diffstat (limited to 'drivers/core')
-rw-r--r--drivers/core/ofnode.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index 29a4294..f72ea41 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -991,6 +991,24 @@ ofnode ofnode_get_chosen_node(const char *name)
return ofnode_path(prop);
}
+int ofnode_read_baud(void)
+{
+ const char *str, *p;
+ u32 baud;
+
+ str = ofnode_read_chosen_string("stdout-path");
+ if (!str)
+ return -EINVAL;
+
+ /* Parse string serial0:115200n8 */
+ p = strchr(str, ':');
+ if (!p)
+ return -EINVAL;
+
+ baud = dectoul(p + 1, NULL);
+ return baud;
+}
+
const void *ofnode_read_aliases_prop(const char *propname, int *sizep)
{
ofnode node;