Module Name: src
Committed By: jdc
Date: Fri Feb 8 15:17:00 UTC 2013
Modified Files:
src/sys/dev/ofw: ofw_subr.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/ofw/ofw_subr.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/ofw/ofw_subr.c
diff -u src/sys/dev/ofw/ofw_subr.c:1.20 src/sys/dev/ofw/ofw_subr.c:1.21
--- src/sys/dev/ofw/ofw_subr.c:1.20 Sun Feb 3 17:41:02 2013
+++ src/sys/dev/ofw/ofw_subr.c Fri Feb 8 15:17:00 2013
@@ -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 @@ void
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 @@ of_enter_i2c_devs(prop_dictionary_t prop
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);
}