linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bruno Randolf <br1@einfach.org>
To: Franky Lin <frankyl@broadcom.com>
Cc: "Bruno Randolf" <br1@einfach.org>,
	"Arend van Spriel" <arend@broadcom.com>,
	linux-wireless@vger.kernel.org, meuleman@broadcom.com,
	brudley@broadcom.com, brcm80211-dev-list@broadcom.com,
	海藻敬之 <tkaiso@thinktube.com>
Subject: Re: Broadcom brcmfmac vs bcmdhd on Android
Date: Fri, 17 May 2013 20:10:16 +0100	[thread overview]
Message-ID: <51968098.9070104@einfach.org> (raw)
In-Reply-To: <51799C33.7040109@broadcom.com>

On 04/25/2013 10:12 PM, Franky Lin wrote:
> 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


diff -Nurb 
compat-drivers-3.9-rc4-2-su/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c 
compat-drivers-3.9-rc4-2-su-brcm/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c
--- 
compat-drivers-3.9-rc4-2-su/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c 
2013-03-29 06:03:35.000000000 +0000
+++ 
compat-drivers-3.9-rc4-2-su-brcm/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c 
2013-04-29 20:17:13.686085551 +0100
@@ -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 */


      parent reply	other threads:[~2013-05-17 19:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-23 15:41 Broadcom brcmfmac vs bcmdhd on Android Bruno Randolf
2013-04-23 21:10 ` Arend van Spriel
2013-04-24 15:18   ` Bruno Randolf
2013-04-25 18:39     ` Bruno Randolf
2013-04-25 21:12       ` Franky Lin
2013-04-25 21:36         ` Bruno Randolf
2013-05-17 19:10         ` Bruno Randolf [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51968098.9070104@einfach.org \
    --to=br1@einfach.org \
    --cc=arend@broadcom.com \
    --cc=brcm80211-dev-list@broadcom.com \
    --cc=brudley@broadcom.com \
    --cc=frankyl@broadcom.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=meuleman@broadcom.com \
    --cc=tkaiso@thinktube.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).