Hi Charles, thanks for your answer.
We are using a NAND512W3A2D from Numonyx, 512-Mbit, 512 byte data + 16 byte
spare page size; minimum erasable unit is a block of 32 pages.
We chosed to use yaffs1 because it was simpler to handle, as we use YDI.
This is the configuration in use:
memset(&m_systemDev,0,sizeof(m_systemDev));
m_systemDev.param.name = "/system";
m_systemDev.param.total_bytes_per_chunk = 512;
m_systemDev.param.chunks_per_block = 32;
m_systemDev.param.n_reserved_blocks = 5;
m_systemDev.param.inband_tags = 0;
m_systemDev.param.start_block = 1;
m_systemDev.param.end_block = 2048;
m_systemDev.param.is_yaffs2 = 0;
m_systemDev.param.use_nand_ecc = 0;
m_systemDev.param.wide_tnodes_disabled = 0;
m_systemDev.param.refresh_period = 1000;
m_systemDev.param.n_caches = 10;
m_systemDev.driver_context = (void *) 0;
m_systemDev.param.write_chunk_fn = yflash_WriteChunkToNAND;
m_systemDev.param.read_chunk_fn = yflash_ReadChunkFromNAND;
m_systemDev.param.erase_fn = yflash_EraseBlockInNAND;
m_systemDev.param.initialise_flash_fn = yflash_InitialiseNAND;
memset(&m_dataDev,0,sizeof(m_dataDev));
m_dataDev.param.name = "/data";
m_dataDev.param.total_bytes_per_chunk = 512;
m_dataDev.param.chunks_per_block = 32;
m_dataDev.param.n_reserved_blocks = 5;
m_dataDev.param.inband_tags = 0;
m_dataDev.param.start_block = m_systemDev.param.end_block + 1;
m_dataDev.param.end_block = m_dataDev.param.start_block + 1024;
m_dataDev.param.is_yaffs2 = 0;
m_dataDev.param.use_nand_ecc = 0;
m_dataDev.param.wide_tnodes_disabled = 0;
m_dataDev.param.refresh_period = 1000;
m_dataDev.param.n_caches = 10;
m_dataDev.driver_context = (void *) 1;
m_dataDev.param.write_chunk_fn = yflash_WriteChunkToNAND;
m_dataDev.param.read_chunk_fn = yflash_ReadChunkFromNAND;
m_dataDev.param.erase_fn = yflash_EraseBlockInNAND;
m_dataDev.param.initialise_flash_fn = yflash_InitialiseNAND;
memset(&m_nvramDev,0,sizeof(m_nvramDev));
m_nvramDev.param.name = "/nvram";
m_nvramDev.param.total_bytes_per_chunk = 512;
m_nvramDev.param.chunks_per_block = 32;
m_nvramDev.param.n_reserved_blocks = 5;
m_nvramDev.param.inband_tags = 0;
m_nvramDev.param.start_block = m_dataDev.param.end_block + 1;
m_nvramDev.param.end_block = m_nvramDev.param.start_block + 512;
m_nvramDev.param.is_yaffs2 = 0;
m_nvramDev.param.use_nand_ecc = 0;
m_nvramDev.param.wide_tnodes_disabled = 0;
m_nvramDev.param.refresh_period = 1000;
m_nvramDev.param.n_caches = 10;
m_nvramDev.driver_context = (void *) 2;
m_nvramDev.param.write_chunk_fn = yflash_WriteChunkToNAND;
m_nvramDev.param.read_chunk_fn = yflash_ReadChunkFromNAND;
m_nvramDev.param.erase_fn = yflash_EraseBlockInNAND;
m_nvramDev.param.initialise_flash_fn = yflash_InitialiseNAND;
memset(&m_tokenDev,0,sizeof(m_tokenDev));
m_tokenDev.param.name = "/token";
m_tokenDev.param.total_bytes_per_chunk = 512;
m_tokenDev.param.chunks_per_block = 32;
m_tokenDev.param.n_reserved_blocks = 5;
m_tokenDev.param.inband_tags = 0;
m_tokenDev.param.start_block = m_nvramDev.param.end_block + 1;
m_tokenDev.param.end_block = min(m_tokenDev.param.start_block + 512, 4095);
m_tokenDev.param.is_yaffs2 = 0;
m_tokenDev.param.use_nand_ecc = 0;
m_tokenDev.param.wide_tnodes_disabled = 0;
m_tokenDev.param.refresh_period = 1000;
m_tokenDev.param.n_caches = 10;
m_tokenDev.driver_context = (void *) 3;
m_tokenDev.param.write_chunk_fn = yflash_WriteChunkToNAND;
m_tokenDev.param.read_chunk_fn = yflash_ReadChunkFromNAND;
m_tokenDev.param.erase_fn = yflash_EraseBlockInNAND;
m_tokenDev.param.initialise_flash_fn = yflash_InitialiseNAND;
Device partitioning is thus as follow (size in blocks):
start end len
1 2048 2048
2049 3073 1025
3074 3586 513
3587 4095 509
Typical usage is this:
- at power up we mount all filesystem in read/write mode
- we read some files from /data (configurations), from /system (images and
languages), from /nvram (user configuration) and from /token (customizations)
- during work time we only read from /system what we need and save data to
/nvram; saving is performed when something is changed on when we detect that
system is being turned off; saving requires from 5 to 15ms (depending on
what has changed) and we are quite sure that power supply still remain active
at least for 1,2s after we detected power failure
- after saving we *DO NOT* unmount filesystems and we expect the system to
die
So the question are:
- is it correct to turn off device without unmounting filesystems?
- may mount mark blocks as deleted?
- if we mount the required partitions in read only mode, could this problem
being resolved?
- is there a way from YDI to force a filesystem check programmatically?
Thanks for your support and regards,
Stefano