Why eeprom driver is read-only ?

valdis.kletnieks at vt.edu valdis.kletnieks at vt.edu
Mon Nov 19 17:32:03 EST 2018


On Tue, 20 Nov 2018 00:04:03 +0200, Ranran said:

> That's interesting...
> I think the name is confusing, because this chips are also writable.
>
> Not only this, but in arm the eeprom (at24) is writable!
> But in the x86 I am using, it is readonly in kernel code:
> https://android.googlesource.com/kernel/omap/+/glass-omap-xrr02/drivers/misc/eeprom/eeprom.c
> static struct bin_attribute eeprom_attr = {
> .attr = {
> .name = "eeprom",
> .mode = S_IRUGO,
> },
> .size = EEPROM_SIZE,
> .read = eeprom_read,
> };

Well, at least in the mainline kernel, we have this at the top of the eeprom.c file:

/* Addresses to scan */
static const unsigned short normal_i2c[] = { 0x50, 0x51, 0x52, 0x53, 0x54,
                                        0x55, 0x56, 0x57, I2C_CLIENT_END };


/* Size of EEPROM in bytes */
#define EEPROM_SIZE             256

which is pretty obviously intended for "very small eeprom hanging off an I2C adapter",
and thus probably *NOT* the boot ROM that the BIOS lives in.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 486 bytes
Desc: not available
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20181119/20996617/attachment.sig>


More information about the Kernelnewbies mailing list