aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimur Tabi <timur@codeaurora.org>2016-01-04 16:37:42 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-01-07 00:02:45 -0500
commit3b78fae793c027140cfe635ef216bf60aa6498f4 (patch)
tree3b0157674a758482d9f3c773f3bdcb78990a9774
parentcdf091ca2c3d6875e5f0fca28de4a6ca2f5273e6 (diff)
tty: amba-pl011: use iotype instead of access_32b to track 32-bit I/O
Instead of defining a new field in the uart_amba_port structure, use the existing iotype field of the uart_port structure, which is intended for this purpose. If we need to use 32-bit register access, we set iotype to UPIO_MEM32, otherwise we set it to UPIO_MEM. For early console, specify the "mmio32" option on the kernel command-line. Example: earlycon=pl011,mmio32,0x3ced1000 Signed-off-by: Timur Tabi <timur@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--Documentation/kernel-parameters.txt5
-rw-r--r--drivers/tty/serial/amba-pl011.c16
2 files changed, 13 insertions, 8 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 054e11d33b6b..654c547b9fc9 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1003,10 +1003,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
1003 unspecified, the h/w is not initialized. 1003 unspecified, the h/w is not initialized.
1004 1004
1005 pl011,<addr> 1005 pl011,<addr>
1006 pl011,mmio32,<addr>
1006 Start an early, polled-mode console on a pl011 serial 1007 Start an early, polled-mode console on a pl011 serial
1007 port at the specified address. The pl011 serial port 1008 port at the specified address. The pl011 serial port
1008 must already be setup and configured. Options are not 1009 must already be setup and configured. Options are not
1009 yet supported. 1010 yet supported. If 'mmio32' is specified, then only
1011 the driver will use only 32-bit accessors to read/write
1012 the device registers.
1010 1013
1011 msm_serial,<addr> 1014 msm_serial,<addr>
1012 Start an early, polled-mode console on an msm serial 1015 Start an early, polled-mode console on an msm serial
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index a7d7ab05dc64..c0da0ccbbcf5 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -238,7 +238,6 @@ struct uart_amba_port {
238 unsigned int fifosize; /* vendor-specific */ 238 unsigned int fifosize; /* vendor-specific */
239 unsigned int old_cr; /* state during shutdown */ 239 unsigned int old_cr; /* state during shutdown */
240 bool autorts; 240 bool autorts;
241 bool access_32b;
242 unsigned int fixed_baud; /* vendor-set fixed baud rate */ 241 unsigned int fixed_baud; /* vendor-set fixed baud rate */
243 char type[12]; 242 char type[12];
244#ifdef CONFIG_DMA_ENGINE 243#ifdef CONFIG_DMA_ENGINE
@@ -262,7 +261,8 @@ static unsigned int pl011_read(const struct uart_amba_port *uap,
262{ 261{
263 void __iomem *addr = uap->port.membase + pl011_reg_to_offset(uap, reg); 262 void __iomem *addr = uap->port.membase + pl011_reg_to_offset(uap, reg);
264 263
265 return uap->access_32b ? readl_relaxed(addr) : readw_relaxed(addr); 264 return (uap->port.iotype == UPIO_MEM32) ?
265 readl_relaxed(addr) : readw_relaxed(addr);
266} 266}
267 267
268static void pl011_write(unsigned int val, const struct uart_amba_port *uap, 268static void pl011_write(unsigned int val, const struct uart_amba_port *uap,
@@ -270,7 +270,7 @@ static void pl011_write(unsigned int val, const struct uart_amba_port *uap,
270{ 270{
271 void __iomem *addr = uap->port.membase + pl011_reg_to_offset(uap, reg); 271 void __iomem *addr = uap->port.membase + pl011_reg_to_offset(uap, reg);
272 272
273 if (uap->access_32b) 273 if (uap->port.iotype == UPIO_MEM32)
274 writel_relaxed(val, addr); 274 writel_relaxed(val, addr);
275 else 275 else
276 writew_relaxed(val, addr); 276 writew_relaxed(val, addr);
@@ -2303,7 +2303,10 @@ static void pl011_putc(struct uart_port *port, int c)
2303{ 2303{
2304 while (readl(port->membase + UART01x_FR) & UART01x_FR_TXFF) 2304 while (readl(port->membase + UART01x_FR) & UART01x_FR_TXFF)
2305 ; 2305 ;
2306 writeb(c, port->membase + UART01x_DR); 2306 if (port->iotype == UPIO_MEM32)
2307 writel(c, port->membase + UART01x_DR);
2308 else
2309 writeb(c, port->membase + UART01x_DR);
2307 while (readl(port->membase + UART01x_FR) & UART01x_FR_BUSY) 2310 while (readl(port->membase + UART01x_FR) & UART01x_FR_BUSY)
2308 ; 2311 ;
2309} 2312}
@@ -2416,7 +2419,6 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap,
2416 uap->port.dev = dev; 2419 uap->port.dev = dev;
2417 uap->port.mapbase = mmiobase->start; 2420 uap->port.mapbase = mmiobase->start;
2418 uap->port.membase = base; 2421 uap->port.membase = base;
2419 uap->port.iotype = UPIO_MEM;
2420 uap->port.fifosize = uap->fifosize; 2422 uap->port.fifosize = uap->fifosize;
2421 uap->port.flags = UPF_BOOT_AUTOCONF; 2423 uap->port.flags = UPF_BOOT_AUTOCONF;
2422 uap->port.line = index; 2424 uap->port.line = index;
@@ -2470,9 +2472,9 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
2470 return PTR_ERR(uap->clk); 2472 return PTR_ERR(uap->clk);
2471 2473
2472 uap->reg_offset = vendor->reg_offset; 2474 uap->reg_offset = vendor->reg_offset;
2473 uap->access_32b = vendor->access_32b;
2474 uap->vendor = vendor; 2475 uap->vendor = vendor;
2475 uap->fifosize = vendor->get_fifosize(dev); 2476 uap->fifosize = vendor->get_fifosize(dev);
2477 uap->port.iotype = vendor->access_32b ? UPIO_MEM32 : UPIO_MEM;
2476 uap->port.irq = dev->irq[0]; 2478 uap->port.irq = dev->irq[0];
2477 uap->port.ops = &amba_pl011_pops; 2479 uap->port.ops = &amba_pl011_pops;
2478 2480
@@ -2551,9 +2553,9 @@ static int sbsa_uart_probe(struct platform_device *pdev)
2551 return -ENOMEM; 2553 return -ENOMEM;
2552 2554
2553 uap->reg_offset = vendor_sbsa.reg_offset; 2555 uap->reg_offset = vendor_sbsa.reg_offset;
2554 uap->access_32b = vendor_sbsa.access_32b;
2555 uap->vendor = &vendor_sbsa; 2556 uap->vendor = &vendor_sbsa;
2556 uap->fifosize = 32; 2557 uap->fifosize = 32;
2558 uap->port.iotype = vendor_sbsa.access_32b ? UPIO_MEM32 : UPIO_MEM;
2557 uap->port.irq = platform_get_irq(pdev, 0); 2559 uap->port.irq = platform_get_irq(pdev, 0);
2558 uap->port.ops = &sbsa_uart_pops; 2560 uap->port.ops = &sbsa_uart_pops;
2559 uap->fixed_baud = baudrate; 2561 uap->fixed_baud = baudrate;