[ECOS] Re: RE : RE : [ECOS] Multiple partitions on a FLASH device.

Andrew Lunn andrew@lunn.ch
Tue Nov 25 12:18:00 GMT 2003

On Tue, Nov 25, 2003 at 11:59:09AM +0100, Vincent Catros wrote:
> Andrew,
> Sorry for my late answer but, as a newbye with eCos, I preferred to
> "dive" a little bit more into source code before saying something
> obviously wrong.

Thats good. Well thought out questions will get better answers.

> > > OK, this will work on a "Linux Synthetic Target" because that way we
> > > create a totaly separated FLASH device.
> > 
> > How are they seperate. I don't understand what you mean.
> OK, my sentence was not clear.
> I was thinking that you asked me to create 2 "Synthetic FLASH Device"
> emulated by 2 different files. That was the meening of "totaly separated
> FLASH devices".
> I think that using 1 "Synthetic FLASH device" with 2 partitions will
> work.
> But this is a particular case.
> With "Synthetic FLASH Driver", the "FLASH" device is emulated by a file.
> Mutual access to different regions of a file (different FLASH
> partitions) using different file handles are safe.
> For "real FLASH device" driver I think it's different.
> > > I think this is not possible without modifying the FLASH driver.
> > 
> > What do you think is wrong with the FLASH driver. Why cannot it do
> > this?
> Some FLASH registers are accessed for read/write/erase operations.
> Mutual accesses to tis registers don't seem to be safe. 
> I did'nt seen any critical ressource access protection.
> So, mutual read/write/erase operations issued from 2 different JFFS2
> file-system will probably go wrong at FLASH device level.

This is the key point. And its not just 2 different JFFS2 FS's but its
any two general flash operations which need mutual exclusion. You
appear to be correct, i cannot find any mutex's in the current code. I
assumed there was when i replied. (Should of checked myself before

OK. There are two obvious ways to solve this.

1) Modify the generic flash layer. Add calls to cyg_drv_mutex_(un)lock
   around the operations which call down into the hardware specific

2) Modify the hardware specific drivers to perform the locking.

The first has the advantage its quick and easy to do and solves the
problem for all devices in one go. The second has the advantage that
when there are multiple flash devices in series, it would be possible
to apply mutex to each device, so allowing operations on different
devices to work in parallel.

I would go for 1) to start with. If anybody needs the extra
performance of 2), it would be easy to add it afterwards.

Do you feel up to coding this? If so, send us a patch, with ChangeLog,
and we will review it.


Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

More information about the Ecos-discuss mailing list