HOWTO SD and MMC card readers
From Gentoo Linux Wiki
| Installation • Kernel & Hardware • Networks • Portage • Software • System • X Server • Gaming • Non-x86 • Emulators • Misc |
Contents |
[edit] Introduction
Since kernel 2.6.17 there is support for a new type of SD/MMC card reader. I had trouble initially to get it working. It seems to be quite often in notebooks and is built by at least Texas Instruments, Ricoh and Toshiba.
My main problem was that I build modules whereas it seems necessary to build the driver into the kernel. I guess this will change with later kernels. 2.6.17-r4 still has this bug for me.
[edit] Configure The Kernel
You will probably need support for the file system on your medium as well (VFAT?).
cd /usr/src/linux make menuconfig
Make at least the following choices:
| Linux Kernel Configuration: At least a 2.6.17 kernel |
Code maturity level options --->
[*] Prompt for development and/or incomplete code/drivers
Device Drivers --->
MMC/SD Card support -->
<*> MMC support
[ ] MMC debugging
<*> MMC block device driver
<*> Secure Digital Host Controller Interface support (EXPERIMENTAL)
< > Winbond W83L51xD SD/MMC Card Interface support
File systems --->
<*> DOS FAT fs support
DOS/FAT/NT Filesystems -->
<*> MSDOS fs support
< > UMSDOS: Unix-like file system on top of standard MSDOS fs
<*> VFAT (Windows-95) fs support
|
[edit] Available drivers
[edit] sdricoh_cs
Recently you can experiment with the sdricoh_cs driver, in case you have this or some similar device.
CardBus bridge: Ricoh Co Ltd RL5c476 II (rev ac)
The sdricoh_cs driver is designed to make function Ricoh Secure Digital and MMC Card Readers that announce themselves as Ricoh Bay1Controller pcmcia device. To install the driver all you need to do is:
emerge -tva sdricoh_cs
In order for the driver to compile correctly, you would need to emerge gentoo-sources-2.18 or higher, compile it with the built-in options (or any other that make your Ricoh PCMCIA cards function properly):
Bus options (PCI, PCMCIA, EISA, MCA, ISA) ---> PCCARD (PCMCIA/CardBus) support ---> <*> PCCard (PCMCIA/CardBus) support [*] Enable PCCARD debugging <*> 16-bit PCMCIA support --- PC-card bridges <*> CardBus yenta-compatible bridge support
At the moment the driver is reported to function read-only with both SD and MMC cards. The latest version 0.1.3 enables write support by default. Please note that the driver is still in early developement, and with this ebuild you might well get your CPU working.
[edit] sdhci
(fixme)
[edit] tifm_sd
(fixme)
[edit] wbsd
(fixme)
[edit] The device
[edit] Adding your user to the disk group
On my machine the device belongs to root:disk. In order to user automount etc. it might be necessary to add your user to the group disk. Although this is probably not appropriate for a standard user account. (Would you also want him to be able umount anything else?!)
Consider user or users options to mount command and put that in /etc/fstab.
[edit] Using lspci
| Code: lspci |
|
lspci | grep MMC
|
On my machine this yields:
09:09.2 Class 0805: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter (rev 18)
[edit] Device
After rebooting and inserting a SD card you should have a device file like:
/dev/mmcblk0
And a partition on it:
/dev/mmcblk0p1
Try to mount it as root (after creating a mount point):
mkdir /mnt/mmc mount /dev/mmcblk0p1 /mnt/mmc
[edit] How to enable user mount
First, make sure your system is correctly setup to automount devices when plugged in. This can be achieved in a few different ways, for example with Thunar Volume Manager, gnome-volume-manager or IVMAN. They all use HAL, D-BUS and pmount (the latter, except thunar-volman) to handle the devices, so make sure those are installed and working (see the HOWTOs above).
If everything else automounts correctly but you are unable to mount the SD-card device with pmount, add the device to /etc/pmount.allow as follows:
| File: /etc/pmount.allow |
# pmount will allow users to additionally mount all devices that are # listed here. /dev/mmcblk0p1 |
[edit] Troubleshooting
If your notebook uses a TI card reader, the tifm_7xx1 and tifm_core drivers still don't work (as of kernel version 2.6.22) [My TI 5-in-1 Reader (PCIxx12 SD Host Controller) now works using the tifm_ modules under kernel 2.6.24]. There is an SDHCI mode that can be enabled that works with the sdhci driver; this works OK. To enable it, use lspci to get the address of the controller (it should show up as something like "Mass storage controller: Texas Instruments PCIxx21 Integrated FlashMedia Controller"), blacklist the tifm_* kernel modules, make sure the mmc_block kernel module gets loaded, and use setpci to put the controller in SDHCI mode:
| File: /etc/hotplug/blacklist |
... tifm_7xx1 tifm_core |
| File: /etc/conf.d/local.start |
... setpci -s 02:09.3 4c.b=02 # change the address to match your system |
| File: /etc/modules.autoload.d/kernel-2.6 |
... mmc_block |
If the driver loads but you get no device try to compile it directly into the kernel. NOT as a module. -- For me it works if I load mmc_core & mmc_block manually in that order.
You can also try making the device nodes yourself:
| Command: cat /proc/partitions |
major minor #blocks name 3 0 97685784 hda 3 1 32098 hda1 ... 252 0 500224 mmcblk0 252 1 500107 mmcblk0p1 |
Once you've located the card there, you can then use mknod to create the entries:
| Code: mknod |
mknod /dev/mmcblk0 b 252 0 mknod /dev/mmcblk0p1 b 252 1 |
Be sure to substitute the last two parameters with the values from your own /proc/partitions file.
On some cardreaders, udev reports the device as not removable, thus causing hal to ignore the device. A workaround is to create a new udev-rule and mount the device manually:
| File: /etc/udev/rules.d/10-mmc.rules |
# Mount and remove mmc partitions manually ACTION=="add" KERNEL=="mmcblk[0-9]p[0-9]", RUN+="/usr/bin/pmount %k" ACTION=="remove" KERNEL=="mmcblk[0-9]p[0-9]", RUN+="/usr/bin/pumount %k" |
Read http://www.dau-sicher.de/pmwiki/Main/CardreaderWithUdev to learn how to automount the mmc-device with read/write-permissions to normal user (needs to be in floppy-group).
[edit] See Also
- HOWTO Multicard reader
- HOWTO USB Mass Storage Device
- SDHCI The original driver (down at the moment?).
- [1] Sample set up with the driver on a Dell Inspirion 6400.
- [2] And Gentoo on an Inspirion 630.
- Driver for Ricoh - Experimental driver for Ricoh card readers
- Original thread for the Ricoh driver - Experimental driver for Ricoh card readers
- Ricoh card readers information on the SDHCI Wiki - Check the page attentively
