|
@@ -450,6 +450,34 @@ 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 int 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;
|
|
|
+}
|
|
|
+
|
|
|
+OF_EARLYCON_DECLARE(mps2, "arm,mps2-uart", mps2_early_console_setup);
|
|
|
+
|
|
|
#else
|
|
|
#define MPS2_SERIAL_CONSOLE NULL
|
|
|
#endif
|