On an embedded Linux platform, I have a network adapter attached to an SDIO interface. There is no Card Detect signal on this particular bus. If for instance, I turn the network adapter power on or off, is there any way I can force a re-scan of the SDIO bus from user space?


As mentioned by 0andriy, you can use bind/unbind. I am doing something similar but this will be different as it depends on the hardware. To unbind my sdio wifi module I use:

echo -n "2190000.usdhc" > /sys/devices/soc0/soc/2100000.aips-bus/2190000.usdhc/driver/unbind

This will give you something like mmc1: card 0001 removed in dmesg.

I then toggle a gpio pin to reset my wifi module

Then to rebind:

echo -n "2190000.usdhc" > /sys/bus/soc/devices/soc0/soc/2100000.aips-bus/2190000.usdhc/subsystem/drivers/sdhci-esdhc-imx/bind

At which point dmesg will print something like:

mmc1: SDHCI controller on 2190000.usdhc [2190000.usdhc] using ADMA
mmc1: new high speed SDIO card at address 0001

Binding/unbinding process is explained well by this old LWN.net article.

  • Note that based on the related question, if you are using a TI SDIO device it won't work without the interrupt. – minghua Jun 3 '18 at 6:30

Looks like there was a patch submitted to the linux-mmc mailing list to add this feature, however looking at the current source, it doesn't appear to have been added.

So unfortunately I guess this makes the answer: you can't.

  • 1
    It's not fully true. Easiest way to work around is to unbind / bind cycle of the host controller. Also there is another way to simulate card detection in the driver, but it might be non-upstreamable solution. – 0andriy Sep 6 '16 at 21:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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