]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
serial: 8250_early: Add earlycon support for Palmchip UART
authorMarc Gonzalez <marc_gonzalez@sigmadesigns.com>
Mon, 10 Apr 2017 09:47:09 +0000 (11:47 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 Apr 2017 15:47:42 +0000 (17:47 +0200)
Define an OF early console for Palmchip UART, which can be enabled
by passing "earlycon" on the boot command line.

Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_early.c
drivers/tty/serial/8250/8250_port.c

index 85a12f03240247494366a231d24fa86ba042dfdb..82fc48eca1df705521c99036d1a0d7f6e7d63402 100644 (file)
@@ -39,6 +39,7 @@
 
 static unsigned int __init serial8250_early_in(struct uart_port *port, int offset)
 {
+       int reg_offset = offset;
        offset <<= port->regshift;
 
        switch (port->iotype) {
@@ -52,6 +53,8 @@ static unsigned int __init serial8250_early_in(struct uart_port *port, int offse
                return ioread32be(port->membase + offset);
        case UPIO_PORT:
                return inb(port->iobase + offset);
+       case UPIO_AU:
+               return port->serial_in(port, reg_offset);
        default:
                return 0;
        }
@@ -59,6 +62,7 @@ static unsigned int __init serial8250_early_in(struct uart_port *port, int offse
 
 static void __init serial8250_early_out(struct uart_port *port, int offset, int value)
 {
+       int reg_offset = offset;
        offset <<= port->regshift;
 
        switch (port->iotype) {
@@ -77,6 +81,9 @@ static void __init serial8250_early_out(struct uart_port *port, int offset, int
        case UPIO_PORT:
                outb(value, port->iobase + offset);
                break;
+       case UPIO_AU:
+               port->serial_out(port, reg_offset, value);
+               break;
        }
 }
 
@@ -172,3 +179,20 @@ OF_EARLYCON_DECLARE(omap8250, "ti,omap3-uart", early_omap8250_setup);
 OF_EARLYCON_DECLARE(omap8250, "ti,omap4-uart", early_omap8250_setup);
 
 #endif
+
+#ifdef CONFIG_SERIAL_8250_RT288X
+
+unsigned int au_serial_in(struct uart_port *p, int offset);
+void au_serial_out(struct uart_port *p, int offset, int value);
+
+static int __init early_au_setup(struct earlycon_device *dev, const char *opt)
+{
+       dev->port.serial_in = au_serial_in;
+       dev->port.serial_out = au_serial_out;
+       dev->port.iotype = UPIO_AU;
+       dev->con->write = early_serial8250_write;
+       return 0;
+}
+OF_EARLYCON_DECLARE(palmchip, "ralink,rt2880-uart", early_au_setup);
+
+#endif
index 6119516ef5fcd3a604ae0a41a70b9f6f51f7fa1d..09a65a3ec7f7df0bb3f7355fd7758d797169f960 100644 (file)
@@ -328,7 +328,7 @@ static const s8 au_io_out_map[8] = {
        -1,     /* UART_SCR (unmapped) */
 };
 
-static unsigned int au_serial_in(struct uart_port *p, int offset)
+unsigned int au_serial_in(struct uart_port *p, int offset)
 {
        if (offset >= ARRAY_SIZE(au_io_in_map))
                return UINT_MAX;
@@ -338,7 +338,7 @@ static unsigned int au_serial_in(struct uart_port *p, int offset)
        return __raw_readl(p->membase + (offset << p->regshift));
 }
 
-static void au_serial_out(struct uart_port *p, int offset, int value)
+void au_serial_out(struct uart_port *p, int offset, int value)
 {
        if (offset >= ARRAY_SIZE(au_io_out_map))
                return;