Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1277178
| From | Vladimir Murzin <vladimir.murzin@arm.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [RFC PATCH 05/10] serial: mps2-uart: add support for early console |
| Date | 2015-11-25 11:40 +0100 |
| Message-ID | <qyFEu-528-31@gated-at.bofh.it> (permalink) |
| References | <qyFEu-528-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
This adds support early console for MPS2 UART which can be enabled via
earlycon=mps2,0x40004000
Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
---
drivers/tty/serial/Kconfig | 1 +
drivers/tty/serial/mps2-uart.c | 30 ++++++++++++++++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index b47f8fc..bb8c66b 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -1477,6 +1477,7 @@ config SERIAL_MPS2_UART_CONSOLE
bool "MPS2 UART console support"
depends on SERIAL_MPS2_UART
select SERIAL_CORE_CONSOLE
+ select SERIAL_EARLYCON
config SERIAL_MPS2_UART
tristate "MPS2 UART port"
diff --git a/drivers/tty/serial/mps2-uart.c b/drivers/tty/serial/mps2-uart.c
index 00e882e..c2f530e 100644
--- a/drivers/tty/serial/mps2-uart.c
+++ b/drivers/tty/serial/mps2-uart.c
@@ -445,6 +445,36 @@ static struct console mps2_uart_console = {
#define MPS2_SERIAL_CONSOLE (&mps2_uart_console)
+static void mps2_early_putchar(struct uart_port *port, int ch)
+{
+
+ while (readb(port->membase + UARTn_STATE) & UARTn_STATE_TX_FULL)
+ cpu_relax();
+
+ writeb((unsigned char)ch, port->membase + UARTn_DATA);
+}
+
+
+static void mps2_early_write(struct console *con, const char *s, unsigned n)
+{
+ struct earlycon_device *dev = con->data;
+
+ uart_console_write(&dev->port, s, n, mps2_early_putchar);
+}
+
+static int __init mps2_early_console_setup(struct earlycon_device *device,
+ const char *opt)
+{
+ if (!device->port.membase)
+ return -ENODEV;
+
+ device->con->write = mps2_early_write;
+
+ return 0;
+}
+EARLYCON_DECLARE(mps2, mps2_early_console_setup);
+OF_EARLYCON_DECLARE(mps2, "arm,mps2-uart", mps2_early_console_setup);
+
#else
#define MPS2_SERIAL_CONSOLE NULL
#endif
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC PATCH 00/10] Support for Cortex-M Prototyping System Vladimir Murzin <vladimir.murzin@arm.com> - 2015-11-25 11:40 +0100
[RFC PATCH 10/10] ARM: dts: introduce MPS2 AN399/AN400 Vladimir Murzin <vladimir.murzin@arm.com> - 2015-11-25 11:40 +0100
[RFC PATCH 02/10] clockevents/drivers: add MPS2 Timer driver Vladimir Murzin <vladimir.murzin@arm.com> - 2015-11-25 11:40 +0100
Re: [RFC PATCH 02/10] clockevents/drivers: add MPS2 Timer driver Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-11-25 14:50 +0100
Re: [RFC PATCH 02/10] clockevents/drivers: add MPS2 Timer driver Vladimir Murzin <vladimir.murzin@arm.com> - 2015-11-25 16:00 +0100
Re: [RFC PATCH 02/10] clockevents/drivers: add MPS2 Timer driver Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-11-25 16:20 +0100
Re: [RFC PATCH 02/10] clockevents/drivers: add MPS2 Timer driver Vladimir Murzin <vladimir.murzin@arm.com> - 2015-11-25 16:30 +0100
[RFC PATCH 01/10] dt-bindings: document the MPS2 timer bindings Vladimir Murzin <vladimir.murzin@arm.com> - 2015-11-25 11:40 +0100
Re: [RFC PATCH 01/10] dt-bindings: document the MPS2 timer bindings Rob Herring <robh@kernel.org> - 2015-11-25 21:10 +0100
[RFC PATCH 07/10] ARM: mps2: add low-level debug support Vladimir Murzin <vladimir.murzin@arm.com> - 2015-11-25 11:40 +0100
[RFC PATCH 05/10] serial: mps2-uart: add support for early console Vladimir Murzin <vladimir.murzin@arm.com> - 2015-11-25 11:40 +0100
[RFC PATCH 04/10] serial: mps2-uart: add MPS2 UART driver Vladimir Murzin <vladimir.murzin@arm.com> - 2015-11-25 11:40 +0100
[RFC PATCH 03/10] dt-bindings: document the MPS2 UART bindings Vladimir Murzin <vladimir.murzin@arm.com> - 2015-11-25 11:40 +0100
Re: [RFC PATCH 03/10] dt-bindings: document the MPS2 UART bindings Rob Herring <robh@kernel.org> - 2015-11-25 21:10 +0100
[RFC PATCH 09/10] ARM: dts: introduce MPS2 AN385/AN386 Vladimir Murzin <vladimir.murzin@arm.com> - 2015-11-25 11:40 +0100
[RFC PATCH 08/10] ARM: configs: add MPS2 defconfig Vladimir Murzin <vladimir.murzin@arm.com> - 2015-11-25 11:40 +0100
Re: [RFC PATCH 00/10] Support for Cortex-M Prototyping System Arnd Bergmann <arnd@arndb.de> - 2015-11-25 12:30 +0100
Re: [RFC PATCH 00/10] Support for Cortex-M Prototyping System Vladimir Murzin <vladimir.murzin@arm.com> - 2015-11-25 15:50 +0100
csiph-web