Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ofw Set the size for EEPROM's that we know about ("i...



details:   https://anonhg.NetBSD.org/src/rev/fb03116f3e90
branches:  trunk
changeset: 784751:fb03116f3e90
user:      jdc <jdc%NetBSD.org@localhost>
date:      Fri Feb 08 15:17:00 2013 +0000

description:
Set the size for EEPROM's that we know about ("i2c-at24c64" is set to 8192).
Allows seeprom(4) to attach correctly, when combined with the direct
configuration support there.

diffstat:

 sys/dev/ofw/ofw_subr.c |  12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diffs (40 lines):

diff -r 7fec756e5ccc -r fb03116f3e90 sys/dev/ofw/ofw_subr.c
--- a/sys/dev/ofw/ofw_subr.c    Fri Feb 08 15:14:11 2013 +0000
+++ b/sys/dev/ofw/ofw_subr.c    Fri Feb 08 15:17:00 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ofw_subr.c,v 1.20 2013/02/03 17:41:02 jdc Exp $        */
+/*     $NetBSD: ofw_subr.c,v 1.21 2013/02/08 15:17:00 jdc Exp $        */
 
 /*
  * Copyright 1998
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.20 2013/02/03 17:41:02 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.21 2013/02/08 15:17:00 jdc Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -336,7 +336,7 @@
 of_enter_i2c_devs(prop_dictionary_t props, int ofnode, size_t cell_size)
 {
        int node, len;
-       char name[32];
+       char name[32], compatible[32];
        uint64_t reg64;
        uint32_t reg32;
        uint64_t addr;
@@ -379,6 +379,12 @@
                prop_dictionary_set_uint32(dev, "addr", addr);
                prop_dictionary_set_uint64(dev, "cookie", node);
                of_to_dataprop(dev, node, "compatible", "compatible");
+               if (OF_getprop(node, "compatible", compatible,
+                   sizeof(compatible)) > 0) {
+                       /* Set size for EEPROM's that we know about */
+                       if (strcmp(compatible, "i2c-at24c64") == 0)
+                               prop_dictionary_set_uint32(dev, "size", 8192);
+               }
                prop_array_add(array, dev);
                prop_object_release(dev);
        }



Home | Main Index | Thread Index | Old Index