Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Allow the EEPROM size to be specified in the kernel configur...
details: https://anonhg.NetBSD.org/src/rev/89a47edf3582
branches: trunk
changeset: 790854:89a47edf3582
user: jdc <jdc%NetBSD.org@localhost>
date: Fri Oct 25 14:23:15 2013 +0000
description:
Allow the EEPROM size to be specified in the kernel configuration by
using flags.
Add the flags values, and configuration examples to the manual page.
diffstat:
share/man/man4/seeprom.4 | 36 +++++++++++++++++++++++++++++++-----
sys/dev/i2c/at24cxx.c | 11 +++++++----
2 files changed, 38 insertions(+), 9 deletions(-)
diffs (107 lines):
diff -r 8b383cb61b46 -r 89a47edf3582 share/man/man4/seeprom.4
--- a/share/man/man4/seeprom.4 Fri Oct 25 14:20:11 2013 +0000
+++ b/share/man/man4/seeprom.4 Fri Oct 25 14:23:15 2013 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: seeprom.4,v 1.4 2013/02/08 15:18:44 jdc Exp $
+.\" $NetBSD: seeprom.4,v 1.5 2013/10/25 14:23:15 jdc Exp $
.\"
.\" Copyright (c) 2007 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -24,21 +24,45 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd February 7, 2013
+.Dd October 25, 2013
.Dt SEEPROM 4
.Os
.Sh NAME
.Nm seeprom
.Nd 24-series I2C EEPROM driver
.Sh SYNOPSIS
-.Cd "seeprom0 at iic0 addr 0x50 size 128"
+.Cd "seeprom0 at iic0 addr 0x51: AT24Cxx or compatible EEPROM: size 256"
+.Cd "seeprom16 at iic1 addr 0x57: power-supply: size 8192"
.Sh DESCRIPTION
The
.Nm
-driver provides support for the 24-series of I2C EEPROMs,
-available from a variety of vendors.
+driver provides support for the ATMEL 24-series of I2C EEPROMs, and
+compatables, available from a variety of vendors. The Philips PCF8582
+is also supported, as compatable with the AT24C02.
.Pp
Access to the contents of the memory is through a character device.
+.Pp
+The size of the EEPROM is either read from the firmware, or can be set
+using the flags keyword in the kernel configuration.
+The value of the flag represents the EEPROM size in Kbit.
+.Bl -column -offset indent "flags" "EEPROM size in bytes"
+.It Sy flags Ta Sy EEPROM size in bytes
+.It Li 1 Ta 128
+.It Li 2 Ta 256
+.It Li 4 Ta 512
+.It Li 8 Ta 1024
+.It Li 16 Ta 2048
+.It Li 32 Ta 4096
+.It Li 64 Ta 8192
+.It Li 128 Ta 16384
+.It Li 256 Ta 32768
+.It Li 512 Ta 65536
+.El
+.Sh EXAMPLES
+Indirect configuration:
+.Dl seeprom* at iic? addr 0x51 flags 0x2
+Direct configuration:
+.Dl seeprom* at iic? addr?
.Sh SEE ALSO
.Xr iic 4
.Sh HISTORY
@@ -49,6 +73,8 @@
.Sh BUGS
AT24C1024 EEPROM's are not supported.
.Pp
+Software write protection on the AT34Cxx EEPROM's is not supported.
+.Pp
The
.Nm
driver reads and writes one byte at a time to be compatible with all
diff -r 8b383cb61b46 -r 89a47edf3582 sys/dev/i2c/at24cxx.c
--- a/sys/dev/i2c/at24cxx.c Fri Oct 25 14:20:11 2013 +0000
+++ b/sys/dev/i2c/at24cxx.c Fri Oct 25 14:23:15 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: at24cxx.c,v 1.14 2013/08/07 19:38:45 soren Exp $ */
+/* $NetBSD: at24cxx.c,v 1.15 2013/10/25 14:23:15 jdc Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: at24cxx.c,v 1.14 2013/08/07 19:38:45 soren Exp $");
+__KERNEL_RCSID(0, "$NetBSD: at24cxx.c,v 1.15 2013/10/25 14:23:15 jdc Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -136,7 +136,7 @@
aprint_normal(": %s", ia->ia_name);
} else {
aprint_naive(": EEPROM");
- aprint_normal(": AT24Cxx EEPROM");
+ aprint_normal(": AT24Cxx or compatible EEPROM");
}
/*
@@ -153,7 +153,10 @@
* switching to select the proper super-page. This isn't
* supported by this driver.
*/
- sc->sc_size = ia->ia_size;
+ if (device_cfdata(self)->cf_flags)
+ sc->sc_size = (device_cfdata(self)->cf_flags << 7);
+ else
+ sc->sc_size = ia->ia_size;
switch (sc->sc_size) {
case 128: /* 1Kbit */
case 256: /* 2Kbit */
Home |
Main Index |
Thread Index |
Old Index