Subject: Re: MTD devices in NetBSD
To: Garrett D'Amore <garrett_damore@tadpole.com>
From: Simon Burge <simonb@wasabisystems.com>
List: tech-kern
Date: 03/22/2006 22:24:18
"Garrett D'Amore" wrote:

First off, I think "MTD" is the name of the Linux flash subsystem, as
opposed to a general term used to describe flash devices.  I'd be more
tempted to just call it the "flash" driver.

> Now, here's what I'm thinking:
> 
>    1. Start with a definition of what ops an MTD must export, probably
>       following Linux in this regard
>    2. Implement MI NOR flash driver using "CFI" (Common Flash Interface,
>       found on many NOR ports)
>    3. Implement bus-specific stuff for one or more platforms.
>    4. Implement MTD stuff as an "mtdbus" for lack of a better abstraction
>    5. Implement "mtd" (block/char compat) driver on top of mtdbus
>    6. Eventually, look at a rewrite of JFFS2 or YAFFS.

I think having an mtdbus in between the cfi driver and the final block
driver is just adding a level of indirection that isn't really needed in
this case.

> The resulting driver tree would look like (using alchemy as an example)
> 
> mainbus -> aubus -> cfiflash (via cfiflash_arbus.c) -> mtdbus -> mtd 
> (and maybe ffs mounted on top of mtd)

For the Alchemy case, you wouldn't attach to the aubus.  The aubus is
for peripherally type devices, whereas flash is just on the normal
memory bus.  You'd attach via an obio bus or even directly to the
mainbus.  I think via an obio bus would be "cleaner".

Thus you'd just end up with:  mainbus -> obio -> cfiflash -> flash.

Cheers,
Simon.
--
Simon Burge                            <simonb@wasabisystems.com>
NetBSD Support and Service:         http://www.wasabisystems.com/