direct access to Flash from userland

Fillod Stephane stephane.fillod at
Thu Sep 4 22:22:35 EST 2008

Dave Littell wrote:
>I have a CFI Flash device which has some non-CFI commands I need to
>issue from userland.  I've tried mmap() of the mtdblock device, but
>only yielded a corrupted Flash as my non-CFI command sequences were
>simply written to Flash.  An attempted mmap() of the character mtd
>device fails the mmap() call.

You should mmap() the /dev/mem device at the physical base address
of your Flash chip. Don't forget to pass O_SYNC to open(), in order
to have a guarded/non cached mapping.

>Is there a way for a userland application to issue non-CFI commands
>directly to a Flash device?  (This is a 2.6.18-based kernel on a AMCC
>PPC440EPx platform.)

I don't know whether there's specific ioctl for such purpose.
Have you tried to read the mtd source? You may also hack the mtd
layer to add your command. Definitely a question for


More information about the Linuxppc-embedded mailing list