What is the correct way to make an mtdchar device available?

James Olin Oden james.oden at gmail.com
Fri Aug 10 10:20:49 EDT 2007

> When you have multiple chips arranged contiguously, then you just give
> it the beginning address of the block, and the total size.  The code
> does multiple probes in this region to identify the individual flash
> chips.  Interleaved devices (eg. two x16 devices on a 32-bit bus)
> are also handled the same way.
> Flash is often physically located at the very top, or very bottom, of
> the memory map.  So if you have say 16MiB of flash, chances are that it
> is mapped at address 0xff000000 with a size of 0x01000000.
So is there a way to tell physmap this information when you load it,
rather than have it hard coded in the kernel?  Or am I
misunderstanding things?

> In the drivers/mtd/maps directory you will see a large number of very
> similar mapping drivers for various boards.  They differ in how they
> get the address/size parameters-- some are hardcoded for specific boards,
> others read information dynamically from the bootloader, etc.  Many of
> them also handle partitioning of the flash -- splitting physical devices
> into multiple logical ones, much like you'd do on a hard disk.
So does this mean I would need to create one of these drivers for each
of my firmware hub types?

Also, what roll then does the code in jedec_probe play in all this?
My simple fantasy was that since there was "probe" info for my two
flash devices (i.e. the two I needed to support) I should only need to
load jedec_probe and mtdchar.  But that was not the case...so where is
my thinking wrong?

> > Also, is there anything that explains what one might need to do in the
> > context of simply making a flash chip available for reading and
> > writing through mtdchar mtdblock?
> I presume you've see the FAQ and the general documention on the
> www.linux-mtd.infradead.org web site?
Yeah your presumption is correct.  I think what the FAQ needs is some
question like:

   I have flash device X used for BIOS, what do I need to do to update my BIOS?

or even:

  How do I update my BIOS with MTD?

The crazy part is once I get the thing detected and the mtdchar device
up its, a very simple process.  If I get this going at some point I am
definately willing to provide the text for that part of the FAQ.   I
think the issue I am having is that though I'm comfortable in the
kernel and with programing in linux, I'm not an embedded developer and
most of the docs are geared towards "so you want to put a filesystem
on this flash device" or "so you want to boot from this flash device",
but the subsystem at least as much as I can understand is clearly
suitable for the "so you want to update your bios" users.


More information about the linux-mtd mailing list