Skip to content

Use MMC cards with Ricoh R5C832 controllers!

Update: You do not need to use the setpci instructions in this article if your kernel is 2.6.25 or newer

The Ricoh R5C832 is a multi-function chip that provides Firewire and four types of memory card support (SD/MMC/Memory Stick/xD). It appears in many laptops including the Dell XPS m1330 that I recently bought for myself. It works great for SD cards, but due to the hardware design, with a separate dedicated MMC controller, it has been impossible, up until now, to use MMC cards on linux. This is because we don’t have specs for the MMC controller, and instead have written a driver for the SD controller (the SDHCI driver) that can additionally handle MMC cards. But for this to work, the SD controller has to be able to see the MMC cards. Unfortunately, the R5C832 detects MMC cards in hardware and directs them to the MMC controller – so the SD controller never sees them!

I strongly suspected that there was a way to disable the MMC controller, because some laptops, for various reasons, come with only the SD controller enabled (I believe the recent Thinkpads are configured this way) and these ones can handle MMC cards through the SD controller just fine. But there is a lack of useful documentation for the chip, so we had no way to know how to do this disabling. Fortunately, Dell were able to come to the rescue on this one – thanks to the efforts of Matt Domsch and Rezwanul Kabir, we know how to do it! You have to write to specific PCI config space register on the Firewire function of the controller. On my laptop, this is device ’03:01.0′ but it might not be on yours – so check your lspci output.

So, I type:

  • /sbin/setpci -s ’03:01.0′ 0xCA=0x57 (Write Enable)
  • /sbin/setpci -s ’03:01.0′ 0xCB=0x02 (MMC Disable)
  • /sbin/setpci -s ’03:01.0′ 0xCA=0x00 (Write Disable)

For now, you’ll want to put these in a startup script, but I’m looking at ways to get this into the kernel in an automatic way. Pierre doesn’t want to use a quirk, so we need to be creative. He suggested a dummy driver for the MMC controller that just disables it. Heh.

{ 69 } Comments