General question regarding multiple partitions on a single NOR device

From: Mark Jackson
Date: Thu Jun 06 2013 - 15:47:49 EST


On one of our products, we have 2 64Mbit NOR devices:- one to hold the
kernel, filesystem, etc, and the other to store "user" data.

The gotcha is that the "user" data is stored using our own wear
levelling code, with read / write / erase operations being carried out
on the raw flash device.

We are now designing a new CPU board with a single 1Gbit Spansion NOR
part on it, rather than the 2 separate devices.

I am planning to allocate 512Mbit to the "system" partitions (eg
bootloader, kernel, filesystem) and have the other 512Mbit as the "data"
partition.

Currently our wear levelling code uses mmap() to gain direct access to
the flash chip, which is not an issue, since all filesystem updates etc
are all carried out on the completely separate chip (via jffs2).

What I would like to know is, when the "system" and "user" partitions
reside on the *same" flash device, if I read/write directly to the
"user" partition, how do I maintain the jffs2 integrity on other
"system" partitions that may be doing their own read/write/erase
operations ?

If I can't read/write directly, can the same be achieved using the mtd
character device using something like:-

fd = open("/dev/mtd4", ..);
seek(fd, 1234);
write(fd, buff, ...);
...etc...

If I need to "manually" erase a sector on our custom data partition, how
can that be handled without disrupting any jffs2 flash access on the
other "system" partitions ?

Do the mtd ioctl() functions handle all the flash locking for me ?

Or is this a bit hole I'm digging for myself ?

Thanks for any help anyone can offer.

Regards
Mark J.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/