diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-14 11:53:39 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-08-14 11:53:39 -0400 |
commit | ae36e95cf81c98b111b84317adeb358aaffa80e2 (patch) | |
tree | 87ef144d3392cca199448117a737c657b7c4663a /drivers/tty | |
parent | cc8a44c671fd3a2c792e9e1f59ea1df52697cc8b (diff) | |
parent | 663d3f7c2e5e1b018a4c53277ccfde40329d98ca (diff) |
Merge tag 'devicetree-for-linus' of git://git.secretlab.ca/git/linux
Pull device tree updates from Grant Likely:
"The branch contains the following device tree changes the v3.17 merge
window:
Group changes to the device tree. In preparation for adding device
tree overlay support, OF_DYNAMIC is reworked so that a set of device
tree changes can be prepared and applied to the tree all at once.
OF_RECONFIG notifiers see the most significant change here so that
users always get a consistent view of the tree. Notifiers generation
is moved from before a change to after it, and notifiers for a group
of changes are emitted after the entire block of changes have been
applied
Automatic console selection from DT. Console drivers can now use
of_console_check() to see if the device node is specified as a console
device. If so then it gets added as a preferred console. UART
devices get this support automatically when uart_add_one_port() is
called.
DT unit tests no longer depend on pre-loaded data in the device tree.
Data is loaded dynamically at the start of unit tests, and then
unloaded again when the tests have completed.
Also contains a few bugfixes for reserved regions and early memory
setup"
* tag 'devicetree-for-linus' of git://git.secretlab.ca/git/linux: (21 commits)
of: Fixing OF Selftest build error
drivers: of: add automated assignment of reserved regions to client devices
of: Use proper types for checking memory overflow
of: typo fix in __of_prop_dup()
Adding selftest testdata dynamically into live tree
of: Add todo tasklist for Devicetree
of: Transactional DT support.
of: Reorder device tree changes and notifiers
of: Move dynamic node fixups out of powerpc and into common code
of: Make sure attached nodes don't carry along extra children
of: Make devicetree sysfs update functions consistent.
of: Create unlocked versions of node and property add/remove functions
OF: Utility helper functions for dynamic nodes
of: Move CONFIG_OF_DYNAMIC code into a separate file
of: rename of_aliases_mutex to just of_mutex
of/platform: Fix of_platform_device_destroy iteration of devices
of: Migrate of_find_node_by_name() users to for_each_node_by_name()
tty: Update hypervisor tty drivers to use core stdout parsing code.
arm/versatile: Add the uart as the stdout device.
of: Enable console on serial ports specified by /chosen/stdout-path
...
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/ehv_bytechan.c | 43 | ||||
-rw-r--r-- | drivers/tty/hvc/hvc_opal.c | 15 | ||||
-rw-r--r-- | drivers/tty/hvc/hvc_vio.c | 29 | ||||
-rw-r--r-- | drivers/tty/serial/pmac_zilog.c | 9 | ||||
-rw-r--r-- | drivers/tty/serial/serial_core.c | 3 |
5 files changed, 23 insertions, 76 deletions
diff --git a/drivers/tty/ehv_bytechan.c b/drivers/tty/ehv_bytechan.c index 0419b69e270f..4f485e88f60c 100644 --- a/drivers/tty/ehv_bytechan.c +++ b/drivers/tty/ehv_bytechan.c | |||
@@ -108,55 +108,23 @@ static void disable_tx_interrupt(struct ehv_bc_data *bc) | |||
108 | * | 108 | * |
109 | * The byte channel to be used for the console is specified via a "stdout" | 109 | * The byte channel to be used for the console is specified via a "stdout" |
110 | * property in the /chosen node. | 110 | * property in the /chosen node. |
111 | * | ||
112 | * For compatible with legacy device trees, we also look for a "stdout" alias. | ||
113 | */ | 111 | */ |
114 | static int find_console_handle(void) | 112 | static int find_console_handle(void) |
115 | { | 113 | { |
116 | struct device_node *np, *np2; | 114 | struct device_node *np = of_stdout; |
117 | const char *sprop = NULL; | 115 | const char *sprop = NULL; |
118 | const uint32_t *iprop; | 116 | const uint32_t *iprop; |
119 | 117 | ||
120 | np = of_find_node_by_path("/chosen"); | ||
121 | if (np) | ||
122 | sprop = of_get_property(np, "stdout-path", NULL); | ||
123 | |||
124 | if (!np || !sprop) { | ||
125 | of_node_put(np); | ||
126 | np = of_find_node_by_name(NULL, "aliases"); | ||
127 | if (np) | ||
128 | sprop = of_get_property(np, "stdout", NULL); | ||
129 | } | ||
130 | |||
131 | if (!sprop) { | ||
132 | of_node_put(np); | ||
133 | return 0; | ||
134 | } | ||
135 | |||
136 | /* We don't care what the aliased node is actually called. We only | 118 | /* We don't care what the aliased node is actually called. We only |
137 | * care if it's compatible with "epapr,hv-byte-channel", because that | 119 | * care if it's compatible with "epapr,hv-byte-channel", because that |
138 | * indicates that it's a byte channel node. We use a temporary | 120 | * indicates that it's a byte channel node. |
139 | * variable, 'np2', because we can't release 'np' until we're done with | ||
140 | * 'sprop'. | ||
141 | */ | 121 | */ |
142 | np2 = of_find_node_by_path(sprop); | 122 | if (!np || !of_device_is_compatible(np, "epapr,hv-byte-channel")) |
143 | of_node_put(np); | ||
144 | np = np2; | ||
145 | if (!np) { | ||
146 | pr_warning("ehv-bc: stdout node '%s' does not exist\n", sprop); | ||
147 | return 0; | ||
148 | } | ||
149 | |||
150 | /* Is it a byte channel? */ | ||
151 | if (!of_device_is_compatible(np, "epapr,hv-byte-channel")) { | ||
152 | of_node_put(np); | ||
153 | return 0; | 123 | return 0; |
154 | } | ||
155 | 124 | ||
156 | stdout_irq = irq_of_parse_and_map(np, 0); | 125 | stdout_irq = irq_of_parse_and_map(np, 0); |
157 | if (stdout_irq == NO_IRQ) { | 126 | if (stdout_irq == NO_IRQ) { |
158 | pr_err("ehv-bc: no 'interrupts' property in %s node\n", sprop); | 127 | pr_err("ehv-bc: no 'interrupts' property in %s node\n", np->full_name); |
159 | of_node_put(np); | ||
160 | return 0; | 128 | return 0; |
161 | } | 129 | } |
162 | 130 | ||
@@ -167,12 +135,9 @@ static int find_console_handle(void) | |||
167 | if (!iprop) { | 135 | if (!iprop) { |
168 | pr_err("ehv-bc: no 'hv-handle' property in %s node\n", | 136 | pr_err("ehv-bc: no 'hv-handle' property in %s node\n", |
169 | np->name); | 137 | np->name); |
170 | of_node_put(np); | ||
171 | return 0; | 138 | return 0; |
172 | } | 139 | } |
173 | stdout_bc = be32_to_cpu(*iprop); | 140 | stdout_bc = be32_to_cpu(*iprop); |
174 | |||
175 | of_node_put(np); | ||
176 | return 1; | 141 | return 1; |
177 | } | 142 | } |
178 | 143 | ||
diff --git a/drivers/tty/hvc/hvc_opal.c b/drivers/tty/hvc/hvc_opal.c index a585079b4b38..a2cc5f834c63 100644 --- a/drivers/tty/hvc/hvc_opal.c +++ b/drivers/tty/hvc/hvc_opal.c | |||
@@ -342,22 +342,13 @@ static void udbg_init_opal_common(void) | |||
342 | 342 | ||
343 | void __init hvc_opal_init_early(void) | 343 | void __init hvc_opal_init_early(void) |
344 | { | 344 | { |
345 | struct device_node *stdout_node = NULL; | 345 | struct device_node *stdout_node = of_node_get(of_stdout); |
346 | const __be32 *termno; | 346 | const __be32 *termno; |
347 | const char *name = NULL; | ||
348 | const struct hv_ops *ops; | 347 | const struct hv_ops *ops; |
349 | u32 index; | 348 | u32 index; |
350 | 349 | ||
351 | /* find the boot console from /chosen/stdout */ | 350 | /* If the console wasn't in /chosen, try /ibm,opal */ |
352 | if (of_chosen) | 351 | if (!stdout_node) { |
353 | name = of_get_property(of_chosen, "linux,stdout-path", NULL); | ||
354 | if (name) { | ||
355 | stdout_node = of_find_node_by_path(name); | ||
356 | if (!stdout_node) { | ||
357 | pr_err("hvc_opal: Failed to locate default console!\n"); | ||
358 | return; | ||
359 | } | ||
360 | } else { | ||
361 | struct device_node *opal, *np; | 352 | struct device_node *opal, *np; |
362 | 353 | ||
363 | /* Current OPAL takeover doesn't provide the stdout | 354 | /* Current OPAL takeover doesn't provide the stdout |
diff --git a/drivers/tty/hvc/hvc_vio.c b/drivers/tty/hvc/hvc_vio.c index b594abfbf21e..5618b5fc7500 100644 --- a/drivers/tty/hvc/hvc_vio.c +++ b/drivers/tty/hvc/hvc_vio.c | |||
@@ -404,42 +404,35 @@ module_exit(hvc_vio_exit); | |||
404 | 404 | ||
405 | void __init hvc_vio_init_early(void) | 405 | void __init hvc_vio_init_early(void) |
406 | { | 406 | { |
407 | struct device_node *stdout_node; | ||
408 | const __be32 *termno; | 407 | const __be32 *termno; |
409 | const char *name; | 408 | const char *name; |
410 | const struct hv_ops *ops; | 409 | const struct hv_ops *ops; |
411 | 410 | ||
412 | /* find the boot console from /chosen/stdout */ | 411 | /* find the boot console from /chosen/stdout */ |
413 | if (!of_chosen) | 412 | if (!of_stdout) |
414 | return; | 413 | return; |
415 | name = of_get_property(of_chosen, "linux,stdout-path", NULL); | 414 | name = of_get_property(of_stdout, "name", NULL); |
416 | if (name == NULL) | ||
417 | return; | ||
418 | stdout_node = of_find_node_by_path(name); | ||
419 | if (!stdout_node) | ||
420 | return; | ||
421 | name = of_get_property(stdout_node, "name", NULL); | ||
422 | if (!name) { | 415 | if (!name) { |
423 | printk(KERN_WARNING "stdout node missing 'name' property!\n"); | 416 | printk(KERN_WARNING "stdout node missing 'name' property!\n"); |
424 | goto out; | 417 | return; |
425 | } | 418 | } |
426 | 419 | ||
427 | /* Check if it's a virtual terminal */ | 420 | /* Check if it's a virtual terminal */ |
428 | if (strncmp(name, "vty", 3) != 0) | 421 | if (strncmp(name, "vty", 3) != 0) |
429 | goto out; | 422 | return; |
430 | termno = of_get_property(stdout_node, "reg", NULL); | 423 | termno = of_get_property(of_stdout, "reg", NULL); |
431 | if (termno == NULL) | 424 | if (termno == NULL) |
432 | goto out; | 425 | return; |
433 | hvterm_priv0.termno = of_read_number(termno, 1); | 426 | hvterm_priv0.termno = of_read_number(termno, 1); |
434 | spin_lock_init(&hvterm_priv0.buf_lock); | 427 | spin_lock_init(&hvterm_priv0.buf_lock); |
435 | hvterm_privs[0] = &hvterm_priv0; | 428 | hvterm_privs[0] = &hvterm_priv0; |
436 | 429 | ||
437 | /* Check the protocol */ | 430 | /* Check the protocol */ |
438 | if (of_device_is_compatible(stdout_node, "hvterm1")) { | 431 | if (of_device_is_compatible(of_stdout, "hvterm1")) { |
439 | hvterm_priv0.proto = HV_PROTOCOL_RAW; | 432 | hvterm_priv0.proto = HV_PROTOCOL_RAW; |
440 | ops = &hvterm_raw_ops; | 433 | ops = &hvterm_raw_ops; |
441 | } | 434 | } |
442 | else if (of_device_is_compatible(stdout_node, "hvterm-protocol")) { | 435 | else if (of_device_is_compatible(of_stdout, "hvterm-protocol")) { |
443 | hvterm_priv0.proto = HV_PROTOCOL_HVSI; | 436 | hvterm_priv0.proto = HV_PROTOCOL_HVSI; |
444 | ops = &hvterm_hvsi_ops; | 437 | ops = &hvterm_hvsi_ops; |
445 | hvsilib_init(&hvterm_priv0.hvsi, hvc_get_chars, hvc_put_chars, | 438 | hvsilib_init(&hvterm_priv0.hvsi, hvc_get_chars, hvc_put_chars, |
@@ -447,7 +440,7 @@ void __init hvc_vio_init_early(void) | |||
447 | /* HVSI, perform the handshake now */ | 440 | /* HVSI, perform the handshake now */ |
448 | hvsilib_establish(&hvterm_priv0.hvsi); | 441 | hvsilib_establish(&hvterm_priv0.hvsi); |
449 | } else | 442 | } else |
450 | goto out; | 443 | return; |
451 | udbg_putc = udbg_hvc_putc; | 444 | udbg_putc = udbg_hvc_putc; |
452 | udbg_getc = udbg_hvc_getc; | 445 | udbg_getc = udbg_hvc_getc; |
453 | udbg_getc_poll = udbg_hvc_getc_poll; | 446 | udbg_getc_poll = udbg_hvc_getc_poll; |
@@ -456,14 +449,12 @@ void __init hvc_vio_init_early(void) | |||
456 | * backend for HVSI, only do udbg | 449 | * backend for HVSI, only do udbg |
457 | */ | 450 | */ |
458 | if (hvterm_priv0.proto == HV_PROTOCOL_HVSI) | 451 | if (hvterm_priv0.proto == HV_PROTOCOL_HVSI) |
459 | goto out; | 452 | return; |
460 | #endif | 453 | #endif |
461 | /* Check whether the user has requested a different console. */ | 454 | /* Check whether the user has requested a different console. */ |
462 | if (!strstr(cmd_line, "console=")) | 455 | if (!strstr(cmd_line, "console=")) |
463 | add_preferred_console("hvc", 0, NULL); | 456 | add_preferred_console("hvc", 0, NULL); |
464 | hvc_instantiate(0, 0, ops); | 457 | hvc_instantiate(0, 0, ops); |
465 | out: | ||
466 | of_node_put(stdout_node); | ||
467 | } | 458 | } |
468 | 459 | ||
469 | /* call this from early_init() for a working debug console on | 460 | /* call this from early_init() for a working debug console on |
diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c index f7ad5b903055..abbfedb84901 100644 --- a/drivers/tty/serial/pmac_zilog.c +++ b/drivers/tty/serial/pmac_zilog.c | |||
@@ -1653,8 +1653,7 @@ static int __init pmz_probe(void) | |||
1653 | /* | 1653 | /* |
1654 | * Find all escc chips in the system | 1654 | * Find all escc chips in the system |
1655 | */ | 1655 | */ |
1656 | node_p = of_find_node_by_name(NULL, "escc"); | 1656 | for_each_node_by_name(node_p, "escc") { |
1657 | while (node_p) { | ||
1658 | /* | 1657 | /* |
1659 | * First get channel A/B node pointers | 1658 | * First get channel A/B node pointers |
1660 | * | 1659 | * |
@@ -1672,7 +1671,7 @@ static int __init pmz_probe(void) | |||
1672 | of_node_put(node_b); | 1671 | of_node_put(node_b); |
1673 | printk(KERN_ERR "pmac_zilog: missing node %c for escc %s\n", | 1672 | printk(KERN_ERR "pmac_zilog: missing node %c for escc %s\n", |
1674 | (!node_a) ? 'a' : 'b', node_p->full_name); | 1673 | (!node_a) ? 'a' : 'b', node_p->full_name); |
1675 | goto next; | 1674 | continue; |
1676 | } | 1675 | } |
1677 | 1676 | ||
1678 | /* | 1677 | /* |
@@ -1699,11 +1698,9 @@ static int __init pmz_probe(void) | |||
1699 | of_node_put(node_b); | 1698 | of_node_put(node_b); |
1700 | memset(&pmz_ports[count], 0, sizeof(struct uart_pmac_port)); | 1699 | memset(&pmz_ports[count], 0, sizeof(struct uart_pmac_port)); |
1701 | memset(&pmz_ports[count+1], 0, sizeof(struct uart_pmac_port)); | 1700 | memset(&pmz_ports[count+1], 0, sizeof(struct uart_pmac_port)); |
1702 | goto next; | 1701 | continue; |
1703 | } | 1702 | } |
1704 | count += 2; | 1703 | count += 2; |
1705 | next: | ||
1706 | node_p = of_find_node_by_name(node_p, "escc"); | ||
1707 | } | 1704 | } |
1708 | pmz_ports_count = count; | 1705 | pmz_ports_count = count; |
1709 | 1706 | ||
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 8bb19da01639..29a7be47389a 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
28 | #include <linux/console.h> | 28 | #include <linux/console.h> |
29 | #include <linux/of.h> | ||
29 | #include <linux/proc_fs.h> | 30 | #include <linux/proc_fs.h> |
30 | #include <linux/seq_file.h> | 31 | #include <linux/seq_file.h> |
31 | #include <linux/device.h> | 32 | #include <linux/device.h> |
@@ -2611,6 +2612,8 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport) | |||
2611 | spin_lock_init(&uport->lock); | 2612 | spin_lock_init(&uport->lock); |
2612 | lockdep_set_class(&uport->lock, &port_lock_key); | 2613 | lockdep_set_class(&uport->lock, &port_lock_key); |
2613 | } | 2614 | } |
2615 | if (uport->cons && uport->dev) | ||
2616 | of_console_check(uport->dev->of_node, uport->cons->name, uport->line); | ||
2614 | 2617 | ||
2615 | uart_configure_port(drv, state, uport); | 2618 | uart_configure_port(drv, state, uport); |
2616 | 2619 | ||