huang zhanfei

How can reset SDIO interface for wifi?

Discussion created by huang zhanfei on Aug 2, 2012
Latest reply on Aug 2, 2015 by Wigros Sun

Hi all:

Sorry for my poor English,  i am debuging bcm4330 wifi module on Android2.3 platform,

when wifi power on (power off) , it needs reset sdio interface, i found a function code sdio_reset_comm() from internet and put them into sdio.c file,  code runs with errors,

 

my wifi module connecting to the sdio 2 (sdio 1 for sd card, sdio 3 for eMMC) of mx535 mcu,

please help me how to reset sdio interface correctlry,

thanks in advance!!

 

 

enabling adb
# input: eCompass as /devices/virtual/input/input7
warning: `zygote' uses 32-bit capabilities (legacy support in use)
pmem: request for physical address of pmem region from process 2278.
rfkill: BT RF going to : on
tootzoe wifi bcm_wlan_power_on now.....
tootzoe wifi power on now.....
sdio_reset_comm(): --tootzoe------
------------[ cut here ]------------
WARNING: at drivers/mmc/core/core.c:240 mmc_wait_for_cmd+0x2c/0x74()
Modules linked in: bcm4330(+)
[<8003e58c>] (unwind_backtrace+0x0/0xf0) from [<8006a078>] (warn_slowpath_common+0x4c/0x64)
[<8006a078>] (warn_slowpath_common+0x4c/0x64) from [<8006a0a8>] (warn_slowpath_null+0x18/0x1c)
[<8006a0a8>] (warn_slowpath_null+0x18/0x1c) from [<8033d510>] (mmc_wait_for_cmd+0x2c/0x74)
[<8033d510>] (mmc_wait_for_cmd+0x2c/0x74) from [<8033f8f0>] (mmc_go_idle+0x60/0xac)
[<8033f8f0>] (mmc_go_idle+0x60/0xac) from [<80341600>] (sdio_reset_comm+0x20/0x110)
[<80341600>] (sdio_reset_comm+0x20/0x110) from [<80341708>] (tootResetSdio+0x18/0x24)
[<80341708>] (tootResetSdio+0x18/0x24) from [<7f008264>] (dhd_customer_gpio_wlan_ctrl+0x58/0x70 [bcm4330])
[<7f008264>] (dhd_customer_gpio_wlan_ctrl+0x58/0x70 [bcm4330]) from [<7f034070>] (dhd_module_init+0x70/0x134 [bcm4330])
[<7f034070>] (dhd_module_init+0x70/0x134 [bcm4330]) from [<80039384>] (do_one_initcall+0x5c/0x1b4)
[<80039384>] (do_one_initcall+0x5c/0x1b4) from [<800964c8>] (sys_init_module+0x90/0x1ac)
[<800964c8>] (sys_init_module+0x90/0x1ac) from [<80039f80>] (ret_fast_syscall+0x0/0x30)
---[ end trace d1ecc3005255da0b ]---
------------[ cut here ]------------
WARNING: at drivers/mmc/core/core.c:167 mmc_wait_for_req+0x50/0x120()
Modules linked in: bcm4330(+)
[<8003e58c>] (unwind_backtrace+0x0/0xf0) from [<8006a078>] (warn_slowpath_common+0x4c/0x64)
[<8006a078>] (warn_slowpath_common+0x4c/0x64) from [<8006a0a8>] (warn_slowpath_null+0x18/0x1c)
[<8006a0a8>] (warn_slowpath_null+0x18/0x1c) from [<8033d414>] (mmc_wait_for_req+0x50/0x120)
[<8033d414>] (mmc_wait_for_req+0x50/0x120) from [<8033d548>] (mmc_wait_for_cmd+0x64/0x74)
[<8033d548>] (mmc_wait_for_cmd+0x64/0x74) from [<8033f8f0>] (mmc_go_idle+0x60/0xac)
[<8033f8f0>] (mmc_go_idle+0x60/0xac) from [<80341600>] (sdio_reset_comm+0x20/0x110)
[<80341600>] (sdio_reset_comm+0x20/0x110) from [<80341708>] (tootResetSdio+0x18/0x24)
[<80341708>] (tootResetSdio+0x18/0x24) from [<7f008264>] (dhd_customer_gpio_wlan_ctrl+0x58/0x70 [bcm4330])
[<7f008264>] (dhd_customer_gpio_wlan_ctrl+0x58/0x70 [bcm4330]) from [<7f034070>] (dhd_module_init+0x70/0x134 [bcm4330])
[<7f034070>] (dhd_module_init+0x70/0x134 [bcm4330]) from [<80039384>] (do_one_initcall+0x5c/0x1b4)
[<80039384>] (do_one_initcall+0x5c/0x1b4) from [<800964c8>] (sys_init_module+0x90/0x1ac)
[<800964c8>] (sys_init_module+0x90/0x1ac) from [<80039f80>] (ret_fast_syscall+0x0/0x30)
---[ end trace d1ecc3005255da0c ]---
mmc_send_io_op_cond--tootzoe------
------------[ cut here ]------------
WARNING: at drivers/mmc/core/core.c:240 mmc_wait_for_cmd+0x2c/0x74()
Modules linked in: bcm4330(+)
[<8003e58c>] (unwind_backtrace+0x0/0xf0) from [<8006a078>] (warn_slowpath_common+0x4c/0x64)
Unhandled fault: external abort on non-linefetch (0x1018) at 0x2b530054
[<8006a078>] (warn_slowpath_common+0x4c/0x64) from [<8006a0a8>] (warn_slowpath_null+0x18/0x1c)
[<8006a0a8>] (warn_slowpath_null+0x18/0x1c) from [<8033d510>] (mmc_wait_for_cmd+0x2c/0x74)
request_suspend_state: on (3->0) at 21354691253 (1970-01-02 00:00:05.189001375 UTC)
[<8033d510>] (mmc_wait_for_cmd+0x2c/0x74) from [<80341b14>] (mmc_send_io_op_cond+0x58/0xc8)
Unhandled fault: external abort on non-linefetch (0x1018) at 0x2b530054
[<80341b14>] (mmc_send_io_op_cond+0x58/0xc8) from [<80341624>] (sdio_reset_comm+0x44/0x110)
[<80341624>] (sdio_reset_comm+0x44/0x110) from [<80341708>] (tootResetSdio+0x18/0x24)
[<80341708>] (tootResetSdio+0x18/0x24) from [<7f008264>] (dhd_customer_gpio_wlan_ctrl+0x58/0x70 [bcm4330])
[<7f008264>] (dhd_customer_gpio_wlan_ctrl+0x58/0x70 [bcm4330]) from [<7f034070>] (dhd_module_init+0x70/0x134 [bcm4330])
binder: release proc 2335, transaction 516, not freed
[<7f034070>] (dhd_module_init+0x70/0x134 [bcm4330]) from [<80039384>] (do_one_initcall+0x5c/0x1b4)
[<80039384>] (do_one_initcall+0x5c/0x1b4) from [<800964c8>] (sys_init_module+0x90/0x1ac)
[<800964c8>] (sys_init_module+0x90/0x1ac) from [<80039f80>] (ret_fast_syscall+0x0/0x30)
---[ end trace d1ecc3005255da0d ]---
------------[ cut here ]------------
WARNING: at drivers/mmc/core/core.c:167 mmc_wait_for_req+0x50/0x120()
Unhandled fault: external abort on non-linefetch (0x1018) at 0x2bb3e054
Modules linked in: bcm4330(+)
[<8003e58c>] (unwind_backtrace+0x0/0xf0) from [<8006a078>] (warn_slowpath_common+0x4c/0x64)
[<8006a078>] (warn_slowpath_common+0x4c/0x64) from [<8006a0a8>] (warn_slowpath_null+0x18/0x1c)
Unhandled fault: external abort on non-linefetch (0x1018) at 0x2bbdb054
[<8006a0a8>] (warn_slowpath_null+0x18/0x1c) from [<8033d414>] (mmc_wait_for_req+0x50/0x120)
[<8033d414>] (mmc_wait_for_req+0x50/0x120) from [<8033d548>] (mmc_wait_for_cmd+0x64/0x74)
[<8033d548>] (mmc_wait_for_cmd+0x64/0x74) from [<80341b14>] (mmc_send_io_op_cond+0x58/0xc8)
[<80341b14>] (mmc_send_io_op_cond+0x58/0xc8) from [<80341624>] (sdio_reset_comm+0x44/0x110)
[<80341624>] (sdio_reset_comm+0x44/0x110) from [<80341708>] (tootResetSdio+0x18/0x24)
[<80341708>] (tootResetSdio+0x18/0x24) from [<7f008264>] (dhd_customer_gpio_wlan_ctrl+0x58/0x70 [bcm4330])
[<7f008264>] (dhd_customer_gpio_wlan_ctrl+0x58/0x70 [bcm4330]) from [<7f034070>] (dhd_module_init+0x70/0x134 [bcm4330])
[<7f034070>] (dhd_module_init+0x70/0x134 [bcm4330]) from [<80039384>] (do_one_initcall+0x5c/0x1b4)
[<80039384>] (do_one_initcall+0x5c/0x1b4) from [<800964c8>] (sys_init_module+0x90/0x1ac)
[<800964c8>] (sys_init_module+0x90/0x1ac) from [<80039f80>] (ret_fast_syscall+0x0/0x30)
---[ end trace d1ecc3005255da0e ]---
mmc2: Error resetting SDIO communications (-110)                             <<<<<<<<<<<------------------ Error here....
------------[ cut here ]------------
WARNING: at drivers/mmc/core/core.c:599 mmc_release_host+0x20/0x38()
Modules linked in: bcm4330(+)
[<8003e58c>] (unwind_backtrace+0x0/0xf0) from [<8006a078>] (warn_slowpath_common+0x4c/0x64)
[<8006a078>] (warn_slowpath_common+0x4c/0x64) from [<8006a0a8>] (warn_slowpath_null+0x18/0x1c)
[<8006a0a8>] (warn_slowpath_null+0x18/0x1c) from [<8033c5f0>] (mmc_release_host+0x20/0x38)
[<8033c5f0>] (mmc_release_host+0x20/0x38) from [<803416c8>] (sdio_reset_comm+0xe8/0x110)
[<803416c8>] (sdio_reset_comm+0xe8/0x110) from [<80341708>] (tootResetSdio+0x18/0x24)
[<80341708>] (tootResetSdio+0x18/0x24) from [<7f008264>] (dhd_customer_gpio_wlan_ctrl+0x58/0x70 [bcm4330])
[<7f008264>] (dhd_customer_gpio_wlan_ctrl+0x58/0x70 [bcm4330]) from [<7f034070>] (dhd_module_init+0x70/0x134 [bcm4330])
[<7f034070>] (dhd_module_init+0x70/0x134 [bcm4330]) from [<80039384>] (do_one_initcall+0x5c/0x1b4)
[<80039384>] (do_one_initcall+0x5c/0x1b4) from [<800964c8>] (sys_init_module+0x90/0x1ac)
[<800964c8>] (sys_init_module+0x90/0x1ac) from [<80039f80>] (ret_fast_syscall+0x0/0x30)
---[ end trace d1ecc3005255da0f ]---
[DHD] sih->chiprev = 4
[DHD] DHD: dongle ram size is set to 294912(orig 294912)
[DHD] load firmware from /system/etc/firmware/bcm4330.bin
Unhandled fault: external abort on non-linefetch (0x1018) at 0x2bc3e054
Unhandled fault: external abort on non-linefetch (0x1018) at 0x2bcdb054
Unhandled fault: external abort on non-linefetch (0x1018) at 0x2bd3e054
Unhandled fault: external abort on non-linefetch (0x1018) at 0x2bddb054
Unhandled fault: external abort on non-linefetch (0x1018) at 0x2b8b6054
Unhandled fault: external abort on non-linefetch (0x1018) at 0x2b8b6054
[DHD] dhdsdio_download_nvram: nvram_path=/system/etc/firmware/nvram.txt
Not all allocated memory blocks were freed. Doing it now.
Freeing list entry #0, gpuaddr=166000
Freeing list entry #1, gpuaddr=167000
Freeing list entry #2, gpuaddr=177000
Freeing list entry #3, gpuaddr=1a9000
Freeing list entry #6, gpuaddr=1fa000
Freeing list entry #7, gpuaddr=1fc000
Freeing list entry #8, gpuaddr=21c000
Freeing list entry #87, gpuaddr=bcc000

 

 


my reset function found from internet ( in file   ~/myandroid/kernel_imx/drivers/mmc/core/sdio.c)

int sdio_reset_comm(struct mmc_card *card)
{

    struct mmc_host *host = card->host;
    u32 ocr;
    int err;

    printk("sdio_reset_comm(): --tootzoe------\n" );
    mmc_go_idle(host);

    mmc_set_clock(host, host->f_min);
printk("mmc_send_io_op_cond--tootzoe------\n" );
    err = mmc_send_io_op_cond(host, 0, &ocr);
    if (err)
        goto err;
printk("mmc_select_voltage --tootzoe------\n" );
    host->ocr = mmc_select_voltage(host, ocr);
    if (!host->ocr) {
        err = -EINVAL;
        goto err;
    }
printk("mmc_send_io_op_cond 2--tootzoe------\n" );
    err = mmc_send_io_op_cond(host, host->ocr, &ocr);
    if (err)
        goto err;

    if (mmc_host_is_spi(host)) {
        err = mmc_spi_set_crc(host, use_spi_crc);
        if (err)
            goto err;
    }

    if (!mmc_host_is_spi(host)) {
        err = mmc_send_relative_addr(host, &card->rca);
        if (err)
            goto err;
        mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL);
    }
    if (!mmc_host_is_spi(host)) {
        err = mmc_select_card(card);
        if (err)
            goto err;
    }
printk("mmc_set_clock 2--tootzoe------\n" );
    mmc_set_clock(host, card->cis.max_dtr);
    printk("sdio_enable_wide--tootzoe------\n" );
    err = sdio_enable_wide(card);
    if (err)
        goto err;

    printk("sdio_reset_comm good\n" );
    return 0;
err:
    printk("%s: Error resetting SDIO communications (%d)\n",
           mmc_hostname(host), err);
    mmc_release_host(host);
    return err;
}

 


 

Outcomes