summaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
authorOleksij Rempel <linux@rempel-privat.de>2017-09-06 16:44:10 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2017-09-08 08:25:23 +0200
commit9ee91ad1c938ff577b3925baf2c41614608b819c (patch)
tree70345f6c5527d34a3ad2142aa6805ac274c94af4 /drivers/serial
parente2cea82facc9cd5302600de9e92fe40e956c263f (diff)
downloadbarebox-9ee91ad1c938ff577b3925baf2c41614608b819c.tar.gz
serial: ns16550: provide big-endian support
we need it at least for QCA AR9344 Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/serial_ns16550.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
index a8953cd..4d73ea8 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",