aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/sh-sci.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2008-10-02 06:14:11 -0400
committerPaul Mundt <lethal@linux-sh.org>2008-10-02 06:14:11 -0400
commitbc0f424faa11a2017ba725bb8c5fc481ece7b440 (patch)
treee6272f37806941443f1ead19f965e8eeb531282c /drivers/serial/sh-sci.c
parenta2159b52219870553fd67e6456f41cd5225c46c6 (diff)
parent225c9a8d1da274bf23efec43ec28b1c9e45e12f8 (diff)
Merge branch 'sh/g3-prep'
Diffstat (limited to 'drivers/serial/sh-sci.c')
-rw-r--r--drivers/serial/sh-sci.c45
1 files changed, 33 insertions, 12 deletions
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 5bb571548558..3b9d2d83b590 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * SuperH on-chip serial module support. (SCI with no FIFO / with FIFO) 4 * SuperH on-chip serial module support. (SCI with no FIFO / with FIFO)
5 * 5 *
6 * Copyright (C) 2002 - 2006 Paul Mundt 6 * Copyright (C) 2002 - 2008 Paul Mundt
7 * Modified to support SH7720 SCIF. Markus Brunner, Mark Jonas (Jul 2007). 7 * Modified to support SH7720 SCIF. Markus Brunner, Mark Jonas (Jul 2007).
8 * 8 *
9 * based off of the old drivers/char/sh-sci.c by: 9 * based off of the old drivers/char/sh-sci.c by:
@@ -46,6 +46,7 @@
46#include <linux/cpufreq.h> 46#include <linux/cpufreq.h>
47#include <linux/clk.h> 47#include <linux/clk.h>
48#include <linux/ctype.h> 48#include <linux/ctype.h>
49#include <linux/err.h>
49 50
50#ifdef CONFIG_SUPERH 51#ifdef CONFIG_SUPERH
51#include <asm/clock.h> 52#include <asm/clock.h>
@@ -1132,12 +1133,16 @@ static void sci_config_port(struct uart_port *port, int flags)
1132 break; 1133 break;
1133 } 1134 }
1134 1135
1135#if defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103) 1136 if (port->flags & UPF_IOREMAP && !port->membase) {
1136 if (port->mapbase == 0) 1137#if defined(CONFIG_SUPERH64)
1137 port->mapbase = onchip_remap(SCIF_ADDR_SH5, 1024, "SCIF"); 1138 port->mapbase = onchip_remap(SCIF_ADDR_SH5, 1024, "SCIF");
1138 1139 port->membase = (void __iomem *)port->mapbase;
1139 port->membase = (void __iomem *)port->mapbase; 1140#else
1141 port->membase = ioremap_nocache(port->mapbase, 0x40);
1140#endif 1142#endif
1143
1144 printk(KERN_ERR "sci: can't remap port#%d\n", port->line);
1145 }
1141} 1146}
1142 1147
1143static int sci_verify_port(struct uart_port *port, struct serial_struct *ser) 1148static int sci_verify_port(struct uart_port *port, struct serial_struct *ser)
@@ -1423,7 +1428,7 @@ static struct uart_driver sci_uart_driver = {
1423static int __devinit sci_probe(struct platform_device *dev) 1428static int __devinit sci_probe(struct platform_device *dev)
1424{ 1429{
1425 struct plat_sci_port *p = dev->dev.platform_data; 1430 struct plat_sci_port *p = dev->dev.platform_data;
1426 int i; 1431 int i, ret = -EINVAL;
1427 1432
1428 for (i = 0; p && p->flags != 0; p++, i++) { 1433 for (i = 0; p && p->flags != 0; p++, i++) {
1429 struct sci_port *sciport = &sci_ports[i]; 1434 struct sci_port *sciport = &sci_ports[i];
@@ -1440,12 +1445,22 @@ static int __devinit sci_probe(struct platform_device *dev)
1440 1445
1441 sciport->port.mapbase = p->mapbase; 1446 sciport->port.mapbase = p->mapbase;
1442 1447
1443 /* 1448 if (p->mapbase && !p->membase) {
1444 * For the simple (and majority of) cases where we don't need 1449 if (p->flags & UPF_IOREMAP) {
1445 * to do any remapping, just cast the cookie directly. 1450 p->membase = ioremap_nocache(p->mapbase, 0x40);
1446 */ 1451 if (IS_ERR(p->membase)) {
1447 if (p->mapbase && !p->membase && !(p->flags & UPF_IOREMAP)) 1452 ret = PTR_ERR(p->membase);
1448 p->membase = (void __iomem *)p->mapbase; 1453 goto err_unreg;
1454 }
1455 } else {
1456 /*
1457 * For the simple (and majority of) cases
1458 * where we don't need to do any remapping,
1459 * just cast the cookie directly.
1460 */
1461 p->membase = (void __iomem *)p->mapbase;
1462 }
1463 }
1449 1464
1450 sciport->port.membase = p->membase; 1465 sciport->port.membase = p->membase;
1451 1466
@@ -1476,6 +1491,12 @@ static int __devinit sci_probe(struct platform_device *dev)
1476#endif 1491#endif
1477 1492
1478 return 0; 1493 return 0;
1494
1495err_unreg:
1496 for (i = i - 1; i >= 0; i--)
1497 uart_remove_one_port(&sci_uart_driver, &sci_ports[i].port);
1498
1499 return ret;
1479} 1500}
1480 1501
1481static int __devexit sci_remove(struct platform_device *dev) 1502static int __devexit sci_remove(struct platform_device *dev)