Using secondary UART for board initialization
Alexander Koch
akoch at initse.com
Wed Nov 13 15:14:18 CET 2024
> All `serial_putc()`-like functions that I could find are either static to the
> actual driver and thus not accessible from `board_init()` or do not accept a
> `struct udevice *` as a parameter and seem to work on the main U-Boot serial
> console device only.
Reading other board code I think I have found a supposed-to-be-working sequence
of calls:
(simplified code)
struct udevice *dev = uclass_get_device_by_name(UCLASS_SERIAL,
"serial at 30860000", &dev);
struct dm_serial_ops *ops = serial_get_ops(dev);
ops->setbrg(dev, 115200);
ops->putc(dev, 'f');
Unfortunately this yields a CPU reset:
"Error" handler, esr 0xbf000002
elr: 00000000402605f0 lr : 00000000402610f8 (reloc)
elr: 00000000bff865f0 lr : 00000000bff870f8
x0 : 000000000000006d x1 : 000000000000081a
x2 : 00000000bffabf00 x3 : 00000000bdf1c630
x4 : 00000000bdf1cf20 x5 : 00000000bdf21804
x6 : 000000000000000f x7 : 00000000bdf1cf50
x8 : 00000000bdf1ce80 x9 : 00000000ffffffd0
x10: 0000000000000002 x11: 00000000ffffffff
x12: 00000000bdf1d080 x13: 0000000000004884
x14: 0000000000000000 x15: 00000000bdf1c6a8
x16: 0000000040234dc4 x17: 000000000000aa80
x18: 00000000bdf25d80 x19: 00000000bdf1cf20
x20: 00000000bdf1c670 x21: 00000000ffffffc8
x22: 00000000bdf1ce8a x23: 00000000bdf1cf20
x24: 00000000bdf1c670 x25: 000000000000081a
x26: 00000000bff9c000 x27: 00000000bffabf00
x28: 0000000000000000 x29: 00000000bdf1c560
Code: d00000ba 91263340 f90037e0 39400360 (350001a0)
Resetting CPU ...
I traced this down to a writel() call to the UART TXD register in the serial
driver (`mxc_serial_putc()` in 'serial_mxc.c').
The documentation for `uclass_get_device_by_name()` says the device is 'probed
to activate it ready for use' so I think this is not an initialization issue.
Any ideas what I might be missing there?
Best regards,
Alex
More information about the U-Boot
mailing list