mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-01 17:10:11 +00:00
bd9ff681bd
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 c4df0f6f31
("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>
41 lines
1.8 KiB
Text
41 lines
1.8 KiB
Text
Fetch serial baudrate from DT
|
|
-----------------------------
|
|
|
|
To support fetching of baudrate from DT, the following is done:-
|
|
|
|
The baudrate configured in Kconfig symbol CONFIG_BAUDRATE is taken by default by serial.
|
|
If change of baudrate is required then the Kconfig symbol CONFIG_BAUDRATE needs to
|
|
changed and U-Boot recompilation is required or the U-Boot environment needs to be updated.
|
|
|
|
To avoid this, add support to fetch the baudrate directly from the device tree file and
|
|
update the environment.
|
|
|
|
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 which is enabled by OF_SERIAL_BAUD.
|
|
|
|
The Kconfig SPL_ENV_SUPPORT needs to be enabled to allow patching in SPL.
|
|
|
|
The Kconfig DEFAULT_ENV_IS_RW which is enabled by OF_SERIAL_BAUD with making the environment
|
|
writable.
|
|
|
|
The ofnode_read_baud() function parses and fetches the baudrate value from the DT. This value
|
|
is validated and updated to baudrate during serial init. Padding is added at the end of the
|
|
default environment and the dt baudrate is updated with the latest value.
|
|
|
|
Example:-
|
|
|
|
The serial port options are of the form "bbbbpnf", where "bbbb" is the baud rate, "p" is parity ("n", "o", or "e"),
|
|
"n" is number of bits, and "f" is flow control ("r" for RTS or omit it). Default is "115200n8".
|
|
|
|
chosen {
|
|
bootargs = "earlycon console=ttyPS0,115200 clk_ignore_unused root=/dev/ram0 rw init_fatal_sh=1";
|
|
stdout-path = "serial0:115200n8";
|
|
};
|
|
|
|
From the chosen node, stdout-path property is obtained as string.
|
|
|
|
stdout-path = "serial0:115200n8";
|
|
|
|
The string is parsed to get the baudrate 115200. This string is converted to integer and updated to the environment.
|