
Dear Reinhard Meyer,
In message 4C600C3D.3060501@emk-elektronik.de you wrote:
We're not concerned about u-boot's environment not being reliable, we just want the ability to completely erase the nand without worrying about losing essential data (like a MAC address). I suppose we could work around that area of the flash if/when
erasing the nand is necessary, but then we would have to keep track of each environment variable that could be stored there.
That is exactly my concern as well.
I have seen _way_ more cases where data in EEPROM got lost than data loss from the environment.
That's discouraging, do you have any advice for where to store the MAC outside of nand, and not in an EEPROM?
I cannot second that, we have always stored environment and vital product data in EEPROM (AT24C64). But VPD (includes MAC adresses) is never writen by u-boot; only read and made into respective setenv() variables. Check boards/emk/common/vpd.c for an idea.
Most people think they are safe when they only read the EEPROM. They are under a misapprehension. If you reset the processor at the right time within a I2C read command, and if you (or your I2C controller) don't take special care, the next read access might cause a write operation on that device. See doc/I2C_Edge_Conditions for details.
Note that this is NOT a theoretical case. Many people have seen this. I had this myself with a customer who was switching to another, cheaper power supply. Upon power on, the voltage ramp up was relatively slow, which caused the system watchdog to reset the system 2 or 3 times because of too low voltages - and with 3 out of 5 power-ons the EEPROM content got corrupted.
If you need reliable read-only storage, use NOR.
Best regards,
Wolfgang Denk