Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

serial: 8250_early: Add earlycon support for Palmchip UART

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>

authored by

Marc Gonzalez and committed by
Greg Kroah-Hartman
72f1b85a 5a0722b8

+26 -2
+24
drivers/tty/serial/8250/8250_early.c
··· 39 39 40 40 static unsigned int __init serial8250_early_in(struct uart_port *port, int offset) 41 41 { 42 + int reg_offset = offset; 42 43 offset <<= port->regshift; 43 44 44 45 switch (port->iotype) { ··· 53 52 return ioread32be(port->membase + offset); 54 53 case UPIO_PORT: 55 54 return inb(port->iobase + offset); 55 + case UPIO_AU: 56 + return port->serial_in(port, reg_offset); 56 57 default: 57 58 return 0; 58 59 } ··· 62 59 63 60 static void __init serial8250_early_out(struct uart_port *port, int offset, int value) 64 61 { 62 + int reg_offset = offset; 65 63 offset <<= port->regshift; 66 64 67 65 switch (port->iotype) { ··· 80 76 break; 81 77 case UPIO_PORT: 82 78 outb(value, port->iobase + offset); 79 + break; 80 + case UPIO_AU: 81 + port->serial_out(port, reg_offset, value); 83 82 break; 84 83 } 85 84 } ··· 177 170 OF_EARLYCON_DECLARE(omap8250, "ti,omap2-uart", early_omap8250_setup); 178 171 OF_EARLYCON_DECLARE(omap8250, "ti,omap3-uart", early_omap8250_setup); 179 172 OF_EARLYCON_DECLARE(omap8250, "ti,omap4-uart", early_omap8250_setup); 173 + 174 + #endif 175 + 176 + #ifdef CONFIG_SERIAL_8250_RT288X 177 + 178 + unsigned int au_serial_in(struct uart_port *p, int offset); 179 + void au_serial_out(struct uart_port *p, int offset, int value); 180 + 181 + static int __init early_au_setup(struct earlycon_device *dev, const char *opt) 182 + { 183 + dev->port.serial_in = au_serial_in; 184 + dev->port.serial_out = au_serial_out; 185 + dev->port.iotype = UPIO_AU; 186 + dev->con->write = early_serial8250_write; 187 + return 0; 188 + } 189 + OF_EARLYCON_DECLARE(palmchip, "ralink,rt2880-uart", early_au_setup); 180 190 181 191 #endif
+2 -2
drivers/tty/serial/8250/8250_port.c
··· 328 328 -1, /* UART_SCR (unmapped) */ 329 329 }; 330 330 331 - static unsigned int au_serial_in(struct uart_port *p, int offset) 331 + unsigned int au_serial_in(struct uart_port *p, int offset) 332 332 { 333 333 if (offset >= ARRAY_SIZE(au_io_in_map)) 334 334 return UINT_MAX; ··· 338 338 return __raw_readl(p->membase + (offset << p->regshift)); 339 339 } 340 340 341 - static void au_serial_out(struct uart_port *p, int offset, int value) 341 + void au_serial_out(struct uart_port *p, int offset, int value) 342 342 { 343 343 if (offset >= ARRAY_SIZE(au_io_out_map)) 344 344 return;