mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Noam Camus <noamc@ezchip.com>
To: <linux-serial@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <gregkh@linuxfoundation.org>,
	<heikki.krogerus@linux.intel.com>,
	<andriy.shevchenko@linux.intel.com>, <vgupta@synopsys.com>,
	<Alexey.Brodkin@synopsys.com>, <jslaby@suse.com>,
	<peter@hurleysoftware.com>, Noam Camus <noamc@ezchip.com>
Subject: [PATCH v9 2/3] serial: 8250_dw: Add support for big-endian MMIO accesses
Date: Sat, 12 Dec 2015 19:18:26 +0200	[thread overview]
Message-ID: <1449940707-17633-3-git-send-email-noamc@ezchip.com> (raw)
In-Reply-To: <1449940707-17633-1-git-send-email-noamc@ezchip.com>

From: Noam Camus <noamc@ezchip.com>

Add support for UPIO_MEM32BE in addition to UPIO_MEM32.

For big endian we use 2 new accessors similar to little endian,
called dw8250_serial_out32be() and dw8250_serial_in32be().

Signed-off-by: Noam Camus <noamc@ezchip.com>
---
 drivers/tty/serial/8250/8250_dw.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index ffe5e0c..92c4a9b 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -182,6 +182,24 @@ static unsigned int dw8250_serial_in32(struct uart_port *p, int offset)
 	return dw8250_modify_msr(p, offset, value);
 }
 
+static void dw8250_serial_out32be(struct uart_port *p, int offset, int value)
+{
+	struct dw8250_data *d = p->private_data;
+
+	iowrite32be(value, p->membase + (offset << p->regshift));
+
+	if (offset == UART_LCR && !d->uart_16550_compatible)
+		dw8250_check_lcr(p, value);
+}
+
+static unsigned int dw8250_serial_in32be(struct uart_port *p, int offset)
+{
+       unsigned int value = ioread32be(p->membase + (offset << p->regshift));
+
+       return dw8250_modify_msr(p, offset, value);
+}
+
+
 static int dw8250_handle_irq(struct uart_port *p)
 {
 	struct dw8250_data *d = p->private_data;
@@ -276,6 +294,11 @@ static void dw8250_quirks(struct uart_port *p, struct dw8250_data *data)
 			data->skip_autocfg = true;
 		}
 #endif
+		if (of_device_is_big_endian(p->dev->of_node)) {
+			p->iotype = UPIO_MEM32BE;
+			p->serial_in = dw8250_serial_in32be;
+			p->serial_out = dw8250_serial_out32be;
+		}
 	} else if (has_acpi_companion(p->dev)) {
 		p->iotype = UPIO_MEM32;
 		p->regshift = 2;
-- 
1.7.1


  parent reply	other threads:[~2015-12-12 17:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-12 17:18 [PATCH v9 0/3] serial: 8250_dw add big endian support Noam Camus
2015-12-12 17:18 ` [PATCH v9 1/3] serial: 8250_dw: Avoid serial_outx code duplicate with new dw8250_check_lcr() Noam Camus
2015-12-20 16:45   ` Andy Shevchenko
2015-12-22  8:57   ` Heikki Krogerus
2015-12-12 17:18 ` Noam Camus [this message]
2015-12-12 17:18 ` [PATCH v9 3/3] serial: 8250_dw: Do not use readl/writel before checking port iotype Noam Camus

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=1449940707-17633-3-git-send-email-noamc@ezchip.com \
    --to=noamc@ezchip.com \
    --cc=Alexey.Brodkin@synopsys.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=jslaby@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=peter@hurleysoftware.com \
    --cc=vgupta@synopsys.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®