public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* Howto write to flash from user space (II)
@ 2004-10-21 16:24 bodhi
  2004-10-21 18:11 ` Josh Boyer
  0 siblings, 1 reply; 3+ messages in thread
From: bodhi @ 2004-10-21 16:24 UTC (permalink / raw)
  To: linux-mtd

I already read http://www.linux-mtd.infradead.org/
but I found no useful informations
How can I write directly into flash from an user space application ?
I am using a SA1110 with 16MB StrataFlash.
I tried using /dev/mem but I can only read and not write to flash.
I do not have any /dev/mtd* device in my /dev , why ?
Do I need to develop a driver ?
Please help me, with at least a useful link or better a sample.
TIA

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: Howto write to flash from user space (II)
@ 2004-10-21 17:07 Fillod Stephane
  0 siblings, 0 replies; 3+ messages in thread
From: Fillod Stephane @ 2004-10-21 17:07 UTC (permalink / raw)
  To: bodhi, linux-mtd

>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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Howto write to flash from user space (II)
  2004-10-21 16:24 Howto write to flash from user space (II) bodhi
@ 2004-10-21 18:11 ` Josh Boyer
  0 siblings, 0 replies; 3+ messages in thread
From: Josh Boyer @ 2004-10-21 18:11 UTC (permalink / raw)
  To: bodhi; +Cc: linux-mtd

On Thu, 2004-10-21 at 11:24, bodhi@despammed.com wrote:
> I already read http://www.linux-mtd.infradead.org/
> but I found no useful informations

There's all kinds of useful information on there...  for MTD developers
;).

> How can I write directly into flash from an user space application ?

Using either /dev/mtdblock (CONFIG_MTD_BLOCK) or /dev/mtd
(CONFIG_MTD_CHAR).

You might also want to look into JFFS2 if you haven't already.

> I am using a SA1110 with 16MB StrataFlash.
> I tried using /dev/mem but I can only read and not write to flash.

That's for DRAM only.

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

You need to configure MTD into your kernel, and create the /dev nodes if
you aren't using devfs or udev.  The MAKEDEV script in the utils
directory helps with that.

> Do I need to develop a driver ?

No, StrataFlash is handled by the cfi_cmdset_0001 driver
(CONFIG_MTD_CFI_INTELEXT).

Also, the more information you give us, the more help we can provide. 
The board and flash chip types are a great start.  If you are still
having trouble, let us know what version of the kernel, what MTD
snapshot, etc.

josh

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-10-21 18:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-21 16:24 Howto write to flash from user space (II) bodhi
2004-10-21 18:11 ` Josh Boyer
  -- strict thread matches above, loose matches on Subject: below --
2004-10-21 17:07 Fillod Stephane

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox