linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Hurley <peter@hurleysoftware.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Rob Herring <robh+dt@kernel.org>,
	Grant Likely <grant.likely@linaro.org>
Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	Peter Hurley <peter@hurleysoftware.com>
Subject: [PATCH v2 -next 13/14] serial: 8250_early: Use port->regshift
Date: Fri,  6 Mar 2015 14:25:29 -0500	[thread overview]
Message-ID: <1425669930-22137-14-git-send-email-peter@hurleysoftware.com> (raw)
In-Reply-To: <1425669930-22137-1-git-send-email-peter@hurleysoftware.com>

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).

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
 drivers/tty/serial/8250/8250_early.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_early.c b/drivers/tty/serial/8250/8250_early.c
index a2b4e58..53db31c 100644
--- a/drivers/tty/serial/8250/8250_early.c
+++ b/drivers/tty/serial/8250/8250_early.c
@@ -38,11 +38,13 @@
 
 unsigned int __weak __init serial8250_early_in(struct uart_port *port, int offset)
 {
+	offset <<= port->regshift;
+
 	switch (port->iotype) {
 	case UPIO_MEM:
 		return readb(port->membase + offset);
 	case UPIO_MEM32:
-		return readl(port->membase + (offset << 2));
+		return readl(port->membase + offset);
 	case UPIO_PORT:
 		return inb(port->iobase + offset);
 	default:
@@ -52,12 +54,14 @@ unsigned int __weak __init serial8250_early_in(struct uart_port *port, int offse
 
 void __weak __init serial8250_early_out(struct uart_port *port, int offset, int value)
 {
+	offset <<= port->regshift;
+
 	switch (port->iotype) {
 	case UPIO_MEM:
 		writeb(value, port->membase + offset);
 		break;
 	case UPIO_MEM32:
-		writel(value, port->membase + (offset << 2));
+		writel(value, port->membase + offset);
 		break;
 	case UPIO_PORT:
 		outb(value, port->iobase + offset);
-- 
2.3.1

  parent reply	other threads:[~2015-03-06 19:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-06 19:25 [PATCH v2 -next 00/14] OF earlycon cleanup Peter Hurley
2015-03-06 19:25 ` [PATCH v2 -next 01/14] of: earlycon: Fix 'stdout-path' with ':' path terminator Peter Hurley
2015-03-06 19:25 ` [PATCH v2 -next 02/14] serial: earlycon: Fixup earlycon console name and index Peter Hurley
2015-03-06 19:25 ` [PATCH v2 -next 03/14] serial: earlycon: Emit earlycon name in the OF table Peter Hurley
2015-03-06 19:25 ` [PATCH v2 -next 04/14] of: earlycon: Fixup earlycon console name and index Peter Hurley
2015-03-06 19:25 ` [PATCH v2 -next 05/14] of: earlycon: Add options string handling Peter Hurley
2015-03-06 19:25 ` [PATCH v2 -next 06/14] of: earlycon: of_setup_earlycon() requires CONFIG_OF_EARLY_FLATTREE Peter Hurley
2015-03-06 19:25 ` [PATCH v2 -next 07/14] of: earlycon: Initialize port fields from DT properties Peter Hurley
2015-03-06 19:25 ` [PATCH v2 -next 08/14] of: earlycon: Move address translation to of_setup_earlycon() Peter Hurley
2015-03-06 19:25 ` [PATCH v2 -next 09/14] serial: earlycon: Common log banner for command line and DT Peter Hurley
2015-03-06 19:25 ` [PATCH v2 -next 10/14] serial: earlycon: Show the earlycon "driver" in banner Peter Hurley
2015-03-06 19:25 ` [PATCH v2 -next 11/14] of: earlycon: Allow multiple OF_EARLYCON_DECLARE() with same name Peter Hurley
2015-03-06 19:25 ` [PATCH v2 -next 12/14] of: earlycon: Log more helpful message if earlycon not found Peter Hurley
2015-03-06 19:25 ` Peter Hurley [this message]
2015-03-06 19:25 ` [PATCH v2 -next 14/14] serial: 8250_omap: Add omap8250 earlycon Peter Hurley

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=1425669930-22137-14-git-send-email-peter@hurleysoftware.com \
    --to=peter@hurleysoftware.com \
    --cc=grant.likely@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).