Commit cd0fa5bff8052b19bde6967c2734f323c9848568
Committed by
Tom Rini
1 parent
9a6598daaf
Exists in
v2017.01-smarct4x
and in
29 other branches
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. Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Tom Rini <trini@konsulko.com> Tested-by: Stephen Warren <swarren@wwwdotorg.org>
Showing 3 changed files with 12 additions and 3 deletions Side-by-side Diff
board/raspberrypi/rpi/rpi.c
drivers/serial/serial_pl01x.c
... | ... | @@ -284,7 +284,10 @@ |
284 | 284 | struct pl01x_serial_platdata *plat = dev_get_platdata(dev); |
285 | 285 | struct pl01x_priv *priv = dev_get_priv(dev); |
286 | 286 | |
287 | - pl01x_generic_setbrg(priv->regs, priv->type, plat->clock, baudrate); | |
287 | + if (!plat->skip_init) { | |
288 | + pl01x_generic_setbrg(priv->regs, priv->type, plat->clock, | |
289 | + baudrate); | |
290 | + } | |
288 | 291 | |
289 | 292 | return 0; |
290 | 293 | } |
... | ... | @@ -296,7 +299,10 @@ |
296 | 299 | |
297 | 300 | priv->regs = (struct pl01x_regs *)plat->base; |
298 | 301 | priv->type = plat->type; |
299 | - return pl01x_generic_serial_init(priv->regs, priv->type); | |
302 | + if (!plat->skip_init) | |
303 | + return pl01x_generic_serial_init(priv->regs, priv->type); | |
304 | + else | |
305 | + return 0; | |
300 | 306 | } |
301 | 307 | |
302 | 308 | static int pl01x_serial_getc(struct udevice *dev) |
include/dm/platform_data/serial_pl01x.h
... | ... | @@ -17,11 +17,14 @@ |
17 | 17 | * @base: Register base address |
18 | 18 | * @type: Port type |
19 | 19 | * @clock: Input clock rate, used for calculating the baud rate divisor |
20 | + * @skip_init: Don't attempt to change port configuration (also means @clock | |
21 | + * is ignored) | |
20 | 22 | */ |
21 | 23 | struct pl01x_serial_platdata { |
22 | 24 | unsigned long base; |
23 | 25 | enum pl01x_type type; |
24 | 26 | unsigned int clock; |
27 | + bool skip_init; | |
25 | 28 | }; |
26 | 29 | |
27 | 30 | #endif |