From: Timur Tabi <timur@codeaurora.org>
To: Greg Kroah-Hartman <greg@kroah.com>,
Russell King <rmk+kernel@arm.linux.org.uk>,
andre.przywara@arm.com, Linus Walleij <linus.walleij@linaro.org>,
andrew.jackson@arm.com, jslaby@suse.com, jun.nie@linaro.org,
shijie.huang@arm.com, linux-serial@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, peter@hurleysoftware.com
Subject: [PATCH 2/2] tty: amba-pl011: use iotype instead of access_32b to track 32-bit I/O
Date: Thu, 24 Dec 2015 09:49:49 -0600 [thread overview]
Message-ID: <1450972189-22639-2-git-send-email-timur@codeaurora.org> (raw)
In-Reply-To: <1450972189-22639-1-git-send-email-timur@codeaurora.org>
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>
---
Documentation/kernel-parameters.txt | 5 ++++-
drivers/tty/serial/amba-pl011.c | 16 +++++++++-------
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 474ce69..ab11d5c 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -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
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 06f827a..f2793c1 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -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) & UART011_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;
--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.
WARNING: multiple messages have this Message-ID (diff)
From: timur@codeaurora.org (Timur Tabi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] tty: amba-pl011: use iotype instead of access_32b to track 32-bit I/O
Date: Thu, 24 Dec 2015 09:49:49 -0600 [thread overview]
Message-ID: <1450972189-22639-2-git-send-email-timur@codeaurora.org> (raw)
In-Reply-To: <1450972189-22639-1-git-send-email-timur@codeaurora.org>
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>
---
Documentation/kernel-parameters.txt | 5 ++++-
drivers/tty/serial/amba-pl011.c | 16 +++++++++-------
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 474ce69..ab11d5c 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -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
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 06f827a..f2793c1 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -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) & UART011_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;
--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.
next prev parent reply other threads:[~2015-12-24 15:49 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-24 15:49 [PATCH 1/2] tty: amba-pl011: fix earlycon register offsets Timur Tabi
2015-12-24 15:49 ` Timur Tabi
2015-12-24 15:49 ` Timur Tabi [this message]
2015-12-24 15:49 ` [PATCH 2/2] tty: amba-pl011: use iotype instead of access_32b to track 32-bit I/O Timur Tabi
2015-12-24 16:47 ` [PATCH 1/2] tty: amba-pl011: fix earlycon register offsets Russell King - ARM Linux
2015-12-24 16:47 ` Russell King - ARM Linux
2016-01-05 12:12 ` Sudeep Holla
2016-01-05 12:12 ` Sudeep Holla
2016-01-05 12:30 ` Russell King - ARM Linux
2016-01-05 12:30 ` Russell King - ARM Linux
2016-01-05 13:45 ` Sudeep Holla
2016-01-05 13:45 ` Sudeep Holla
2016-01-06 2:43 ` Greg Kroah-Hartman
2016-01-06 2:43 ` Greg Kroah-Hartman
2016-01-06 10:07 ` Russell King - ARM Linux
2016-01-06 10:07 ` Russell King - ARM Linux
2016-01-07 5:17 ` Greg Kroah-Hartman
2016-01-07 5:17 ` Greg Kroah-Hartman
2016-01-07 18:13 ` Peter Hurley
2016-01-07 18:13 ` Peter Hurley
2015-12-25 1:46 ` Huang Shijie
2015-12-25 1:46 ` Huang Shijie
2015-12-25 1:56 ` Huang Shijie
2015-12-25 1:56 ` Huang Shijie
-- strict thread matches above, loose matches on Subject: below --
2016-01-04 21:37 [PATCH 1/2] [v2] " Timur Tabi
2016-01-04 21:37 ` [PATCH 2/2] tty: amba-pl011: use iotype instead of access_32b to track 32-bit I/O Timur Tabi
2016-01-07 8:09 ` Geert Uytterhoeven
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1450972189-22639-2-git-send-email-timur@codeaurora.org \
--to=timur@codeaurora.org \
--cc=andre.przywara@arm.com \
--cc=andrew.jackson@arm.com \
--cc=greg@kroah.com \
--cc=jslaby@suse.com \
--cc=jun.nie@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-serial@vger.kernel.org \
--cc=peter@hurleysoftware.com \
--cc=rmk+kernel@arm.linux.org.uk \
--cc=shijie.huang@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.