tty: amba-pl011: fix earlycon register offsets
Subsystems (4)
PATCH v2 1/2 tty: amba-pl011: fix earlycon register offsets
From: Russell King <[email protected]>
The REG_x macros are indices into a table, not register offsets. Since earlycon does not have access to the vendor data, we can currently only support standard ARM PL011 devices.
--- drivers/tty/serial/amba-pl011.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/tty/serial/amba-pl011.c +3 -3
@@ -2302,10 +2302,10 @@ static struct console amba_console = {static void pl011_putc (struct uart_port *port,int c) { -while (readl (port->membase +REG_FR ) & UART01x_FR_TXFF) +while (readl (port->membase + UART01x_FR) & UART01x_FR_TXFF) ; -writeb (c, port->membase +REG_DR ); -while (readl (port->membase +REG_FR ) & UART01x_FR_BUSY) +writeb (c, port->membase + UART01x_DR); +while (readl (port->membase + UART01x_FR) & UART01x_FR_BUSY) ; }
Signature · 3 lines
Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
PATCH 2/2 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
--- Documentation/kernel-parameters.txt | 5 ++++- drivers/tty/serial/amba-pl011.c | 16 +++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-)
Documentation/kernel-parameters.txt +4 -1
@@ -995,10 +995,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted. unspecified, the h/w is not initialized. pl011,<addr> + pl011,mmio32,<addr> Start an early, polled-mode console on a pl011 serial port at the specified address. The pl011 serial port must already be setup and configured. Options are not - yet supported. + yet supported. If 'mmio32' is specified, then only + the driver will use only 32-bit accessors to read/write + the device registers. msm_serial,<addr> Start an early, polled-mode console on an msm serial
drivers/tty/serial/amba-pl011.c +9 -7
@@ -239,7 +239,6 @@ struct uart_amba_port {unsigned int fifosize;/* vendor-specific */ unsigned int old_cr;/* state during shutdown */ bool autorts; -bool access_32b;unsigned int fixed_baud;/* vendor-set fixed baud rate */ char type[12 ];#ifdef CONFIG_DMA_ENGINE
@@ -263,7 +262,8 @@ static unsigned int pl011_read(const struct uart_amba_port *uap, {void __iomem *addr = uap->port.membase +pl011_reg_to_offset (uap, reg); -return uap->access_32b ?readl_relaxed (addr) :readw_relaxed (addr); +return (uap->port.iotype ==UPIO_MEM32 ) ? +readl_relaxed (addr) :readw_relaxed (addr); } static void pl011_write(unsigned int val, const struct uart_amba_port *uap,
@@ -271,7 +271,7 @@ static void pl011_write(unsigned int val, const struct uart_amba_port *uap, {void __iomem *addr = uap->port.membase +pl011_reg_to_offset (uap, reg); -if (uap->access_32b) +if (uap->port.iotype ==UPIO_MEM32 )writel_relaxed (val, addr);else writew_relaxed (val, addr);
@@ -2304,7 +2304,10 @@ static void pl011_putc(struct uart_port *port, int c) {while (readl (port->membase + UART01x_FR) & UART01x_FR_TXFF) ; -writeb (c, port->membase + UART01x_DR); +if (port->iotype ==UPIO_MEM32 ) +writel (c, port->membase + UART01x_DR); +else +writeb (c, port->membase + UART01x_DR);while (readl (port->membase + UART01x_FR) & UART01x_FR_BUSY) ; }
@@ -2417,7 +2420,6 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap, uap->port.dev = dev; uap->port.mapbase = mmiobase->start; uap->port.membase = base; - uap->port.iotype =UPIO_MEM ; uap->port.fifosize = uap->fifosize; uap->port.flags =UPF_BOOT_AUTOCONF ; uap->port.line = index;
@@ -2471,9 +2473,9 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)return PTR_ERR (uap->clk); uap->reg_offset = vendor->reg_offset; - uap->access_32b = vendor->access_32b; uap->vendor = vendor; uap->fifosize = vendor->get_fifosize (dev); + uap->port.iotype = vendor->access_32b ?UPIO_MEM32 :UPIO_MEM ; uap->port.irq = dev->irq[0 ]; uap->port.ops = &amba_pl011_pops;
@@ -2552,9 +2554,9 @@ static int sbsa_uart_probe(struct platform_device *pdev)return -ENOMEM ; uap->reg_offset = vendor_sbsa.reg_offset; - uap->access_32b = vendor_sbsa.access_32b; uap->vendor = &vendor_sbsa; uap->fifosize =32 ; + uap->port.iotype = vendor_sbsa.access_32b ?UPIO_MEM32 :UPIO_MEM ; uap->port.irq =platform_get_irq (pdev,0 ); uap->port.ops = &sbsa_uart_pops; uap->fixed_baud = baudrate;
Signature · 3 lines
Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
Quoted 6 lines · Timur Tabi
From: Russell King <[email protected]>
The
REG_xmacros are indices into a table, not register offsets. Since earlycon does not have access to the vendor data, we can currently only support standard ARM PL011 devices.
Quoted 6 lines
Signed-off-by Russell King <[email protected]>Tested-by Huang Shijie <[email protected]>Signed-off-by Timur Tabi <[email protected]>--- drivers/tty/serial/amba-pl011.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
What changed in v2?
thanks,
greg k-h
Quoted 7 lines · Greg Kroah-Hartman
Quoted 6 lines
Quoted 6 lines
Signed-off-by Russell King<[email protected]>Tested-by Huang Shijie<[email protected]>Signed-off-by Timur Tabi<[email protected]>--- drivers/tty/serial/amba-pl011.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)What changed in v2?
I fixed a typo with a macro name (UART01x_FR_BUSY instead of UART011_FR_BUSY).
Signature · 3 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation.
Quoted 11 lines · Timur Tabi
Quoted 7 lines · Greg Kroah-Hartman
Quoted 6 lines
Quoted 6 lines
Signed-off-by Russell King<[email protected]>Tested-by Huang Shijie<[email protected]>Signed-off-by Timur Tabi<[email protected]>--- drivers/tty/serial/amba-pl011.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)What changed in v2?
I fixed a typo with a macro name (
UART01x_FR_BUSYinstead ofUART011_FR_BUSY).
Please always document this below the --- line, you know this...
Re: [PATCH 2/2] tty: amba-pl011: use iotype instead of access_32b to track 32-bit I/O
In reply to Timur TabiDocumentation/kernel-parameters.txt bytes respectively. Such letter suffixes can also be entirely omitted. · line 1002
Quoted 12 lines · Timur Tabi
Documentation/kernel-parameters.txt +2
-1@@ -995,10 +995,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted. unspecified, the h/w is not initialized. pl011,<addr> + pl011,mmio32,<addr> Start an early, polled-mode console on a pl011 serial port at the specified address. The pl011 serial port must already be setup and configured. Options are not - yet supported. + yet supported. If 'mmio32' is specified, then only
Bogus "only"
Documentation/kernel-parameters.txt bytes respectively. Such letter suffixes can also be entirely omitted. · line 1004
Quoted 2 lines
Documentation/kernel-parameters.txt +2
-0+ the driver will use only 32-bit accessors to read/write + the device registers.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds