[U-Boot] [PATCH] serial: pl01x: Add support for devices with the rate pre-configured.

Eric Anholt eric at anholt.net
Fri Feb 5 22:43:27 CET 2016


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 at anholt.net>
---
 board/raspberrypi/rpi/rpi.c             | 3 +--
 drivers/serial/serial_pl01x.c           | 4 ++++
 include/dm/platform_data/serial_pl01x.h | 1 +
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
index 4b80d7b..1fd3f97 100644
--- a/board/raspberrypi/rpi/rpi.c
+++ b/board/raspberrypi/rpi/rpi.c
@@ -35,8 +35,7 @@ static const struct pl01x_serial_platdata serial_platdata = {
 #else
 	.base = 0x20201000,
 #endif
-	.type = TYPE_PL011,
-	.clock = 3000000,
+	.type = TYPE_PL01X_PRECONFIGURED,
 };
 
 U_BOOT_DEVICE(bcm2835_serials) = {
diff --git a/drivers/serial/serial_pl01x.c b/drivers/serial/serial_pl01x.c
index 552c945..7d4d214 100644
--- a/drivers/serial/serial_pl01x.c
+++ b/drivers/serial/serial_pl01x.c
@@ -83,6 +83,8 @@ static int pl01x_generic_serial_init(struct pl01x_regs *regs,
 		/* disable everything */
 		writel(0, &regs->pl011_cr);
 		break;
+	case TYPE_PL01X_PRECONFIGURED:
+		break;
 	default:
 		return -EINVAL;
 	}
@@ -172,6 +174,8 @@ static int pl01x_generic_setbrg(struct pl01x_regs *regs, enum pl01x_type type,
 		writel(UART_PL011_CR_UARTEN | UART_PL011_CR_TXE |
 		       UART_PL011_CR_RXE | UART_PL011_CR_RTS, &regs->pl011_cr);
 		break;
+	case TYPE_PL01X_PRECONFIGURED:
+		break;
 	}
 	default:
 		return -EINVAL;
diff --git a/include/dm/platform_data/serial_pl01x.h b/include/dm/platform_data/serial_pl01x.h
index 5e068f3..ae1bf31 100644
--- a/include/dm/platform_data/serial_pl01x.h
+++ b/include/dm/platform_data/serial_pl01x.h
@@ -9,6 +9,7 @@
 enum pl01x_type {
 	TYPE_PL010,
 	TYPE_PL011,
+	TYPE_PL01X_PRECONFIGURED,
 };
 
 /*
-- 
2.7.0



More information about the U-Boot mailing list