drivers: eeprom: EEPROM emulation in flash memory
This driver emulates a EEPROM device in flash. Reworked implementation with modified flash layout. The emulation represents the EEPROM in flash as a region that is a direct map of the eeprom data followed by a region where changes to the eeprom data is stored. Changes are written as address-data combinations. The size of such a combination is determined by the flash write block size and the size of the eeprom (required address space), with a minimum of 4 byte. The eeprom page needs to be a multiple of the flash page. Multiple eeprom pages is also so supported and increases the number of writes that can be performed. The eeprom size, pagesize and the flash partition used for the eeprom are defined in the dts. The flash partition should allow at least two eeprom pages. For fast read access a rambuffer can be enabled for the eeprom (by setting the option rambuf in the dts). Signed-off-by: Laczen JMS <laczenjms@gmail.com>
This commit is contained in:
parent
7a91cf0176
commit
232272cff8
8 changed files with 919 additions and 19 deletions
|
@ -27,6 +27,7 @@
|
|||
uart-0 = &uart0;
|
||||
uart-1 = &uart1;
|
||||
eeprom-0 = &eeprom0;
|
||||
eeprom-1 = &eeprom1;
|
||||
};
|
||||
|
||||
chosen {
|
||||
|
@ -70,12 +71,23 @@
|
|||
};
|
||||
};
|
||||
|
||||
eeprom0: eeprom {
|
||||
eeprom1: eeprom1 {
|
||||
status = "okay";
|
||||
compatible = "zephyr,emu-eeprom";
|
||||
label = "EEPROM_1";
|
||||
size = <DT_SIZE_K(4)>;
|
||||
pagesize = <DT_SIZE_K(8)>;
|
||||
partition = <&eepromemu_partition>;
|
||||
rambuf;
|
||||
};
|
||||
|
||||
eeprom0: eeprom0 {
|
||||
status = "okay";
|
||||
compatible = "zephyr,sim-eeprom";
|
||||
label = "EEPROM_0";
|
||||
size = <DT_SIZE_K(32)>;
|
||||
size = <DT_SIZE_K(4)>;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
&uart0 {
|
||||
|
@ -116,5 +128,9 @@
|
|||
label = "image-1";
|
||||
reg = <0x00021000 0x00010000>;
|
||||
};
|
||||
eepromemu_partition: partition@31000 {
|
||||
label = "eeprom-emu";
|
||||
reg = <0x00031000 0x00010000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue