diff options
author | Paul Mundt <lethal@linux-sh.org> | 2008-10-02 06:14:11 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2008-10-02 06:14:11 -0400 |
commit | bc0f424faa11a2017ba725bb8c5fc481ece7b440 (patch) | |
tree | e6272f37806941443f1ead19f965e8eeb531282c /drivers/serial | |
parent | a2159b52219870553fd67e6456f41cd5225c46c6 (diff) | |
parent | 225c9a8d1da274bf23efec43ec28b1c9e45e12f8 (diff) |
Merge branch 'sh/g3-prep'
Diffstat (limited to 'drivers/serial')
-rw-r--r-- | drivers/serial/sh-sci.c | 45 | ||||
-rw-r--r-- | drivers/serial/sh-sci.h | 10 |
2 files changed, 37 insertions, 18 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 | ||
1143 | static int sci_verify_port(struct uart_port *port, struct serial_struct *ser) | 1148 | static int sci_verify_port(struct uart_port *port, struct serial_struct *ser) |
@@ -1423,7 +1428,7 @@ static struct uart_driver sci_uart_driver = { | |||
1423 | static int __devinit sci_probe(struct platform_device *dev) | 1428 | static 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 | |||
1495 | err_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 | ||
1481 | static int __devexit sci_remove(struct platform_device *dev) | 1502 | static int __devexit sci_remove(struct platform_device *dev) |
diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h index b3d906bfbd87..511c10d42187 100644 --- a/drivers/serial/sh-sci.h +++ b/drivers/serial/sh-sci.h | |||
@@ -320,18 +320,16 @@ | |||
320 | #define SCI_EVENT_WRITE_WAKEUP 0 | 320 | #define SCI_EVENT_WRITE_WAKEUP 0 |
321 | 321 | ||
322 | #define SCI_IN(size, offset) \ | 322 | #define SCI_IN(size, offset) \ |
323 | unsigned int addr = port->mapbase + (offset); \ | ||
324 | if ((size) == 8) { \ | 323 | if ((size) == 8) { \ |
325 | return ctrl_inb(addr); \ | 324 | return ioread8(port->membase + (offset)); \ |
326 | } else { \ | 325 | } else { \ |
327 | return ctrl_inw(addr); \ | 326 | return ioread16(port->membase + (offset)); \ |
328 | } | 327 | } |
329 | #define SCI_OUT(size, offset, value) \ | 328 | #define SCI_OUT(size, offset, value) \ |
330 | unsigned int addr = port->mapbase + (offset); \ | ||
331 | if ((size) == 8) { \ | 329 | if ((size) == 8) { \ |
332 | ctrl_outb(value, addr); \ | 330 | iowrite8(value, port->membase + (offset)); \ |
333 | } else if ((size) == 16) { \ | 331 | } else if ((size) == 16) { \ |
334 | ctrl_outw(value, addr); \ | 332 | iowrite16(value, port->membase + (offset)); \ |
335 | } | 333 | } |
336 | 334 | ||
337 | #define CPU_SCIx_FNS(name, sci_offset, sci_size, scif_offset, scif_size)\ | 335 | #define CPU_SCIx_FNS(name, sci_offset, sci_size, scif_offset, scif_size)\ |