| From 72b1ef6ddb73200e5afaedb6f7440bfd8a7187a2 Mon Sep 17 00:00:00 2001 |
| From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> |
| Date: Wed, 11 Jan 2017 16:43:24 +0200 |
| Subject: [PATCH 172/255] serial: sh-sci: Don't rely on platform data flags |
| when not needed |
| |
| The UPF_BOOT_AUTOCONF platform data flag is set by all platforms, |
| hardcode it. |
| |
| The UPF_IOREMAP flag is set by a single SH platform and thus needs to be |
| kept. However, for ARM platforms, we can base the decision on whether an |
| OF node is present and bypass the platform data flags completely. |
| |
| 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> |
| (cherry picked from commit 3d73f32bfa312155a0990efd95803a3e7061140c) |
| Signed-off-by: Simon Horman <horms+renesas@verge.net.au> |
| --- |
| drivers/tty/serial/sh-sci.c | 7 +++---- |
| 1 file changed, 3 insertions(+), 4 deletions(-) |
| |
| --- a/drivers/tty/serial/sh-sci.c |
| +++ b/drivers/tty/serial/sh-sci.c |
| @@ -2461,7 +2461,7 @@ static int sci_remap_port(struct uart_po |
| if (port->membase) |
| return 0; |
| |
| - if (port->flags & UPF_IOREMAP) { |
| + if (port->dev->of_node || (port->flags & UPF_IOREMAP)) { |
| port->membase = ioremap_nocache(port->mapbase, sport->reg_size); |
| if (unlikely(!port->membase)) { |
| dev_err(port->dev, "can't remap port#%d\n", port->line); |
| @@ -2483,7 +2483,7 @@ static void sci_release_port(struct uart |
| { |
| struct sci_port *sport = to_sci_port(port); |
| |
| - if (port->flags & UPF_IOREMAP) { |
| + if (port->dev->of_node || (port->flags & UPF_IOREMAP)) { |
| iounmap(port->membase); |
| port->membase = NULL; |
| } |
| @@ -2739,7 +2739,7 @@ static int sci_init_single(struct platfo |
| } |
| |
| port->type = p->type; |
| - port->flags = UPF_FIXED_PORT | p->flags; |
| + port->flags = UPF_FIXED_PORT | UPF_BOOT_AUTOCONF | p->flags; |
| port->regshift = p->regshift; |
| |
| /* |
| @@ -3001,7 +3001,6 @@ sci_parse_dt(struct platform_device *pde |
| |
| *dev_id = id; |
| |
| - p->flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF; |
| p->type = SCI_OF_TYPE(match->data); |
| p->regtype = SCI_OF_REGTYPE(match->data); |
| |