Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sparc64/sparc64 pmu's i2c devices are under the "i2...



details:   https://anonhg.NetBSD.org/src/rev/d0e1c100d7a1
branches:  trunk
changeset: 772950:d0e1c100d7a1
user:      nakayama <nakayama%NetBSD.org@localhost>
date:      Sun Jan 22 10:32:35 2012 +0000

description:
pmu's i2c devices are under the "i2c" node, so find it out before
calling of_enter_i2c_devs().

diffstat:

 sys/arch/sparc64/sparc64/autoconf.c |  27 ++++++++++++++++++++++++---
 1 files changed, 24 insertions(+), 3 deletions(-)

diffs (50 lines):

diff -r e225e53ba365 -r d0e1c100d7a1 sys/arch/sparc64/sparc64/autoconf.c
--- a/sys/arch/sparc64/sparc64/autoconf.c       Sun Jan 22 09:25:26 2012 +0000
+++ b/sys/arch/sparc64/sparc64/autoconf.c       Sun Jan 22 10:32:35 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.183 2011/07/09 15:03:35 mrg Exp $ */
+/*     $NetBSD: autoconf.c,v 1.184 2012/01/22 10:32:35 nakayama Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.183 2011/07/09 15:03:35 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.184 2012/01/22 10:32:35 nakayama Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -1040,9 +1040,30 @@
                        prop_dictionary_t props = device_properties(busdev);
                        prop_object_t cfg = prop_dictionary_get(props,
                                "i2c-child-devices");
-                       if (!cfg)
+                       if (!cfg) {
+                               int node;
+                               const char *name;
+
+                               /*
+                                * pmu's i2c devices are under the "i2c" node,
+                                * so find it out.
+                                */
+                               name = prom_getpropstring(busnode, "name");
+                               if (strcmp(name, "pmu") == 0) {
+                                       for (node = OF_child(busnode);
+                                            node != 0; node = OF_peer(node)) {
+                                               name = prom_getpropstring(node,
+                                                   "name");
+                                               if (strcmp(name, "i2c") == 0) {
+                                                       busnode = node;
+                                                       break;
+                                               }
+                                       }
+                               }
+
                                of_enter_i2c_devs(props, busnode,
                                    sizeof(cell_t));
+                       }
                }
        }
 



Home | Main Index | Thread Index | Old Index