How can reset SDIO interface for wifi?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How can reset SDIO interface for wifi?

25,585 次查看
tootzoe
Contributor III

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;
}

 


 

标签 (1)
标记 (2)
0 项奖励
回复
11 回复数

19,329 次查看
tootzoe
Contributor III

hi jianzheng zhou, are you chinese,

thanks for reply, i will try and post result here....

Jianzheng Zhou said:

I think you should have two steps to do not only reset.

After power on, you should force detect sdio, then do reset_sdio_comm

0 项奖励
回复

19,329 次查看
zhuhaigang
Contributor I

hai:tootzoe

are you debuging bcm4330 wifi module on Android2.3 platform succefully?

why kernel don't distinguish sdio?

void mmc_rescan(struct work_struct *work)

{

     .....

    

/*

  * First we search for SDIO...

  */

  printk("================First we search for SDIO...\n");

  err = mmc_send_io_op_cond(host, 0, &ocr);

  if (!err) {

  if (mmc_attach_sdio(host, ocr))

  mmc_power_off(host);

  goto out;

  }

  /*

  * ...then normal SD...

  */

  printk("================...then normal SD...\n");

  err = mmc_send_app_op_cond(host, 0, &ocr);

  if (!err) {

  if (mmc_attach_sd(host, ocr))

  mmc_power_off(host);

  goto out;

  }

  /*

  * ...and finally MMC.

  */

  printk("================...and finally MMC.\n");

  err = mmc_send_op_cond(host, 0, &ocr);

  if (!err) {

  if (mmc_attach_mmc(host, ocr))

  mmc_power_off(host);

  goto out;

  }

  mmc_release_host(host);

  mmc_power_off(host);


}

I find  err = mmc_send_io_op_cond(host, 0, &ocr) failed,

so can't entery (mmc_attach_sdio(host, ocr).

can you help me?

0 项奖励
回复

19,329 次查看
dilshad_alam
Senior Contributor II

Dear Jianzheng Zhou,

Could you please tell me why sdio_reset_comm function is not present in imx 3.10.17 Kernel.

While inserting module

its giving error

insmod bcmdhd.ko

Error: could not insert module bcmdhd.ko: Unknown symbol in module

bcmdhd: Unknown symbol sdio_reset_comm (err 0)

Do you have patch for this?

0 项奖励
回复

19,328 次查看
weidong_sun
NXP TechSupport
NXP TechSupport

Hi

0 项奖励
回复

19,328 次查看
waterzhou
Contributor V

I think you should have two steps to do not only reset.

After power on, you should force detect sdio, then do reset_sdio_comm

0 项奖励
回复

19,328 次查看
liyu1
Contributor III
Hello  !

 

0 项奖励
回复

19,328 次查看
waterzhou
Contributor V

From 716bf64c825fba7d1b941d2f2b46ba3f78e762e0 Mon Sep 17 00:00:00 2001

From: Jianzheng Zhou <B38613@freescale.com>

Date: Wed, 27 Jun 2012 12:15:04 +0800

Subject: [PATCH 2/2] ENGR00214870-2:export sdio force detect or remove feature for some special case

For dongle sdio wifi modules,power and clock will still on althrough rmmod wifi

drivers. Add force detect or remove feature, wifi driver can control their own

power and clock when enable/disable wifi.

Signed-off-by: Jianzheng Zhou <B38613@freescale.com>

---

drivers/mmc/host/sdhci-esdhc-imx.c |    2 ++

drivers/mmc/host/sdhci-pltfm.c     |   23 +++++++++++++++++++++++

drivers/mmc/host/sdhci.c           |    1 +

include/linux/mmc/sdio_func.h      |    1 +

4 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c

index 1a81571..a438242 100644

--- a/drivers/mmc/host/sdhci-esdhc-imx.c

+++ b/drivers/mmc/host/sdhci-esdhc-imx.c

