Difference between revisions of "How to get the internal SD card working"
(Driver is included in kernel version >= 2.6.17-rc1) |
|||
(13 intermediate revisions by 12 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{NOTE|The information on this page is stale, the SD-Card patches mentioned below have long found there way into the kernel, so patches for any recent kernel are no longer required. SD cards (at least storage cards) should work out of the box with any recent Linux distribution}} | ||
+ | |||
+ | =Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter= | ||
+ | |||
1. First of it all you need a working kernel 2.6 source. | 1. First of it all you need a working kernel 2.6 source. | ||
− | 2. Get the patches at http://mmc.drzeus.cx/wiki/Linux/Drivers/sdhci all the *.bin. Note that with kernel versions >= 2.6.17-rc1, the driver is included in the kernel, and patching is unnecessary. | + | 2. Get the patches at http://mmc.drzeus.cx/wiki/Linux/Drivers/sdhci 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 | + | 3. Patch your kernel |
cd /usr/src/linux | cd /usr/src/linux | ||
Line 10: | Line 16: | ||
patch -p1 < mmc-respopcode-0001.bin | patch -p1 < mmc-respopcode-0001.bin | ||
− | 4. reconfigure your | + | 4. reconfigure your kernel with menuconfig |
make menuconfig | make menuconfig | ||
− | 5. | + | 5. activate "Device Drivers" -> "MMC/SD Card support" |
<*> MMC support | <*> MMC support | ||
Line 24: | Line 30: | ||
make clean && make && make modules_install.. dont forget to copy your new kernel. ;) | make clean && make && make modules_install.. dont forget to copy your new kernel. ;) | ||
− | 7. Modprobe your new | + | 7. Modprobe your new kernel module: |
modprobe sdhci | modprobe sdhci | ||
− | 8. Mount your SD | + | 8. Mount your SD card |
mount /dev/mmcblk0p1 /mnt | mount /dev/mmcblk0p1 /mnt | ||
Line 34: | Line 40: | ||
9. RocknRoll | 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. | ||
+ | |||
+ | '''Step-by-step:''' | ||
+ | |||
+ | 1. Make a backup of your 'modules' in case something goes wrong: | ||
+ | {{cmduser|sudo cp /etc/modules /etc/modules.backup}} | ||
+ | 2. Open the file with gedit: | ||
+ | {{cmduser|sudo gedit /etc/modules}} | ||
+ | 3. Add the following entry to the end of the file: | ||
+ | tifm_sd | ||
+ | 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: [https://launchpad.net/distros/ubuntu/+bug/53268 BUG #53268] | ||
== Update for FC5 running the newest 2.6.17 kernel: == | == Update for FC5 running the newest 2.6.17 kernel: == | ||
Line 51: | Line 74: | ||
I'm using ASPLinux release 11 (Seliger) based on FC4 and kernel 2.6.17-1.2142asp. | I'm using ASPLinux release 11 (Seliger) based on FC4 and kernel 2.6.17-1.2142asp. | ||
− | * 1. | + | * 1. I created the script <code>/etc/sysconfig/modules/sd.modules</code> to load modules on boot. Don't forget to chmod it 775. |
<pre> | <pre> | ||
Line 58: | Line 81: | ||
start () { | start () { | ||
for i in mmc_core mmc_block sdhci; do | for i in mmc_core mmc_block sdhci; do | ||
− | modprobe $i >/dev/null 2>&1 | + | /sbin/modprobe $i >/dev/null 2>&1 |
done | done | ||
} | } | ||
Line 64: | Line 87: | ||
stop () { | stop () { | ||
for i in sdhci mmc_block mmc_core; do | for i in sdhci mmc_block mmc_core; do | ||
− | rmmod $i >/dev/null 2>&1 | + | /sbin/rmmod $i >/dev/null 2>&1 |
done | done | ||
} | } | ||
Line 90: | Line 113: | ||
</pre> | </pre> | ||
− | * 2. This script will run after reboot. When you insert card the automount system in | + | * 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 | + | '''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 ([https://launchpad.net/distros/ubuntu/+bug/53268 BUG #53268]). The temporary workaround is to remove && insert the module while the medium is in the reader (<code>/etc/sysconfig/modules/sd.modules restart</code>). 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) | 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)= | ||
+ | |||
+ | The TI 5-in-1 card reader is found several Z-series ThinkPads (such as the {{Z61m}}, {{Z61e}}, and the {{Z61t}}). You will need a recent kernel and will need need to enable the [[tifm]] drivers in the kernel: | ||
+ | |||
+ | {{kernelconf|CONFIG_TIFM_CORE|[M]|TI Flash Media interface support (EXPERIMENTAL)|Misc devices|Device Drivers||}} | ||
+ | |||
+ | {{kernelconf|CONFIG_TIFM_7XX1|[M]|TI Flash Media PCI74xx/PCI76xx host adapter support (EXPERIMENTAL)|Misc devices|Device Drivers||}} | ||
+ | |||
+ | {{kernelconf|CONFIG_MMC|[M]|MMC support|MMC/SD Card support|Device Drivers||}} | ||
+ | |||
+ | {{kernelconf|CONFIG_MMC_BLOCK|[M]|MMC block device driver|MMC/SD Card support|Device Drivers||}} | ||
+ | |||
+ | {{kernelconf|CONFIG_MMC_TIFM_SD|[M]|TI Flash Media MMC/SD Interface support (EXPERIMENTAL)|MMC/SD Card support|Device Drivers||}} | ||
+ | |||
+ | {{NOTE|As of this writing, these drivers are still experimental and under ongoing development. See the [[tifm]] page for further important details and caveats.}} | ||
+ | |||
+ | After rebuilding your kernel, you should have the modules '''tifm_core''', '''tifm_7xx1''', '''tifm_sd''', '''mmc_core''', and '''mmc_block'''. Because these drivers are relatively new, the HAL auto-detection system may not load them on boot, requiring you to add them to {{path|/etc/modules}} (or equivalent for your distribution). | ||
+ | |||
+ | The modules may be loaded by hand using the '''modprobe''' command as root: | ||
+ | |||
+ | {{cmdroot|modprobe tifm_7xx1 tifm_sd}} | ||
+ | |||
+ | '''modprobe''' will correctly load the dependent modules. Once loaded, you may insert an SD card into the slot. The LED should blink once as the card is inspected, and output from '''dmesg''' should report finding a card: | ||
+ | |||
+ | tifm_core: MMC/SD card detected in socket 0:1 | ||
+ | PM: Adding info for tifm:tifm_sd0:1 | ||
+ | PM: Adding info for No Bus:mmc1 | ||
+ | PM: Adding info for mmc:mmc1:b368 | ||
+ | mmcblk0: mmc1:b368 SD 993792KiB | ||
+ | mmcblk0: p1 | ||
+ | |||
+ | If you see errors, you could probably do with a newer version of the [[tifm]] drivers. | ||
+ | |||
+ | After insertion, the {{path|/dev}} heirarchy is populated with new devices. {{path|/dev/disk/by-label}} should be populated with the labels of the partitions on the device, which you may then mount: | ||
+ | |||
+ | {{cmdroot|mount /dev/disk/by-label/cardlabel /mnt}} | ||
+ | |||
+ | Alternatively, you can mount the block device directly, which usually appears as {{path|/dev/mmcblk0}} or, when the card has a partition table, {{path|/dev/mmcblk0p1}}: | ||
+ | |||
+ | {{cmdroot|mount /dev/mmcblk0p1 /mnt}} | ||
+ | |||
+ | {{NOTE|As of this writing, only SD cards are reported to work. The driver isn't yet able to handle MMC/MS/MS PRO/xD cards.}} |
Latest revision as of 21:46, 29 July 2009
Contents
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 http://mmc.drzeus.cx/wiki/Linux/Drivers/sdhci 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.
Step-by-step:
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:
tifm_sd
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.
#!/bin/sh start () { for i in mmc_core mmc_block sdhci; do /sbin/modprobe $i >/dev/null 2>&1 done } stop () { for i in sdhci mmc_block mmc_core; do /sbin/rmmod $i >/dev/null 2>&1 done } restart() { stop start } case $1 in start) start ;; stop) stop ;; restart) echo -n "Reloading SD modules" restart echo ".. DONE" ;; *) start esac
- 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)
The TI 5-in-1 card reader is found several Z-series ThinkPads (such as the Z61m, Z61e, and the Z61t). You will need a recent kernel and will need need to enable the tifm drivers in the kernel:
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 have the modules tifm_core, tifm_7xx1, tifm_sd, mmc_core, and mmc_block. Because these drivers are relatively new, the HAL auto-detection system may not load them on boot, requiring you to add them to /etc/modules (or equivalent for your distribution).
The modules may be loaded by hand using the modprobe command as root:
# modprobe tifm_7xx1 tifm_sd
modprobe will correctly load the dependent modules. Once loaded, you may insert an SD card into the slot. The LED should blink once as the card is inspected, and output from dmesg should report finding a card:
tifm_core: MMC/SD card detected in socket 0:1 PM: Adding info for tifm:tifm_sd0:1 PM: Adding info for No Bus:mmc1 PM: Adding info for mmc:mmc1:b368 mmcblk0: mmc1:b368 SD 993792KiB mmcblk0: p1
If you see errors, you could probably do with a newer version of the tifm drivers.
After insertion, the /dev heirarchy is populated with new devices. /dev/disk/by-label should be populated with the labels of the partitions on the device, which you may then mount:
# mount /dev/disk/by-label/cardlabel /mnt
Alternatively, you can mount the block device directly, which usually appears as /dev/mmcblk0 or, when the card has a partition table, /dev/mmcblk0p1:
# mount /dev/mmcblk0p1 /mnt