Re: MTD Device Drivers.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2004-09-23 at 10:00 +0200, matrix reloaded wrote:
> 	I am going through the code for device drivers of MTD [Memory Technology 
> Devices] and found that code in "mtdblock.c" uses interface which is for block 
> devices [like register_blkdev(), blk_init_queue() etc], but there is one mor folder 
> inside it named "devices" [drivers/mtd/devices] where there are some drivers for 
> doc1000, doc2000 and doc2001 etc. But here the interface used for implementing 
> driver is totally that of MTD devices only [like inter_module_register(), 
> inter_module_unregister() etc]. 
>  
> Can anyone please tell me why is it like this ? 

The MTD device driver infrastructure is for devices which appear to the
system as flash -- you can directly perform read/write/erase operations
on them.

On top of a flash device, you can implement a 'translation layer' -- a
kind of hackish pseudo-filesystem which is used to make it pretend to be
a normal block device, while taking care of wear levelling, bad block
remapping etc. We support a handful of these, including a _really_
simple one we call 'mtdblock' which does no wear levelling or remapping
but simply responds to a 'sector' write by reading the entire eraseblock
to which it corresponds, erasing that block, and then writing back the
whole block. Thus 'mtdblock' is quite useful just for dumping images to
the flash but you should never really be using it with a 'real' file
system on it in writable mode.

There are many types of device which have flash _inside_ them but which
also have a microcontroller to do this kind of 'translation layer' for
you. These really appear to the system as if they were a hard drive --
CompactFlash is like this. The MTD system is not relevant for those.

There are saner ways of using flash than making it pretend to be a block
device. JFFS2 is a log-structured file system which works directly on
flash, rather than through an extra layer of indirection.

JFFS2 should on the supported models of DiskOnChip, although we do
support M-Systems' 'NFTL' and 'INFTL' translation layers too.

However M-Systems _do_ make some devices which appear just as an IDE
drive. It's _possible_ that you're correct when you say that's what you
have, although _many_ people claim it's an IDE drive "just because it
says it's C: in DOS".

-- 
dwmw2



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux