serial: pl01x: Add support for devices with the rate pre-configured.
PATCH v2 1/1 serial: pl01x: Add support for devices with the rate pre-configured.
For Raspberry Pi, we had the input clock rate to the pl011 fixed in the rpi.c file, but it may be changed by firmware due to user changes to config.txt. Since the firmware always sets up the uart (default 115200 output unless the user changes it), we can just skip our own uart init to simplify the boot process and more reliably get serial output.
--- board/raspberrypi/rpi/rpi.c | 2 +- drivers/serial/serial_pl01x.c | 10 ++++++++-- include/dm/platform_data/serial_pl01x.h | 3 +++ 3 files changed, 12 insertions(+), 3 deletions(-)
board/raspberrypi/rpi/rpi.c +1 -1
@@ -36,7 +36,7 @@ static const struct pl01x_serial_platdata serial_platdata = { .base = 0x20201000, #endif .type = TYPE_PL011, - .clock = 3000000, + .skip_init = true, }; U_BOOT_DEVICE(bcm2835_serials) = {
drivers/serial/serial_pl01x.c +8 -2
@@ -284,7 +284,10 @@ static int pl01x_serial_setbrg(struct udevice *dev, int baudrate)struct pl01x_serial_platdata *plat =dev_get_platdata (dev);struct pl01x_priv *priv =dev_get_priv (dev); -pl01x_generic_setbrg (priv->regs, priv->type, plat->clock, baudrate); +if (!plat->skip_init) { +pl01x_generic_setbrg (priv->regs, priv->type, plat->clock, + baudrate); + }return 0 ; }
@@ -296,7 +299,10 @@ static int pl01x_serial_probe(struct udevice *dev) priv->regs = (struct pl01x_regs *)plat->base; priv->type = plat->type; -return pl01x_generic_serial_init (priv->regs, priv->type); +if (!plat->skip_init) +return pl01x_generic_serial_init (priv->regs, priv->type); +else +return 0 ; }static int pl01x_serial_getc (struct udevice *dev)
include/dm/platform_data/serial_pl01x.h +3 -0
@@ -17,11 +17,14 @@ enum pl01x_type {* @base: Register base address * @type: Port type * @clock: Input clock rate, used for calculating the baud rate divisor +* @skip_init: Don't attempt to change port configuration (also means @clock +* is ignored) */ struct pl01x_serial_platdata {unsigned long base;enum pl01x_type type;unsigned int clock; +bool skip_init; };#endif
Signature · 1 line
2.7.0
PATCH v2 1/1 serial: pl01x: Add support for devices with the rate pre-configured.
Quoted 8 lines · Eric Anholt
For Raspberry Pi, we had the input clock rate to the pl011 fixed in the
rpi.cfile, but it may be changed by firmware due to user changes to config.txt. Since the firmware always sets up the uart (default 115200 output unless the user changes it), we can just skip our own uart init to simplify the boot process and more reliably get serial output.Signed-off-by Eric Anholt <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160314/99f7c76a/attachment.sig>
PATCH v2 1/1 serial: pl01x: Add support for devices with the rate pre-configured.
In reply to Eric AnholtQuoted 6 lines · Eric Anholt
For Raspberry Pi, we had the input clock rate to the pl011 fixed in the
rpi.cfile, but it may be changed by firmware due to user changes to config.txt. Since the firmware always sets up the uart (default 115200 output unless the user changes it), we can just skip our own uart init to simplify the boot process and more reliably get serial output.
# on RPi B+ and RPi 2
PATCH v2 1/1 serial: pl01x: Add support for devices with the rate pre-configured.
Quoted 10 lines · Stephen Warren
Quoted 6 lines · Eric Anholt
For Raspberry Pi, we had the input clock rate to the pl011 fixed in the
rpi.cfile, but it may be changed by firmware due to user changes to config.txt. Since the firmware always sets up the uart (default 115200 output unless the user changes it), we can just skip our own uart init to simplify the boot process and more reliably get serial output.Tested-by Stephen Warren <[email protected]># on RPi B+ and RPi 2
Sorry, I take this Tested-by back. With the latest firmware (which has some modifications intended to initialize either the PL01x or the mini UART depending on which the kernel will actually use), this patch causes U-Boot not to boot at all. I'm pretty sure this is a FW bug (since even without this patch the UART doesn't work, but U-Boot does at least boot and can be used over HDMI/usbkbd), but I'd still prefer not to apply this until the FW is working again and we can double-check everything.
Hopefully this will be resolved in
https://github.com/raspberrypi/firmware/issues/553 soon.
PATCH v2 1/1 serial: pl01x: Add support for devices with the rate pre-configured.
Quoted 20 lines · Stephen Warren
Quoted 10 lines · Stephen Warren
Quoted 6 lines · Eric Anholt
For Raspberry Pi, we had the input clock rate to the pl011 fixed in the
rpi.cfile, but it may be changed by firmware due to user changes to config.txt. Since the firmware always sets up the uart (default 115200 output unless the user changes it), we can just skip our own uart init to simplify the boot process and more reliably get serial output.Tested-by Stephen Warren <[email protected]># on RPi B+ and RPi 2Sorry, I take this Tested-by back. With the latest firmware (which has some modifications intended to initialize either the PL01x or the mini UART depending on which the kernel will actually use), this patch causes U-Boot not to boot at all. I'm pretty sure this is a FW bug (since even without this patch the UART doesn't work, but U-Boot does at least boot and can be used over HDMI/usbkbd), but I'd still prefer not to apply this until the FW is working again and we can double-check everything.
Quoted 2 lines
Hopefully this will be resolved in
https://github.com/raspberrypi/firmware/issues/553 soon.
We can go ahead with this patch now; the FW behaviour has been accepted as a bug, and fixed in a new FW release.
PATCH v2 1/1 serial: pl01x: Add support for devices with the rate pre-configured.
In reply to Eric AnholtQuoted 10 lines · Eric Anholt
For Raspberry Pi, we had the input clock rate to the pl011 fixed in the
rpi.cfile, but it may be changed by firmware due to user changes to config.txt. Since the firmware always sets up the uart (default 115200 output unless the user changes it), we can just skip our own uart init to simplify the boot process and more reliably get serial output.Signed-off-by Eric Anholt <[email protected]>Reviewed-by Tom Rini <[email protected]>Tested-by Stephen Warren <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160322/0ecf8283/attachment.sig>