public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Multiple partitions on a FLASH device.
@ 2003-11-19 10:00 Vincent Catros
  2003-11-19 10:21 ` Andrew Lunn
  0 siblings, 1 reply; 6+ messages in thread
From: Vincent Catros @ 2003-11-19 10:00 UTC (permalink / raw)
  To: ecos-discuss

Hello,

I've a FLASH device (the Linux Synthetic Target one for the moment) that
I would like to split into multiple partitions.

Is it possible?
If yes, how to do that?

Thanks

Vincent


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

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

* Re: [ECOS] Multiple partitions on a FLASH device.
  2003-11-19 10:00 [ECOS] Multiple partitions on a FLASH device Vincent Catros
@ 2003-11-19 10:21 ` Andrew Lunn
  2003-11-19 10:41   ` [ECOS] RE : " Vincent Catros
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2003-11-19 10:21 UTC (permalink / raw)
  To: Vincent Catros; +Cc: ecos-discuss

On Wed, Nov 19, 2003 at 11:02:53AM +0100, Vincent Catros wrote:
> Hello,
> 
> I've a FLASH device (the Linux Synthetic Target one for the moment) that
> I would like to split into multiple partitions.
> 
> Is it possible?
> If yes, how to do that?

What exactly do you mean by partitions? Do you mean multiple jffs2
filesystems? ie /dev/flash1 & /dev/flash2?

In this case, not its not supported. But it does not look too hard to
add it. You would need to modify
packages/io/flash/current/io_flash.cdl and add a 
cdl_component CYGDAT_IO_FLASH_BLOCK_DEVICE_NAME_2 based on the ..._NAME_2.
Then in src/flashiodev.c:

static struct flashiodev_priv_t flashiodev_priv[1];

needs to have 2 entries when there are 2 devices, and add a second

BLOCK_DEVTAB_ENTRY( cyg_io_flashdev1,
                    CYGDAT_IO_FLASH_BLOCK_DEVICE_NAME_1,
                    0,
                    &cyg_io_flashdev1_ops,
                    &flashiodev_init,
                    0, // No lookup required
                    &flashiodev_priv[0] );

but make that last line &flashiodev_priv[1]

flashiodev_init() will need to be generalized. It assumes only one
device when working out what dev->start and dev->end should be. 

       Andrew

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

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

* [ECOS] RE : [ECOS] Multiple partitions on a FLASH device.
  2003-11-19 10:21 ` Andrew Lunn
@ 2003-11-19 10:41   ` Vincent Catros
  2003-11-19 10:57     ` [ECOS] " Andrew Lunn
  0 siblings, 1 reply; 6+ messages in thread
From: Vincent Catros @ 2003-11-19 10:41 UTC (permalink / raw)
  To: 'Andrew Lunn'; +Cc: ecos-discuss

> -----Message d'origine-----
> De : Andrew Lunn [mailto:andrew@lunn.ch]
> Envoyé : mercredi 19 novembre 2003 11:22
> À : Vincent Catros
> Cc : ecos-discuss@sources.redhat.com
> Objet : Re: [ECOS] Multiple partitions on a FLASH device.
> 
> On Wed, Nov 19, 2003 at 11:02:53AM +0100, Vincent Catros wrote:
> > Hello,
> >
> > I've a FLASH device (the Linux Synthetic Target one for the moment)
that
> > I would like to split into multiple partitions.
> >
> > Is it possible?
> > If yes, how to do that?
> 
> What exactly do you mean by partitions? Do you mean multiple jffs2
> filesystems? ie /dev/flash1 & /dev/flash2?

Yes.

> In this case, not its not supported. But it does not look too hard to
> add it. You would need to modify
> packages/io/flash/current/io_flash.cdl and add a
> cdl_component CYGDAT_IO_FLASH_BLOCK_DEVICE_NAME_2 based on the
..._NAME_2.
> Then in src/flashiodev.c:
> 
> static struct flashiodev_priv_t flashiodev_priv[1];
> 
> needs to have 2 entries when there are 2 devices, and add a second
> 
> BLOCK_DEVTAB_ENTRY( cyg_io_flashdev1,
>                     CYGDAT_IO_FLASH_BLOCK_DEVICE_NAME_1,
>                     0,
>                     &cyg_io_flashdev1_ops,
>                     &flashiodev_init,
>                     0, // No lookup required
>                     &flashiodev_priv[0] );
> 
> but make that last line &flashiodev_priv[1]

OK, this will work on a "Linux Synthetic Target" because that way we
create a totaly separated FLASH device.

But I plan to use multiple partitions on a real device where, for
instance, "/dev/flash1" and "/dev/flash2" are on the same device but on
different locations.

I think this is not possible without modifying the FLASH driver.
Am I wrong?

Regards.

Vincent


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

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

* [ECOS] Re: RE : [ECOS] Multiple partitions on a FLASH device.
  2003-11-19 10:41   ` [ECOS] RE : " Vincent Catros
@ 2003-11-19 10:57     ` Andrew Lunn
  2003-11-25 10:56       ` [ECOS] RE : " Vincent Catros
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2003-11-19 10:57 UTC (permalink / raw)
  To: Vincent Catros; +Cc: 'Andrew Lunn', ecos-discuss

> 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.
 
> But I plan to use multiple partitions on a real device where, for
> instance, "/dev/flash1" and "/dev/flash2" are on the same device but on
> different locations.
> 
> 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?

        Andrew

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

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

* [ECOS] RE : RE : [ECOS] Multiple partitions on a FLASH device.
  2003-11-19 10:57     ` [ECOS] " Andrew Lunn
@ 2003-11-25 10:56       ` Vincent Catros
  2003-11-25 12:18         ` [ECOS] " Andrew Lunn
  0 siblings, 1 reply; 6+ messages in thread
From: Vincent Catros @ 2003-11-25 10:56 UTC (permalink / raw)
  To: 'Andrew Lunn'; +Cc: ecos-discuss

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.

> -----Message d'origine-----
> De : Andrew Lunn [mailto:andrew@lunn.ch]
> Envoyé : mercredi 19 novembre 2003 11:57
> À : Vincent Catros
> Cc : 'Andrew Lunn'; ecos-discuss@sources.redhat.com
> Objet : Re: RE : [ECOS] Multiple partitions on a FLASH device.
> 
> > 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.

Regards

Vincent


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

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

* [ECOS] Re: RE : RE : [ECOS] Multiple partitions on a FLASH device.
  2003-11-25 10:56       ` [ECOS] RE : " Vincent Catros
@ 2003-11-25 12:18         ` Andrew Lunn
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2003-11-25 12:18 UTC (permalink / raw)
  To: Vincent Catros; +Cc: 'Andrew Lunn', ecos-discuss

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
replying!)

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
   driver.

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.

    Andrew

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

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

end of thread, other threads:[~2003-11-25 12:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-19 10:00 [ECOS] Multiple partitions on a FLASH device Vincent Catros
2003-11-19 10:21 ` Andrew Lunn
2003-11-19 10:41   ` [ECOS] RE : " Vincent Catros
2003-11-19 10:57     ` [ECOS] " Andrew Lunn
2003-11-25 10:56       ` [ECOS] RE : " Vincent Catros
2003-11-25 12:18         ` [ECOS] " Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).