Subject: Re: [PATCH] powerpc: Pegasos keyboard detection

From: Andrew Morton <[email-masked]>
Date: Thu, 26 Jul 2007 18:48:00 -0700

On Wed, 25 Jul 2007 17:12:45 +1000 Benjamin Herrenschmidt <[email-masked]> wrote:

> On Tue, 2007-07-24 at 21:28 -0400, Alan Curry wrote:
> > As of 2.6.22 the kernel doesn't recognize the i8042 keyboard/mouse controller
> > on the PegasosPPC. This is because of a feature/bug in the OF device tree:
> > the "device_type" attribute is an empty string instead of "8042" as the
> > kernel expects. This patch (against 2.6.22.1) adds a secondary detection
> > which looks for a device whose *name* is "8042" if there is no device whose
> > *type* is "8042".
> > 
> > Signed-off-by: Alan Curry <[email-masked]>
> 
> Acked-by: Benjamin Herrenschmidt <[email-masked]>
> 
> Note, if there's a volunteer, we could probably turn that code into a
> nice table lookup.

Did this get merged, or otherwise fixed?  Even though the code in there has
changed quite a bit, it looks to my untrained eye like the fix is still
applicable?

From: Alan Curry <[email-masked]>

As of 2.6.22 the kernel doesn't recognize the i8042 keyboard/mouse
controller on the PegasosPPC.  This is because of a feature/bug in the OF
device tree: the "device_type" attribute is an empty string instead of
"8042" as the kernel expects.  This patch (against 2.6.22.1) adds a
secondary detection which looks for a device whose *name* is "8042" if
there is no device whose *type* is "8042".

Signed-off-by: Alan Curry <[email-masked]>
Acked-by: Benjamin Herrenschmidt <[email-masked]>
Signed-off-by: Andrew Morton <[email-masked]>
---

 arch/powerpc/kernel/setup-common.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff -puN /dev/null /dev/null
diff -puN arch/powerpc/kernel/setup-common.c~powerpc-pegasos-keyboard-detection arch/powerpc/kernel/setup-common.c
--- a/arch/powerpc/kernel/setup-common.c~powerpc-pegasos-keyboard-detection
+++ a/arch/powerpc/kernel/setup-common.c
@@ -496,6 +496,12 @@ int check_legacy_ioport(unsigned long ba
 			break;
 		}
 		np = of_find_node_by_type(NULL, "8042");
+		/*
+		 * Pegasos has no device_type on its 8042 node, look for the
+		 * name instead
+		 */
+		if (!np)
+			np = of_find_node_by_name(NULL, "8042");
 		break;
 	case FDC_BASE: /* FDC1 */
 		np = of_find_node_by_type(NULL, "fdc");
_

And ALan says that 2.6.22 is bust, but this patch no won't apply there so
if we want to fix 2.6.22.x then Alan's original patch would be needed.