[Sdhci-devel] Exorcising TI's flash media controller
Pierre Ossman
drzeus-list at drzeus.cx
Sat Nov 19 16:49:06 CET 2005
It seems that the hardware I was using didn't use the SD host controller
interface after all. TI's engineers seem to be a sneaky bunch, since the
flash media controller was called 'PCMCIA Flash media controller' and
had a PCMCIA icon. To really make sure no-one would find it, they also
added the (non-functional) SD host controller at the root, giving it a
big flashing icon showing a SD memory card. Guaranteed to trick any
weary explorers.
So it seemed like my project had come to a screeching halt. I no longer
had any hardware that used the correct interface. Or more correctly I
never had...
Fortunately I'm a stubborn little bugger. TI is not going to dictate
what I can and cannot do with their chip! So I started sifting through
TI's docs again. But no luck... The implementation notes give the
impression that everything should "just work", which we all know is a
filthy lie. Time for experiments...
After fiddling with most of the registers I could find, I finally found
the secret! The missing piece of information that TI has left out of
their specs. SD/MMC control can be at _either_ the flash controller, or
the SD host, not both. The control for this is in a PCI register on the
flash controller called MMC_SD_DIS and is documented as disabling MMC/SD
support in the flash media controller. What they failed to mention is
that the SD host controller takes over at that point.
Fixing this is ugly. Real ugly. A register in PCI space needs to be
changed. A register that is configured by the eeprom in the laptop. In
other words, something you normally should never touch. The gain is that
we can use the SD host interface, which we have a lot more information
about than TI's own system.
So how to do it then... First we need to know the current value of the
reg. It is in subfunction 3 at offset 4C:
40: 00 00 00 00 01 00 02 7e 00 00 00 00 20 00 00 00
^^
The bit we want to set is bit 2. So we change the above to 22.
$ setpci -s 06.3 4c=0x22
And presto! It starts sending interrupts when inserting cards.
This hack will of course not work itself into the driver since it is TI
specific. So it will have to be in people's start scripts until we have
a driver for TI's flash media controller.
</rant>
Pierre
More information about the Sdhci-devel
mailing list