The driver simply maps out the address space of the card and then tries each of the MTD
chip probe routines in sequence until it finds a device it understands. It is a
replacement for the memory_cs
module from the pcmcia-cs package but uses the
chip drivers from the MTD subsystem, and presents an MTD device rather than block and
char devices. A flash filesystem such as jffs2 can then be used on top of it or
the mtdblock
and mtdchar
modules can be used to give more
direct access.
NOTE Currently this driver is very alpha software, so please use with caution!
Then in the Linux kernel configuration under the MTD menu, select 'Mapping drivers for chip access' and select 'PCMCIA MTD driver' and select the chip drivers as required in the 'RAM/ROM/Flash chip drivers' section.
NOTE The PCMCIA MTD driver has only been tested as a module, so it best to compile it as so.
Rebuild and install the modules etc then edit your /etc/pcmcia/config
file
to add the following:
device "pcmciamtd"
class "memory" module "pcmciamtd"
And for each card type you have bind it to pcmciamtd
(by default they are
bound to memory_cs
) eg:
# # Memory cards # card "Anonymous Memory" anonymous bind "pcmciamtd" card "Memory Card" function memory_card bind "pcmciamtd" card "IBM 2MB SRAM" version "IBM", "2MB SRAM" bind "pcmciamtd"
and then restart cardmgr.
Note If the module is bound to the Anonymous memory then it may be used for any card that can not be identified, which may not always be desirable.
buswidth | Set buswidth (1 = 8 bit, 2 = 16 bit, default = 2) |
mem_speed | Set memory access speed in ns |
force_size | Force size of card in MB (1-64 default = 64) |
vpp | Set Vpp in 1/10ths eg 33 = 3.3V 120 = 12V (Dangerous) |
setvpp | Set Vpp (0=Never, 1=On writes, 2=Always on, default=0) |
mem_type | Set Memory type (0 = Flash, 1 = RAM, 2 = ROM, default = 0) |
debug | Debug level 0 - 5 (default = MTD debug) |
buswidth
sets the memory window into 8 or 16bit mode. By default it uses
16bit mode, however the correct usage is dependant on the card's hardware.
memspeed
sets the access speed of the memory in nanoseconds. This option
should not be needed unless the card doesnt work with the default.
force_size
sets the size of the memory area to search if it cannot be
determined from the CIS. The probe routine looks for flash chips in this area and
may find a smaller flash memory area than was set with force_size.
vpp
set the Vpp used to power the card optionally for
programming the card during write and erase. This is very card specific and some
cards can require different Vpp voltages. This can be apparent if the card
can be read, but not be written or erased. Currently the only way to find out the required
voltages is to enable debugging in the probe routines and see the model numbers of the
chips that are found. The voltages are set in 1/10ths of a volt so to set Vpp to 5.0
volts, use vpp=50
. This option can damage hardware if voltages are
incorrectly set!
setvpp
enables setting of Vpp. Not all flash chips require Vpp whilst others
do. setvpp
allows three modes: 0 sets the Vpp to 0 volts permanently, 1 enables
the set_vpp()
function to be called everytime the chip driver wants to write to
the chip to set the Vpp on and off and 2 sets the Vpp on permanently. Enabling the
set_vpp()
can slow down writes quite considerably as every write requires a PCMCIA
subsystem call to set the Vpp on and off. However not all flash chips require or want the Vpp
to be enabled permanently.
mem_type
sets the probe routines to call. 0 will use the jedec_probe
and cfi_probe. This probe can fail if no supported flash chips are found. Using
1 or 2 will always succed as the RAM and ROM probe routines dont actually probe and just
return true.
debug
sets the debug level. This is only compiled in if CONFIG_MTD_DEBUG is
set. 0 is quiet, 5 is very noisy.
If the card does not appear to work, then try using the memory_cs
module.
If this works then please report this as a bug (include as much information as possible
about the hardware).
Patch against 2.4.19
patch-2.4.19-pcmciamtd.diff
This driver is now in kerenel 2.5.44. These patches fix removal of the card and cleaning up on exit. They also handle the card being removed whilst in use (and just returning fail to the chip drivers).
Patch against 2.4.19
patch-2.4.19-pcmciamtd-2.diff
Patch against 2.5.44
patch-2.5.44-pcmciamtd.diff