Re: Support of removable MTD devices and other advanced features (follow-up from lkml)

David Woodhouse
2008-05-21T09:06:07Z

On Tue, 2008-05-20 at 06:59 -0700, Alex Dubov wrote:
> Therefore, I propose (and intend to implement) a new architecture for MTD core,
> modeled after the block device API. The "alpha" version of it is here:
>
> http://gentoo-wiki.com/User:Oakad/mtd_proposal

That looks very interesting, and is fairly similar to what we were
thinking. Some of the outstanding problems we need to solve when we
change are:

- Support for devices larger than 4GiB.
- Clarifying whether buffers can be used for DMA
- Partitioning (which is a bit of a hack right now) & concatenation.
- Removable devices
- Sysfs presence

Here's one way I think we can get started on this...

1. Turn all calls to functions like mtd->read(mtd...) into calls to
core functions 'mtd_read()' which we can later play with.
2. Introduce a wrapper which acts on mtd_requests by making calls to
the existing direct driver functions (much like mtd_blkdevs.c does
for block requests).
3. Make our code 'mtd_read()' et al functions use the mtd_request API.
4. Shift partitioning into the new layer.
5. Make it possible for devices to provide the new API directly instead
of the old one being invoked through the wrappers -- and for user
modules to use it directly. This is the point at which we fix sysfs.

--
dwmw2