diff options
Diffstat (limited to 'arch/powerpc/kernel/legacy_serial.c')
-rw-r--r-- | arch/powerpc/kernel/legacy_serial.c | 51 |
1 files changed, 20 insertions, 31 deletions
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c index 4ed58875ee17..76b862bd1fe9 100644 --- a/arch/powerpc/kernel/legacy_serial.c +++ b/arch/powerpc/kernel/legacy_serial.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/serial_core.h> | 4 | #include <linux/serial_core.h> |
5 | #include <linux/console.h> | 5 | #include <linux/console.h> |
6 | #include <linux/pci.h> | 6 | #include <linux/pci.h> |
7 | #include <linux/of_device.h> | ||
7 | #include <asm/io.h> | 8 | #include <asm/io.h> |
8 | #include <asm/mmu.h> | 9 | #include <asm/mmu.h> |
9 | #include <asm/prom.h> | 10 | #include <asm/prom.h> |
@@ -31,6 +32,15 @@ static struct legacy_serial_info { | |||
31 | int irq_check_parent; | 32 | int irq_check_parent; |
32 | phys_addr_t taddr; | 33 | phys_addr_t taddr; |
33 | } legacy_serial_infos[MAX_LEGACY_SERIAL_PORTS]; | 34 | } legacy_serial_infos[MAX_LEGACY_SERIAL_PORTS]; |
35 | |||
36 | static struct __initdata of_device_id parents[] = { | ||
37 | {.type = "soc",}, | ||
38 | {.type = "tsi-bridge",}, | ||
39 | {.type = "opb", .compatible = "ibm,opb",}, | ||
40 | {.compatible = "simple-bus",}, | ||
41 | {.compatible = "wrs,epld-localbus",}, | ||
42 | }; | ||
43 | |||
34 | static unsigned int legacy_serial_count; | 44 | static unsigned int legacy_serial_count; |
35 | static int legacy_serial_console = -1; | 45 | static int legacy_serial_console = -1; |
36 | 46 | ||
@@ -306,19 +316,21 @@ void __init find_legacy_serial_ports(void) | |||
306 | DBG(" no linux,stdout-path !\n"); | 316 | DBG(" no linux,stdout-path !\n"); |
307 | } | 317 | } |
308 | 318 | ||
309 | /* First fill our array with SOC ports */ | 319 | /* Iterate over all the 16550 ports, looking for known parents */ |
310 | for (np = NULL; (np = of_find_compatible_node(np, "serial", "ns16550")) != NULL;) { | 320 | for_each_compatible_node(np, "serial", "ns16550") { |
311 | struct device_node *soc = of_get_parent(np); | 321 | struct device_node *parent = of_get_parent(np); |
312 | if (soc && !strcmp(soc->type, "soc")) { | 322 | if (!parent) |
323 | continue; | ||
324 | if (of_match_node(parents, parent) != NULL) { | ||
313 | index = add_legacy_soc_port(np, np); | 325 | index = add_legacy_soc_port(np, np); |
314 | if (index >= 0 && np == stdout) | 326 | if (index >= 0 && np == stdout) |
315 | legacy_serial_console = index; | 327 | legacy_serial_console = index; |
316 | } | 328 | } |
317 | of_node_put(soc); | 329 | of_node_put(parent); |
318 | } | 330 | } |
319 | 331 | ||
320 | /* First fill our array with ISA ports */ | 332 | /* Next, fill our array with ISA ports */ |
321 | for (np = NULL; (np = of_find_node_by_type(np, "serial"));) { | 333 | for_each_node_by_type(np, "serial") { |
322 | struct device_node *isa = of_get_parent(np); | 334 | struct device_node *isa = of_get_parent(np); |
323 | if (isa && !strcmp(isa->name, "isa")) { | 335 | if (isa && !strcmp(isa->name, "isa")) { |
324 | index = add_legacy_isa_port(np, isa); | 336 | index = add_legacy_isa_port(np, isa); |
@@ -328,29 +340,6 @@ void __init find_legacy_serial_ports(void) | |||
328 | of_node_put(isa); | 340 | of_node_put(isa); |
329 | } | 341 | } |
330 | 342 | ||
331 | /* First fill our array with tsi-bridge ports */ | ||
332 | for (np = NULL; (np = of_find_compatible_node(np, "serial", "ns16550")) != NULL;) { | ||
333 | struct device_node *tsi = of_get_parent(np); | ||
334 | if (tsi && !strcmp(tsi->type, "tsi-bridge")) { | ||
335 | index = add_legacy_soc_port(np, np); | ||
336 | if (index >= 0 && np == stdout) | ||
337 | legacy_serial_console = index; | ||
338 | } | ||
339 | of_node_put(tsi); | ||
340 | } | ||
341 | |||
342 | /* First fill our array with opb bus ports */ | ||
343 | for (np = NULL; (np = of_find_compatible_node(np, "serial", "ns16550")) != NULL;) { | ||
344 | struct device_node *opb = of_get_parent(np); | ||
345 | if (opb && (!strcmp(opb->type, "opb") || | ||
346 | of_device_is_compatible(opb, "ibm,opb"))) { | ||
347 | index = add_legacy_soc_port(np, np); | ||
348 | if (index >= 0 && np == stdout) | ||
349 | legacy_serial_console = index; | ||
350 | } | ||
351 | of_node_put(opb); | ||
352 | } | ||
353 | |||
354 | #ifdef CONFIG_PCI | 343 | #ifdef CONFIG_PCI |
355 | /* Next, try to locate PCI ports */ | 344 | /* Next, try to locate PCI ports */ |
356 | for (np = NULL; (np = of_find_all_nodes(np));) { | 345 | for (np = NULL; (np = of_find_all_nodes(np));) { |
@@ -474,7 +463,7 @@ static int __init serial_dev_init(void) | |||
474 | 463 | ||
475 | /* | 464 | /* |
476 | * Before we register the platfrom serial devices, we need | 465 | * Before we register the platfrom serial devices, we need |
477 | * to fixup their interrutps and their IO ports. | 466 | * to fixup their interrupts and their IO ports. |
478 | */ | 467 | */ |
479 | DBG("Fixing serial ports interrupts and IO ports ...\n"); | 468 | DBG("Fixing serial ports interrupts and IO ports ...\n"); |
480 | 469 | ||