serial: pl01x: Add support for devices with the rate pre-configured.
authorEric Anholt <eric@anholt.net>
Mon, 14 Mar 2016 01:16:54 +0000 (18:16 -0700)
committerTom Rini <trini@konsulko.com>
Tue, 22 Mar 2016 16:16:12 +0000 (12:16 -0400)
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>
board/raspberrypi/rpi/rpi.c
drivers/serial/serial_pl01x.c
include/dm/platform_data/serial_pl01x.h

index 1d3a4e09cfa3c3f2ca12d253c1c64ea947722908..da4b6ff234d6ce2199a24d737d8687cd28b817ba 100644 (file)
@@ -37,7 +37,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) = {
index 552c945264c8d549c6da6fbbb311beb188fcb66c..6f83835fa8cd2a3748149c45bd6c5abb113a952f 100644 (file)
@@ -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)
index 5e068f390bd2bee97885fb74f4484d4a12278e5f..ccfa808e2332465d0097962527583f36d599a021 100644 (file)
@@ -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