@@ -674,6 +674,8 @@ static irqreturn_t cd_irq(int irq, void *data)

  esdhc_reset(sdhost);

  mdelay(1);

+ if (sdhost->mmc->sdio_force_remove)

+ sdhost->mmc->sdio_force_remove = false;

  tasklet_schedule(&sdhost->card_tasklet);

  return IRQ_HANDLED;

};

diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c

index dbab040..18b1944 100644

--- a/drivers/mmc/host/sdhci-pltfm.c

+++ b/drivers/mmc/host/sdhci-pltfm.c

@@ -41,10 +41,30 @@

  *                                                                           *

\*****************************************************************************/

+struct sdhci_host *__host;

static struct sdhci_ops sdhci_pltfm_ops = {

};

/*****************************************************************************\

+*                                                                            *

+* Force detect with force remove sysmbol                                     *

+* remove = false: force detect                                               *

+* remove = true : force remove                                               *

+*                                                                            *

+******************************************************************************/

+

+void mmc_force_remove_sdio_detect(bool remove)

+{

+ struct mmc_host *host;

+ if (__host != NULL) {

+ host = __host->mmc;

+ host->sdio_force_remove = remove;

+ tasklet_schedule(&__host->card_tasklet);

+ }

+}

+EXPORT_SYMBOL_GPL(mmc_force_remove_sdio_detect);

+

+/*****************************************************************************\

  *                                                                           *

  * Device probing/removal                                                    *

  *                                                                           *

@@ -80,6 +100,8 @@ static int __devinit sdhci_pltfm_probe(struct platform_device *pdev)

  else

  host = sdhci_alloc_host(&pdev->dev, sizeof(*pltfm_host));

+ __host = host;

+

  if (IS_ERR(host)) {

  ret = PTR_ERR(host);

  goto err;

@@ -157,6 +179,7 @@ static int __devexit sdhci_pltfm_remove(struct platform_device *pdev)

  iounmap(host->ioaddr);

  release_mem_region(iomem->start, resource_size(iomem));

  sdhci_free_host(host);

+ __host = NULL;

  platform_set_drvdata(pdev, NULL);

  return 0;

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c

index 2f200b8..265c544 100755

--- a/drivers/mmc/host/sdhci.c

+++ b/drivers/mmc/host/sdhci.c

@@ -1556,6 +1556,7 @@ out:

  mmiowb();

  spin_unlock_irqrestore(&host->lock, flags);

+ sdhci_disable_clk(host, 0);

}

static int sdhci_start_signal_voltage_switch(struct mmc_host *mmc,

diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h

index 557acae..d021702 100755

--- a/include/linux/mmc/sdio_func.h

+++ b/include/linux/mmc/sdio_func.h

@@ -170,6 +170,7 @@ extern void sdio_f0_writeb(struct sdio_func *func, unsigned char b,

extern mmc_pm_flag_t sdio_get_host_pm_caps(struct sdio_func *func);

extern int sdio_set_host_pm_flags(struct sdio_func *func, mmc_pm_flag_t flags);

+extern void mmc_force_remove_sdio_detect(bool remove);

#endif

--

1.7.1

0 项奖励
回复

19,328 次查看
liyu1
Contributor III

Hello:

    jianzheng zhou !

      freescale can support boardcom wifi module ? if support, please give a porting manual !


               Thanks !

0 项奖励
回复

19,328 次查看
waterzhou
Contributor V

We default use atheros and realtek's. For broadcom's we don't have portal.Sorry.

0 项奖励
回复

19,328 次查看
liyu1
Contributor III

hello !

           Jianzheng Zhou !


                  I found that I would sdio reset, mmc_force_remove_sdio_detect () function can not enforce this interface detection sdio device, please tell me how to do it can do this function.    

0 项奖励
回复

19,328 次查看
liyu1
Contributor III

Thanks !

             I will test and verify it   !

0 项奖励
回复