What is the correct way to make an mtdchar device available?
ralphs at netwinder.org
Fri Aug 10 09:45:27 EDT 2007
On Thu, Aug 09, 2007 at 03:03:12PM -0400, James Olin Oden wrote:
> Is there any documentation anywhere that talks about the mapping
> driver, their uses and requriements?
Not specifically, that I am aware of. There is some documentation
in Documentation/DocBook/mtdnand.tmpl althought it is geard towards
NAND flash particulars. I actually started writing a little HOWTO
after I had figured it out, but it never got far enough to be useful.
> I started looking into this and the config involves answering things
> like "physical start address of flash mapping". I guess that would
> be the start adress of where the FWH maps itself into memory, but
> since there are two on the system setting this does not seem
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.
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.
> 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? The general steps are to turn
on MTD debug options in your kernel, enable the appropriate mapping
driver, and then look through the "dmesg" during boot-up, you should
see your flash chip detected. If not, check the mapping driver...
You should see something along these lines:
Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx
ide-floppy driver 0.99.newide
physmap platform flash device: 01000000 at ff000000
physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank
Intel/Sharp Extended Query Table at 0x0031
Using buffer write method
cfi_cmdset_0001: Erase suspend on write enabled
erase region 0: offset=0x0,size=0x20000,blocks=128
Once the chip is detected, you can enable mtdblock/char drivers and
then probably you want filesystem (JFFS2/YAFFS etc) on top of that.
More information about the linux-mtd