[U-Boot] Reg. CFI flash_init and hardware write protected devices

Wolfgang Denk
2011-06-24T14:26:49Z

Dear =?ISO-8859-1?Q?Frank_Svendsb=F8e?=,

In message <BANLkTimt0LYXr-B5PAr1ONEaEoWKCyEHbw@mail.gmail.com> you wrote:
>
> Hi Wolfgang, I did as you recommended and replaced cfi-flash with
> mtd-ram in the device tree. I also defined CONFIG_MTD_PHYSMAP_OF,
> CONFIG_MTD_MTDRAM, CONFIG_MTDRAM_TOTAL_SIZE according to our
> specifications. The default erase-size was 128k, which is what we have
> too, so I didn't touch that. Now when I boot the kernel recognizes all
> the partitions I've defined in the dts. But, when mounting a
> jffs2-filesystem, it ends with a jffs2_scan_eraseblock(): Magic
> bitmask 0x1985 not found...
>
> Do you have any other tips?

Difficult to speculate - I don't know your hardware (eventually you
have two 16 bit flash chips in parallel to build a 32 bit bus, and
have to double the chip's erase block size?), and I don;t know how you
created the JFFS2 file system.

Are you sure you want to use JFFS2? UBIFS is considered to be a
better choice these days...

> When working with this, I realised that if I could get it to work we'd
> still might have a problem. You see, we need write access for one of
> the flashes when upgrading software. We can't treat this as a simple
> ROM. So do we need CFI working in order to set the device into
> write-mode, erase flash sectors, etc.? Or do mtd-ram handle flash
> write operations too?

mtd-ram provides a pure memory interface, i. e. you cannot use this to
erase or program any blocks in a CFI flash device. To do so, you need
the CFI driver.

> In theory, I guess I could unmount the root fs, unload the mtd module,
> insert the cfi-flash module, mount the filesystem, then write, etc..

Yes, or you could start with the CFI driver in the first place.

> But isn't that harder than write a custom map driver?

I consider your chances to get such a customdriver into mainline to be
epsilon. And you don't really want to use any out of tree drivers.

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If you're out of tree, you don't exist.
- David Woodhouse in <1304620350.2398.29.camel@i7.infradead.org>