diff options
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/Kconfig | 2 | ||||
-rw-r--r-- | drivers/tty/hvc/Kconfig | 9 | ||||
-rw-r--r-- | drivers/tty/hvc/Makefile | 1 | ||||
-rw-r--r-- | drivers/tty/hvc/hvc_opal.c | 424 | ||||
-rw-r--r-- | drivers/tty/hvc/hvcs.c | 6 | ||||
-rw-r--r-- | drivers/tty/hvc/hvsi_lib.c | 4 | ||||
-rw-r--r-- | drivers/tty/serial/8250.c | 23 | ||||
-rw-r--r-- | drivers/tty/serial/msm_serial.c | 30 | ||||
-rw-r--r-- | drivers/tty/serial/sh-sci.c | 25 |
9 files changed, 468 insertions, 56 deletions
diff --git a/drivers/tty/Kconfig b/drivers/tty/Kconfig index 8816f53e004d..b3d17416d86a 100644 --- a/drivers/tty/Kconfig +++ b/drivers/tty/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config VT | 1 | config VT |
2 | bool "Virtual terminal" if EXPERT | 2 | bool "Virtual terminal" if EXPERT |
3 | depends on !S390 | 3 | depends on !S390 && !UML |
4 | select INPUT | 4 | select INPUT |
5 | default y | 5 | default y |
6 | ---help--- | 6 | ---help--- |
diff --git a/drivers/tty/hvc/Kconfig b/drivers/tty/hvc/Kconfig index e371753ba921..4222035acfb7 100644 --- a/drivers/tty/hvc/Kconfig +++ b/drivers/tty/hvc/Kconfig | |||
@@ -34,6 +34,15 @@ config HVC_ISERIES | |||
34 | help | 34 | help |
35 | iSeries machines support a hypervisor virtual console. | 35 | iSeries machines support a hypervisor virtual console. |
36 | 36 | ||
37 | config HVC_OPAL | ||
38 | bool "OPAL Console support" | ||
39 | depends on PPC_POWERNV | ||
40 | select HVC_DRIVER | ||
41 | select HVC_IRQ | ||
42 | default y | ||
43 | help | ||
44 | PowerNV machines running under OPAL need that driver to get a console | ||
45 | |||
37 | config HVC_RTAS | 46 | config HVC_RTAS |
38 | bool "IBM RTAS Console support" | 47 | bool "IBM RTAS Console support" |
39 | depends on PPC_RTAS | 48 | depends on PPC_RTAS |
diff --git a/drivers/tty/hvc/Makefile b/drivers/tty/hvc/Makefile index e29205316376..89abf40bc73d 100644 --- a/drivers/tty/hvc/Makefile +++ b/drivers/tty/hvc/Makefile | |||
@@ -1,4 +1,5 @@ | |||
1 | obj-$(CONFIG_HVC_CONSOLE) += hvc_vio.o hvsi_lib.o | 1 | obj-$(CONFIG_HVC_CONSOLE) += hvc_vio.o hvsi_lib.o |
2 | obj-$(CONFIG_HVC_OPAL) += hvc_opal.o hvsi_lib.o | ||
2 | obj-$(CONFIG_HVC_OLD_HVSI) += hvsi.o | 3 | obj-$(CONFIG_HVC_OLD_HVSI) += hvsi.o |
3 | obj-$(CONFIG_HVC_ISERIES) += hvc_iseries.o | 4 | obj-$(CONFIG_HVC_ISERIES) += hvc_iseries.o |
4 | obj-$(CONFIG_HVC_RTAS) += hvc_rtas.o | 5 | obj-$(CONFIG_HVC_RTAS) += hvc_rtas.o |
diff --git a/drivers/tty/hvc/hvc_opal.c b/drivers/tty/hvc/hvc_opal.c new file mode 100644 index 000000000000..7b38512d6c41 --- /dev/null +++ b/drivers/tty/hvc/hvc_opal.c | |||
@@ -0,0 +1,424 @@ | |||
1 | /* | ||
2 | * opal driver interface to hvc_console.c | ||
3 | * | ||
4 | * Copyright 2011 Benjamin Herrenschmidt <benh@kernel.crashing.org>, IBM Corp. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | * | ||
20 | */ | ||
21 | |||
22 | #undef DEBUG | ||
23 | |||
24 | #include <linux/types.h> | ||
25 | #include <linux/init.h> | ||
26 | #include <linux/delay.h> | ||
27 | #include <linux/slab.h> | ||
28 | #include <linux/console.h> | ||
29 | #include <linux/of.h> | ||
30 | #include <linux/of_platform.h> | ||
31 | |||
32 | #include <asm/hvconsole.h> | ||
33 | #include <asm/prom.h> | ||
34 | #include <asm/firmware.h> | ||
35 | #include <asm/hvsi.h> | ||
36 | #include <asm/udbg.h> | ||
37 | #include <asm/opal.h> | ||
38 | |||
39 | #include "hvc_console.h" | ||
40 | |||
41 | static const char hvc_opal_name[] = "hvc_opal"; | ||
42 | |||
43 | static struct of_device_id hvc_opal_match[] __devinitdata = { | ||
44 | { .name = "serial", .compatible = "ibm,opal-console-raw" }, | ||
45 | { .name = "serial", .compatible = "ibm,opal-console-hvsi" }, | ||
46 | { }, | ||
47 | }; | ||
48 | |||
49 | typedef enum hv_protocol { | ||
50 | HV_PROTOCOL_RAW, | ||
51 | HV_PROTOCOL_HVSI | ||
52 | } hv_protocol_t; | ||
53 | |||
54 | struct hvc_opal_priv { | ||
55 | hv_protocol_t proto; /* Raw data or HVSI packets */ | ||
56 | struct hvsi_priv hvsi; /* HVSI specific data */ | ||
57 | }; | ||
58 | static struct hvc_opal_priv *hvc_opal_privs[MAX_NR_HVC_CONSOLES]; | ||
59 | |||
60 | /* For early boot console */ | ||
61 | static struct hvc_opal_priv hvc_opal_boot_priv; | ||
62 | static u32 hvc_opal_boot_termno; | ||
63 | |||
64 | static const struct hv_ops hvc_opal_raw_ops = { | ||
65 | .get_chars = opal_get_chars, | ||
66 | .put_chars = opal_put_chars, | ||
67 | .notifier_add = notifier_add_irq, | ||
68 | .notifier_del = notifier_del_irq, | ||
69 | .notifier_hangup = notifier_hangup_irq, | ||
70 | }; | ||
71 | |||
72 | static int hvc_opal_hvsi_get_chars(uint32_t vtermno, char *buf, int count) | ||
73 | { | ||
74 | struct hvc_opal_priv *pv = hvc_opal_privs[vtermno]; | ||
75 | |||
76 | if (WARN_ON(!pv)) | ||
77 | return -ENODEV; | ||
78 | |||
79 | return hvsilib_get_chars(&pv->hvsi, buf, count); | ||
80 | } | ||
81 | |||
82 | static int hvc_opal_hvsi_put_chars(uint32_t vtermno, const char *buf, int count) | ||
83 | { | ||
84 | struct hvc_opal_priv *pv = hvc_opal_privs[vtermno]; | ||
85 | |||
86 | if (WARN_ON(!pv)) | ||
87 | return -ENODEV; | ||
88 | |||
89 | return hvsilib_put_chars(&pv->hvsi, buf, count); | ||
90 | } | ||
91 | |||
92 | static int hvc_opal_hvsi_open(struct hvc_struct *hp, int data) | ||
93 | { | ||
94 | struct hvc_opal_priv *pv = hvc_opal_privs[hp->vtermno]; | ||
95 | int rc; | ||
96 | |||
97 | pr_devel("HVSI@%x: do open !\n", hp->vtermno); | ||
98 | |||
99 | rc = notifier_add_irq(hp, data); | ||
100 | if (rc) | ||
101 | return rc; | ||
102 | |||
103 | return hvsilib_open(&pv->hvsi, hp); | ||
104 | } | ||
105 | |||
106 | static void hvc_opal_hvsi_close(struct hvc_struct *hp, int data) | ||
107 | { | ||
108 | struct hvc_opal_priv *pv = hvc_opal_privs[hp->vtermno]; | ||
109 | |||
110 | pr_devel("HVSI@%x: do close !\n", hp->vtermno); | ||
111 | |||
112 | hvsilib_close(&pv->hvsi, hp); | ||
113 | |||
114 | notifier_del_irq(hp, data); | ||
115 | } | ||
116 | |||
117 | void hvc_opal_hvsi_hangup(struct hvc_struct *hp, int data) | ||
118 | { | ||
119 | struct hvc_opal_priv *pv = hvc_opal_privs[hp->vtermno]; | ||
120 | |||
121 | pr_devel("HVSI@%x: do hangup !\n", hp->vtermno); | ||
122 | |||
123 | hvsilib_close(&pv->hvsi, hp); | ||
124 | |||
125 | notifier_hangup_irq(hp, data); | ||
126 | } | ||
127 | |||
128 | static int hvc_opal_hvsi_tiocmget(struct hvc_struct *hp) | ||
129 | { | ||
130 | struct hvc_opal_priv *pv = hvc_opal_privs[hp->vtermno]; | ||
131 | |||
132 | if (!pv) | ||
133 | return -EINVAL; | ||
134 | return pv->hvsi.mctrl; | ||
135 | } | ||
136 | |||
137 | static int hvc_opal_hvsi_tiocmset(struct hvc_struct *hp, unsigned int set, | ||
138 | unsigned int clear) | ||
139 | { | ||
140 | struct hvc_opal_priv *pv = hvc_opal_privs[hp->vtermno]; | ||
141 | |||
142 | pr_devel("HVSI@%x: Set modem control, set=%x,clr=%x\n", | ||
143 | hp->vtermno, set, clear); | ||
144 | |||
145 | if (set & TIOCM_DTR) | ||
146 | hvsilib_write_mctrl(&pv->hvsi, 1); | ||
147 | else if (clear & TIOCM_DTR) | ||
148 | hvsilib_write_mctrl(&pv->hvsi, 0); | ||
149 | |||
150 | return 0; | ||
151 | } | ||
152 | |||
153 | static const struct hv_ops hvc_opal_hvsi_ops = { | ||
154 | .get_chars = hvc_opal_hvsi_get_chars, | ||
155 | .put_chars = hvc_opal_hvsi_put_chars, | ||
156 | .notifier_add = hvc_opal_hvsi_open, | ||
157 | .notifier_del = hvc_opal_hvsi_close, | ||
158 | .notifier_hangup = hvc_opal_hvsi_hangup, | ||
159 | .tiocmget = hvc_opal_hvsi_tiocmget, | ||
160 | .tiocmset = hvc_opal_hvsi_tiocmset, | ||
161 | }; | ||
162 | |||
163 | static int __devinit hvc_opal_probe(struct platform_device *dev) | ||
164 | { | ||
165 | const struct hv_ops *ops; | ||
166 | struct hvc_struct *hp; | ||
167 | struct hvc_opal_priv *pv; | ||
168 | hv_protocol_t proto; | ||
169 | unsigned int termno, boot = 0; | ||
170 | const __be32 *reg; | ||
171 | |||
172 | if (of_device_is_compatible(dev->dev.of_node, "ibm,opal-console-raw")) { | ||
173 | proto = HV_PROTOCOL_RAW; | ||
174 | ops = &hvc_opal_raw_ops; | ||
175 | } else if (of_device_is_compatible(dev->dev.of_node, | ||
176 | "ibm,opal-console-hvsi")) { | ||
177 | proto = HV_PROTOCOL_HVSI; | ||
178 | ops = &hvc_opal_hvsi_ops; | ||
179 | } else { | ||
180 | pr_err("hvc_opal: Unkown protocol for %s\n", | ||
181 | dev->dev.of_node->full_name); | ||
182 | return -ENXIO; | ||
183 | } | ||
184 | |||
185 | reg = of_get_property(dev->dev.of_node, "reg", NULL); | ||
186 | termno = reg ? be32_to_cpup(reg) : 0; | ||
187 | |||
188 | /* Is it our boot one ? */ | ||
189 | if (hvc_opal_privs[termno] == &hvc_opal_boot_priv) { | ||
190 | pv = hvc_opal_privs[termno]; | ||
191 | boot = 1; | ||
192 | } else if (hvc_opal_privs[termno] == NULL) { | ||
193 | pv = kzalloc(sizeof(struct hvc_opal_priv), GFP_KERNEL); | ||
194 | if (!pv) | ||
195 | return -ENOMEM; | ||
196 | pv->proto = proto; | ||
197 | hvc_opal_privs[termno] = pv; | ||
198 | if (proto == HV_PROTOCOL_HVSI) | ||
199 | hvsilib_init(&pv->hvsi, opal_get_chars, opal_put_chars, | ||
200 | termno, 0); | ||
201 | |||
202 | /* Instanciate now to establish a mapping index==vtermno */ | ||
203 | hvc_instantiate(termno, termno, ops); | ||
204 | } else { | ||
205 | pr_err("hvc_opal: Device %s has duplicate terminal number #%d\n", | ||
206 | dev->dev.of_node->full_name, termno); | ||
207 | return -ENXIO; | ||
208 | } | ||
209 | |||
210 | pr_info("hvc%d: %s protocol on %s%s\n", termno, | ||
211 | proto == HV_PROTOCOL_RAW ? "raw" : "hvsi", | ||
212 | dev->dev.of_node->full_name, | ||
213 | boot ? " (boot console)" : ""); | ||
214 | |||
215 | /* We don't do IRQ yet */ | ||
216 | hp = hvc_alloc(termno, 0, ops, MAX_VIO_PUT_CHARS); | ||
217 | if (IS_ERR(hp)) | ||
218 | return PTR_ERR(hp); | ||
219 | dev_set_drvdata(&dev->dev, hp); | ||
220 | |||
221 | return 0; | ||
222 | } | ||
223 | |||
224 | static int __devexit hvc_opal_remove(struct platform_device *dev) | ||
225 | { | ||
226 | struct hvc_struct *hp = dev_get_drvdata(&dev->dev); | ||
227 | int rc, termno; | ||
228 | |||
229 | termno = hp->vtermno; | ||
230 | rc = hvc_remove(hp); | ||
231 | if (rc == 0) { | ||
232 | if (hvc_opal_privs[termno] != &hvc_opal_boot_priv) | ||
233 | kfree(hvc_opal_privs[termno]); | ||
234 | hvc_opal_privs[termno] = NULL; | ||
235 | } | ||
236 | return rc; | ||
237 | } | ||
238 | |||
239 | static struct platform_driver hvc_opal_driver = { | ||
240 | .probe = hvc_opal_probe, | ||
241 | .remove = __devexit_p(hvc_opal_remove), | ||
242 | .driver = { | ||
243 | .name = hvc_opal_name, | ||
244 | .owner = THIS_MODULE, | ||
245 | .of_match_table = hvc_opal_match, | ||
246 | } | ||
247 | }; | ||
248 | |||
249 | static int __init hvc_opal_init(void) | ||
250 | { | ||
251 | if (!firmware_has_feature(FW_FEATURE_OPAL)) | ||
252 | return -ENODEV; | ||
253 | |||
254 | /* Register as a vio device to receive callbacks */ | ||
255 | return platform_driver_register(&hvc_opal_driver); | ||
256 | } | ||
257 | module_init(hvc_opal_init); | ||
258 | |||
259 | static void __exit hvc_opal_exit(void) | ||
260 | { | ||
261 | platform_driver_unregister(&hvc_opal_driver); | ||
262 | } | ||
263 | module_exit(hvc_opal_exit); | ||
264 | |||
265 | static void udbg_opal_putc(char c) | ||
266 | { | ||
267 | unsigned int termno = hvc_opal_boot_termno; | ||
268 | int count = -1; | ||
269 | |||
270 | if (c == '\n') | ||
271 | udbg_opal_putc('\r'); | ||
272 | |||
273 | do { | ||
274 | switch(hvc_opal_boot_priv.proto) { | ||
275 | case HV_PROTOCOL_RAW: | ||
276 | count = opal_put_chars(termno, &c, 1); | ||
277 | break; | ||
278 | case HV_PROTOCOL_HVSI: | ||
279 | count = hvc_opal_hvsi_put_chars(termno, &c, 1); | ||
280 | break; | ||
281 | } | ||
282 | } while(count == 0 || count == -EAGAIN); | ||
283 | } | ||
284 | |||
285 | static int udbg_opal_getc_poll(void) | ||
286 | { | ||
287 | unsigned int termno = hvc_opal_boot_termno; | ||
288 | int rc = 0; | ||
289 | char c; | ||
290 | |||
291 | switch(hvc_opal_boot_priv.proto) { | ||
292 | case HV_PROTOCOL_RAW: | ||
293 | rc = opal_get_chars(termno, &c, 1); | ||
294 | break; | ||
295 | case HV_PROTOCOL_HVSI: | ||
296 | rc = hvc_opal_hvsi_get_chars(termno, &c, 1); | ||
297 | break; | ||
298 | } | ||
299 | if (!rc) | ||
300 | return -1; | ||
301 | return c; | ||
302 | } | ||
303 | |||
304 | static int udbg_opal_getc(void) | ||
305 | { | ||
306 | int ch; | ||
307 | for (;;) { | ||
308 | ch = udbg_opal_getc_poll(); | ||
309 | if (ch == -1) { | ||
310 | /* This shouldn't be needed...but... */ | ||
311 | volatile unsigned long delay; | ||
312 | for (delay=0; delay < 2000000; delay++) | ||
313 | ; | ||
314 | } else { | ||
315 | return ch; | ||
316 | } | ||
317 | } | ||
318 | } | ||
319 | |||
320 | static void udbg_init_opal_common(void) | ||
321 | { | ||
322 | udbg_putc = udbg_opal_putc; | ||
323 | udbg_getc = udbg_opal_getc; | ||
324 | udbg_getc_poll = udbg_opal_getc_poll; | ||
325 | tb_ticks_per_usec = 0x200; /* Make udelay not suck */ | ||
326 | } | ||
327 | |||
328 | void __init hvc_opal_init_early(void) | ||
329 | { | ||
330 | struct device_node *stdout_node = NULL; | ||
331 | const u32 *termno; | ||
332 | const char *name = NULL; | ||
333 | const struct hv_ops *ops; | ||
334 | u32 index; | ||
335 | |||
336 | /* find the boot console from /chosen/stdout */ | ||
337 | if (of_chosen) | ||
338 | name = of_get_property(of_chosen, "linux,stdout-path", NULL); | ||
339 | if (name) { | ||
340 | stdout_node = of_find_node_by_path(name); | ||
341 | if (!stdout_node) { | ||
342 | pr_err("hvc_opal: Failed to locate default console!\n"); | ||
343 | return; | ||
344 | } | ||
345 | } else { | ||
346 | struct device_node *opal, *np; | ||
347 | |||
348 | /* Current OPAL takeover doesn't provide the stdout | ||
349 | * path, so we hard wire it | ||
350 | */ | ||
351 | opal = of_find_node_by_path("/ibm,opal/consoles"); | ||
352 | if (opal) | ||
353 | pr_devel("hvc_opal: Found consoles in new location\n"); | ||
354 | if (!opal) { | ||
355 | opal = of_find_node_by_path("/ibm,opal"); | ||
356 | if (opal) | ||
357 | pr_devel("hvc_opal: " | ||
358 | "Found consoles in old location\n"); | ||
359 | } | ||
360 | if (!opal) | ||
361 | return; | ||
362 | for_each_child_of_node(opal, np) { | ||
363 | if (!strcmp(np->name, "serial")) { | ||
364 | stdout_node = np; | ||
365 | break; | ||
366 | } | ||
367 | } | ||
368 | of_node_put(opal); | ||
369 | } | ||
370 | if (!stdout_node) | ||
371 | return; | ||
372 | termno = of_get_property(stdout_node, "reg", NULL); | ||
373 | index = termno ? *termno : 0; | ||
374 | if (index >= MAX_NR_HVC_CONSOLES) | ||
375 | return; | ||
376 | hvc_opal_privs[index] = &hvc_opal_boot_priv; | ||
377 | |||
378 | /* Check the protocol */ | ||
379 | if (of_device_is_compatible(stdout_node, "ibm,opal-console-raw")) { | ||
380 | hvc_opal_boot_priv.proto = HV_PROTOCOL_RAW; | ||
381 | ops = &hvc_opal_raw_ops; | ||
382 | pr_devel("hvc_opal: Found RAW console\n"); | ||
383 | } | ||
384 | else if (of_device_is_compatible(stdout_node,"ibm,opal-console-hvsi")) { | ||
385 | hvc_opal_boot_priv.proto = HV_PROTOCOL_HVSI; | ||
386 | ops = &hvc_opal_hvsi_ops; | ||
387 | hvsilib_init(&hvc_opal_boot_priv.hvsi, opal_get_chars, | ||
388 | opal_put_chars, index, 1); | ||
389 | /* HVSI, perform the handshake now */ | ||
390 | hvsilib_establish(&hvc_opal_boot_priv.hvsi); | ||
391 | pr_devel("hvc_opal: Found HVSI console\n"); | ||
392 | } else | ||
393 | goto out; | ||
394 | hvc_opal_boot_termno = index; | ||
395 | udbg_init_opal_common(); | ||
396 | add_preferred_console("hvc", index, NULL); | ||
397 | hvc_instantiate(index, index, ops); | ||
398 | out: | ||
399 | of_node_put(stdout_node); | ||
400 | } | ||
401 | |||
402 | #ifdef CONFIG_PPC_EARLY_DEBUG_OPAL_RAW | ||
403 | void __init udbg_init_debug_opal(void) | ||
404 | { | ||
405 | u32 index = CONFIG_PPC_EARLY_DEBUG_OPAL_VTERMNO; | ||
406 | hvc_opal_privs[index] = &hvc_opal_boot_priv; | ||
407 | hvc_opal_boot_priv.proto = HV_PROTOCOL_RAW; | ||
408 | hvc_opal_boot_termno = index; | ||
409 | udbg_init_opal_common(); | ||
410 | } | ||
411 | #endif /* CONFIG_PPC_EARLY_DEBUG_OPAL_RAW */ | ||
412 | |||
413 | #ifdef CONFIG_PPC_EARLY_DEBUG_OPAL_HVSI | ||
414 | void __init udbg_init_debug_opal_hvsi(void) | ||
415 | { | ||
416 | u32 index = CONFIG_PPC_EARLY_DEBUG_OPAL_VTERMNO; | ||
417 | hvc_opal_privs[index] = &hvc_opal_boot_priv; | ||
418 | hvc_opal_boot_termno = index; | ||
419 | udbg_init_opal_common(); | ||
420 | hvsilib_init(&hvc_opal_boot_priv.hvsi, opal_get_chars, opal_put_chars, | ||
421 | index, 1); | ||
422 | hvsilib_establish(&hvc_opal_boot_priv.hvsi); | ||
423 | } | ||
424 | #endif /* CONFIG_PPC_EARLY_DEBUG_OPAL_HVSI */ | ||
diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c index 55882b5930a6..b9040bec36bd 100644 --- a/drivers/tty/hvc/hvcs.c +++ b/drivers/tty/hvc/hvcs.c | |||
@@ -1532,7 +1532,7 @@ static int __devinit hvcs_initialize(void) | |||
1532 | goto register_fail; | 1532 | goto register_fail; |
1533 | } | 1533 | } |
1534 | 1534 | ||
1535 | hvcs_pi_buff = kmalloc(PAGE_SIZE, GFP_KERNEL); | 1535 | hvcs_pi_buff = (unsigned long *) __get_free_page(GFP_KERNEL); |
1536 | if (!hvcs_pi_buff) { | 1536 | if (!hvcs_pi_buff) { |
1537 | rc = -ENOMEM; | 1537 | rc = -ENOMEM; |
1538 | goto buff_alloc_fail; | 1538 | goto buff_alloc_fail; |
@@ -1548,7 +1548,7 @@ static int __devinit hvcs_initialize(void) | |||
1548 | return 0; | 1548 | return 0; |
1549 | 1549 | ||
1550 | kthread_fail: | 1550 | kthread_fail: |
1551 | kfree(hvcs_pi_buff); | 1551 | free_page((unsigned long)hvcs_pi_buff); |
1552 | buff_alloc_fail: | 1552 | buff_alloc_fail: |
1553 | tty_unregister_driver(hvcs_tty_driver); | 1553 | tty_unregister_driver(hvcs_tty_driver); |
1554 | register_fail: | 1554 | register_fail: |
@@ -1597,7 +1597,7 @@ static void __exit hvcs_module_exit(void) | |||
1597 | kthread_stop(hvcs_task); | 1597 | kthread_stop(hvcs_task); |
1598 | 1598 | ||
1599 | spin_lock(&hvcs_pi_lock); | 1599 | spin_lock(&hvcs_pi_lock); |
1600 | kfree(hvcs_pi_buff); | 1600 | free_page((unsigned long)hvcs_pi_buff); |
1601 | hvcs_pi_buff = NULL; | 1601 | hvcs_pi_buff = NULL; |
1602 | spin_unlock(&hvcs_pi_lock); | 1602 | spin_unlock(&hvcs_pi_lock); |
1603 | 1603 | ||
diff --git a/drivers/tty/hvc/hvsi_lib.c b/drivers/tty/hvc/hvsi_lib.c index bd9b09827b24..6f4dd83d8695 100644 --- a/drivers/tty/hvc/hvsi_lib.c +++ b/drivers/tty/hvc/hvsi_lib.c | |||
@@ -183,7 +183,7 @@ int hvsilib_get_chars(struct hvsi_priv *pv, char *buf, int count) | |||
183 | unsigned int tries, read = 0; | 183 | unsigned int tries, read = 0; |
184 | 184 | ||
185 | if (WARN_ON(!pv)) | 185 | if (WARN_ON(!pv)) |
186 | return 0; | 186 | return -ENXIO; |
187 | 187 | ||
188 | /* If we aren't open, don't do anything in order to avoid races | 188 | /* If we aren't open, don't do anything in order to avoid races |
189 | * with connection establishment. The hvc core will call this | 189 | * with connection establishment. The hvc core will call this |
@@ -234,7 +234,7 @@ int hvsilib_put_chars(struct hvsi_priv *pv, const char *buf, int count) | |||
234 | int rc, adjcount = min(count, HVSI_MAX_OUTGOING_DATA); | 234 | int rc, adjcount = min(count, HVSI_MAX_OUTGOING_DATA); |
235 | 235 | ||
236 | if (WARN_ON(!pv)) | 236 | if (WARN_ON(!pv)) |
237 | return 0; | 237 | return -ENODEV; |
238 | 238 | ||
239 | dp.hdr.type = VS_DATA_PACKET_HEADER; | 239 | dp.hdr.type = VS_DATA_PACKET_HEADER; |
240 | dp.hdr.len = adjcount + sizeof(struct hvsi_header); | 240 | dp.hdr.len = adjcount + sizeof(struct hvsi_header); |
diff --git a/drivers/tty/serial/8250.c b/drivers/tty/serial/8250.c index a87a56cb5417..eeadf1b8e093 100644 --- a/drivers/tty/serial/8250.c +++ b/drivers/tty/serial/8250.c | |||
@@ -450,24 +450,6 @@ static void au_serial_out(struct uart_port *p, int offset, int value) | |||
450 | __raw_writel(value, p->membase + offset); | 450 | __raw_writel(value, p->membase + offset); |
451 | } | 451 | } |
452 | 452 | ||
453 | static unsigned int tsi_serial_in(struct uart_port *p, int offset) | ||
454 | { | ||
455 | unsigned int tmp; | ||
456 | offset = map_8250_in_reg(p, offset) << p->regshift; | ||
457 | if (offset == UART_IIR) { | ||
458 | tmp = readl(p->membase + (UART_IIR & ~3)); | ||
459 | return (tmp >> 16) & 0xff; /* UART_IIR % 4 == 2 */ | ||
460 | } else | ||
461 | return readb(p->membase + offset); | ||
462 | } | ||
463 | |||
464 | static void tsi_serial_out(struct uart_port *p, int offset, int value) | ||
465 | { | ||
466 | offset = map_8250_out_reg(p, offset) << p->regshift; | ||
467 | if (!((offset == UART_IER) && (value & UART_IER_UUE))) | ||
468 | writeb(value, p->membase + offset); | ||
469 | } | ||
470 | |||
471 | static unsigned int io_serial_in(struct uart_port *p, int offset) | 453 | static unsigned int io_serial_in(struct uart_port *p, int offset) |
472 | { | 454 | { |
473 | offset = map_8250_in_reg(p, offset) << p->regshift; | 455 | offset = map_8250_in_reg(p, offset) << p->regshift; |
@@ -508,11 +490,6 @@ static void set_io_from_upio(struct uart_port *p) | |||
508 | p->serial_out = au_serial_out; | 490 | p->serial_out = au_serial_out; |
509 | break; | 491 | break; |
510 | 492 | ||
511 | case UPIO_TSI: | ||
512 | p->serial_in = tsi_serial_in; | ||
513 | p->serial_out = tsi_serial_out; | ||
514 | break; | ||
515 | |||
516 | default: | 493 | default: |
517 | p->serial_in = io_serial_in; | 494 | p->serial_in = io_serial_in; |
518 | p->serial_out = io_serial_out; | 495 | p->serial_out = io_serial_out; |
diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c index 29cbfd8c4e7c..8131e2c28015 100644 --- a/drivers/tty/serial/msm_serial.c +++ b/drivers/tty/serial/msm_serial.c | |||
@@ -19,6 +19,7 @@ | |||
19 | # define SUPPORT_SYSRQ | 19 | # define SUPPORT_SYSRQ |
20 | #endif | 20 | #endif |
21 | 21 | ||
22 | #include <linux/atomic.h> | ||
22 | #include <linux/hrtimer.h> | 23 | #include <linux/hrtimer.h> |
23 | #include <linux/module.h> | 24 | #include <linux/module.h> |
24 | #include <linux/io.h> | 25 | #include <linux/io.h> |
@@ -33,6 +34,8 @@ | |||
33 | #include <linux/clk.h> | 34 | #include <linux/clk.h> |
34 | #include <linux/platform_device.h> | 35 | #include <linux/platform_device.h> |
35 | #include <linux/delay.h> | 36 | #include <linux/delay.h> |
37 | #include <linux/of.h> | ||
38 | #include <linux/of_device.h> | ||
36 | 39 | ||
37 | #include "msm_serial.h" | 40 | #include "msm_serial.h" |
38 | 41 | ||
@@ -589,9 +592,8 @@ static void msm_release_port(struct uart_port *port) | |||
589 | iowrite32(GSBI_PROTOCOL_IDLE, msm_port->gsbi_base + | 592 | iowrite32(GSBI_PROTOCOL_IDLE, msm_port->gsbi_base + |
590 | GSBI_CONTROL); | 593 | GSBI_CONTROL); |
591 | 594 | ||
592 | gsbi_resource = platform_get_resource_byname(pdev, | 595 | gsbi_resource = platform_get_resource(pdev, |
593 | IORESOURCE_MEM, | 596 | IORESOURCE_MEM, 1); |
594 | "gsbi_resource"); | ||
595 | 597 | ||
596 | if (unlikely(!gsbi_resource)) | 598 | if (unlikely(!gsbi_resource)) |
597 | return; | 599 | return; |
@@ -612,8 +614,7 @@ static int msm_request_port(struct uart_port *port) | |||
612 | resource_size_t size; | 614 | resource_size_t size; |
613 | int ret; | 615 | int ret; |
614 | 616 | ||
615 | uart_resource = platform_get_resource_byname(pdev, IORESOURCE_MEM, | 617 | uart_resource = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
616 | "uart_resource"); | ||
617 | if (unlikely(!uart_resource)) | 618 | if (unlikely(!uart_resource)) |
618 | return -ENXIO; | 619 | return -ENXIO; |
619 | 620 | ||
@@ -628,8 +629,7 @@ static int msm_request_port(struct uart_port *port) | |||
628 | goto fail_release_port; | 629 | goto fail_release_port; |
629 | } | 630 | } |
630 | 631 | ||
631 | gsbi_resource = platform_get_resource_byname(pdev, IORESOURCE_MEM, | 632 | gsbi_resource = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
632 | "gsbi_resource"); | ||
633 | /* Is this a GSBI-based port? */ | 633 | /* Is this a GSBI-based port? */ |
634 | if (gsbi_resource) { | 634 | if (gsbi_resource) { |
635 | size = resource_size(gsbi_resource); | 635 | size = resource_size(gsbi_resource); |
@@ -857,6 +857,8 @@ static struct uart_driver msm_uart_driver = { | |||
857 | .cons = MSM_CONSOLE, | 857 | .cons = MSM_CONSOLE, |
858 | }; | 858 | }; |
859 | 859 | ||
860 | static atomic_t msm_uart_next_id = ATOMIC_INIT(0); | ||
861 | |||
860 | static int __init msm_serial_probe(struct platform_device *pdev) | 862 | static int __init msm_serial_probe(struct platform_device *pdev) |
861 | { | 863 | { |
862 | struct msm_port *msm_port; | 864 | struct msm_port *msm_port; |
@@ -864,6 +866,9 @@ static int __init msm_serial_probe(struct platform_device *pdev) | |||
864 | struct uart_port *port; | 866 | struct uart_port *port; |
865 | int irq; | 867 | int irq; |
866 | 868 | ||
869 | if (pdev->id == -1) | ||
870 | pdev->id = atomic_inc_return(&msm_uart_next_id) - 1; | ||
871 | |||
867 | if (unlikely(pdev->id < 0 || pdev->id >= UART_NR)) | 872 | if (unlikely(pdev->id < 0 || pdev->id >= UART_NR)) |
868 | return -ENXIO; | 873 | return -ENXIO; |
869 | 874 | ||
@@ -873,7 +878,7 @@ static int __init msm_serial_probe(struct platform_device *pdev) | |||
873 | port->dev = &pdev->dev; | 878 | port->dev = &pdev->dev; |
874 | msm_port = UART_TO_MSM(port); | 879 | msm_port = UART_TO_MSM(port); |
875 | 880 | ||
876 | if (platform_get_resource_byname(pdev, IORESOURCE_MEM, "gsbi_resource")) | 881 | if (platform_get_resource(pdev, IORESOURCE_MEM, 1)) |
877 | msm_port->is_uartdm = 1; | 882 | msm_port->is_uartdm = 1; |
878 | else | 883 | else |
879 | msm_port->is_uartdm = 0; | 884 | msm_port->is_uartdm = 0; |
@@ -897,8 +902,7 @@ static int __init msm_serial_probe(struct platform_device *pdev) | |||
897 | printk(KERN_INFO "uartclk = %d\n", port->uartclk); | 902 | printk(KERN_INFO "uartclk = %d\n", port->uartclk); |
898 | 903 | ||
899 | 904 | ||
900 | resource = platform_get_resource_byname(pdev, IORESOURCE_MEM, | 905 | resource = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
901 | "uart_resource"); | ||
902 | if (unlikely(!resource)) | 906 | if (unlikely(!resource)) |
903 | return -ENXIO; | 907 | return -ENXIO; |
904 | port->mapbase = resource->start; | 908 | port->mapbase = resource->start; |
@@ -922,11 +926,17 @@ static int __devexit msm_serial_remove(struct platform_device *pdev) | |||
922 | return 0; | 926 | return 0; |
923 | } | 927 | } |
924 | 928 | ||
929 | static struct of_device_id msm_match_table[] = { | ||
930 | { .compatible = "qcom,msm-uart" }, | ||
931 | {} | ||
932 | }; | ||
933 | |||
925 | static struct platform_driver msm_platform_driver = { | 934 | static struct platform_driver msm_platform_driver = { |
926 | .remove = msm_serial_remove, | 935 | .remove = msm_serial_remove, |
927 | .driver = { | 936 | .driver = { |
928 | .name = "msm_serial", | 937 | .name = "msm_serial", |
929 | .owner = THIS_MODULE, | 938 | .owner = THIS_MODULE, |
939 | .of_match_table = msm_match_table, | ||
930 | }, | 940 | }, |
931 | }; | 941 | }; |
932 | 942 | ||
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 9871c57b348e..1945c70539c2 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c | |||
@@ -1446,12 +1446,8 @@ static bool filter(struct dma_chan *chan, void *slave) | |||
1446 | dev_dbg(chan->device->dev, "%s: slave ID %d\n", __func__, | 1446 | dev_dbg(chan->device->dev, "%s: slave ID %d\n", __func__, |
1447 | param->slave_id); | 1447 | param->slave_id); |
1448 | 1448 | ||
1449 | if (param->dma_dev == chan->device->dev) { | 1449 | chan->private = param; |
1450 | chan->private = param; | 1450 | return true; |
1451 | return true; | ||
1452 | } else { | ||
1453 | return false; | ||
1454 | } | ||
1455 | } | 1451 | } |
1456 | 1452 | ||
1457 | static void rx_timer_fn(unsigned long arg) | 1453 | static void rx_timer_fn(unsigned long arg) |
@@ -1477,10 +1473,10 @@ static void sci_request_dma(struct uart_port *port) | |||
1477 | dma_cap_mask_t mask; | 1473 | dma_cap_mask_t mask; |
1478 | int nent; | 1474 | int nent; |
1479 | 1475 | ||
1480 | dev_dbg(port->dev, "%s: port %d DMA %p\n", __func__, | 1476 | dev_dbg(port->dev, "%s: port %d\n", __func__, |
1481 | port->line, s->cfg->dma_dev); | 1477 | port->line); |
1482 | 1478 | ||
1483 | if (!s->cfg->dma_dev) | 1479 | if (s->cfg->dma_slave_tx <= 0 || s->cfg->dma_slave_rx <= 0) |
1484 | return; | 1480 | return; |
1485 | 1481 | ||
1486 | dma_cap_zero(mask); | 1482 | dma_cap_zero(mask); |
@@ -1490,7 +1486,6 @@ static void sci_request_dma(struct uart_port *port) | |||
1490 | 1486 | ||
1491 | /* Slave ID, e.g., SHDMA_SLAVE_SCIF0_TX */ | 1487 | /* Slave ID, e.g., SHDMA_SLAVE_SCIF0_TX */ |
1492 | param->slave_id = s->cfg->dma_slave_tx; | 1488 | param->slave_id = s->cfg->dma_slave_tx; |
1493 | param->dma_dev = s->cfg->dma_dev; | ||
1494 | 1489 | ||
1495 | s->cookie_tx = -EINVAL; | 1490 | s->cookie_tx = -EINVAL; |
1496 | chan = dma_request_channel(mask, filter, param); | 1491 | chan = dma_request_channel(mask, filter, param); |
@@ -1519,7 +1514,6 @@ static void sci_request_dma(struct uart_port *port) | |||
1519 | 1514 | ||
1520 | /* Slave ID, e.g., SHDMA_SLAVE_SCIF0_RX */ | 1515 | /* Slave ID, e.g., SHDMA_SLAVE_SCIF0_RX */ |
1521 | param->slave_id = s->cfg->dma_slave_rx; | 1516 | param->slave_id = s->cfg->dma_slave_rx; |
1522 | param->dma_dev = s->cfg->dma_dev; | ||
1523 | 1517 | ||
1524 | chan = dma_request_channel(mask, filter, param); | 1518 | chan = dma_request_channel(mask, filter, param); |
1525 | dev_dbg(port->dev, "%s: RX: got channel %p\n", __func__, chan); | 1519 | dev_dbg(port->dev, "%s: RX: got channel %p\n", __func__, chan); |
@@ -1564,9 +1558,6 @@ static void sci_free_dma(struct uart_port *port) | |||
1564 | { | 1558 | { |
1565 | struct sci_port *s = to_sci_port(port); | 1559 | struct sci_port *s = to_sci_port(port); |
1566 | 1560 | ||
1567 | if (!s->cfg->dma_dev) | ||
1568 | return; | ||
1569 | |||
1570 | if (s->chan_tx) | 1561 | if (s->chan_tx) |
1571 | sci_tx_dma_release(s, false); | 1562 | sci_tx_dma_release(s, false); |
1572 | if (s->chan_rx) | 1563 | if (s->chan_rx) |
@@ -1981,9 +1972,9 @@ static int __devinit sci_init_single(struct platform_device *dev, | |||
1981 | port->serial_in = sci_serial_in; | 1972 | port->serial_in = sci_serial_in; |
1982 | port->serial_out = sci_serial_out; | 1973 | port->serial_out = sci_serial_out; |
1983 | 1974 | ||
1984 | if (p->dma_dev) | 1975 | if (p->dma_slave_tx > 0 && p->dma_slave_rx > 0) |
1985 | dev_dbg(port->dev, "DMA device %p, tx %d, rx %d\n", | 1976 | dev_dbg(port->dev, "DMA tx %d, rx %d\n", |
1986 | p->dma_dev, p->dma_slave_tx, p->dma_slave_rx); | 1977 | p->dma_slave_tx, p->dma_slave_rx); |
1987 | 1978 | ||
1988 | return 0; | 1979 | return 0; |
1989 | } | 1980 | } |