public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* Mtd block access (jffs2 formatted) and mtd char access (unformatted) on different partitions of a single flash device
@ 2003-05-20 20:53 John Burch
  2003-05-20 21:13 ` Charles Manning
  2003-05-21  9:05 ` Jörn Engel
  0 siblings, 2 replies; 6+ messages in thread
From: John Burch @ 2003-05-20 20:53 UTC (permalink / raw)
  To: linux-mtd

Is there a preferred way to access different mtd partitions of a single
flash device when certain accesses will be (1) block oriented via
standard file I/O of a jffs2 file system mounted on a /dev/mtdblockN
device and other accesses will be (2) character oriented via 'dd' (or
some other mechanism?) of unformatted/raw flash using /dev/mtdN?  Are
there any possibly bad interactions between mtd char and block device
access to the same device?

I've adopted a system that uses a driver with its own flash support to
read/write raw (non-jffs2) portions of the flash, while application code
uses standard file I/O to read/write jffs2 partitions on the same
device.  I'm concerned that these accesses may clash and possibly result
in corrupted flash, crashed kernel, etc.  Is this a legitimate concern
or does the mtd driver check flash status prior to any operations?


Thanks,
John

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

* Re: Mtd block access (jffs2 formatted) and mtd char access (unformatted) on different partitions of a single flash device
  2003-05-20 20:53 Mtd block access (jffs2 formatted) and mtd char access (unformatted) on different partitions of a single flash device John Burch
@ 2003-05-20 21:13 ` Charles Manning
  2003-05-21  9:05 ` Jörn Engel
  1 sibling, 0 replies; 6+ messages in thread
From: Charles Manning @ 2003-05-20 21:13 UTC (permalink / raw)
  To: John Burch, linux-mtd

On Wednesday 21 May 2003 08:53, John Burch wrote:
> Is there a preferred way to access different mtd partitions of a single
> flash device when certain accesses will be (1) block oriented via
> standard file I/O of a jffs2 file system mounted on a /dev/mtdblockN
> device and other accesses will be (2) character oriented via 'dd' (or
> some other mechanism?) of unformatted/raw flash using /dev/mtdN?  Are
> there any possibly bad interactions between mtd char and block device
> access to the same device?

This should not be a problem.
>
> I've adopted a system that uses a driver with its own flash support to
> read/write raw (non-jffs2) portions of the flash, while application code
> uses standard file I/O to read/write jffs2 partitions on the same
> device.  I'm concerned that these accesses may clash and possibly result
> in corrupted flash, crashed kernel, etc.  Is this a legitimate concern
> or does the mtd driver check flash status prior to any operations?

It is mtd's job to handle this sort of thing.

-- CHarles

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

* Re: Mtd block access (jffs2 formatted) and mtd char access (unformatted) on different partitions of a single flash device
  2003-05-20 20:53 Mtd block access (jffs2 formatted) and mtd char access (unformatted) on different partitions of a single flash device John Burch
  2003-05-20 21:13 ` Charles Manning
@ 2003-05-21  9:05 ` Jörn Engel
  2003-05-21  9:25   ` David Woodhouse
  1 sibling, 1 reply; 6+ messages in thread
From: Jörn Engel @ 2003-05-21  9:05 UTC (permalink / raw)
  To: John Burch; +Cc: linux-mtd

On Tue, 20 May 2003 16:53:30 -0400, John Burch wrote:
> 
> Is there a preferred way to access different mtd partitions of a single
> flash device when certain accesses will be (1) block oriented via
> standard file I/O of a jffs2 file system mounted on a /dev/mtdblockN
> device and other accesses will be (2) character oriented via 'dd' (or
> some other mechanism?) of unformatted/raw flash using /dev/mtdN?  Are
> there any possibly bad interactions between mtd char and block device
> access to the same device?

Usually not. It would be a bug.

> I've adopted a system that uses a driver with its own flash support to
> read/write raw (non-jffs2) portions of the flash, while application code
> uses standard file I/O to read/write jffs2 partitions on the same
> device.  I'm concerned that these accesses may clash and possibly result
> in corrupted flash, crashed kernel, etc.  Is this a legitimate concern
> or does the mtd driver check flash status prior to any operations?

The physical flash device can only have one driver accessing it at any
time. The low level chip drivers have locking for this, so you should
be safe.

What does "driver" mean? If you have two in-kernel drivers for the
same flash chip, they will use different locks and things will break.
If that is a user-space driver, using the /dev/mtdX devices, you are
perfectly safe. Which one is it?

Jörn

-- 
Courage is not the absence of fear, but rather the judgement that
something else is more important than fear.
-- Ambrose Redmoon

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

* Re: Mtd block access (jffs2 formatted) and mtd char access (unformatted) on different partitions of a single flash device
  2003-05-21  9:05 ` Jörn Engel
