Broadcom brcmfmac vs bcmdhd on Android
Hello!
I know this is the Linux kernel wireless list, and not Android, but due to the lack of better places, I'm going to ask here...
I am trying to make IBSS mode work on Android. As I'm finding problems with "bcmdhd", I am wondering if using the "brcmfmac" under Android would be the better way to go?
I succeeded to compile brcmfmac from recent compat-drivers against the "tuna" (Galaxy Nexus) kernel, the modules load, but no device is recognized. Has anyone succeeded doing this? Is there any chance it can work?
Also I'm wondering what is the relation between the "bcmdhd" driver on Android and "brcmfmac" in the standard Linux kernel. Is there any official maintainer of "bcmdhd", any place where to submit patches? Will "bcmdhd" and "brcmfmac" merge eventually?
Thanks for any hints,
bruno
Quoted 4 lines · Bruno Randolf
Hello!
I know this is the Linux kernel wireless list, and not Android, but due to the lack of better places, I'm going to ask here...
The lines are less drawn than they used to be (at least for me).
Quoted 3 lines
I am trying to make IBSS mode work on Android. As I'm finding problems with "bcmdhd", I am wondering if using the "brcmfmac" under Android would be the better way to go?
I am working mainly on brcmfmac. IBSS should work, but reading the commit message of your patch I guess it may be a firmware issue so using brcmfmac will not make a difference.
Quoted 4 lines
I succeeded to compile brcmfmac from recent compat-drivers against the "tuna" (Galaxy Nexus) kernel, the modules load, but no device is recognized. Has anyone succeeded doing this? Is there any chance it can work?
That is how we did it and with success. What do you mean by 'no device is recognized'? Do you have any traces to look at?
Quoted 4 lines
Also I'm wondering what is the relation between the "bcmdhd" driver on Android and "brcmfmac" in the standard Linux kernel. Is there any official maintainer of "bcmdhd", any place where to submit patches? Will "bcmdhd" and "brcmfmac" merge eventually?
bcmdhd is what broadcom open-sourced for android. Separately, we started working on brcmfmac for the mainline linux kernel. Both drivers come from the same proprietary driver. The goal is to have brcmfmac work on Android as well and we have most features on board for that.
Regards
Quoted 3 lines · Arend van Spriel
I am working mainly on brcmfmac. IBSS should work, but reading the commit message of your patch I guess it may be a firmware issue so using brcmfmac will not make a difference.
I would like to try that to confirm it. And from your message I conclude the brcmfmac is the way to go forward...
Quoted 7 lines
Quoted 4 lines
I succeeded to compile brcmfmac from recent compat-drivers against the "tuna" (Galaxy Nexus) kernel, the modules load, but no device is recognized. Has anyone succeeded doing this? Is there any chance it can work?
That is how we did it and with success. What do you mean by 'no device is recognized'? Do you have any traces to look at?
Good to know. What I did is I compiled the "tuna" kernel (3.0.31) without bcmdhd, then brcmfmac from compat-drivers, loaded the brcmfmac module (+ dependencies), but then nothing happens. It looks like the device is not recognized on SDIO. Is there anything special I need to do to activate the chip? Anyhow I'll debug this further and send you more info later.
Thanks,
bruno
Quoted 5 lines · Bruno Randolf
Quoted 5 lines
Quoted 4 lines
I succeeded to compile brcmfmac from recent compat-drivers against the "tuna" (Galaxy Nexus) kernel, the modules load, but no device is recognized. Has anyone succeeded doing this? Is there any chance it can work?
Quoted 8 lines
Quoted 2 lines
That is how we did it and with success. What do you mean by 'no device is recognized'? Do you have any traces to look at?
Good to know. What I did is I compiled the "tuna" kernel (3.0.31) without bcmdhd, then brcmfmac from compat-drivers, loaded the brcmfmac module (+ dependencies), but then nothing happens. It looks like the device is not recognized on SDIO. Is there anything special I need to do to activate the chip?
I spent some more time tracing the problem, without much success. Still it simply looks like no SDIO device is detected. Please see below for what I found, maybe something rings a bell for you?
Enabling tracing in the brcmfmac driver shows me
"brcmfmac: brcmf_sdio_init: Enter", nothing more.
Then, I enabled function tracing, here are the relevant parts:
sdio_register_driver <-brcmf_sdio_initdriver_register <-sdio_register_driverdriver_find <-driver_registerbus_add_driver <-driver_registerdriver_attach <-bus_add_driverbus_for_each_dev <-driver_attachmodule_add_driver <-bus_add_driver
The rest is sysfs file registration, nothing more interesting, but I can send you the full dump if you want... No driver probe functions are called.
I see a strange problem with the brcmf_sdmmc_ids:
{SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_43241)}, {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4329)}, {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4330)}, {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4334)},
On the Galaxy Nexus modinfo just shows:
alias: sdio:c*v02D0d4334* alias: sdio:c*v02D0d4329*
I.e. every second device, while on my host the modinfo list looks OK.
I manually changed the list to only include 4330 and that way modinfo shows it correctly also on the device, but maybe this is part of the problem?
How did you get it to work? Which device did you use (Galaxy Nexus?)? Do I need to activate CONFIG_BRCMFMAC_SDIO_OOB (I tried with no difference)?
Thank you for any hints,
bruno
Quoted 5 lines · Bruno Randolf
I manually changed the list to only include 4330 and that way modinfo shows it correctly also on the device, but maybe this is part of the problem?
How did you get it to work? Which device did you use (Galaxy Nexus?)? Do I need to activate
CONFIG_BRCMFMAC_SDIO_OOB(I tried with no difference)?
It looks like the device is not powered up. Do you see the wifi chip get enumerated by SDIO bus? There should be something like mmc0:0001:1 under /sys/bus/sdio/devices
Franky
Quoted 3 lines · Franky Lin
It looks like the device is not powered up. Do you see the wifi chip get enumerated by SDIO bus? There should be something like mmc0:0001:1 under
/sys/bus/sdio/devices
No, /sys/bus/sdio/devices is empty. How can I power it up? Any reference in bcmdhd?
bruno
Quoted 3 lines · Franky Lin
It looks like the device is not powered up. Do you see the wifi chip get enumerated by SDIO bus? There should be something like mmc0:0001:1 under
/sys/bus/sdio/devices
Just for public reference, this was the problem. I made it work with the following patch, which adds the platform_driver as used by bcmdhd to power up the wifi chip.
bruno
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c 2013-04-29 20:17:13.686085551 +0100 renamed from drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c 2013-03-29 06:03:35.000000000 +0000 +72 -3
@@ -27,6 +27,7 @@ #include <linux/module.h> #include <linux/platform_device.h> #include <net/cfg80211.h> +#include <linux/wlan_plat.h> #include <defs.h> #include <brcm_hw_ids.h>
@@ -664,11 +665,80 @@ brcmf_err("platform_driver_register failed: %d\n", ret); } #else + +static struct wifi_platform_data *wifi_control_data = NULL; + +int wifi_set_power(int on, unsigned long msec) +{ + printk("%s = %d\n", __FUNCTION__, on); + if (wifi_control_data && wifi_control_data->set_power) { + wifi_control_data->set_power(on); + } + if (msec) + msleep(msec); + return 0; +} + +static int wifi_set_carddetect(int on) +{ + printk("%s = %d\n", __FUNCTION__, on); + if (wifi_control_data && wifi_control_data->set_carddetect) { + wifi_control_data->set_carddetect(on); + } + return 0; +} + +static int wifi_probe(struct platform_device *pdev) +{ + int ret; + struct wifi_platform_data *wifi_ctrl = + (struct wifi_platform_data *)(pdev->dev.platform_data); + + printk("## %s\n", __FUNCTION__); + //wifi_irqres = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "bcmdhd_wlan_irq"); + wifi_control_data = wifi_ctrl; + + wifi_set_power(1, 0); /* Power On */ + wifi_set_carddetect(1); /* CardDetect (0->1) */ + + ret = sdio_register_driver(&brcmf_sdmmc_driver); + if (ret) + brcmf_err("sdio_register_driver failed: %d\n", ret); + + return 0; +} + +static int wifi_remove(struct platform_device *pdev) +{ + struct wifi_platform_data *wifi_ctrl = + (struct wifi_platform_data *)(pdev->dev.platform_data); + + printk("## %s\n", __FUNCTION__); + wifi_control_data = wifi_ctrl; + + wifi_set_power(0, 0); /* Power Off */ + wifi_set_carddetect(0); /* CardDetect (1->0) */ + + //up(&wifi_control_sem); + return 0; +} + +static struct platform_driver wifi_device = { + .probe = wifi_probe, + .remove = wifi_remove, +// .suspend = wifi_suspend, +// .resume = wifi_resume, + .driver = { + .name = "bcmdhd_wlan", + } +}; + void brcmf_sdio_exit(void) { brcmf_dbg(TRACE, "Enter\n"); sdio_unregister_driver(&brcmf_sdmmc_driver); + platform_driver_unregister(&wifi_device); } void brcmf_sdio_init(void)
@@ -677,9 +747,8 @@ brcmf_dbg(TRACE, "Enter\n"); - ret = sdio_register_driver(&brcmf_sdmmc_driver); + printk("SDIO init\n"); - if (ret) - brcmf_err("sdio_register_driver failed: %d\n", ret); + platform_driver_register(&wifi_device); } #endif /* CONFIG_BRCMFMAC_SDIO_OOB */