Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I've a notebook with a SD card reader and I was wondering if the GNU/Linux driver is using the SPI protocol or the proprietary SD protocol (one or four bits). I'm asking this because I'm testing a SPI based SD card reader device I'm working on and when I check the reading speed on my notebook it reads a card at 6MB/s... Another thing, I would like to take a look to the driver sources, do you know where can I find them?

Thanks in advance!

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Without looking at the kernel source, that would depend on the specific SD chip and its kernel driver. You should look at datasheets and the kernel source. For example, on my laptop:

$ lspci | grep SD
15:00.2 SD Host controller: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter (rev 21)

Presumably, the chip implements the SD state machine in hardware, and some chip-to-host interface (PCI, in the case of mine). The specifics of the chip-to-card connection may be abstracted out by the chip, but it's likely the choice can be influenced by the host. The kernel is likely to go with the fastest means available, unless there's a known bug.

Update: checked the kernel source. If a card supports 4-bit transfers, they're enabled automatically. You can see this in drivers/mmc/core/mmc.c, function mmc_init_card(). For Linux 2.6.38, line 489 seems to activate high speed transfers, and line 535 seems to activate 4-bit-wide transfers. Don't let the ‘mmc’ confuse you. This directory contains the drivers that handle SD (including SDIO) cards as well as MMC.

share|improve this answer
    
Thanks! Could you please point me out to the source files you've checked? –  Federico Feb 1 '12 at 16:01
    
Sure, I'll update the answer. –  Alexios Feb 1 '12 at 18:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.