aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/68328serial.c2
-rw-r--r--drivers/serial/68360serial.c2
-rw-r--r--drivers/serial/8250.c4
-rw-r--r--drivers/serial/8250_acorn.c9
-rw-r--r--drivers/serial/8250_gsc.c1
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_core.c24
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_cpm2.c143
-rw-r--r--drivers/serial/cpm_uart/cpm_uart_cpm2.h2
-rw-r--r--drivers/serial/crisv10.c2
-rw-r--r--drivers/serial/ioc4_serial.c3
-rw-r--r--drivers/serial/ip22zilog.c16
-rw-r--r--drivers/serial/mcfserial.c2
-rw-r--r--drivers/serial/mpc52xx_uart.c11
-rw-r--r--drivers/serial/mpsc.c12
-rw-r--r--drivers/serial/mux.c2
-rw-r--r--drivers/serial/serial_core.c2
-rw-r--r--drivers/serial/sunsu.c3
17 files changed, 165 insertions, 75 deletions
diff --git a/drivers/serial/68328serial.c b/drivers/serial/68328serial.c
index 993a702422ec..bac853c5abb5 100644
--- a/drivers/serial/68328serial.c
+++ b/drivers/serial/68328serial.c
@@ -1378,7 +1378,7 @@ void startup_console(void)
1378#endif /* CONFIG_PM_LEGACY */ 1378#endif /* CONFIG_PM_LEGACY */
1379 1379
1380 1380
1381static struct tty_operations rs_ops = { 1381static const struct tty_operations rs_ops = {
1382 .open = rs_open, 1382 .open = rs_open,
1383 .close = rs_close, 1383 .close = rs_close,
1384 .write = rs_write, 1384 .write = rs_write,
diff --git a/drivers/serial/68360serial.c b/drivers/serial/68360serial.c
index e80e70e9b126..1b299e8c57cd 100644
--- a/drivers/serial/68360serial.c
+++ b/drivers/serial/68360serial.c
@@ -2424,7 +2424,7 @@ long console_360_init(long kmem_start, long kmem_end)
2424*/ 2424*/
2425static int baud_idx; 2425static int baud_idx;
2426 2426
2427static struct tty_operations rs_360_ops = { 2427static const struct tty_operations rs_360_ops = {
2428 .owner = THIS_MODULE, 2428 .owner = THIS_MODULE,
2429 .open = rs_360_open, 2429 .open = rs_360_open,
2430 .close = rs_360_close, 2430 .close = rs_360_close,
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 0ede0ee64243..cc2a205d4230 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -320,8 +320,8 @@ static unsigned int serial_in(struct uart_8250_port *up, int offset)
320 320
321 case UPIO_TSI: 321 case UPIO_TSI:
322 if (offset == UART_IIR) { 322 if (offset == UART_IIR) {
323 tmp = readl((u32 *)(up->port.membase + UART_RX)); 323 tmp = readl(up->port.membase + (UART_IIR & ~3));
324 return (cpu_to_le32(tmp) >> 8) & 0xff; 324 return (tmp >> 16) & 0xff; /* UART_IIR % 4 == 2 */
325 } else 325 } else
326 return readb(up->port.membase + offset); 326 return readb(up->port.membase + offset);
327 327
diff --git a/drivers/serial/8250_acorn.c b/drivers/serial/8250_acorn.c
index 32af3650e8b4..ef8cc8a70c60 100644
--- a/drivers/serial/8250_acorn.c
+++ b/drivers/serial/8250_acorn.c
@@ -35,6 +35,7 @@ struct serial_card_type {
35struct serial_card_info { 35struct serial_card_info {
36 unsigned int num_ports; 36 unsigned int num_ports;
37 int ports[MAX_PORTS]; 37 int ports[MAX_PORTS];
38 void __iomem *vaddr;
38}; 39};
39 40
40static int __devinit 41static int __devinit
@@ -44,7 +45,6 @@ serial_card_probe(struct expansion_card *ec, const struct ecard_id *id)
44 struct serial_card_type *type = id->data; 45 struct serial_card_type *type = id->data;
45 struct uart_port port; 46 struct uart_port port;
46 unsigned long bus_addr; 47 unsigned long bus_addr;
47 unsigned char __iomem *virt_addr;
48 unsigned int i; 48 unsigned int i;
49 49
50 info = kmalloc(sizeof(struct serial_card_info), GFP_KERNEL); 50 info = kmalloc(sizeof(struct serial_card_info), GFP_KERNEL);
@@ -55,8 +55,8 @@ serial_card_probe(struct expansion_card *ec, const struct ecard_id *id)
55 info->num_ports = type->num_ports; 55 info->num_ports = type->num_ports;
56 56
57 bus_addr = ecard_resource_start(ec, type->type); 57 bus_addr = ecard_resource_start(ec, type->type);
58 virt_addr = ioremap(bus_addr, ecard_resource_len(ec, type->type)); 58 info->vaddr = ioremap(bus_addr, ecard_resource_len(ec, type->type));
59 if (!virt_addr) { 59 if (!info->vaddr) {
60 kfree(info); 60 kfree(info);
61 return -ENOMEM; 61 return -ENOMEM;
62 } 62 }
@@ -72,7 +72,7 @@ serial_card_probe(struct expansion_card *ec, const struct ecard_id *id)
72 port.dev = &ec->dev; 72 port.dev = &ec->dev;
73 73
74 for (i = 0; i < info->num_ports; i ++) { 74 for (i = 0; i < info->num_ports; i ++) {
75 port.membase = virt_addr + type->offset[i]; 75 port.membase = info->vaddr + type->offset[i];
76 port.mapbase = bus_addr + type->offset[i]; 76 port.mapbase = bus_addr + type->offset[i];
77 77
78 info->ports[i] = serial8250_register_port(&port); 78 info->ports[i] = serial8250_register_port(&port);
@@ -92,6 +92,7 @@ static void __devexit serial_card_remove(struct expansion_card *ec)
92 if (info->ports[i] > 0) 92 if (info->ports[i] > 0)
93 serial8250_unregister_port(info->ports[i]); 93 serial8250_unregister_port(info->ports[i]);
94 94
95 iounmap(info->vaddr);
95 kfree(info); 96 kfree(info);
96} 97}
97 98
diff --git a/drivers/serial/8250_gsc.c b/drivers/serial/8250_gsc.c
index 913c71cc0569..1ebe6b585d2d 100644
--- a/drivers/serial/8250_gsc.c
+++ b/drivers/serial/8250_gsc.c
@@ -64,6 +64,7 @@ serial_init_chip(struct parisc_device *dev)
64 err = serial8250_register_port(&port); 64 err = serial8250_register_port(&port);
65 if (err < 0) { 65 if (err < 0) {
66 printk(KERN_WARNING "serial8250_register_port returned error %d\n", err); 66 printk(KERN_WARNING "serial8250_register_port returned error %d\n", err);
67 iounmap(port.membase);
67 return err; 68 return err;
68 } 69 }
69 70
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c
index 90ff96e3339b..a0d6136deb9b 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -46,6 +46,7 @@
46#include <asm/io.h> 46#include <asm/io.h>
47#include <asm/irq.h> 47#include <asm/irq.h>
48#include <asm/delay.h> 48#include <asm/delay.h>
49#include <asm/fs_pd.h>
49 50
50#if defined(CONFIG_SERIAL_CPM_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 51#if defined(CONFIG_SERIAL_CPM_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
51#define SUPPORT_SYSRQ 52#define SUPPORT_SYSRQ
@@ -1022,15 +1023,17 @@ int cpm_uart_drv_get_platform_data(struct platform_device *pdev, int is_con)
1022{ 1023{
1023 struct resource *r; 1024 struct resource *r;
1024 struct fs_uart_platform_info *pdata = pdev->dev.platform_data; 1025 struct fs_uart_platform_info *pdata = pdev->dev.platform_data;
1025 int idx = pdata->fs_no; /* It is UART_SMCx or UART_SCCx index */ 1026 int idx; /* It is UART_SMCx or UART_SCCx index */
1026 struct uart_cpm_port *pinfo; 1027 struct uart_cpm_port *pinfo;
1027 int line; 1028 int line;
1028 u32 mem, pram; 1029 u32 mem, pram;
1029 1030
1031 idx = pdata->fs_no = fs_uart_get_id(pdata);
1032
1030 line = cpm_uart_id2nr(idx); 1033 line = cpm_uart_id2nr(idx);
1031 if(line < 0) { 1034 if(line < 0) {
1032 printk(KERN_ERR"%s(): port %d is not registered", __FUNCTION__, idx); 1035 printk(KERN_ERR"%s(): port %d is not registered", __FUNCTION__, idx);
1033 return -1; 1036 return -EINVAL;
1034 } 1037 }
1035 1038
1036 pinfo = (struct uart_cpm_port *) &cpm_uart_ports[idx]; 1039 pinfo = (struct uart_cpm_port *) &cpm_uart_ports[idx];
@@ -1044,11 +1047,11 @@ int cpm_uart_drv_get_platform_data(struct platform_device *pdev, int is_con)
1044 1047
1045 if (!(r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs"))) 1048 if (!(r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs")))
1046 return -EINVAL; 1049 return -EINVAL;
1047 mem = r->start; 1050 mem = (u32)ioremap(r->start, r->end - r->start + 1);
1048 1051
1049 if (!(r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pram"))) 1052 if (!(r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pram")))
1050 return -EINVAL; 1053 return -EINVAL;
1051 pram = r->start; 1054 pram = (u32)ioremap(r->start, r->end - r->start + 1);
1052 1055
1053 if(idx > fsid_smc2_uart) { 1056 if(idx > fsid_smc2_uart) {
1054 pinfo->sccp = (scc_t *)mem; 1057 pinfo->sccp = (scc_t *)mem;
@@ -1179,7 +1182,7 @@ static int __init cpm_uart_console_setup(struct console *co, char *options)
1179 pdata = pdev->dev.platform_data; 1182 pdata = pdev->dev.platform_data;
1180 if (pdata) 1183 if (pdata)
1181 if (pdata->init_ioports) 1184 if (pdata->init_ioports)
1182 pdata->init_ioports(); 1185 pdata->init_ioports(pdata);
1183 1186
1184 cpm_uart_drv_get_platform_data(pdev, 1); 1187 cpm_uart_drv_get_platform_data(pdev, 1);
1185 } 1188 }
@@ -1189,11 +1192,7 @@ static int __init cpm_uart_console_setup(struct console *co, char *options)
1189 if (options) { 1192 if (options) {
1190 uart_parse_options(options, &baud, &parity, &bits, &flow); 1193 uart_parse_options(options, &baud, &parity, &bits, &flow);
1191 } else { 1194 } else {
1192 bd_t *bd = (bd_t *) __res; 1195 if ((baud = uart_baudrate()) == -1)
1193
1194 if (bd->bi_baudrate)
1195 baud = bd->bi_baudrate;
1196 else
1197 baud = 9600; 1196 baud = 9600;
1198 } 1197 }
1199 1198
@@ -1266,13 +1265,14 @@ static int cpm_uart_drv_probe(struct device *dev)
1266 } 1265 }
1267 1266
1268 pdata = pdev->dev.platform_data; 1267 pdata = pdev->dev.platform_data;
1269 pr_debug("cpm_uart_drv_probe: Adding CPM UART %d\n", cpm_uart_id2nr(pdata->fs_no));
1270 1268
1271 if ((ret = cpm_uart_drv_get_platform_data(pdev, 0))) 1269 if ((ret = cpm_uart_drv_get_platform_data(pdev, 0)))
1272 return ret; 1270 return ret;
1273 1271
1272 pr_debug("cpm_uart_drv_probe: Adding CPM UART %d\n", cpm_uart_id2nr(pdata->fs_no));
1273
1274 if (pdata->init_ioports) 1274 if (pdata->init_ioports)
1275 pdata->init_ioports(); 1275 pdata->init_ioports(pdata);
1276 1276
1277 ret = uart_add_one_port(&cpm_reg, &cpm_uart_ports[pdata->fs_no].port); 1277 ret = uart_add_one_port(&cpm_reg, &cpm_uart_ports[pdata->fs_no].port);
1278 1278
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.c b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
index ef3bb476c432..b691d3e14754 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm2.c
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
@@ -40,6 +40,7 @@
40 40
41#include <asm/io.h> 41#include <asm/io.h>
42#include <asm/irq.h> 42#include <asm/irq.h>
43#include <asm/fs_pd.h>
43 44
44#include <linux/serial_core.h> 45#include <linux/serial_core.h>
45#include <linux/kernel.h> 46#include <linux/kernel.h>
@@ -50,8 +51,9 @@
50 51
51void cpm_line_cr_cmd(int line, int cmd) 52void cpm_line_cr_cmd(int line, int cmd)
52{ 53{
53 volatile cpm_cpm2_t *cp = cpmp;
54 ulong val; 54 ulong val;
55 volatile cpm_cpm2_t *cp = cpm2_map(im_cpm);
56
55 57
56 switch (line) { 58 switch (line) {
57 case UART_SMC1: 59 case UART_SMC1:
@@ -84,11 +86,14 @@ void cpm_line_cr_cmd(int line, int cmd)
84 } 86 }
85 cp->cp_cpcr = val; 87 cp->cp_cpcr = val;
86 while (cp->cp_cpcr & CPM_CR_FLG) ; 88 while (cp->cp_cpcr & CPM_CR_FLG) ;
89
90 cpm2_unmap(cp);
87} 91}
88 92
89void smc1_lineif(struct uart_cpm_port *pinfo) 93void smc1_lineif(struct uart_cpm_port *pinfo)
90{ 94{
91 volatile iop_cpm2_t *io = &cpm2_immr->im_ioport; 95 volatile iop_cpm2_t *io = cpm2_map(im_ioport);
96 volatile cpmux_t *cpmux = cpm2_map(im_cpmux);
92 97
93 /* SMC1 is only on port D */ 98 /* SMC1 is only on port D */
94 io->iop_ppard |= 0x00c00000; 99 io->iop_ppard |= 0x00c00000;
@@ -97,13 +102,17 @@ void smc1_lineif(struct uart_cpm_port *pinfo)
97 io->iop_psord &= ~0x00c00000; 102 io->iop_psord &= ~0x00c00000;
98 103
99 /* Wire BRG1 to SMC1 */ 104 /* Wire BRG1 to SMC1 */
100 cpm2_immr->im_cpmux.cmx_smr &= 0x0f; 105 cpmux->cmx_smr &= 0x0f;
101 pinfo->brg = 1; 106 pinfo->brg = 1;
107
108 cpm2_unmap(cpmux);
109 cpm2_unmap(io);
102} 110}
103 111
104void smc2_lineif(struct uart_cpm_port *pinfo) 112void smc2_lineif(struct uart_cpm_port *pinfo)
105{ 113{
106 volatile iop_cpm2_t *io = &cpm2_immr->im_ioport; 114 volatile iop_cpm2_t *io = cpm2_map(im_ioport);
115 volatile cpmux_t *cpmux = cpm2_map(im_cpmux);
107 116
108 /* SMC2 is only on port A */ 117 /* SMC2 is only on port A */
109 io->iop_ppara |= 0x00c00000; 118 io->iop_ppara |= 0x00c00000;
@@ -112,13 +121,17 @@ void smc2_lineif(struct uart_cpm_port *pinfo)
112 io->iop_psora &= ~0x00c00000; 121 io->iop_psora &= ~0x00c00000;
113 122
114 /* Wire BRG2 to SMC2 */ 123 /* Wire BRG2 to SMC2 */
115 cpm2_immr->im_cpmux.cmx_smr &= 0xf0; 124 cpmux->cmx_smr &= 0xf0;
116 pinfo->brg = 2; 125 pinfo->brg = 2;
126
127 cpm2_unmap(cpmux);
128 cpm2_unmap(io);
117} 129}
118 130
119void scc1_lineif(struct uart_cpm_port *pinfo) 131void scc1_lineif(struct uart_cpm_port *pinfo)
120{ 132{
121 volatile iop_cpm2_t *io = &cpm2_immr->im_ioport; 133 volatile iop_cpm2_t *io = cpm2_map(im_ioport);
134 volatile cpmux_t *cpmux = cpm2_map(im_cpmux);
122 135
123 /* Use Port D for SCC1 instead of other functions. */ 136 /* Use Port D for SCC1 instead of other functions. */
124 io->iop_ppard |= 0x00000003; 137 io->iop_ppard |= 0x00000003;
@@ -128,9 +141,12 @@ void scc1_lineif(struct uart_cpm_port *pinfo)
128 io->iop_pdird |= 0x00000002; /* Tx */ 141 io->iop_pdird |= 0x00000002; /* Tx */
129 142
130 /* Wire BRG1 to SCC1 */ 143 /* Wire BRG1 to SCC1 */
131 cpm2_immr->im_cpmux.cmx_scr &= 0x00ffffff; 144 cpmux->cmx_scr &= 0x00ffffff;
132 cpm2_immr->im_cpmux.cmx_scr |= 0x00000000; 145 cpmux->cmx_scr |= 0x00000000;
133 pinfo->brg = 1; 146 pinfo->brg = 1;
147
148 cpm2_unmap(cpmux);
149 cpm2_unmap(io);
134} 150}
135 151
136void scc2_lineif(struct uart_cpm_port *pinfo) 152void scc2_lineif(struct uart_cpm_port *pinfo)
@@ -143,43 +159,57 @@ void scc2_lineif(struct uart_cpm_port *pinfo)
143 * be supported in a sane fashion. 159 * be supported in a sane fashion.
144 */ 160 */
145#ifndef CONFIG_STX_GP3 161#ifndef CONFIG_STX_GP3
146 volatile iop_cpm2_t *io = &cpm2_immr->im_ioport; 162 volatile iop_cpm2_t *io = cpm2_map(im_ioport);
163 volatile cpmux_t *cpmux = cpm2_map(im_cpmux);
164
147 io->iop_pparb |= 0x008b0000; 165 io->iop_pparb |= 0x008b0000;
148 io->iop_pdirb |= 0x00880000; 166 io->iop_pdirb |= 0x00880000;
149 io->iop_psorb |= 0x00880000; 167 io->iop_psorb |= 0x00880000;
150 io->iop_pdirb &= ~0x00030000; 168 io->iop_pdirb &= ~0x00030000;
151 io->iop_psorb &= ~0x00030000; 169 io->iop_psorb &= ~0x00030000;
152#endif 170#endif
153 cpm2_immr->im_cpmux.cmx_scr &= 0xff00ffff; 171 cpmux->cmx_scr &= 0xff00ffff;
154 cpm2_immr->im_cpmux.cmx_scr |= 0x00090000; 172 cpmux->cmx_scr |= 0x00090000;
155 pinfo->brg = 2; 173 pinfo->brg = 2;
174
175 cpm2_unmap(cpmux);
176 cpm2_unmap(io);
156} 177}
157 178
158void scc3_lineif(struct uart_cpm_port *pinfo) 179void scc3_lineif(struct uart_cpm_port *pinfo)
159{ 180{
160 volatile iop_cpm2_t *io = &cpm2_immr->im_ioport; 181 volatile iop_cpm2_t *io = cpm2_map(im_ioport);
182 volatile cpmux_t *cpmux = cpm2_map(im_cpmux);
183
161 io->iop_pparb |= 0x008b0000; 184 io->iop_pparb |= 0x008b0000;
162 io->iop_pdirb |= 0x00880000; 185 io->iop_pdirb |= 0x00880000;
163 io->iop_psorb |= 0x00880000; 186 io->iop_psorb |= 0x00880000;
164 io->iop_pdirb &= ~0x00030000; 187 io->iop_pdirb &= ~0x00030000;
165 io->iop_psorb &= ~0x00030000; 188 io->iop_psorb &= ~0x00030000;
166 cpm2_immr->im_cpmux.cmx_scr &= 0xffff00ff; 189 cpmux->cmx_scr &= 0xffff00ff;
167 cpm2_immr->im_cpmux.cmx_scr |= 0x00001200; 190 cpmux->cmx_scr |= 0x00001200;
168 pinfo->brg = 3; 191 pinfo->brg = 3;
192
193 cpm2_unmap(cpmux);
194 cpm2_unmap(io);
169} 195}
170 196
171void scc4_lineif(struct uart_cpm_port *pinfo) 197void scc4_lineif(struct uart_cpm_port *pinfo)
172{ 198{
173 volatile iop_cpm2_t *io = &cpm2_immr->im_ioport; 199 volatile iop_cpm2_t *io = cpm2_map(im_ioport);
200 volatile cpmux_t *cpmux = cpm2_map(im_cpmux);
174 201
175 io->iop_ppard |= 0x00000600; 202 io->iop_ppard |= 0x00000600;
176 io->iop_psord &= ~0x00000600; /* Tx/Rx */ 203 io->iop_psord &= ~0x00000600; /* Tx/Rx */
177 io->iop_pdird &= ~0x00000200; /* Rx */ 204 io->iop_pdird &= ~0x00000200; /* Rx */
178 io->iop_pdird |= 0x00000400; /* Tx */ 205 io->iop_pdird |= 0x00000400; /* Tx */
179 206
180 cpm2_immr->im_cpmux.cmx_scr &= 0xffffff00; 207 cpmux->cmx_scr &= 0xffffff00;
181 cpm2_immr->im_cpmux.cmx_scr |= 0x0000001b; 208 cpmux->cmx_scr |= 0x0000001b;
182 pinfo->brg = 4; 209 pinfo->brg = 4;
210
211 cpm2_unmap(cpmux);
212 cpm2_unmap(io);
183} 213}
184 214
185/* 215/*
@@ -254,88 +284,103 @@ void cpm_uart_freebuf(struct uart_cpm_port *pinfo)
254/* Setup any dynamic params in the uart desc */ 284/* Setup any dynamic params in the uart desc */
255int cpm_uart_init_portdesc(void) 285int cpm_uart_init_portdesc(void)
256{ 286{
287#if defined(CONFIG_SERIAL_CPM_SMC1) || defined(CONFIG_SERIAL_CPM_SMC2)
288 u32 addr;
289#endif
257 pr_debug("CPM uart[-]:init portdesc\n"); 290 pr_debug("CPM uart[-]:init portdesc\n");
258 291
259 cpm_uart_nr = 0; 292 cpm_uart_nr = 0;
260#ifdef CONFIG_SERIAL_CPM_SMC1 293#ifdef CONFIG_SERIAL_CPM_SMC1
261 cpm_uart_ports[UART_SMC1].smcp = (smc_t *) & cpm2_immr->im_smc[0]; 294 cpm_uart_ports[UART_SMC1].smcp = (smc_t *) cpm2_map(im_smc[0]);
262 cpm_uart_ports[UART_SMC1].smcup =
263 (smc_uart_t *) & cpm2_immr->im_dprambase[PROFF_SMC1];
264 *(u16 *)(&cpm2_immr->im_dprambase[PROFF_SMC1_BASE]) = PROFF_SMC1;
265 cpm_uart_ports[UART_SMC1].port.mapbase = 295 cpm_uart_ports[UART_SMC1].port.mapbase =
266 (unsigned long)&cpm2_immr->im_smc[0]; 296 (unsigned long)cpm_uart_ports[UART_SMC1].smcp;
297
298 cpm_uart_ports[UART_SMC1].smcup =
299 (smc_uart_t *) cpm2_map_size(im_dprambase[PROFF_SMC1], PROFF_SMC_SIZE);
300 addr = (u16 *)cpm2_map_size(im_dprambase[PROFF_SMC1_BASE], 2);
301 *addr = PROFF_SMC1;
302 cpm2_unmap(addr);
303
267 cpm_uart_ports[UART_SMC1].smcp->smc_smcm |= (SMCM_RX | SMCM_TX); 304 cpm_uart_ports[UART_SMC1].smcp->smc_smcm |= (SMCM_RX | SMCM_TX);
268 cpm_uart_ports[UART_SMC1].smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN); 305 cpm_uart_ports[UART_SMC1].smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN);
269 cpm_uart_ports[UART_SMC1].port.uartclk = (((bd_t *) __res)->bi_intfreq); 306 cpm_uart_ports[UART_SMC1].port.uartclk = uart_clock();
270 cpm_uart_port_map[cpm_uart_nr++] = UART_SMC1; 307 cpm_uart_port_map[cpm_uart_nr++] = UART_SMC1;
271#endif 308#endif
272 309
273#ifdef CONFIG_SERIAL_CPM_SMC2 310#ifdef CONFIG_SERIAL_CPM_SMC2
274 cpm_uart_ports[UART_SMC2].smcp = (smc_t *) & cpm2_immr->im_smc[1]; 311 cpm_uart_ports[UART_SMC2].smcp = (smc_t *) cpm2_map(im_smc[1]);
275 cpm_uart_ports[UART_SMC2].smcup =
276 (smc_uart_t *) & cpm2_immr->im_dprambase[PROFF_SMC2];
277 *(u16 *)(&cpm2_immr->im_dprambase[PROFF_SMC2_BASE]) = PROFF_SMC2;
278 cpm_uart_ports[UART_SMC2].port.mapbase = 312 cpm_uart_ports[UART_SMC2].port.mapbase =
279 (unsigned long)&cpm2_immr->im_smc[1]; 313 (unsigned long)cpm_uart_ports[UART_SMC2].smcp;
314
315 cpm_uart_ports[UART_SMC2].smcup =
316 (smc_uart_t *) cpm2_map_size(im_dprambase[PROFF_SMC2], PROFF_SMC_SIZE);
317 addr = (u16 *)cpm2_map_size(im_dprambase[PROFF_SMC2_BASE], 2);
318 *addr = PROFF_SMC2;
319 cpm2_unmap(addr);
320
280 cpm_uart_ports[UART_SMC2].smcp->smc_smcm |= (SMCM_RX | SMCM_TX); 321 cpm_uart_ports[UART_SMC2].smcp->smc_smcm |= (SMCM_RX | SMCM_TX);
281 cpm_uart_ports[UART_SMC2].smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN); 322 cpm_uart_ports[UART_SMC2].smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN);
282 cpm_uart_ports[UART_SMC2].port.uartclk = (((bd_t *) __res)->bi_intfreq); 323 cpm_uart_ports[UART_SMC2].port.uartclk = uart_clock();
283 cpm_uart_port_map[cpm_uart_nr++] = UART_SMC2; 324 cpm_uart_port_map[cpm_uart_nr++] = UART_SMC2;
284#endif 325#endif
285 326
286#ifdef CONFIG_SERIAL_CPM_SCC1 327#ifdef CONFIG_SERIAL_CPM_SCC1
287 cpm_uart_ports[UART_SCC1].sccp = (scc_t *) & cpm2_immr->im_scc[0]; 328 cpm_uart_ports[UART_SCC1].sccp = (scc_t *) cpm2_map(im_scc[0]);
288 cpm_uart_ports[UART_SCC1].sccup =
289 (scc_uart_t *) & cpm2_immr->im_dprambase[PROFF_SCC1];
290 cpm_uart_ports[UART_SCC1].port.mapbase = 329 cpm_uart_ports[UART_SCC1].port.mapbase =
291 (unsigned long)&cpm2_immr->im_scc[0]; 330 (unsigned long)cpm_uart_ports[UART_SCC1].sccp;
331 cpm_uart_ports[UART_SCC1].sccup =
332 (scc_uart_t *) cpm2_map_size(im_dprambase[PROFF_SCC1], PROFF_SCC_SIZE);
333
292 cpm_uart_ports[UART_SCC1].sccp->scc_sccm &= 334 cpm_uart_ports[UART_SCC1].sccp->scc_sccm &=
293 ~(UART_SCCM_TX | UART_SCCM_RX); 335 ~(UART_SCCM_TX | UART_SCCM_RX);
294 cpm_uart_ports[UART_SCC1].sccp->scc_gsmrl &= 336 cpm_uart_ports[UART_SCC1].sccp->scc_gsmrl &=
295 ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT); 337 ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT);
296 cpm_uart_ports[UART_SCC1].port.uartclk = (((bd_t *) __res)->bi_intfreq); 338 cpm_uart_ports[UART_SCC1].port.uartclk = uart_clock();
297 cpm_uart_port_map[cpm_uart_nr++] = UART_SCC1; 339 cpm_uart_port_map[cpm_uart_nr++] = UART_SCC1;
298#endif 340#endif
299 341
300#ifdef CONFIG_SERIAL_CPM_SCC2 342#ifdef CONFIG_SERIAL_CPM_SCC2
301 cpm_uart_ports[UART_SCC2].sccp = (scc_t *) & cpm2_immr->im_scc[1]; 343 cpm_uart_ports[UART_SCC2].sccp = (scc_t *) cpm2_map(im_scc[1]);
302 cpm_uart_ports[UART_SCC2].sccup =
303 (scc_uart_t *) & cpm2_immr->im_dprambase[PROFF_SCC2];
304 cpm_uart_ports[UART_SCC2].port.mapbase = 344 cpm_uart_ports[UART_SCC2].port.mapbase =
305 (unsigned long)&cpm2_immr->im_scc[1]; 345 (unsigned long)cpm_uart_ports[UART_SCC2].sccp;
346 cpm_uart_ports[UART_SCC2].sccup =
347 (scc_uart_t *) cpm2_map_size(im_dprambase[PROFF_SCC2], PROFF_SCC_SIZE);
348
306 cpm_uart_ports[UART_SCC2].sccp->scc_sccm &= 349 cpm_uart_ports[UART_SCC2].sccp->scc_sccm &=
307 ~(UART_SCCM_TX | UART_SCCM_RX); 350 ~(UART_SCCM_TX | UART_SCCM_RX);
308 cpm_uart_ports[UART_SCC2].sccp->scc_gsmrl &= 351 cpm_uart_ports[UART_SCC2].sccp->scc_gsmrl &=
309 ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT); 352 ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT);
310 cpm_uart_ports[UART_SCC2].port.uartclk = (((bd_t *) __res)->bi_intfreq); 353 cpm_uart_ports[UART_SCC2].port.uartclk = uart_clock();
311 cpm_uart_port_map[cpm_uart_nr++] = UART_SCC2; 354 cpm_uart_port_map[cpm_uart_nr++] = UART_SCC2;
312#endif 355#endif
313 356
314#ifdef CONFIG_SERIAL_CPM_SCC3 357#ifdef CONFIG_SERIAL_CPM_SCC3
315 cpm_uart_ports[UART_SCC3].sccp = (scc_t *) & cpm2_immr->im_scc[2]; 358 cpm_uart_ports[UART_SCC3].sccp = (scc_t *) cpm2_map(im_scc[2]);
316 cpm_uart_ports[UART_SCC3].sccup =
317 (scc_uart_t *) & cpm2_immr->im_dprambase[PROFF_SCC3];
318 cpm_uart_ports[UART_SCC3].port.mapbase = 359 cpm_uart_ports[UART_SCC3].port.mapbase =
319 (unsigned long)&cpm2_immr->im_scc[2]; 360 (unsigned long)cpm_uart_ports[UART_SCC3].sccp;
361 cpm_uart_ports[UART_SCC3].sccup =
362 (scc_uart_t *) cpm2_map_size(im_dprambase[PROFF_SCC3], PROFF_SCC_SIZE);
363
320 cpm_uart_ports[UART_SCC3].sccp->scc_sccm &= 364 cpm_uart_ports[UART_SCC3].sccp->scc_sccm &=
321 ~(UART_SCCM_TX | UART_SCCM_RX); 365 ~(UART_SCCM_TX | UART_SCCM_RX);
322 cpm_uart_ports[UART_SCC3].sccp->scc_gsmrl &= 366 cpm_uart_ports[UART_SCC3].sccp->scc_gsmrl &=
323 ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT); 367 ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT);
324 cpm_uart_ports[UART_SCC3].port.uartclk = (((bd_t *) __res)->bi_intfreq); 368 cpm_uart_ports[UART_SCC3].port.uartclk = uart_clock();
325 cpm_uart_port_map[cpm_uart_nr++] = UART_SCC3; 369 cpm_uart_port_map[cpm_uart_nr++] = UART_SCC3;
326#endif 370#endif
327 371
328#ifdef CONFIG_SERIAL_CPM_SCC4 372#ifdef CONFIG_SERIAL_CPM_SCC4
329 cpm_uart_ports[UART_SCC4].sccp = (scc_t *) & cpm2_immr->im_scc[3]; 373 cpm_uart_ports[UART_SCC4].sccp = (scc_t *) cpm2_map(im_scc[3]);
330 cpm_uart_ports[UART_SCC4].sccup =
331 (scc_uart_t *) & cpm2_immr->im_dprambase[PROFF_SCC4];
332 cpm_uart_ports[UART_SCC4].port.mapbase = 374 cpm_uart_ports[UART_SCC4].port.mapbase =
333 (unsigned long)&cpm2_immr->im_scc[3]; 375 (unsigned long)cpm_uart_ports[UART_SCC4].sccp;
376 cpm_uart_ports[UART_SCC4].sccup =
377 (scc_uart_t *) cpm2_map_size(im_dprambase[PROFF_SCC4], PROFF_SCC_SIZE);
378
334 cpm_uart_ports[UART_SCC4].sccp->scc_sccm &= 379 cpm_uart_ports[UART_SCC4].sccp->scc_sccm &=
335 ~(UART_SCCM_TX | UART_SCCM_RX); 380 ~(UART_SCCM_TX | UART_SCCM_RX);
336 cpm_uart_ports[UART_SCC4].sccp->scc_gsmrl &= 381 cpm_uart_ports[UART_SCC4].sccp->scc_gsmrl &=
337 ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT); 382 ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT);
338 cpm_uart_ports[UART_SCC4].port.uartclk = (((bd_t *) __res)->bi_intfreq); 383 cpm_uart_ports[UART_SCC4].port.uartclk = uart_clock();
339 cpm_uart_port_map[cpm_uart_nr++] = UART_SCC4; 384 cpm_uart_port_map[cpm_uart_nr++] = UART_SCC4;
340#endif 385#endif
341 386
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.h b/drivers/serial/cpm_uart/cpm_uart_cpm2.h
index 4793fecf8ece..a663300d3476 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm2.h
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm2.h
@@ -40,6 +40,6 @@ static inline void cpm_set_smc_fcr(volatile smc_uart_t * up)
40 up->smc_tfcr = CPMFCR_GBL | CPMFCR_EB; 40 up->smc_tfcr = CPMFCR_GBL | CPMFCR_EB;
41} 41}
42 42
43#define DPRAM_BASE ((unsigned char *)&cpm2_immr->im_dprambase[0]) 43#define DPRAM_BASE ((unsigned char *)cpm_dpram_addr(0))
44 44
45#endif 45#endif
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c
index cabd048c8636..9851d9eff022 100644
--- a/drivers/serial/crisv10.c
+++ b/drivers/serial/crisv10.c
@@ -4825,7 +4825,7 @@ show_serial_version(void)
4825 4825
4826/* rs_init inits the driver at boot (using the module_init chain) */ 4826/* rs_init inits the driver at boot (using the module_init chain) */
4827 4827
4828static struct tty_operations rs_ops = { 4828static const struct tty_operations rs_ops = {
4829 .open = rs_open, 4829 .open = rs_open,
4830 .close = rs_close, 4830 .close = rs_close,
4831 .write = rs_write, 4831 .write = rs_write,
diff --git a/drivers/serial/ioc4_serial.c b/drivers/serial/ioc4_serial.c
index 576ca1eaa2b6..5ec4716c99bf 100644
--- a/drivers/serial/ioc4_serial.c
+++ b/drivers/serial/ioc4_serial.c
@@ -2685,6 +2685,7 @@ static int ioc4_serial_remove_one(struct ioc4_driver_data *idd)
2685 if (soft) { 2685 if (soft) {
2686 free_irq(control->ic_irq, soft); 2686 free_irq(control->ic_irq, soft);
2687 if (soft->is_ioc4_serial_addr) { 2687 if (soft->is_ioc4_serial_addr) {
2688 iounmap(soft->is_ioc4_serial_addr);
2688 release_region((unsigned long) 2689 release_region((unsigned long)
2689 soft->is_ioc4_serial_addr, 2690 soft->is_ioc4_serial_addr,
2690 sizeof(struct ioc4_serial)); 2691 sizeof(struct ioc4_serial));
@@ -2887,6 +2888,8 @@ out4:
2887out3: 2888out3:
2888 kfree(control); 2889 kfree(control);
2889out2: 2890out2:
2891 if (serial)
2892 iounmap(serial);
2890 release_region(tmp_addr1, sizeof(struct ioc4_serial)); 2893 release_region(tmp_addr1, sizeof(struct ioc4_serial));
2891out1: 2894out1:
2892 2895
diff --git a/drivers/serial/ip22zilog.c b/drivers/serial/ip22zilog.c
index 5ff269fb604c..dbf13c03a1bb 100644
--- a/drivers/serial/ip22zilog.c
+++ b/drivers/serial/ip22zilog.c
@@ -1229,13 +1229,27 @@ static int __init ip22zilog_init(void)
1229static void __exit ip22zilog_exit(void) 1229static void __exit ip22zilog_exit(void)
1230{ 1230{
1231 int i; 1231 int i;
1232 struct uart_ip22zilog_port *up;
1232 1233
1233 for (i = 0; i < NUM_CHANNELS; i++) { 1234 for (i = 0; i < NUM_CHANNELS; i++) {
1234 struct uart_ip22zilog_port *up = &ip22zilog_port_table[i]; 1235 up = &ip22zilog_port_table[i];
1235 1236
1236 uart_remove_one_port(&ip22zilog_reg, &up->port); 1237 uart_remove_one_port(&ip22zilog_reg, &up->port);
1237 } 1238 }
1238 1239
1240 /* Free IO mem */
1241 up = &ip22zilog_port_table[0];
1242 for (i = 0; i < NUM_IP22ZILOG; i++) {
1243 if (up[(i * 2) + 0].port.mapbase) {
1244 iounmap((void*)up[(i * 2) + 0].port.mapbase);
1245 up[(i * 2) + 0].port.mapbase = 0;
1246 }
1247 if (up[(i * 2) + 1].port.mapbase) {
1248 iounmap((void*)up[(i * 2) + 1].port.mapbase);
1249 up[(i * 2) + 1].port.mapbase = 0;
1250 }
1251 }
1252
1239 uart_unregister_driver(&ip22zilog_reg); 1253 uart_unregister_driver(&ip22zilog_reg);
1240} 1254}
1241 1255
diff --git a/drivers/serial/mcfserial.c b/drivers/serial/mcfserial.c
index 832abd3c4706..00d7859c167e 100644
--- a/drivers/serial/mcfserial.c
+++ b/drivers/serial/mcfserial.c
@@ -1666,7 +1666,7 @@ static void show_serial_version(void)
1666 printk(mcfrs_drivername); 1666 printk(mcfrs_drivername);
1667} 1667}
1668 1668
1669static struct tty_operations mcfrs_ops = { 1669static const struct tty_operations mcfrs_ops = {
1670 .open = mcfrs_open, 1670 .open = mcfrs_open,
1671 .close = mcfrs_close, 1671 .close = mcfrs_close,
1672 .write = mcfrs_write, 1672 .write = mcfrs_write,
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
index 7708e5dd3656..dbad0e31e005 100644
--- a/drivers/serial/mpc52xx_uart.c
+++ b/drivers/serial/mpc52xx_uart.c
@@ -338,14 +338,23 @@ mpc52xx_uart_release_port(struct uart_port *port)
338static int 338static int
339mpc52xx_uart_request_port(struct uart_port *port) 339mpc52xx_uart_request_port(struct uart_port *port)
340{ 340{
341 int err;
342
341 if (port->flags & UPF_IOREMAP) /* Need to remap ? */ 343 if (port->flags & UPF_IOREMAP) /* Need to remap ? */
342 port->membase = ioremap(port->mapbase, MPC52xx_PSC_SIZE); 344 port->membase = ioremap(port->mapbase, MPC52xx_PSC_SIZE);
343 345
344 if (!port->membase) 346 if (!port->membase)
345 return -EINVAL; 347 return -EINVAL;
346 348
347 return request_mem_region(port->mapbase, MPC52xx_PSC_SIZE, 349 err = request_mem_region(port->mapbase, MPC52xx_PSC_SIZE,
348 "mpc52xx_psc_uart") != NULL ? 0 : -EBUSY; 350 "mpc52xx_psc_uart") != NULL ? 0 : -EBUSY;
351
352 if (err && (port->flags & UPF_IOREMAP)) {
353 iounmap(port->membase);
354 port->membase = NULL;
355 }
356
357 return err;
349} 358}
350 359
351static void 360static void
diff --git a/drivers/serial/mpsc.c b/drivers/serial/mpsc.c
index 63d2a66e563b..704243c9f78a 100644
--- a/drivers/serial/mpsc.c
+++ b/drivers/serial/mpsc.c
@@ -1893,6 +1893,10 @@ mpsc_drv_map_regs(struct mpsc_port_info *pi, struct platform_device *pd)
1893 } 1893 }
1894 else { 1894 else {
1895 mpsc_resource_err("SDMA base"); 1895 mpsc_resource_err("SDMA base");
1896 if (pi->mpsc_base) {
1897 iounmap(pi->mpsc_base);
1898 pi->mpsc_base = NULL;
1899 }
1896 return -ENOMEM; 1900 return -ENOMEM;
1897 } 1901 }
1898 1902
@@ -1905,6 +1909,14 @@ mpsc_drv_map_regs(struct mpsc_port_info *pi, struct platform_device *pd)
1905 } 1909 }
1906 else { 1910 else {
1907 mpsc_resource_err("BRG base"); 1911 mpsc_resource_err("BRG base");
1912 if (pi->mpsc_base) {
1913 iounmap(pi->mpsc_base);
1914 pi->mpsc_base = NULL;
1915 }
1916 if (pi->sdma_base) {
1917 iounmap(pi->sdma_base);
1918 pi->sdma_base = NULL;
1919 }
1908 return -ENOMEM; 1920 return -ENOMEM;
1909 } 1921 }
1910 1922
diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c
index 4a1c9983f38f..aa819d3f8ee5 100644
--- a/drivers/serial/mux.c
+++ b/drivers/serial/mux.c
@@ -521,6 +521,8 @@ static void __exit mux_exit(void)
521 521
522 for (i = 0; i < port_cnt; i++) { 522 for (i = 0; i < port_cnt; i++) {
523 uart_remove_one_port(&mux_driver, &mux_ports[i]); 523 uart_remove_one_port(&mux_driver, &mux_ports[i]);
524 if (mux_ports[i].membase)
525 iounmap(mux_ports[i].membase);
524 } 526 }
525 527
526 uart_unregister_driver(&mux_driver); 528 uart_unregister_driver(&mux_driver);
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 397147a7054f..c67b05e9a451 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -2117,7 +2117,7 @@ uart_configure_port(struct uart_driver *drv, struct uart_state *state,
2117 } 2117 }
2118} 2118}
2119 2119
2120static struct tty_operations uart_ops = { 2120static const struct tty_operations uart_ops = {
2121 .open = uart_open, 2121 .open = uart_open,
2122 .close = uart_close, 2122 .close = uart_close,
2123 .write = uart_write, 2123 .write = uart_write,
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c
index d3a5aeee73a3..9b3b9aaa6b90 100644
--- a/drivers/serial/sunsu.c
+++ b/drivers/serial/sunsu.c
@@ -1499,6 +1499,9 @@ static int __devexit su_remove(struct of_device *dev)
1499 uart_remove_one_port(&sunsu_reg, &up->port); 1499 uart_remove_one_port(&sunsu_reg, &up->port);
1500 } 1500 }
1501 1501
1502 if (up->port.membase)
1503 of_iounmap(up->port.membase, up->reg_size);
1504
1502 dev_set_drvdata(&dev->dev, NULL); 1505 dev_set_drvdata(&dev->dev, NULL);
1503 1506
1504 return 0; 1507 return 0;