public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2] serial: pl01x: Add support for devices with the rate pre-configured.
@ 2016-03-14  1:16 Eric Anholt
  2016-03-14 15:25 ` Tom Rini
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Eric Anholt @ 2016-03-14  1:16 UTC (permalink / raw)
  To: u-boot

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>
---
 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(-)

diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
index 7f4fe64..bb640b1 100644
--- a/board/raspberrypi/rpi/rpi.c
+++ b/board/raspberrypi/rpi/rpi.c
@@ -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) = {
diff --git a/drivers/serial/serial_pl01x.c b/drivers/serial/serial_pl01x.c
index 552c945..6f83835 100644
--- a/drivers/serial/serial_pl01x.c
+++ b/drivers/serial/serial_pl01x.c
@@ -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)
diff --git a/include/dm/platform_data/serial_pl01x.h b/include/dm/platform_data/serial_pl01x.h
index 5e068f3..ccfa808 100644
--- a/include/dm/platform_data/serial_pl01x.h
+++ b/include/dm/platform_data/serial_pl01x.h
@@ -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
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-03-23  1:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-14  1:16 [U-Boot] [PATCH v2] serial: pl01x: Add support for devices with the rate pre-configured Eric Anholt
2016-03-14 15:25 ` Tom Rini
2016-03-16  2:36 ` Stephen Warren
2016-03-20  6:06   ` Stephen Warren
2016-03-22  2:11     ` Stephen Warren
2016-03-23  1:59 ` [U-Boot] [U-Boot, " Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox