[0/14] Ebony support, 2nd spi

Josh Boyer jwboyer at linux.vnet.ibm.com
Wed Feb 21 07:29:25 EST 2007


On Tue, 2007-02-20 at 20:51 +0100, Segher Boessenkool wrote:
> 
> > We probably also need a volunteer to clean up the legacy_serial
> >
> > code for this, it's grown pretty messy by now.
> 
> I nominate you :-)

In the absence of someone actually cleaning up the code, the following
ugly patch should work for both Axon and 4xx until we can settle on
settle on something.  It booted on my Ebony board with David's
FIXED_PORT flag patch also applied anyway.

josh

Make legacy_serial look for multiple compatible serial types on the OBP bus.

Signed-off-by: Josh Boyer <jwboyer at linux.vnet.ibm.com>

--

diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index 325f490..3cb2f51 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -291,7 +291,14 @@ void __init find_legacy_serial_ports(void)
 {
 	struct device_node *np, *stdout = NULL;
 	const char *path;
-	int index;
+	int index, i;
+	const char *compat[] = {
+		"ns16750",
+		"ns16550",
+		"ns16450",
+		"i8250",
+		NULL,
+	};
 
 	DBG(" -> find_legacy_serial_port()\n");
 
@@ -339,14 +346,19 @@ void __init find_legacy_serial_ports(void)
 	}
 
 	/* First fill our array with opb bus ports */
-	for (np = NULL; (np = of_find_compatible_node(np, "serial", "ns16750")) != NULL;) {
-		struct device_node *opb = of_get_parent(np);
-		if (opb && !strcmp(opb->type, "opb")) {
-			index = add_legacy_soc_port(np, np);
-			if (index >= 0 && np == stdout)
-				legacy_serial_console = index;
+	for (i = 0; compat[i] != NULL; i++) {
+		for (np = NULL;
+			(np = of_find_compatible_node(np, "serial", compat[i])) != NULL;) {
+
+			struct device_node *opb = of_get_parent(np);
+			if (opb &&
+				(!strcmp(opb->type, "opb") || !strcmp(opb->type, "ibm,opb"))) {
+				index = add_legacy_soc_port(np, np);
+				if (index >= 0 && np == stdout)
+					legacy_serial_console = index;
+			}
+			of_node_put(opb);
 		}
-		of_node_put(opb);
 	}
 
 #ifdef CONFIG_PCI




More information about the Linuxppc-dev mailing list