public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Daniel Helgason <dhelgason@shaw.ca>
To: Andrew Lunn <andrew@lunn.ch>
Cc: ecos-discuss@ecos.sourceware.org
Subject: Re: [ECOS] Non-contiguous flash with flashv2
Date: Tue, 09 Dec 2008 00:41:00 -0000	[thread overview]
Message-ID: <1228759213.3047.50.camel@localhost.localdomain> (raw)
In-Reply-To: <20081204063325.GN27015@lunn.ch>

On Thu, 2008-12-04 at 07:33 +0100, Andrew Lunn wrote:
> > Take 2:
> > 
> > If I define two flash drivers that share code, then each driver will
> > have a single block_info that covers just the valid area:
> > 
> >   Driver 1
> >   - block_info[0] - program flash
> >   Driver 2
> >   - block_info[0] - boot flash
> 
> This is what was intended when i designed the API.
> 
> However, i did not think of your case, multiple FLASH devices hanging
> off one controller. 
> 
> The mutex is there to stop multiple threads accessing the same flash
> device. That is still valid for you.
> 
> However the fact that there is one controller is hidden from the flash
> API layer. You register two different devices. So your controller
> mutex should be lower down. The device specific driver needs to
> implement the mutex. 
> ...

Thanks Andrew. That's what I implemented.

It seems a bit of a pity to have to take two mutexs to perform a flash
operation. Would it be worth considering making the locking strategy a
configurable option in io/flash? Perhaps the choices could be none,
common, or per-driver.

If 'none' is selected, then flash drivers can implement their own
locking if they want. This would have to assume that the flash drivers
are aware of each others resource requirements. In smaller MPUs with
built-in flash and no external bus this restriction shouldn't be a
problem.

If 'common' is selected, then the io/flash layer would supply a single
lock that covers all drivers. Only a single flash driver could ever be
actively working at a time. This would have to assume that flash
operations complete in a timely manner.

If 'per-driver' is selected, then io/flash would do what it does now -
manage a lock for each flash driver.

To implement this would require changes to io/flash, of course, but I
don't think any of the existing v2 flash drivers would have to be
changed.

It comes to my mind as I write this email that maybe this idea would
impact flash drivers controlling NAND or serially accessed memory
devices. In fact the more I think about it, the less onerous having to
take two mutexes appears. Wishy-washy, eh?!

-- 
+---------------------------------------------
| Daniel Helgason <dhelgason@shaw.ca>


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

  reply	other threads:[~2008-12-08 18:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-04  6:18 Daniel Helgason
2008-12-04 10:41 ` Andrew Lunn
2008-12-09  0:41   ` Daniel Helgason [this message]
2008-12-10  6:10     ` Jonathan Larmour
2008-12-10 10:26     ` Bart Veer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1228759213.3047.50.camel@localhost.localdomain \
    --to=dhelgason@shaw.ca \
    --cc=andrew@lunn.ch \
    --cc=ecos-discuss@ecos.sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).