Re: FAT vs jFFS2 for NAND.

Thomas Gleixner
2006-06-20T17:40:10Z

Claudio,

On Tue, 2006-06-20 at 19:26 +0200, Claudio Lanconelli wrote:
> Thanks Thomas for your tips.
> Here a second try, does it look fine?

Much better now.

> I attached the file instead of inline to avoid tab/space replacement by
> email client.

> however can I ask you where I find prototype/usage for mtd->block_is_bad()?

Oops, mtd->block_isbad()

if (mtd->block_isbad(mtd, offset)
skip_bad_block();
else
scan_block()

offs is the offset of the block:
0 for the first block
16384 for the second ...
you certainly have this offset handy in the scan any way

This looks up the bad block table which is created in ram after the NAND
chip has been detected in nand_scan() and helps you to avoid reading bad
blocks. Just skip the block, when the function returns 1.

The only exception I think is block 0, which contains the SSFDC header
and is marked bad for protection.

> And against which tree I need to build it? Be patient, please.

The best is to build against mtd-26.git from git.infradead.org. git
instructions are on the MTD homepage.

I do a thorough review, when you have it running with that tree.

Thanks,

tglx

> #define ArraySize(x) ( sizeof(x) / sizeof((x)[0]) )

use the existing ARRAY_SIZE() macro please

> //Must be ordered by size

C++

> static const chs_entry_t chs_table[] = {

> /* Read and check for a valid CIS sector */
> static int get_valid_cis_sector(struct mtd_info *mtd)
> {
> int ret, k, cis_sector;
> size_t retlen;
> loff_t offset;
> uint8_t sect_buf[SECTOR_SIZE];
>
> /* Look for CIS/IDI sector on the first GOOD block (give up after 4 bad
> blocks). If the first good block doesn't contain CIS number the flash
> is not SSFDC formatted */

/*
* Use this for
* multiline comments please
*/