@ 2003-05-21  9:25   ` David Woodhouse
  2003-05-21 12:33     ` Mtd block access (jffs2 formatted) and mtd char access(unformatted) on different partitions of a single flashdevice John Burch
  0 siblings, 1 reply; 6+ messages in thread
From: David Woodhouse @ 2003-05-21  9:25 UTC (permalink / raw)
  To: Jörn Engel; +Cc: linux-mtd, John Burch

On Wed, 2003-05-21 at 10:05, Jörn Engel wrote:
> > I've adopted a system that uses a driver with its own flash support to
> > read/write raw (non-jffs2) portions of the flash, while application code
> > uses standard file I/O to read/write jffs2 partitions on the same
> > device.
> 
> What does "driver" mean? If you have two in-kernel drivers for the
> same flash chip, they will use different locks and things will break.
> If that is a user-space driver, using the /dev/mtdX devices, you are
> perfectly safe. Which one is it?

Hmmm. What he actually said was 'driver with its own flash support',
which sounds bad. As long as everything accessing the flash goes through
the MTD driver for the flash, using its read/write/erase functions
rather than banging on the hardware directly, it'll be fine. If your raw
driver is actually dealing with the flash driver directly, that's
broken.

-- 
dwmw2

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

* RE: Mtd block access (jffs2 formatted) and mtd char access(unformatted) on different partitions of a single flashdevice
  2003-05-21  9:25   ` David Woodhouse
@ 2003-05-21 12:33     ` John Burch
  2003-05-21 12:35       ` Mtd block access (jffs2 formatted) and mtd char access(unformatted) on different partitions of a single flash device David Woodhouse
  0 siblings, 1 reply; 6+ messages in thread
From: John Burch @ 2003-05-21 12:33 UTC (permalink / raw)
  To: 'David Woodhouse', 'Jörn Engel'; +Cc: linux-mtd

> > 
> > What does "driver" mean? If you have two in-kernel drivers for the 
> > same flash chip, they will use different locks and things 
> will break. 
> > If that is a user-space driver, using the /dev/mtdX 
> devices, you are 
> > perfectly safe. Which one is it?
> 
> Hmmm. What he actually said was 'driver with its own flash 
> support', which sounds bad. As long as everything accessing 
> the flash goes through the MTD driver for the flash, using 
> its read/write/erase functions rather than banging on the 

When accessing "raw" flash via the char driver, how can I initiate a
sector erase?  Also, does the mtd driver for AMD CFI devices handle
AMD's ability to support erasure of multiple sectors simultaneously?

> hardware directly, it'll be fine. If your raw driver is 
> actually dealing with the flash driver directly, that's broken.
> 

David has it right.  The raw "in-kernel" driver deals with flash
directly on its own, not through mtd.

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

* RE: Mtd block access (jffs2 formatted) and mtd char access(unformatted) on different partitions of a single flash device
  2003-05-21 12:33     ` Mtd block access (jffs2 formatted) and mtd char access(unformatted) on different partitions of a single flashdevice John Burch
@ 2003-05-21 12:35       ` David Woodhouse
  0 siblings, 0 replies; 6+ messages in thread
From: David Woodhouse @ 2003-05-21 12:35 UTC (permalink / raw)
  To: John Burch; +Cc: linux-mtd, 'Jörn Engel'

On Wed, 2003-05-21 at 13:33, John Burch wrote:
> When accessing "raw" flash via the char driver, how can I initiate a
> sector erase?  
See how it's done in util/erase.c: ioctl(...MEMERASE...)

> Also, does the mtd driver for AMD CFI devices handle
> AMD's ability to support erasure of multiple sectors simultaneously?

Probably not yet, but there's no reason why it shouldn't. Criticism in
'diff -u' form is preferred :)

> David has it right.  The raw "in-kernel" driver deals with flash
> directly on its own, not through mtd.

Then you lose :) If you have sane code which handles multiple concurrent
erases, we'd be happy to merge it so that you can use the mtd driver
without losing out on that feature ;)

-- 
dwmw2

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

end of thread, other threads:[~2003-05-21 12:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-20 20:53 Mtd block access (jffs2 formatted) and mtd char access (unformatted) on different partitions of a single flash device John Burch
2003-05-20 21:13 ` Charles Manning
2003-05-21  9:05 ` Jörn Engel
2003-05-21  9:25   ` David Woodhouse
2003-05-21 12:33     ` Mtd block access (jffs2 formatted) and mtd char access(unformatted) on different partitions of a single flashdevice John Burch
2003-05-21 12:35       ` Mtd block access (jffs2 formatted) and mtd char access(unformatted) on different partitions of a single flash device David Woodhouse

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