Commit dc6b576b authored by Peter Hurley's avatar Peter Hurley Committed by Greg Kroah-Hartman

serial: 8250_early: Use port->regshift

earlycon initializes struct uart_port::regshift to the correct
value for UPIO_MEM32 already. Use the port field rather than
hard-coded value.

This enables broader support for various i/o access methods in
8250 earlycon (eg., omap8250 earlycon).
Acked-by: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b9693984
...@@ -39,15 +39,17 @@ ...@@ -39,15 +39,17 @@
static unsigned int __init serial8250_early_in(struct uart_port *port, int offset) static unsigned int __init serial8250_early_in(struct uart_port *port, int offset)
{ {
offset <<= port->regshift;
switch (port->iotype) { switch (port->iotype) {
case UPIO_MEM: case UPIO_MEM:
return readb(port->membase + offset); return readb(port->membase + offset);
case UPIO_MEM16: case UPIO_MEM16:
return readw(port->membase + (offset << 1)); return readw(port->membase + offset);
case UPIO_MEM32: case UPIO_MEM32:
return readl(port->membase + (offset << 2)); return readl(port->membase + offset);
case UPIO_MEM32BE: case UPIO_MEM32BE:
return ioread32be(port->membase + (offset << 2)); return ioread32be(port->membase + offset);
case UPIO_PORT: case UPIO_PORT:
return inb(port->iobase + offset); return inb(port->iobase + offset);
default: default:
...@@ -57,18 +59,20 @@ static unsigned int __init serial8250_early_in(struct uart_port *port, int offse ...@@ -57,18 +59,20 @@ 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) static void __init serial8250_early_out(struct uart_port *port, int offset, int value)
{ {
offset <<= port->regshift;
switch (port->iotype) { switch (port->iotype) {
case UPIO_MEM: case UPIO_MEM:
writeb(value, port->membase + offset); writeb(value, port->membase + offset);
break; break;
case UPIO_MEM16: case UPIO_MEM16:
writew(value, port->membase + (offset << 1)); writew(value, port->membase + offset);
break; break;
case UPIO_MEM32: case UPIO_MEM32:
writel(value, port->membase + (offset << 2)); writel(value, port->membase + offset);
break; break;
case UPIO_MEM32BE: case UPIO_MEM32BE:
iowrite32be(value, port->membase + (offset << 2)); iowrite32be(value, port->membase + offset);
break; break;
case UPIO_PORT: case UPIO_PORT:
outb(value, port->iobase + offset); outb(value, port->iobase + offset);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment