From: Oleksij Rempel <linux@rempel-privat.de>
To: barebox@lists.infradead.org
Cc: Oleksij Rempel <linux@rempel-privat.de>
Subject: [PATCH 4/4] serial: ns16550: provide big-endian support
Date: Wed, 6 Sep 2017 16:44:10 +0200 [thread overview]
Message-ID: <20170906144410.525-5-linux@rempel-privat.de> (raw)
In-Reply-To: <20170906144410.525-1-linux@rempel-privat.de>
we need it at least for QCA AR9344
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
---
drivers/serial/serial_ns16550.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
index a8953cd99..4d73ea8b8 100644
--- a/drivers/serial/serial_ns16550.c
+++ b/drivers/serial/serial_ns16550.c
@@ -94,6 +94,16 @@ static void ns16550_write_reg_mmio_32(struct ns16550_priv *priv, uint8_t val, un
writel(val, priv->mmiobase + offset);
}
+static uint8_t ns16550_read_reg_mmio_32be(struct ns16550_priv *priv, unsigned offset)
+{
+ return ioread32be(priv->mmiobase + offset);
+}
+
+static void ns16550_write_reg_mmio_32be(struct ns16550_priv *priv, uint8_t val, unsigned offset)
+{
+ iowrite32be(val, priv->mmiobase + offset);
+}
+
static uint8_t ns16550_read_reg_ioport_8(struct ns16550_priv *priv, unsigned offset)
{
return inb(priv->iobase + offset);
@@ -305,8 +315,13 @@ static void ns16550_probe_dt(struct device_d *dev, struct ns16550_priv *priv)
priv->write_reg = ns16550_write_reg_mmio_16;
break;
case 4:
- priv->read_reg = ns16550_read_reg_mmio_32;
- priv->write_reg = ns16550_write_reg_mmio_32;
+ if (of_device_is_big_endian(np)) {
+ priv->read_reg = ns16550_read_reg_mmio_32be;
+ priv->write_reg = ns16550_write_reg_mmio_32be;
+ } else {
+ priv->read_reg = ns16550_read_reg_mmio_32;
+ priv->write_reg = ns16550_write_reg_mmio_32;
+ }
break;
default:
dev_err(dev, "unsupported reg-io-width (%d)\n",
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2017-09-06 14:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-06 14:44 [PATCH 0/4] privide ns16550 support for AR9344 Oleksij Rempel
2017-09-06 14:44 ` [PATCH 1/4] of: base: port of_device_is_big_endian from linux Oleksij Rempel
2017-09-06 14:44 ` [PATCH 2/4] asm-generic: partially sync io.h with linux kernel Oleksij Rempel
2017-09-06 14:44 ` [PATCH 3/4] x86: asm: include asm-generic.h Oleksij Rempel
2017-09-06 14:44 ` Oleksij Rempel [this message]
2017-09-07 10:23 ` [PATCH 0/4] privide ns16550 support for AR9344 Robert Schwebel
2017-09-08 6:25 ` Sascha Hauer
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=20170906144410.525-5-linux@rempel-privat.de \
--to=linux@rempel-privat.de \
--cc=barebox@lists.infradead.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