Howto write to flash from user space (II)

Fillod Stephane stephane.fillod at thomson.net
Thu Oct 21 13:07:26 EDT 2004


>I already read http://www.linux-mtd.infradead.org/
>but I found no useful informations

Maintainer: could this reply be added to a FAQ?

>How can I write directly into flash from an user space application ?
>I am using a SA1110 with 16MB StrataFlash.

	open("/dev/mtd0")
	lseek()
	write()
	read()
	close()

See "fcp" source code in mtd-utils for examples.

You need MTD char support built in your kernel.

>I tried using /dev/mem but I can only read and not write to flash.

/dev/mem would work for read's, but not write's since write requires
specific protocol. You should know that if you wanna use flash.
Read appropriate papers if need be.

>I do not have any /dev/mtd* device in my /dev , why ?

why? don't know. But you can go create them (MAKEDEV or mknod by hand),
AFAIAC I tend to run away from devfs.

>Do I need to develop a driver ?

no, StrataFlash is supported already. However, you may need a map driver
for declaring flash address and partitionning though.

>Please help me, with at least a useful link or better a sample.
>TIA

Hope it helps. Reading mailing list archives helps A LOT, as well as
kernel documentation, as well as other mtd tools, as weel as googling,
as well as linux/drivers/mtd/ ...

>
>(sorry for the broken thread, I've lost the original message)

Don't worry, my stinking MUA is not helping either :(

Regards
-- 
Stephane




More information about the linux-mtd mailing list