Subject: Re: MTD devices in NetBSD
To: Simon Burge <>
From: Garrett D'Amore <>
List: tech-kern
Date: 03/22/2006 08:17:54
Simon Burge wrote:
> "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.

Okay, but I think the point is that you might not want to have code for
a block device hanging around, particularly if you're going to use
something like JFFS2 that can access the "mtdbus" directly.

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

Sure.   I was just contriving an example. :-)

    -- Garrett
> Cheers,
> Simon.
> --
> Simon Burge                            <>
> NetBSD Support and Service:

Garrett D'Amore, Principal Software Engineer
Tadpole Computer / Computing Technologies Division,
General Dynamics C4 Systems
Phone: 951 325-2134  Fax: 951 325-2191