如何在Linux内核重启期间写入EEPROM?

时间:2015-06-05 05:31:48

标签: c linux linux-kernel device-tree

我需要根据arg中的int reboot(int magic, int magic2, int cmd, void *arg);在EEPROM中存储一个标志。 eeprom在我的设备树中定义如下:

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

我还可以通过用户空间中的sysfs文件读取/写入eeprom。用户空间写入最终会调用at24.c:at24_write(struct at24_data *at24, const char *buf, loff_t off, size_t count)。从我的机器的arch / arm下的restart()方法,如何获得指向正确的at24_data结构的指针,以便我可以调用at24_write()?

0 个答案:

没有答案