How to get the internal SD card working

From ThinkWiki
Revision as of 23:59, 16 April 2007 by Runia (Talk | contribs) (chg: stress that starting from 2.6.17-rc1 no patch required)
Jump to: navigation, search

Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter

1. First of it all you need a working kernel 2.6 source.

2. Get the patches at all the *.bin.

=> Note that with kernel versions >= 2.6.17-rc1, the driver is included in the kernel, and patching is unnecessary.

3. Patch your kernel

 cd /usr/src/linux
 patch -p1 < sdhci-0001.bin
 patch -p1 < pci-sdhc-0001.bin
 patch -p1 < mmc-respopcode-0001.bin

4. reconfigure your kernel with menuconfig

 make menuconfig

5. activate "Device Drivers" -> "MMC/SD Card support"

 <*> MMC support
 <*>   MMC block device driver
 <M>   Secure Digital Host Controller Interface support  (EXPERIMENTAL)

6. recompile your kernel & reboot

 make clean && make && make modules_install.. dont forget to copy your new kernel. ;)

7. Modprobe your new kernel module:

 modprobe sdhci

8. Mount your SD card

 mount /dev/mmcblk0p1 /mnt

9. RocknRoll

Ubuntu 6.10 'edgy eft':

To get the card reader working on edgy:

Add the module 'tifm_sd' to /etc/modules and restart. Now this module gets loaded on sys bootup and a card is detected when inserted. The card reader is found as /dev/mmcblk0 and mounted automatically on card insert.


1. Make a backup of your 'modules' in case something goes wrong:

 $ sudo cp /etc/modules /etc/modules.backup

2. Open the file with gedit:

 $ sudo gedit /etc/modules

3. Add the following entry to the end of the file:


4. Save and close the file. On the next boot, the sd-card reader works.

As mentioned below, this is already reported as a bug: BUG #53268

Update for FC5 running the newest 2.6.17 kernel:

1. modprobe mmc_block

2. modprobe sdhci

3. mount /dev/mmcblk0p1 /mnt

4. RocknRoll

Tested on my X41 with 04:00.1 Class 0805: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter (rev 13)

Automated module loading

I'm using ASPLinux release 11 (Seliger) based on FC4 and kernel 2.6.17-1.2142asp.

  • 1. I created the script /etc/sysconfig/modules/sd.modules to load modules on boot. Don't forget to chmod it 775.

start () {
        for i in mmc_core mmc_block sdhci; do
                /sbin/modprobe $i >/dev/null 2>&1

stop () {
        for i in sdhci mmc_block mmc_core; do
                /sbin/rmmod $i >/dev/null 2>&1

restart() {

case $1 in
                echo -n "Reloading SD modules"
                echo ".. DONE"
  • 2. This script will run after reboot. When you insert a card the automount system in KDE or Gnome will catch the medium on the fly. I found that it only works if the medium is inserted at boot time due to a BUG :-(. That's why my script is longer then it has to be...

BUG Currently the bug exists in automounting an SD card. The SD card is mounted properly when the card is inserted at boot time (or at time when modules is loaded). Otherwise it is not mounted (BUG #53268). The temporary workaround is to remove && insert the module while the medium is in the reader (/etc/sysconfig/modules/sd.modules restart). Note that you have to be root to perform this.

Tested on my Z60t with 14:00.2 Class 0805: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter (rev 17)

Texas Instruments 5-in-1 Multimedia Card Reader (SD/MMC/MS/MS PRO/xD)

To get the TI 5in1 Card Reader (like it is built in the Z61m) to work, you need a recent kernel (I use 2.6.19 on Debian Sid here, should work with 2.6.18 too) with some special options enabled:

Device Drivers → Misc devices → [M]TI Flash Media interface support (EXPERIMENTAL) (CONFIG_TIFM_CORE)

Device Drivers → Misc devices → [M]TI Flash Media PCI74xx/PCI76xx host adapter support (EXPERIMENTAL) (CONFIG_TIFM_7XX1)

Device Drivers → MMC/SD Card support → [M]MMC support (CONFIG_MMC)

Device Drivers → MMC/SD Card support → [M]MMC block device driver (CONFIG_MMC_BLOCK)

Device Drivers → MMC/SD Card support → [M]TI Flash Media MMC/SD Interface support (EXPERIMENTAL) (CONFIG_MMC_TIFM_SD)

After rebuilding your kernel, you should get some new modules: tifm_core, tifm_7xx1, mmc_core, mmc_block, tifm_sd. The first two will get autoloaded on boot, if you use some kind of hardware-autodetection, the others won't, so edit your /etc/modules (or however the file where the modules to load on boot are listed is called by your distribution) and add these modules there.

After a reboot, or after you've loaded the modules by-hand with modprobe, you can put a SD-Card into the slot and see the light blink once. You should see something like this in your $ dmesg output:

 tifm_7xx1: sd card detected in socket 1
 mmcblk0: mmc0:b368 SMI   999424KiB
  mmcblk0: p1
 mmcblk0: error 4 sending stop command
 end_request: I/O error, dev mmcblk0, sector 1998840
 Buffer I/O error on device mmcblk0, logical block 249855}}

Don't care about the errors, my card is still working. Now you can mount the card with # mount /dev/mmcblk0p1 /somewhere and work with it.

This works only for SD cards at the moment, the driver isn't able to handle MMC/MS/MS PRO/xD yet.