summaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/sh-sci.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2017-01-11 16:43:40 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-01-19 14:17:05 +0100
commitdfc80387aefb78161f83732804c6d01c89c24595 (patch)
tree1576a2c29d8c81842c676c6c6e9095e45e3c9f91 /drivers/tty/serial/sh-sci.c
parent97ed9790c514066bfae67f22e084b505ed5af436 (diff)
downloadop-kernel-dev-dfc80387aefb78161f83732804c6d01c89c24595.zip
op-kernel-dev-dfc80387aefb78161f83732804c6d01c89c24595.tar.gz
serial: sh-sci: Compute the regshift value for SCI ports
SCI instances found in SH SoCs have different spacing between registers depending on the SoC. The platform data contains a regshift field that tells the driver by how many bits to shift the register offset to compute its address. We can compute the regshift value automatically based on the memory resource size, there's no need to pass the value through platform data. Fix the sh7750 SCI and sh7760 SIM port memory resources length to ensure proper computation of the regshift value. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/sh-sci.c')
-rw-r--r--drivers/tty/serial/sh-sci.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index a04ed40..a18f4cb 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -2574,9 +2574,15 @@ static int sci_init_single(struct platform_device *dev,
port->type = p->type;
port->flags = UPF_FIXED_PORT | UPF_BOOT_AUTOCONF | p->flags;
- port->regshift = p->regshift;
port->fifosize = sci_port->params->fifosize;
+ if (port->type == PORT_SCI) {
+ if (sci_port->reg_size >= 0x20)
+ port->regshift = 2;
+ else
+ port->regshift = 1;
+ }
+
/*
* The UART port needs an IRQ value, so we peg this to the RX IRQ
* for the multi-IRQ ports, which is where we are primarily
OpenPOWER on IntegriCloud