This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SDIO Driver in AM335x

Hi ,

We are using BBB(am335x) based custom board with a Marvell's Wifi chip. We are using linux-3.12.10 kernel.


On boot up, If I insert the marvel driver, everything works fine i.e. it is able to probe successfully and able to be set as an AP etc etc. Therefore I’m pretty sure that the mmc interface is setup fine and the driver is using the correct interface.

If I remove the inserted driver then power down the wifi chip and power back up without rebooting AM335x (using a power down, GPIO pin of the wifi chip), I see that inserting the driver now fails with error as follows
"wlan_sdio: probe of mmc0:0001:1 failed with error -110"

Little more debigging I found that mmc_wait_for_cmd() in `linux-3.12/drivers/mmc/core/sdio_ops.c` is returning with error 110

Not completely sure what this is and why. Also not sure if this is a problem with the SDIO driver. Has any one faced similar issue???

Let me know if you need more details.

Thanks
Shankar

  • Hi,
    Why do you want to remove the driver (rmmod) ?
    Just you can power down directly without removing the driver.

    Is it driver must be built as module or built with kernel image (uImage or zImage) ?

    It seems to be the driver issue that it cause the problem when we insert in second time.

    Also, check the current SDK driver has any modification on this file.
    linux-3.12/drivers/mmc/core/sdio_ops.c

    You can check with kernel.org too...
    https://kernel.org/
  • Hi,
    Thanks for your reply.
    ``Why do you want to remove the driver (rmmod) ?
    Just you can power down directly without removing the driver.``
    Basically, Marvell have different firmwares for manufacturing and actual application that goes on to the chip. These firmwares are loaded through the driver. In our case we want to be able to switch between manufacturing and actual application dynamically. Hence we need to remove the driver, power cycle the chip and load the driver with different firmware.

    ``Is it driver must be built as module or built with kernel image (uImage or zImage) ?``
    Since we want to be able to dynamically load different marvell firmwares, we want to build it as a module.

    Anyways, I will take a look at the kernel.org.
    Let me know if you find anything else.

    Thanks
    Shankar
  • Shankar,

    Would you please provide the exact commands that you are using to unload and reload the driver. A log trace of you doing these commands would be ideal.

    Also, would you please do a "lsmod" before and after you attempt these commands.

    Finally, what media are you booting from?

    Thanks.

  • Sorry for the delayed reply,

    Finally I was able to get this working, we don't need a patch in the kernel like i had thought before, what we need is to rebind the mmc module after you reset the WiFi chip. I used the following commands as below to get this working

    # Bring down the marvell WiFi interface
    ifconfig mlan0 down
    
    #list the modules
    lsmod
    
    ---------output---------
    Module                  Size  Used by    Tainted: P  
    sd8xxx                267307  1
    mlan                  249270  1 sd8xxx
    --------------------------------------
    
    
    #Remove the Marvell Wifi modules
    rmmod sd8xxx
    rmmod mlan
    
    #list the modules
    lsmod
    
    ---------output---------
    Module                  Size  Used by    Tainted: P
    -------------------------
    
    
    # Unbind the MMC driver as echo ${WIFI_MMC_BINDING_NAME} > ${WIFI_MMC_UNBIND_PATH}
    # In my case the wifi was on mmc0 with name as "48060000.mmc"
    echo 48060000.mmc > /sys/bus/platform/drivers/omap_hsmmc/unbind
    
    #Command to power OFF the wifi Chip goes here which depends on where the WiFi pwr down pin is connected
    ...
    
    # Delay to make sure the chip has enough time to power down completely
    sleep 1
    
    #Command to power ON the wifi Chip goes here which depends on where the Wifi pwr down pin is connected
    ...
    
    # Bind the MMC driver as echo ${WIFI_MMC_BINDING_NAME} > ${WIFI_MMC_BIND_PATH}
    echo 48060000.mmc > /sys/bus/platform/drivers/omap_hsmmc/bind
    
    #insert the WiFi module again with the configurations that you need
    insmod /lib/mlan
    insmod sd8xxx ....
    
    # Bring up the interface with the configuration of your interface depending on whether its AP or client.
    .......

    Hope this helps others who might face similar issue.

    Let me know if you need any more details

    Thanks
    Shankar