How to write to an EEPROM during Linux kernel reboot?

601 views Asked by At

I need to store a flag in an EEPROM based on the arg in int reboot(int magic, int magic2, int cmd, void *arg);. The eeprom is defined in my device tree like this:

eeprom2: eeprom@51 {
    compatible = "atmel,24c02";
    reg = <0x51>;
    pagesize = <16>;
};

I can also read/write the eeprom via a sysfs file in userspace. That userspace write ultimately calls at24.c:at24_write(struct at24_data *at24, const char *buf, loff_t off, size_t count). From my machine's restart() method under arch/arm, how can I get the pointer to the correct at24_data structure so I can call at24_write()?

0

There are 0 answers