Hello,
Yes, EEPROMs are small and are managed as a virtual fixed-size file.
The EEPROM bytes can be erased and written individually, which means the
erase block size of the associated mtd device would be one byte long,
which is uselessly complex. Using larger block sizes would make the
driver worse as changing one byte would require a read-modify-write from
user space.
And EEPROM usually dont have an ERASE command, just a WRITE, so it's not
a good match for the MTD framework. No JEDEC RDID identification either.
Also, when I wrote the EEPROM driver, there was no generic way to access
MTD devices.
-----
You can add ioctls to the EEPROM drivers, just make sure you define
these in terms of generic functions that have potential for
implementation on several devices.
For some devices, the built-in MAC address is part of the main memory
plane, so there is no specific access function, but ID page is one of
these functions that would benefit from dedicated IOCTLs.
Please plan a way to indicate the size of this ID page to the user,
because I'm sure the size is not the same on all devices.
Also please add flags to devices supported by the driver so the ID page
IOCTLs are not activated for devices that dont have ID memory.
I can proof read your code to offer suggestions if you wish.
Sebastien
Le 07/11/2023 à 15:31, Gregory Nutt a écrit :
On 11/4/2023 6:12 PM, Robert Middleton wrote:
I'm a little confused as to what the difference is between the MTD
folder
and the EEPROM folder. It seems that both folders have support for the
at24xx and at25xx series of chips, so it's not obvious which one is
better.
MTD is more of a "heavyweight" solution that can support a higher
level of functionality on Memory Technology Devices (MTDs) such as
file systems or wear-leveling layers.
Most EEPPROMs are small, however, and it may not be practical to
support a file system on top of the EEPROM. So the lightweight
character driver layer from Sebastien Lorquet. This lightweight layer
will support only character-oriented I/O via lseek, read, and write