Hi Petr,
You realize of course that it makes no sense to write an erased page? Then you can't use it.
Any use of the NAND will read erased pages - this behaviour should be documented. I don't see any mention in any Freescale docs the result of reading an erased page.
For example, ST Micro does a good job explaining what's happening with their NFC: http://www.stlinux.com/howto/NAND/ST-ECC
Detecting good erased pages would be a great use for hardware inside the NFC. Unfortunately I don't see any mention of it. This leaves any NAND filesystem management to either:
1. If a page read returns an ECC error, before flagging as an actual error, read every byte in the page buffer and see if they are all 0xFF indicating an erased page, and return no error in that case. Lots of CPU cycles.
2. Keep an in-memory list of erased pages, which would be filled by reading every page upon startup and maintained throughout the program's life. Long startup time, and added RAM usage (if you're using only internal SRAM, not good..)
If you notice, ST's Nand driver handles this case... probably NFC_LDD should as well.
Best regards,
Marc