Linux wireless drivers development
 help / color / mirror / Atom feed
* Re: Problems connectring to an AP with Acer Aspire Revo
From: Carlos Balseiro @ 2010-07-04 19:13 UTC (permalink / raw)
  To: linux-wireless

> This seems to indicate that there is some trouble on this platform ...
> and makes me start thinking that this card may not work well on this
> platform.

Just installed Windows 7 on my machine to test this and efectively,
the problem also exist.

^ permalink raw reply

* Re: rt61pci AP performance issues
From: Helmut Schaa @ 2010-07-05  6:14 UTC (permalink / raw)
  To: David Ellingsworth; +Cc: rt2x00 Users List, wireless
In-Reply-To: <AANLkTikRH3YEoZ47ihcZyqBiwfxdBPAEgZdAzAWES8x-@mail.gmail.com>

Am Dienstag 29 Juni 2010 schrieb David Ellingsworth:
> I haven't conducted any other tests beyond what was bisected in the
> attached log. Performance across all those revisions remained somewhat
> fast, and my markings were based solely on client link failure. Each
> bad commit resulted in the link failing after about 10s while
> transferring a file. At which point, the transfer would stop, the AP
> would be unreachable via pings, but the client remained associated to
> the AP. About 30s after that point, the client would timeout and
> re-associate to the AP reactivating the link.

Could you please check if the queues get stuck in that situation? I was
able to sometimes observe queues getting stuck on rt2800.

Just do the following (on the AP mode machine):

mount -t debugfs none /sys/debug
cat /sys/debug/ieee80211/phy0/queues

That should give you something like:

00: 0x00000000/0
01: 0x00000000/0
02: 0x00000000/0
03: 0x00000000/0

And if there's somewhere a 1 instead of a 0 it means that this queue is
stopped (which can/and must actually happen in some scenarios without
causing problems). If that 1 stays there for longer that means something
didn't start the queue anymore and your connection is most likely stuck.

Helmut

^ permalink raw reply

* Re: wl1271 firmware
From: Pazzo Da Legare @ 2010-07-05  7:36 UTC (permalink / raw)
  To: Levi, Shahar; +Cc: linux-wireless@vger.kernel.org
In-Reply-To: <AC090B9732AB2B4DB7FF476E907FE660010673660C@dnce02.ent.ti.com>

Hi Shahar,

Did you have any news about nvs file? I wrote an email to driver's
mantaneir too,

Thank you in advance,

pz

2010/6/30 Levi, Shahar <shahar_levi@ti.com>:
> Hi pz,
> I am checking the way to access the FW and NVS file of wl1271.
> Let me find more details on that and get back to you.
> Regards,
> Shahar
> -----Original Message-----
> From: linux-wireless-owner@vger.kernel.org [mailto:linux-wireless-owner@vger.kernel.org] On Behalf Of Pazzo Da Legare
> Sent: Wednesday, June 30, 2010 2:27 PM
> To: linux-wireless@vger.kernel.org
> Subject: wl1271 firmware
>
> Hi all,
>
> I'm looking for wl1271 firmwares. I found wl1271-fw.bin but I cannot
> find wl1271-nvs.bin needed to use the wl1271's driver.
> Could you please indicate where I can get it?
>
> Thank in advance,
>
> pz
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply

* [PATCH] wl1251: Use MODULE_ALIAS macro at correct postion for SPI bus
From: Ameya Palande @ 2010-07-05 14:12 UTC (permalink / raw)
  To: linux-wireless; +Cc: kalle.valo, luciano.coelho, juuso.oikarinen

Signed-off-by: Ameya Palande <ameya.palande@nokia.com>
---
 drivers/net/wireless/wl12xx/wl1251_main.c |    1 -
 drivers/net/wireless/wl12xx/wl1251_spi.c  |    1 +
 drivers/net/wireless/wl12xx/wl1271_spi.c  |    1 +
 3 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1251_main.c b/drivers/net/wireless/wl12xx/wl1251_main.c
index 00b2428..35fdf88 100644
--- a/drivers/net/wireless/wl12xx/wl1251_main.c
+++ b/drivers/net/wireless/wl12xx/wl1251_main.c
@@ -1419,5 +1419,4 @@ EXPORT_SYMBOL_GPL(wl1251_free_hw);
 MODULE_DESCRIPTION("TI wl1251 Wireles LAN Driver Core");
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Kalle Valo <kalle.valo@nokia.com>");
-MODULE_ALIAS("spi:wl1251");
 MODULE_FIRMWARE(WL1251_FW_NAME);
diff --git a/drivers/net/wireless/wl12xx/wl1251_spi.c b/drivers/net/wireless/wl12xx/wl1251_spi.c
index e814742..27fdfaa 100644
--- a/drivers/net/wireless/wl12xx/wl1251_spi.c
+++ b/drivers/net/wireless/wl12xx/wl1251_spi.c
@@ -345,3 +345,4 @@ module_exit(wl1251_spi_exit);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Kalle Valo <kalle.valo@nokia.com>");
+MODULE_ALIAS("spi:wl1251");
diff --git a/drivers/net/wireless/wl12xx/wl1271_spi.c b/drivers/net/wireless/wl12xx/wl1271_spi.c
index 5189b81..96d25fb 100644
--- a/drivers/net/wireless/wl12xx/wl1271_spi.c
+++ b/drivers/net/wireless/wl12xx/wl1271_spi.c
@@ -461,3 +461,4 @@ MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Luciano Coelho <luciano.coelho@nokia.com>");
 MODULE_AUTHOR("Juuso Oikarinen <juuso.oikarinen@nokia.com>");
 MODULE_FIRMWARE(WL1271_FW_NAME);
+MODULE_ALIAS("spi:wl1271");
-- 
1.7.0.4


^ permalink raw reply related

* Re: wl1271 firmware
From: Pazzo Da Legare @ 2010-07-05 16:49 UTC (permalink / raw)
  To: Levi, Shahar; +Cc: linux-wireless@vger.kernel.org
In-Reply-To: <AANLkTimcFgxOmw4oOa28unhmSpTt0jNacFKXRXycKKA9@mail.gmail.com>

Dear Shahar,

I start from tiwlan.ini file for tiwlan driver to produce an nvs file.

Could you please indicate values to use for the following parameters
of struct wl1271_nvs_file: general_params.srf1[],
general_params.srf2[], general_params.srf3[],
dyn_radio_params_2[].params.degraded_low_to_normal_thr,
dyn_radio_params_2[].params.normal_to_degraded_high_thr,
dyn_radio_params_5[i].params.degraded_low_to_normal_thr,
dyn_radio_params_5[i].params.normal_to_degraded_high_thr

Thank you very much for your time,

Best Regards,

pz


2010/7/5 Pazzo Da Legare <pazzodalegare@gmail.com>:
> Hi Shahar,
>
> Did you have any news about nvs file? I wrote an email to driver's
> mantaneir too,
>
> Thank you in advance,
>
> pz
>
> 2010/6/30 Levi, Shahar <shahar_levi@ti.com>:
>> Hi pz,
>> I am checking the way to access the FW and NVS file of wl1271.
>> Let me find more details on that and get back to you.
>> Regards,
>> Shahar
>> -----Original Message-----
>> From: linux-wireless-owner@vger.kernel.org [mailto:linux-wireless-owner@vger.kernel.org] On Behalf Of Pazzo Da Legare
>> Sent: Wednesday, June 30, 2010 2:27 PM
>> To: linux-wireless@vger.kernel.org
>> Subject: wl1271 firmware
>>
>> Hi all,
>>
>> I'm looking for wl1271 firmwares. I found wl1271-fw.bin but I cannot
>> find wl1271-nvs.bin needed to use the wl1271's driver.
>> Could you please indicate where I can get it?
>>
>> Thank in advance,
>>
>> pz
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>

^ permalink raw reply

* Re: ath9k doesn't clean up virtual wifis on rmmod, and crashes.
From: Ben Greear @ 2010-07-05 18:57 UTC (permalink / raw)
  To: Vasanthakumar Thiagarajan
  Cc: Vasanth Thiagarajan, linux-wireless@vger.kernel.org
In-Reply-To: <4C30AFD0.80100@candelatech.com>

I ran the same test on wireless-testing, and it still crashes.

It appears that the patch you sent is already in wireless-testing,
so I did not apply it.

[root@atom ~]# uname -a
Linux atom 2.6.35-rc3-wl+ #1 SMP Mon Jul 5 11:36:08 PDT 2010 i686 i686 i386 GNU/Linux
[root@atom ~]# echo add > /debug/ath9k/phy0/wiphy
Jul  5 11:54:59 atom kernel: phy1: Selected rate control algorithm 'ath9k_rate_control'
[root@atom ~]# rmmod ath9k
BUG: unable to handle kernel NULL pointer dereference at 000000a4
IP: [<f8d455d6>] ath9k_hw_intrpend+0x6/0x49 [ath9k_hw]
*pde = 00000000
Oops: 0000 [#1] SMP
last sysfs file: /sys/devices/pci0000:00/0000:00:1e.0/0000:05:00.0/net/wlan1/flags
Modules linked in: xt_CT iptable_raw ipt_addrtype xt_DSCP xt_dscp xt_string xt_owner xt_NFQUEUE xt_mul]

Pid: 5817, comm: rmmod Not tainted 2.6.35-rc3-wl+ #1 To be filled by O.E.M./To Be Filled By O.E.M.
EIP: 0060:[<f8d455d6>] EFLAGS: 00010046 CPU: 0
EIP is at ath9k_hw_intrpend+0x6/0x49 [ath9k_hw]
EAX: 00000000 EBX: 00000000 ECX: c08de3bc EDX: f705ec78
ESI: f705ec78 EDI: 00000010 EBP: f4563e70 ESP: f4563e6c
  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process rmmod (pid: 5817, ti=f4562000 task=f4504550 task.ti=f4562000)
Stack:
  00000000 f4563e88 f8de3cb4 00000010 f6aab6c0 00000282 00000010 f4563ea8
<0> c046d228 f705ec78 00000282 c08de3bc 00000010 c08de380 f705ec78 f4563ebc
<0> c046d28f f705ec78 f7113000 f8f00000 f4563ed0 f8dea27f f7113000 f8def9a8
Call Trace:
  [<f8de3cb4>] ? ath_isr+0x25/0x189 [ath9k]
  [<c046d228>] ? __free_irq+0x11e/0x15e
  [<c046d28f>] ? free_irq+0x27/0x3a
  [<f8dea27f>] ? ath_pci_remove+0x2f/0x54 [ath9k]
  [<c05816da>] ? pci_device_remove+0x19/0x39
  [<c06036d6>] ? __device_release_driver+0x59/0x9d
  [<c0603781>] ? driver_detach+0x67/0x85
  [<c0602c9d>] ? bus_remove_driver+0x69/0x85
  [<c0603b92>] ? driver_unregister+0x4b/0x52
  [<c05818a9>] ? pci_unregister_driver+0x2d/0x6e
  [<f8dea171>] ? ath_pci_exit+0xd/0xf [ath9k]
  [<f8dec664>] ? ath9k_exit+0x8/0x2f [ath9k]
  [<c0455232>] ? sys_delete_module+0x16f/0x1c0
  [<c07458dc>] ? do_page_fault+0x26a/0x2c5
  [<c074590a>] ? do_page_fault+0x298/0x2c5
  [<c0402fdc>] ? sysenter_do_call+0x12/0x28
Code: 80 4b 06 10 31 c9 83 c4 68 89 c8 5b 5e 5f 5d c3 55 b9 0c 00 00 00 89 e5 53 8b 98 94 00 00 00 ff
EIP: [<f8d455d6>] ath9k_hw_intrpend+0x6/0x49 [ath9k_hw] SS:ESP 0068:f4563e6c
CR2: 00000000000000a4
---[ end trace 43bc6f57caff1689 ]---
Killed
Jul  5 1


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

^ permalink raw reply

* Compat-wireless release for 2010-07-05 is baked
From: Compat-wireless cronjob account @ 2010-07-05 19:03 UTC (permalink / raw)
  To: linux-wireless

>From git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next
   c48fe0c..39a2e97  history    -> origin/history
 + 4985a03...2880928 master     -> origin/master  (forced update)
   9fbd7f9..123f94f  stable     -> origin/stable
 * [new tag]         next-20100705 -> next-20100705
cat: /var/opt/compat/compat-wireless-2.6/compat_version: No such file or directory
cat: compat_base_tree: No such file or directory
cat: compat_base_tree_version: No such file or directory
cat: compat_version: No such file or directory
cat: /var/opt/compat/compat-wireless-2.6/compat_version: No such file or directory
scripts/Makefile.clean:17: /var/opt/compat/compat-wireless-2.6/drivers/net/wireless/hostap/Makefile: No such file or directory
make[4]: *** No rule to make target `/var/opt/compat/compat-wireless-2.6/drivers/net/wireless/hostap/Makefile'.  Stop.
make[3]: *** [/var/opt/compat/compat-wireless-2.6/drivers/net/wireless/hostap] Error 2
make[2]: *** [/var/opt/compat/compat-wireless-2.6/drivers/net/wireless] Error 2
make[1]: *** [_clean_/var/opt/compat/compat-wireless-2.6] Error 2
make: *** [clean] Error 2
/usr/bin/sha1sum: *.tar.bz2: No such file or directory

compat-wireless code metrics

    494471 - Total upstream lines of code being pulled

^ permalink raw reply

* [ath9k] ath9k:  Expose virtual wiphy indexes to debugfs.
From: greearb @ 2010-07-05 19:52 UTC (permalink / raw)
  To: linux-wireless; +Cc: Ben Greear

From: Ben Greear <greearb@candelatech.com>

It is very difficult to map phyX devices to real/virtual
entities because the phyX devices change on module
reload.  This patch makes it slightly easier to
associate virtual phy devices with phyX entities.

 # echo add=5 > /debug/ath9k/phy0/wiphy
 # cat /debug/ath9k/phy0/wiphy
primary: phy0 (ACTIVE chan=0 ht=0)
secondary[5]: phy1 (ACTIVE chan=0 ht=0)
addr: ef:be:ad:de:ef:be
addrmask: ef:be:ad:de:ef:be

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 6e486a5... a58ff60... M	drivers/net/wireless/ath/ath9k/ath9k.h
:100644 100644 54aae93... f63423c... M	drivers/net/wireless/ath/ath9k/debug.c
:100644 100644 89423ca... 03fd64d... M	drivers/net/wireless/ath/ath9k/virtual.c
 drivers/net/wireless/ath/ath9k/ath9k.h   |    2 +-
 drivers/net/wireless/ath/ath9k/debug.c   |   12 ++++++++----
 drivers/net/wireless/ath/ath9k/virtual.c |   26 ++++++++++++++++++++------
 3 files changed, 29 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 6e486a5..a58ff60 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -670,7 +670,7 @@ void ath9k_ps_wakeup(struct ath_softc *sc);
 void ath9k_ps_restore(struct ath_softc *sc);
 
 void ath9k_set_bssid_mask(struct ieee80211_hw *hw);
-int ath9k_wiphy_add(struct ath_softc *sc);
+int ath9k_wiphy_add(struct ath_softc *sc, const char* id);
 int ath9k_wiphy_del(struct ath_wiphy *aphy);
 void ath9k_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb);
 int ath9k_wiphy_pause(struct ath_wiphy *aphy);
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
index 54aae93..f63423c 100644
--- a/drivers/net/wireless/ath/ath9k/debug.c
+++ b/drivers/net/wireless/ath/ath9k/debug.c
@@ -503,8 +503,8 @@ static ssize_t read_file_wiphy(struct file *file, char __user *user_buf,
 		if (aphy == NULL)
 			continue;
 		len += snprintf(buf + len, sizeof(buf) - len,
-				"secondary: %s (%s chan=%d ht=%d)\n",
-				wiphy_name(aphy->hw->wiphy),
+				"secondary[%i]: %s (%s chan=%d ht=%d)\n",
+				i, wiphy_name(aphy->hw->wiphy),
 				ath_wiphy_state_str(aphy->state),
 				aphy->chan_idx, aphy->chan_is_ht);
 	}
@@ -589,8 +589,12 @@ static ssize_t write_file_wiphy(struct file *file, const char __user *user_buf,
 	if (len > 0 && buf[len - 1] == '\n')
 		buf[len - 1] = '\0';
 
-	if (strncmp(buf, "add", 3) == 0) {
-		int res = ath9k_wiphy_add(sc);
+	if (strncmp(buf, "add=", 4) == 0) {
+		int res = ath9k_wiphy_add(sc, buf + 4);
+		if (res < 0)
+			return res;
+	} else if (strncmp(buf, "add", 3) == 0) {
+		int res = ath9k_wiphy_add(sc, NULL);
 		if (res < 0)
 			return res;
 	} else if (strncmp(buf, "del=", 4) == 0) {
diff --git a/drivers/net/wireless/ath/ath9k/virtual.c b/drivers/net/wireless/ath/ath9k/virtual.c
index 89423ca..03fd64d 100644
--- a/drivers/net/wireless/ath/ath9k/virtual.c
+++ b/drivers/net/wireless/ath/ath9k/virtual.c
@@ -99,9 +99,10 @@ void ath9k_set_bssid_mask(struct ieee80211_hw *hw)
 	ath_hw_setbssidmask(common);
 }
 
-int ath9k_wiphy_add(struct ath_softc *sc)
+int ath9k_wiphy_add(struct ath_softc *sc, const char* id)
 {
 	int i, error;
+	int nid = 0;
 	struct ath_wiphy *aphy;
 	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	struct ieee80211_hw *hw;
@@ -112,16 +113,26 @@ int ath9k_wiphy_add(struct ath_softc *sc)
 		return -ENOMEM;
 
 	spin_lock_bh(&sc->wiphy_lock);
-	for (i = 0; i < sc->num_sec_wiphy; i++) {
+	if (id && id[0]) {
+		nid = simple_strtoul(id, NULL, 0);
+		if (nid < 0 || nid > 10000) { /* 10,000 should be plenty! */
+			printk("ath9k: id out of range in wiphy_add:"
+                               " %i, ignoring.", nid);
+			nid = 0;
+		}
+	}
+	
+	for (i = nid; i < sc->num_sec_wiphy; i++) {
 		if (sc->sec_wiphy[i] == NULL)
 			break;
 	}
 
-	if (i == sc->num_sec_wiphy) {
+	if (i >= sc->num_sec_wiphy) {
 		/* No empty slot available; increase array length */
 		struct ath_wiphy **n;
+		int q;
 		n = krealloc(sc->sec_wiphy,
-			     (sc->num_sec_wiphy + 1) *
+			     (i + 1) *
 			     sizeof(struct ath_wiphy *),
 			     GFP_ATOMIC);
 		if (n == NULL) {
@@ -129,9 +140,12 @@ int ath9k_wiphy_add(struct ath_softc *sc)
 			ieee80211_free_hw(hw);
 			return -ENOMEM;
 		}
-		n[i] = NULL;
+		// Null out any new memory allocated.
+		for (q = sc->num_sec_wiphy; q <= i; q++) {
+			n[q] = NULL;
+		}
 		sc->sec_wiphy = n;
-		sc->num_sec_wiphy++;
+		sc->num_sec_wiphy = i+1;
 	}
 
 	SET_IEEE80211_DEV(hw, sc->dev);
-- 
1.7.0.1


^ permalink raw reply related

* [PATCH 00/15] wlan+omap+mmc: out-of-the-box WLAN support for ZOOM2/3
From: Ohad Ben-Cohen @ 2010-07-06  0:37 UTC (permalink / raw)
  To: linux-wireless, linux-mmc, linux-omap
  Cc: linux-arm-kernel, linux, Chikkature Rajashekar Madhusudhan,
	Luciano Coelho, akpm, San Mehat, Ohad Ben-Cohen

From: Ohad Ben-Cohen <ohadb@ti.com>

The ZOOM2/3 boards include TI's wl1271 wlan sdio device,
hardwired to the 3rd mmc controller.

These patches add support for WLAN on the ZOOM2/3 boards
using only mainline components (most notably mac80211 and wl1271).

Patches were tested on both ZOOM2 and ZOOM3.

In short, these patches add software control for emulating
card detect events, add board configurations to support the
wl1271 device, and update the wl1271 driver to make use of
these new mechanisms.

Software card detect emulation is based on Android's
EMBEDDED_SDIO patch by San Mehat <san@google.com> (thanks, San!).

These patches span over several differnt subsystems, but since
they are highly dependent on each other, it is preferrable
to pull them all together into a single tree (once approved).

Patches are available at:

git://wizery.com/pub/linux-2.6.git wl1271

And will also be sent as a follow-on to this message to the
omap, mmc, arm and wireless mailing lists.

Patches are based on mainline 2.6.35-rc4, but can easily be applied
on wireless-testing (with two minor conflicts). If desired, I can
rebase to wireless-testing and resend.

Note: last missing part for full mainline community support
of the wl1271 on ZOOM is the firmware, and for that there is already
on-going TI work to provide it in linux-firmware. Hopefully
that would be resolved soon.

Thanks,

Ohad Ben-Cohen (15):
  sdio: add TI + wl1271 ids
  wireless: wl1271: remove SDIO IDs from driver
  omap: mmc: prepare for software card detect support
  mmc: support embedded data field in mmc_host
  omap: hsmmc: add virtual card detect support
  omap zoom2: wlan board muxing
  omap zoom3: wlan board muxing
  wireless: wl1271: make wl12xx.h common to both spi and sdio
  wireless: wl12xx: support pdata SDIO handlers
  wireless: wl1271: support return value for the set power func
  wireless: wl1271: introduce platform device support
  wireless: wl1271: take irq info from platform data
  wireless: wl1271: make ref_clock configurable by board
  omap: zoom: add WLAN device
  omap: zoom: enable WLAN device

 arch/arm/mach-omap2/Kconfig                   |    5 +
 arch/arm/mach-omap2/Makefile                  |    1 +
 arch/arm/mach-omap2/board-zoom-peripherals.c  |   15 ++
 arch/arm/mach-omap2/board-zoom-wlan.c         |  129 ++++++++++++++++
 arch/arm/mach-omap2/board-zoom2.c             |   15 ++
 arch/arm/mach-omap2/board-zoom3.c             |   15 ++
 arch/arm/mach-omap2/hsmmc.c                   |    4 +
 arch/arm/mach-omap2/hsmmc.h                   |    5 +
 arch/arm/mach-omap2/include/mach/board-zoom.h |    5 +
 arch/arm/plat-omap/include/plat/mmc.h         |    5 +
 drivers/mmc/core/Kconfig                      |    8 +
 drivers/mmc/host/omap_hsmmc.c                 |   37 +++++-
 drivers/net/wireless/wl12xx/Kconfig           |    1 +
 drivers/net/wireless/wl12xx/wl1251_sdio.c     |    2 +-
 drivers/net/wireless/wl12xx/wl1251_spi.c      |    2 +-
 drivers/net/wireless/wl12xx/wl1271.h          |    8 +-
 drivers/net/wireless/wl12xx/wl1271_boot.c     |   13 +-
 drivers/net/wireless/wl12xx/wl1271_boot.h     |    1 -
 drivers/net/wireless/wl12xx/wl1271_io.h       |    8 +-
 drivers/net/wireless/wl12xx/wl1271_main.c     |    4 +-
 drivers/net/wireless/wl12xx/wl1271_sdio.c     |  204 +++++++++++++++++++------
 drivers/net/wireless/wl12xx/wl1271_spi.c      |    8 +-
 include/linux/mmc/host.h                      |   16 ++
 include/linux/mmc/sdio_ids.h                  |    3 +
 include/linux/spi/wl12xx.h                    |   34 ----
 include/linux/wl12xx.h                        |   37 +++++
 26 files changed, 486 insertions(+), 99 deletions(-)
 create mode 100644 arch/arm/mach-omap2/board-zoom-wlan.c
 delete mode 100644 include/linux/spi/wl12xx.h
 create mode 100644 include/linux/wl12xx.h


^ permalink raw reply

* [PATCH 01/15] sdio: add TI + wl1271 ids
From: Ohad Ben-Cohen @ 2010-07-06  0:37 UTC (permalink / raw)
  To: linux-wireless, linux-mmc, linux-omap
  Cc: linux-arm-kernel, linux, Chikkature Rajashekar Madhusudhan,
	Luciano Coelho, akpm, San Mehat, Ohad Ben-Cohen
In-Reply-To: <1278376666-3509-1-git-send-email-ohad@wizery.com>

From: Ohad Ben-Cohen <ohadb@ti.com>

Add SDIO IDs for TI and for TI's wl1271 wlan device.

Signed-off-by: Ohad Ben-Cohen <ohadb@ti.com>
---
 include/linux/mmc/sdio_ids.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/include/linux/mmc/sdio_ids.h b/include/linux/mmc/sdio_ids.h
index 33b2ea0..0d313c6 100644
--- a/include/linux/mmc/sdio_ids.h
+++ b/include/linux/mmc/sdio_ids.h
@@ -43,4 +43,7 @@
 #define SDIO_DEVICE_ID_SIANO_NOVA_A0		0x1100
 #define SDIO_DEVICE_ID_SIANO_STELLAR 		0x5347
 
+#define SDIO_VENDOR_ID_TI			0x0097
+#define SDIO_DEVICE_ID_TI_WL1271		0x4076
+
 #endif
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH 02/15] wireless: wl1271: remove SDIO IDs from driver
From: Ohad Ben-Cohen @ 2010-07-06  0:37 UTC (permalink / raw)
  To: linux-wireless, linux-mmc, linux-omap
  Cc: linux-arm-kernel, linux, Chikkature Rajashekar Madhusudhan,
	Luciano Coelho, akpm, San Mehat, Ohad Ben-Cohen
In-Reply-To: <1278376666-3509-1-git-send-email-ohad@wizery.com>

From: Ohad Ben-Cohen <ohadb@ti.com>

Remove SDIO IDs from the driver code since now it is
included in linux/mmc/sdio_ids.h.

Signed-off-by: Ohad Ben-Cohen <ohadb@ti.com>
---
 drivers/net/wireless/wl12xx/wl1271_sdio.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_sdio.c b/drivers/net/wireless/wl12xx/wl1271_sdio.c
index d3d6f30..9903ae9 100644
--- a/drivers/net/wireless/wl12xx/wl1271_sdio.c
+++ b/drivers/net/wireless/wl12xx/wl1271_sdio.c
@@ -37,14 +37,6 @@
 
 #define RX71_WL1271_IRQ_GPIO		42
 
-#ifndef SDIO_VENDOR_ID_TI
-#define SDIO_VENDOR_ID_TI		0x0097
-#endif
-
-#ifndef SDIO_DEVICE_ID_TI_WL1271
-#define SDIO_DEVICE_ID_TI_WL1271	0x4076
-#endif
-
 static const struct sdio_device_id wl1271_devices[] = {
 	{ SDIO_DEVICE(SDIO_VENDOR_ID_TI, SDIO_DEVICE_ID_TI_WL1271) },
 	{}
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH 03/15] omap: mmc: prepare for software card detect support
From: Ohad Ben-Cohen @ 2010-07-06  0:37 UTC (permalink / raw)
  To: linux-wireless, linux-mmc, linux-omap
  Cc: linux-arm-kernel, linux, Chikkature Rajashekar Madhusudhan,
	Luciano Coelho, akpm, San Mehat, Ohad Ben-Cohen
In-Reply-To: <1278376666-3509-1-git-send-email-ohad@wizery.com>

From: Ohad Ben-Cohen <ohadb@ti.com>

Make it possible for board files to give the
host controller two handlers needed for emulating
card detect events in software:

* The virtual_get_cd handler will allow the host
controller to query the status of the software
card detect (for the given controller/slot).

* The register_embedded_control will allow the host
controller to register handlers that will be used by
board devices to:
    1. trigger a software card detect event
    2. set private data (e.g. device context) that can later
       be used by an sdio function driver

Signed-off-by: Ohad Ben-Cohen <ohadb@ti.com>
---
 arch/arm/mach-omap2/hsmmc.c           |    4 ++++
 arch/arm/mach-omap2/hsmmc.h           |    5 +++++
 arch/arm/plat-omap/include/plat/mmc.h |    5 +++++
 3 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index 1ef54b0..1361128 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -269,6 +269,10 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
 
 		mmc->slots[0].remux = c->remux;
 
+		mmc->slots[0].register_embedded_control =
+						c->register_embedded_control;
+		mmc->slots[0].virtual_get_cd = c->virtual_get_cd;
+
 		if (c->cover_only)
 			mmc->slots[0].cover = 1;
 
diff --git a/arch/arm/mach-omap2/hsmmc.h b/arch/arm/mach-omap2/hsmmc.h
index 36f0ba8..dc12c90 100644
--- a/arch/arm/mach-omap2/hsmmc.h
+++ b/arch/arm/mach-omap2/hsmmc.h
@@ -23,6 +23,11 @@ struct omap2_hsmmc_info {
 	int	ocr_mask;	/* temporary HACK */
 	/* Remux (pad configuation) when powering on/off */
 	void (*remux)(struct device *dev, int slot, int power_on);
+	/* following methods are for embedded sdio devices, e.g. wl1271 */
+	int (*register_embedded_control)(void *dev_id,
+			void (*set_virtual_cd)(void *dev_id, int card_present),
+			void (*set_embedded_data)(void *dev_id, void *priv));
+	int (*virtual_get_cd)(void);
 };
 
 #if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
diff --git a/arch/arm/plat-omap/include/plat/mmc.h b/arch/arm/plat-omap/include/plat/mmc.h
index c835f1e..0f5bf12 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/arch/arm/plat-omap/include/plat/mmc.h
@@ -140,6 +140,11 @@ struct omap_mmc_platform_data {
 
 		unsigned int ban_openended:1;
 
+		/* Embedded SDIO devices control */
+		int (*register_embedded_control)(void *dev_id,
+			void (*set_virtual_cd)(void *dev_id, int card_present),
+			void (*set_embedded_data)(void *dev_id, void *priv));
+		int (*virtual_get_cd)(void);
 	} slots[OMAP_MMC_MAX_SLOTS];
 };
 
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH 04/15] mmc: support embedded data field in mmc_host
From: Ohad Ben-Cohen @ 2010-07-06  0:37 UTC (permalink / raw)
  To: linux-wireless, linux-mmc, linux-omap
  Cc: linux-arm-kernel, linux, Chikkature Rajashekar Madhusudhan,
	Luciano Coelho, akpm, San Mehat, Ohad Ben-Cohen
In-Reply-To: <1278376666-3509-1-git-send-email-ohad@wizery.com>

From: Ohad Ben-Cohen <ohadb@ti.com>

Add support to set/get mmc_host private embedded
data.

This is needed to allow software to dynamically
create (and remove) SDIO functions which represents
embedded SDIO devices.

Typically, it will be used to set the context of
a driver that is creating a new SDIO function
(and would then expect to be able to get that context
back upon creation of the new sdio func).

Signed-off-by: Ohad Ben-Cohen <ohadb@ti.com>
---
 drivers/mmc/core/Kconfig |    8 ++++++++
 include/linux/mmc/host.h |   16 ++++++++++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/core/Kconfig b/drivers/mmc/core/Kconfig
index bb22ffd..ab27eb3 100644
--- a/drivers/mmc/core/Kconfig
+++ b/drivers/mmc/core/Kconfig
@@ -16,3 +16,11 @@ config MMC_UNSAFE_RESUME
 
 	  This option sets a default which can be overridden by the
 	  module parameter "removable=0" or "removable=1".
+
+config MMC_EMBEDDED_SDIO
+	boolean "MMC embedded SDIO device support"
+	help
+	  If you say Y here, support will be added for embedded SDIO
+	  devices (e.g. hardwired embedded WLAN SDIO devices).
+	  Such devices require software support for emulating
+	  card detect events.
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index f65913c..9a48486 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -209,6 +209,10 @@ struct mmc_host {
 	struct led_trigger	*led;		/* activity led */
 #endif
 
+#ifdef CONFIG_MMC_EMBEDDED_SDIO
+	void			*embedded_data;
+#endif
+
 	struct dentry		*debugfs_root;
 
 	unsigned long		private[0] ____cacheline_aligned;
@@ -264,5 +268,17 @@ static inline void mmc_set_disable_delay(struct mmc_host *host,
 	host->disable_delay = disable_delay;
 }
 
+#ifdef CONFIG_MMC_EMBEDDED_SDIO
+static inline void *mmc_get_embedded_data(struct mmc_host *host)
+{
+	return host->embedded_data;
+}
+
+static inline void mmc_set_embedded_data(struct mmc_host *host, void *data)
+{
+	host->embedded_data = data;
+}
+#endif
+
 #endif
 
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH 05/15] omap: hsmmc: add virtual card detect support
From: Ohad Ben-Cohen @ 2010-07-06  0:37 UTC (permalink / raw)
  To: linux-wireless, linux-mmc, linux-omap
  Cc: linux-arm-kernel, linux, Chikkature Rajashekar Madhusudhan,
	Luciano Coelho, akpm, San Mehat, Ohad Ben-Cohen
In-Reply-To: <1278376666-3509-1-git-send-email-ohad@wizery.com>

From: Ohad Ben-Cohen <ohadb@ti.com>

Add support for software emulation of card detect
events.

This is required for specific controllers
that are hard wired with embedded SDIO devices
(such as TI's wl1271 WLAN device).

Board-specific configuration is required to
enable this software card detect control.

Based on Android's EMBEDDED SDIO patch by
San Mehat <san@android.com>.

Signed-off-by: Ohad Ben-Cohen <ohadb@ti.com>
---
 drivers/mmc/host/omap_hsmmc.c |   37 ++++++++++++++++++++++++++++++++++++-
 1 files changed, 36 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index b032828..60694df 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1208,6 +1208,38 @@ static void omap_hsmmc_detect(struct work_struct *work)
 		mmc_detect_change(host->mmc, (HZ * 50) / 1000);
 }
 
+#ifdef CONFIG_MMC_EMBEDDED_SDIO
+static void omap_hsmmc_set_embedded_data(void *dev_id, void *priv)
+{
+	struct omap_hsmmc_host *host = dev_id;
+	struct mmc_host *mmc = host->mmc;
+
+	mmc_set_embedded_data(mmc, priv);
+}
+
+static void omap_hsmmc_virtual_detect(void *dev_id, int carddetect)
+{
+	struct omap_hsmmc_host *host = dev_id;
+
+	printk(KERN_DEBUG "%s: card detect %d\n", mmc_hostname(host->mmc),
+							carddetect);
+
+	sysfs_notify(&host->mmc->class_dev.kobj, NULL, "cover_switch");
+
+	if (carddetect)
+		mmc_detect_change(host->mmc, (HZ * 200) / 1000);
+	else
+		mmc_detect_change(host->mmc, (HZ * 50) / 1000);
+}
+#else
+static void omap_hsmmc_set_embedded_data(void *dev_id, void *priv)
+{
+}
+static void omap_hsmmc_virtual_detect(void *dev_id, int carddetect)
+{
+}
+#endif
+
 /*
  * ISR for handling card insertion and removal
  */
@@ -2170,7 +2202,10 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev)
 				"Unable to grab MMC CD IRQ\n");
 			goto err_irq_cd;
 		}
-	}
+	} else if (mmc_slot(host).register_embedded_control)
+		mmc_slot(host).register_embedded_control(host,
+					omap_hsmmc_virtual_detect,
+					omap_hsmmc_set_embedded_data);
 
 	omap_hsmmc_disable_irq(host);
 
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH 06/15] omap zoom2: wlan board muxing
From: Ohad Ben-Cohen @ 2010-07-06  0:37 UTC (permalink / raw)
  To: linux-wireless, linux-mmc, linux-omap
  Cc: linux-arm-kernel, linux, Chikkature Rajashekar Madhusudhan,
	Luciano Coelho, akpm, San Mehat, Ohad Ben-Cohen
In-Reply-To: <1278376666-3509-1-git-send-email-ohad@wizery.com>

From: Ohad Ben-Cohen <ohadb@ti.com>

Add board muxing to support the wlan wl1271 chip that is
hardwired to mmc2 (third mmc controller) on the ZOOM2.

Signed-off-by: Ohad Ben-Cohen <ohadb@ti.com>
---
 arch/arm/mach-omap2/board-zoom2.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-zoom2.c b/arch/arm/mach-omap2/board-zoom2.c
index 803ef14..00871be 100644
--- a/arch/arm/mach-omap2/board-zoom2.c
+++ b/arch/arm/mach-omap2/board-zoom2.c
@@ -71,6 +71,21 @@ static struct twl4030_platform_data zoom2_twldata = {
 
 #ifdef CONFIG_OMAP_MUX
 static struct omap_board_mux board_mux[] __initdata = {
+#ifdef CONFIG_OMAP_ZOOM_WLAN
+	/* WLAN IRQ - GPIO 162 */
+	OMAP3_MUX(MCBSP1_CLKX, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP),
+	/* WLAN POWER ENABLE - GPIO 101 */
+	OMAP3_MUX(CAM_D2, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
+	/* WLAN SDIO: MMC3 CMD */
+	OMAP3_MUX(MCSPI1_CS1, OMAP_MUX_MODE3 | OMAP_PIN_INPUT_PULLUP),
+	/* WLAN SDIO: MMC3 CLK */
+	OMAP3_MUX(ETK_CLK, OMAP_MUX_MODE2 | OMAP_PIN_INPUT_PULLUP),
+	/* WLAN SDIO: MMC3 DAT[0-3] */
+	OMAP3_MUX(ETK_D3, OMAP_MUX_MODE2 | OMAP_PIN_INPUT_PULLUP),
+	OMAP3_MUX(ETK_D4, OMAP_MUX_MODE2 | OMAP_PIN_INPUT_PULLUP),
+	OMAP3_MUX(ETK_D5, OMAP_MUX_MODE2 | OMAP_PIN_INPUT_PULLUP),
+	OMAP3_MUX(ETK_D6, OMAP_MUX_MODE2 | OMAP_PIN_INPUT_PULLUP),
+#endif
 	{ .reg_offset = OMAP_MUX_TERMINATOR },
 };
 #else
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH 07/15] omap zoom3: wlan board muxing
From: Ohad Ben-Cohen @ 2010-07-06  0:37 UTC (permalink / raw)
  To: linux-wireless, linux-mmc, linux-omap
  Cc: linux-arm-kernel, linux, Chikkature Rajashekar Madhusudhan,
	Luciano Coelho, akpm, San Mehat, Ohad Ben-Cohen
In-Reply-To: <1278376666-3509-1-git-send-email-ohad@wizery.com>

From: Ohad Ben-Cohen <ohadb@ti.com>

Add board muxing to support the wlan wl1271 chip that is
hardwired to mmc2 (third mmc controller) on the ZOOM3.

Signed-off-by: Ohad Ben-Cohen <ohadb@ti.com>
---
 arch/arm/mach-omap2/board-zoom3.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-zoom3.c b/arch/arm/mach-omap2/board-zoom3.c
index 3314704..0b62663 100644
--- a/arch/arm/mach-omap2/board-zoom3.c
+++ b/arch/arm/mach-omap2/board-zoom3.c
@@ -46,6 +46,21 @@ static void __init omap_zoom_init_irq(void)
 
 #ifdef CONFIG_OMAP_MUX
 static struct omap_board_mux board_mux[] __initdata = {
+#ifdef CONFIG_OMAP_ZOOM_WLAN
+	/* WLAN IRQ - GPIO 162 */
+	OMAP3_MUX(MCBSP1_CLKX, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP),
+	/* WLAN POWER ENABLE - GPIO 101 */
+	OMAP3_MUX(CAM_D2, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
+	/* WLAN SDIO: MMC3 CMD */
+	OMAP3_MUX(MCSPI1_CS1, OMAP_MUX_MODE3 | OMAP_PIN_INPUT_PULLUP),
+	/* WLAN SDIO: MMC3 CLK */
+	OMAP3_MUX(ETK_CLK, OMAP_MUX_MODE2 | OMAP_PIN_INPUT_PULLUP),
+	/* WLAN SDIO: MMC3 DAT[0-3] */
+	OMAP3_MUX(ETK_D3, OMAP_MUX_MODE2 | OMAP_PIN_INPUT_PULLUP),
+	OMAP3_MUX(ETK_D4, OMAP_MUX_MODE2 | OMAP_PIN_INPUT_PULLUP),
+	OMAP3_MUX(ETK_D5, OMAP_MUX_MODE2 | OMAP_PIN_INPUT_PULLUP),
+	OMAP3_MUX(ETK_D6, OMAP_MUX_MODE2 | OMAP_PIN_INPUT_PULLUP),
+#endif
 	{ .reg_offset = OMAP_MUX_TERMINATOR },
 };
 #else
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH 08/15] wireless: wl1271: make wl12xx.h common to both spi and sdio
From: Ohad Ben-Cohen @ 2010-07-06  0:37 UTC (permalink / raw)
  To: linux-wireless, linux-mmc, linux-omap
  Cc: linux-arm-kernel, linux, Chikkature Rajashekar Madhusudhan,
	Luciano Coelho, akpm, San Mehat, Ohad Ben-Cohen
In-Reply-To: <1278376666-3509-1-git-send-email-ohad@wizery.com>

From: Ohad Ben-Cohen <ohadb@ti.com>

Move wl12xx.h outside of the spi-specific location,
so it can be shared with both spi and sdio solutions.

Signed-off-by: Ohad Ben-Cohen <ohadb@ti.com>
---
 drivers/net/wireless/wl12xx/wl1251_sdio.c |    2 +-
 drivers/net/wireless/wl12xx/wl1251_spi.c  |    2 +-
 drivers/net/wireless/wl12xx/wl1271_spi.c  |    2 +-
 include/linux/spi/wl12xx.h                |   34 -----------------------------
 include/linux/wl12xx.h                    |   34 +++++++++++++++++++++++++++++
 5 files changed, 37 insertions(+), 37 deletions(-)
 delete mode 100644 include/linux/spi/wl12xx.h
 create mode 100644 include/linux/wl12xx.h

diff --git a/drivers/net/wireless/wl12xx/wl1251_sdio.c b/drivers/net/wireless/wl12xx/wl1251_sdio.c
index c561332..416d5aa 100644
--- a/drivers/net/wireless/wl12xx/wl1251_sdio.c
+++ b/drivers/net/wireless/wl12xx/wl1251_sdio.c
@@ -24,7 +24,7 @@
 #include <linux/mmc/sdio_func.h>
 #include <linux/mmc/sdio_ids.h>
 #include <linux/platform_device.h>
-#include <linux/spi/wl12xx.h>
+#include <linux/wl12xx.h>
 #include <linux/irq.h>
 
 #include "wl1251.h"
diff --git a/drivers/net/wireless/wl12xx/wl1251_spi.c b/drivers/net/wireless/wl12xx/wl1251_spi.c
index e814742..4847b6a 100644
--- a/drivers/net/wireless/wl12xx/wl1251_spi.c
+++ b/drivers/net/wireless/wl12xx/wl1251_spi.c
@@ -26,7 +26,7 @@
 #include <linux/slab.h>
 #include <linux/crc7.h>
 #include <linux/spi/spi.h>
-#include <linux/spi/wl12xx.h>
+#include <linux/wl12xx.h>
 
 #include "wl1251.h"
 #include "wl1251_reg.h"
diff --git a/drivers/net/wireless/wl12xx/wl1271_spi.c b/drivers/net/wireless/wl12xx/wl1271_spi.c
index 5189b81..e866049 100644
--- a/drivers/net/wireless/wl12xx/wl1271_spi.c
+++ b/drivers/net/wireless/wl12xx/wl1271_spi.c
@@ -25,7 +25,7 @@
 #include <linux/module.h>
 #include <linux/crc7.h>
 #include <linux/spi/spi.h>
-#include <linux/spi/wl12xx.h>
+#include <linux/wl12xx.h>
 #include <linux/slab.h>
 
 #include "wl1271.h"
diff --git a/include/linux/spi/wl12xx.h b/include/linux/spi/wl12xx.h
deleted file mode 100644
index a223ecb..0000000
--- a/include/linux/spi/wl12xx.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * This file is part of wl12xx
- *
- * Copyright (C) 2009 Nokia Corporation
- *
- * Contact: Kalle Valo <kalle.valo@nokia.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA
- *
- */
-
-#ifndef _LINUX_SPI_WL12XX_H
-#define _LINUX_SPI_WL12XX_H
-
-struct wl12xx_platform_data {
-	void (*set_power)(bool enable);
-	/* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
-	int irq;
-	bool use_eeprom;
-};
-
-#endif
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
new file mode 100644
index 0000000..137ac89
--- /dev/null
+++ b/include/linux/wl12xx.h
@@ -0,0 +1,34 @@
+/*
+ * This file is part of wl12xx
+ *
+ * Copyright (C) 2009 Nokia Corporation
+ *
+ * Contact: Kalle Valo <kalle.valo@nokia.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef _LINUX_WL12XX_H
+#define _LINUX_WL12XX_H
+
+struct wl12xx_platform_data {
+	void (*set_power)(bool enable);
+	/* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
+	int irq;
+	bool use_eeprom;
+};
+
+#endif
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH 09/15] wireless: wl12xx: support pdata SDIO handlers
From: Ohad Ben-Cohen @ 2010-07-06  0:37 UTC (permalink / raw)
  To: linux-wireless, linux-mmc, linux-omap
  Cc: linux-arm-kernel, linux, Chikkature Rajashekar Madhusudhan,
	Luciano Coelho, akpm, San Mehat, Ohad Ben-Cohen
In-Reply-To: <1278376666-3509-1-git-send-email-ohad@wizery.com>

From: Ohad Ben-Cohen <ohadb@ti.com>

Make it possible for board code to send SDIO handlers to
the wl12xx driver.

These SDIO handlers are needed to allow software to trigger
card detect events for hard-wired SDIO devices such as the
wl1271 device.

Signed-off-by: Ohad Ben-Cohen <ohadb@ti.com>
---
 drivers/net/wireless/wl12xx/wl1271.h |    4 ++++
 include/linux/wl12xx.h               |    2 ++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h
index 6f1b6b5..fc4d122 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -356,6 +356,10 @@ struct wl1271 {
 	struct wl1271_if_operations *if_ops;
 
 	void (*set_power)(bool enable);
+	/* SDIO card detect emulation */
+	void (*set_carddetect)(bool card_present);
+	void (*set_embedded_data)(void *priv);
+
 	int irq;
 
 	spinlock_t wl_lock;
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index 137ac89..4106184 100644
--- a/include/linux/wl12xx.h
+++ b/include/linux/wl12xx.h
@@ -26,6 +26,8 @@
 
 struct wl12xx_platform_data {
 	void (*set_power)(bool enable);
+	void (*set_carddetect)(bool card_present);
+	void (*set_embedded_data)(void *priv);
 	/* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
 	int irq;
 	bool use_eeprom;
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH 10/15] wireless: wl1271: support return value for the set power func
From: Ohad Ben-Cohen @ 2010-07-06  0:37 UTC (permalink / raw)
  To: linux-wireless, linux-mmc, linux-omap
  Cc: linux-arm-kernel, linux, Chikkature Rajashekar Madhusudhan,
	Luciano Coelho, akpm, San Mehat, Ohad Ben-Cohen
In-Reply-To: <1278376666-3509-1-git-send-email-ohad@wizery.com>

From: Ohad Ben-Cohen <ohadb@ti.com>

Make it possible for the set power method to indicate a
success/failure return value. This is needed to support
more complex power on/off operations such as bringing up
(and down) sdio functions.

Signed-off-by: Ohad Ben-Cohen <ohadb@ti.com>
---
 drivers/net/wireless/wl12xx/wl1271.h      |    2 +-
 drivers/net/wireless/wl12xx/wl1271_io.h   |    8 +++++---
 drivers/net/wireless/wl12xx/wl1271_main.c |    4 +++-
 drivers/net/wireless/wl12xx/wl1271_sdio.c |    4 +++-
 drivers/net/wireless/wl12xx/wl1271_spi.c  |    4 +++-
 5 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h
index fc4d122..5250361 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -340,7 +340,7 @@ struct wl1271_if_operations {
 		     bool fixed);
 	void (*reset)(struct wl1271 *wl);
 	void (*init)(struct wl1271 *wl);
-	void (*power)(struct wl1271 *wl, bool enable);
+	int (*power)(struct wl1271 *wl, bool enable);
 	struct device* (*dev)(struct wl1271 *wl);
 	void (*enable_irq)(struct wl1271 *wl);
 	void (*disable_irq)(struct wl1271 *wl);
diff --git a/drivers/net/wireless/wl12xx/wl1271_io.h b/drivers/net/wireless/wl12xx/wl1271_io.h
index bc806c7..4a5b92c 100644
--- a/drivers/net/wireless/wl12xx/wl1271_io.h
+++ b/drivers/net/wireless/wl12xx/wl1271_io.h
@@ -144,10 +144,12 @@ static inline void wl1271_power_off(struct wl1271 *wl)
 	clear_bit(WL1271_FLAG_GPIO_POWER, &wl->flags);
 }
 
-static inline void wl1271_power_on(struct wl1271 *wl)
+static inline int wl1271_power_on(struct wl1271 *wl)
 {
-	wl->if_ops->power(wl, true);
-	set_bit(WL1271_FLAG_GPIO_POWER, &wl->flags);
+	int ret = wl->if_ops->power(wl, true);
+	if (ret == 0)
+		set_bit(WL1271_FLAG_GPIO_POWER, &wl->flags);
+	return ret;
 }
 
 
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index b7d9137..6bd748e 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -620,7 +620,9 @@ static int wl1271_chip_wakeup(struct wl1271 *wl)
 	int ret = 0;
 
 	msleep(WL1271_PRE_POWER_ON_SLEEP);
-	wl1271_power_on(wl);
+	ret = wl1271_power_on(wl);
+	if (ret < 0)
+		goto out;
 	msleep(WL1271_POWER_ON_SLEEP);
 	wl1271_io_reset(wl);
 	wl1271_io_init(wl);
diff --git a/drivers/net/wireless/wl12xx/wl1271_sdio.c b/drivers/net/wireless/wl12xx/wl1271_sdio.c
index 9903ae9..571c6b9 100644
--- a/drivers/net/wireless/wl12xx/wl1271_sdio.c
+++ b/drivers/net/wireless/wl12xx/wl1271_sdio.c
@@ -144,7 +144,7 @@ static void wl1271_sdio_raw_write(struct wl1271 *wl, int addr, void *buf,
 
 }
 
-static void wl1271_sdio_set_power(struct wl1271 *wl, bool enable)
+static int wl1271_sdio_set_power(struct wl1271 *wl, bool enable)
 {
 	struct sdio_func *func = wl_to_func(wl);
 
@@ -159,6 +159,8 @@ static void wl1271_sdio_set_power(struct wl1271 *wl, bool enable)
 		sdio_disable_func(func);
 		sdio_release_host(func);
 	}
+
+	return 0;
 }
 
 static struct wl1271_if_operations sdio_ops = {
diff --git a/drivers/net/wireless/wl12xx/wl1271_spi.c b/drivers/net/wireless/wl12xx/wl1271_spi.c
index e866049..85a167f 100644
--- a/drivers/net/wireless/wl12xx/wl1271_spi.c
+++ b/drivers/net/wireless/wl12xx/wl1271_spi.c
@@ -313,10 +313,12 @@ static irqreturn_t wl1271_irq(int irq, void *cookie)
 	return IRQ_HANDLED;
 }
 
-static void wl1271_spi_set_power(struct wl1271 *wl, bool enable)
+static int wl1271_spi_set_power(struct wl1271 *wl, bool enable)
 {
 	if (wl->set_power)
 		wl->set_power(enable);
+
+	return 0;
 }
 
 static struct wl1271_if_operations spi_ops = {
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH 11/15] wireless: wl1271: introduce platform device support
From: Ohad Ben-Cohen @ 2010-07-06  0:37 UTC (permalink / raw)
  To: linux-wireless, linux-mmc, linux-omap
  Cc: linux-arm-kernel, linux, Chikkature Rajashekar Madhusudhan,
	Luciano Coelho, akpm, San Mehat, Ohad Ben-Cohen
In-Reply-To: <1278376666-3509-1-git-send-email-ohad@wizery.com>

From: Ohad Ben-Cohen <ohadb@ti.com>

Introduce a platform device support which is decoupled
from the life cycle of the sdio function.

The platform device objective is to deliver board-specific
values (like irq, ref_clock, and software card-detect
emulation control).

The driver can then dynamically create (or destroy)
the sdio function whenever the wlan interface is
brought up (or down), as part of the power() operation.

Signed-off-by: Ohad Ben-Cohen <ohadb@ti.com>
---
 drivers/net/wireless/wl12xx/Kconfig       |    1 +
 drivers/net/wireless/wl12xx/wl1271.h      |    1 +
 drivers/net/wireless/wl12xx/wl1271_sdio.c |  185 +++++++++++++++++++++++------
 3 files changed, 150 insertions(+), 37 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/Kconfig b/drivers/net/wireless/wl12xx/Kconfig
index 337fc7b..8fb7b5a 100644
--- a/drivers/net/wireless/wl12xx/Kconfig
+++ b/drivers/net/wireless/wl12xx/Kconfig
@@ -66,6 +66,7 @@ config WL1271_SPI
 config WL1271_SDIO
 	tristate "TI wl1271 SDIO support"
 	depends on WL1271 && MMC && ARM
+	select MMC_EMBEDDED_SDIO
 	---help---
 	  This module adds support for the SDIO interface of adapters using
 	  TI wl1271 chipset.  Select this if your platform is using
diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h
index 5250361..2df57cc 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -352,6 +352,7 @@ struct wl1271 {
 	bool mac80211_registered;
 
 	void *if_priv;
+	void *if_plat_priv;
 
 	struct wl1271_if_operations *if_ops;
 
diff --git a/drivers/net/wireless/wl12xx/wl1271_sdio.c b/drivers/net/wireless/wl12xx/wl1271_sdio.c
index 571c6b9..96b8fc3 100644
--- a/drivers/net/wireless/wl12xx/wl1271_sdio.c
+++ b/drivers/net/wireless/wl12xx/wl1271_sdio.c
@@ -28,6 +28,10 @@
 #include <linux/mmc/sdio_func.h>
 #include <linux/mmc/sdio_ids.h>
 #include <linux/mmc/card.h>
+#include <linux/mmc/host.h>
+#include <linux/completion.h>
+#include <linux/wl12xx.h>
+#include <linux/platform_device.h>
 #include <plat/gpio.h>
 
 #include "wl1271.h"
@@ -36,6 +40,7 @@
 
 
 #define RX71_WL1271_IRQ_GPIO		42
+static DECLARE_COMPLETION(wl1271_sdio_ready);
 
 static const struct sdio_device_id wl1271_devices[] = {
 	{ SDIO_DEVICE(SDIO_VENDOR_ID_TI, SDIO_DEVICE_ID_TI_WL1271) },
@@ -50,7 +55,9 @@ static inline struct sdio_func *wl_to_func(struct wl1271 *wl)
 
 static struct device *wl1271_sdio_wl_to_dev(struct wl1271 *wl)
 {
-	return &(wl_to_func(wl)->dev);
+	struct platform_device *pdev = wl->if_plat_priv;
+
+	return &pdev->dev;
 }
 
 static irqreturn_t wl1271_irq(int irq, void *cookie)
@@ -146,21 +153,44 @@ static void wl1271_sdio_raw_write(struct wl1271 *wl, int addr, void *buf,
 
 static int wl1271_sdio_set_power(struct wl1271 *wl, bool enable)
 {
-	struct sdio_func *func = wl_to_func(wl);
+	int ret = 0, timeleft;
 
-	/* Let the SDIO stack handle wlan_enable control, so we
-	 * keep host claimed while wlan is in use to keep wl1271
-	 * alive.
-	 */
 	if (enable) {
-		sdio_claim_host(func);
-		sdio_enable_func(func);
+		/* save our wl struct as private mmc data */
+		wl->set_embedded_data(wl);
+
+		INIT_COMPLETION(wl1271_sdio_ready);
+		/* 1271 Power Up Sequence */
+		wl->set_power(true);
+		mdelay(15);
+		wl->set_power(false);
+		mdelay(1);
+		wl->set_power(true);
+		mdelay(70);
+
+		/* emulate card detect event */
+		wl->set_carddetect(true);
+
 	} else {
-		sdio_disable_func(func);
-		sdio_release_host(func);
+		wl->set_embedded_data(NULL);
+
+		INIT_COMPLETION(wl1271_sdio_ready);
+
+		wl->set_power(false);
+		mdelay(10);
+
+		wl->set_carddetect(false);
 	}
 
-	return 0;
+	timeleft = wait_for_completion_interruptible_timeout(&wl1271_sdio_ready,
+						msecs_to_jiffies(5000));
+	if (timeleft <= 0) {
+		wl1271_error("%s: unsuccessful SDIO %s (%d)", __func__,
+				enable ? "init" : "deinit", timeleft);
+		ret = (timeleft == 0 ? -EAGAIN : timeleft);
+	}
+
+	return ret;
 }
 
 static struct wl1271_if_operations sdio_ops = {
@@ -174,30 +204,97 @@ static struct wl1271_if_operations sdio_ops = {
 	.disable_irq	= wl1271_sdio_disable_interrupts
 };
 
-static int __devinit wl1271_probe(struct sdio_func *func,
+static int wl1271_sdio_probe(struct sdio_func *func,
 				  const struct sdio_device_id *id)
 {
+	struct wl1271 *wl = mmc_get_embedded_data(func->card->host);
+
+	/* 2nd func is WLAN, make sure wl context is received */
+	if (func->num != 0x02 || !wl)
+		return -ENODEV;
+
+	sdio_set_drvdata(func, wl);
+
+	wl->if_priv = func;
+
+	/* Grab access to FN0 for ELP reg. */
+	func->card->quirks |= MMC_QUIRK_LENIENT_FN0;
+
+	sdio_claim_host(func);
+	sdio_enable_func(func);
+
+	complete(&wl1271_sdio_ready);
+
+	return 0;
+}
+
+static void wl1271_sdio_remove(struct sdio_func *func)
+{
+	struct wl1271 *wl = sdio_get_drvdata(func);
+
+	wl->if_priv = NULL;
+
+	sdio_disable_func(func);
+	sdio_release_host(func);
+
+	complete(&wl1271_sdio_ready);
+}
+
+static struct sdio_driver wl1271_sdio_driver = {
+	.name		= "wl1271_sdio_func",
+	.id_table	= wl1271_devices,
+	.probe		= wl1271_sdio_probe,
+	.remove		= wl1271_sdio_remove,
+};
+
+static int wl1271_plat_probe(struct platform_device *pdev)
+{
+	struct wl12xx_platform_data *pdata;
 	struct ieee80211_hw *hw;
 	struct wl1271 *wl;
 	int ret;
 
-	/* We are only able to handle the wlan function */
-	if (func->num != 0x02)
+	pdata = pdev->dev.platform_data;
+	if (!pdata) {
+		wl1271_error("no platform data");
 		return -ENODEV;
+	}
 
 	hw = wl1271_alloc_hw();
-	if (IS_ERR(hw))
+	if (IS_ERR(hw)) {
+		wl1271_error("wl1271_alloc_hw failed: %ld", PTR_ERR(hw));
 		return PTR_ERR(hw);
+	}
 
 	wl = hw->priv;
 
-	wl->if_priv = func;
 	wl->if_ops = &sdio_ops;
+	wl->if_plat_priv = pdev;
+	platform_set_drvdata(pdev, wl);
 
-	/* Grab access to FN0 for ELP reg. */
-	func->card->quirks |= MMC_QUIRK_LENIENT_FN0;
+	wl->set_embedded_data = pdata->set_embedded_data;
+	if (!wl->set_embedded_data) {
+		wl1271_error("set embedded_data func missing in platform data");
+		ret = -ENODEV;
+		goto out_free;
+	}
+
+	wl->set_carddetect = pdata->set_carddetect;
+	if (!wl->set_carddetect) {
+		wl1271_error("set carddetect func missing in platform data");
+		ret = -ENODEV;
+		goto out_free;
+	}
 
 	wl->irq = gpio_to_irq(RX71_WL1271_IRQ_GPIO);
+
+	wl->set_power = pdata->set_power;
+	if (!wl->set_power) {
+		wl1271_error("set power function missing in platform data");
+		ret = -ENODEV;
+		goto out_free;
+	}
+
 	if (wl->irq < 0) {
 		ret = wl->irq;
 		wl1271_error("could not get irq!");
@@ -215,53 +312,67 @@ static int __devinit wl1271_probe(struct sdio_func *func,
 	disable_irq(wl->irq);
 
 	ret = wl1271_init_ieee80211(wl);
-	if (ret)
+	if (ret) {
+		wl1271_error("wl1271_init_ieee80211 failed: %d", ret);
 		goto out_irq;
+	}
 
 	ret = wl1271_register_hw(wl);
-	if (ret)
+	if (ret) {
+		wl1271_error("wl1271_register_hw failed: %d", ret);
 		goto out_irq;
+	}
 
-	sdio_set_drvdata(func, wl);
+	ret = sdio_register_driver(&wl1271_sdio_driver);
+	if (ret < 0) {
+		wl1271_error("failed to register sdio driver: %d", ret);
+		goto out_hw;
+	}
 
 	wl1271_notice("initialized");
 
 	return 0;
 
- out_irq:
+out_hw:
+	wl1271_unregister_hw(wl);
+out_irq:
 	free_irq(wl->irq, wl);
-
-
- out_free:
+out_free:
 	wl1271_free_hw(wl);
-
 	return ret;
 }
 
-static void __devexit wl1271_remove(struct sdio_func *func)
+static int __devexit wl1271_plat_remove(struct platform_device *pdev)
 {
-	struct wl1271 *wl = sdio_get_drvdata(func);
+	struct wl1271 *wl = platform_get_drvdata(pdev);
 
-	free_irq(wl->irq, wl);
+	sdio_unregister_driver(&wl1271_sdio_driver);
 
 	wl1271_unregister_hw(wl);
+
+	free_irq(wl->irq, wl);
+
 	wl1271_free_hw(wl);
+
+	return 0;
 }
 
-static struct sdio_driver wl1271_sdio_driver = {
-	.name		= "wl1271_sdio",
-	.id_table	= wl1271_devices,
-	.probe		= wl1271_probe,
-	.remove		= __devexit_p(wl1271_remove),
+static struct platform_driver wl1271_plat_driver = {
+	.probe = wl1271_plat_probe,
+	.remove = __devexit_p(wl1271_plat_remove),
+	.driver = {
+		.name		= "wl1271_sdio",
+		.owner		= THIS_MODULE,
+	},
 };
 
 static int __init wl1271_init(void)
 {
 	int ret;
 
-	ret = sdio_register_driver(&wl1271_sdio_driver);
+	ret = platform_driver_register(&wl1271_plat_driver);
 	if (ret < 0) {
-		wl1271_error("failed to register sdio driver: %d", ret);
+		wl1271_error("failed to register plat driver: %d", ret);
 		goto out;
 	}
 
@@ -271,7 +382,7 @@ out:
 
 static void __exit wl1271_exit(void)
 {
-	sdio_unregister_driver(&wl1271_sdio_driver);
+	platform_driver_unregister(&wl1271_plat_driver);
 
 	wl1271_notice("unloaded");
 }
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH 12/15] wireless: wl1271: take irq info from platform data
From: Ohad Ben-Cohen @ 2010-07-06  0:37 UTC (permalink / raw)
  To: linux-wireless, linux-mmc, linux-omap
  Cc: linux-arm-kernel, linux, Chikkature Rajashekar Madhusudhan,
	Luciano Coelho, akpm, San Mehat, Ohad Ben-Cohen
In-Reply-To: <1278376666-3509-1-git-send-email-ohad@wizery.com>

From: Ohad Ben-Cohen <ohadb@ti.com>

Remove the hard coded irq information, and instead take
the irq information from the platform-specific data
which is supplied by the board device.

Signed-off-by: Ohad Ben-Cohen <ohadb@ti.com>
---
 drivers/net/wireless/wl12xx/wl1271_sdio.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271_sdio.c b/drivers/net/wireless/wl12xx/wl1271_sdio.c
index 96b8fc3..0af0dce 100644
--- a/drivers/net/wireless/wl12xx/wl1271_sdio.c
+++ b/drivers/net/wireless/wl12xx/wl1271_sdio.c
@@ -38,8 +38,6 @@
 #include "wl12xx_80211.h"
 #include "wl1271_io.h"
 
-
-#define RX71_WL1271_IRQ_GPIO		42
 static DECLARE_COMPLETION(wl1271_sdio_ready);
 
 static const struct sdio_device_id wl1271_devices[] = {
@@ -286,8 +284,6 @@ static int wl1271_plat_probe(struct platform_device *pdev)
 		goto out_free;
 	}
 
-	wl->irq = gpio_to_irq(RX71_WL1271_IRQ_GPIO);
-
 	wl->set_power = pdata->set_power;
 	if (!wl->set_power) {
 		wl1271_error("set power function missing in platform data");
@@ -295,9 +291,10 @@ static int wl1271_plat_probe(struct platform_device *pdev)
 		goto out_free;
 	}
 
+	wl->irq = pdata->irq;
 	if (wl->irq < 0) {
-		ret = wl->irq;
-		wl1271_error("could not get irq!");
+		wl1271_error("irq missing in platform data");
+		ret = -ENODEV;
 		goto out_free;
 	}
 
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH 13/15] wireless: wl1271: make ref_clock configurable by board
From: Ohad Ben-Cohen @ 2010-07-06  0:37 UTC (permalink / raw)
  To: linux-wireless, linux-mmc, linux-omap
  Cc: linux-arm-kernel, linux, Chikkature Rajashekar Madhusudhan,
	Luciano Coelho, akpm, San Mehat, Ohad Ben-Cohen
In-Reply-To: <1278376666-3509-1-git-send-email-ohad@wizery.com>

From: Ohad Ben-Cohen <ohadb@ti.com>

The wl1271 device is using a reference clock that may change
between board to board.

Make the ref_clock parameter configurable by the board
files that set up the device, instead of having a hard coded
value in the driver source itself.

Signed-off-by: Ohad Ben-Cohen <ohadb@ti.com>
---
 drivers/net/wireless/wl12xx/wl1271.h      |    1 +
 drivers/net/wireless/wl12xx/wl1271_boot.c |   13 +++++++++----
 drivers/net/wireless/wl12xx/wl1271_boot.h |    1 -
 drivers/net/wireless/wl12xx/wl1271_sdio.c |    2 ++
 drivers/net/wireless/wl12xx/wl1271_spi.c  |    2 ++
 include/linux/wl12xx.h                    |    1 +
 6 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h
index 2df57cc..cb3126d 100644
--- a/drivers/net/wireless/wl12xx/wl1271.h
+++ b/drivers/net/wireless/wl12xx/wl1271.h
@@ -362,6 +362,7 @@ struct wl1271 {
 	void (*set_embedded_data)(void *priv);
 
 	int irq;
+	int ref_clock;
 
 	spinlock_t wl_lock;
 
diff --git a/drivers/net/wireless/wl12xx/wl1271_boot.c b/drivers/net/wireless/wl12xx/wl1271_boot.c
index 1a36d8a..fa1b8b9 100644
--- a/drivers/net/wireless/wl12xx/wl1271_boot.c
+++ b/drivers/net/wireless/wl12xx/wl1271_boot.c
@@ -455,17 +455,22 @@ int wl1271_boot(struct wl1271 *wl)
 {
 	int ret = 0;
 	u32 tmp, clk, pause;
+	int ref_clock = wl->ref_clock;
 
 	wl1271_boot_hw_version(wl);
 
-	if (REF_CLOCK == 0 || REF_CLOCK == 2 || REF_CLOCK == 4)
+	if (ref_clock == 0 || ref_clock == 2 || ref_clock == 4)
 		/* ref clk: 19.2/38.4/38.4-XTAL */
 		clk = 0x3;
-	else if (REF_CLOCK == 1 || REF_CLOCK == 3)
+	else if (ref_clock == 1 || ref_clock == 3)
 		/* ref clk: 26/52 */
 		clk = 0x5;
+	else {
+		ret = -EINVAL;
+		goto out;
+	}
 
-	if (REF_CLOCK != 0) {
+	if (ref_clock != 0) {
 		u16 val;
 		/* Set clock type (open drain) */
 		val = wl1271_top_reg_read(wl, OCP_REG_CLK_TYPE);
@@ -514,7 +519,7 @@ int wl1271_boot(struct wl1271 *wl)
 	wl1271_debug(DEBUG_BOOT, "clk2 0x%x", clk);
 
 	/* 2 */
-	clk |= (REF_CLOCK << 1) << 4;
+	clk |= (ref_clock << 1) << 4;
 	wl1271_write32(wl, DRPW_SCRATCH_START, clk);
 
 	wl1271_set_partition(wl, &part_table[PART_WORK]);
diff --git a/drivers/net/wireless/wl12xx/wl1271_boot.h b/drivers/net/wireless/wl12xx/wl1271_boot.h
index f829699..f73b0b1 100644
--- a/drivers/net/wireless/wl12xx/wl1271_boot.h
+++ b/drivers/net/wireless/wl12xx/wl1271_boot.h
@@ -46,7 +46,6 @@ struct wl1271_static_data {
 /* delay between retries */
 #define INIT_LOOP_DELAY 50
 
-#define REF_CLOCK            2
 #define WU_COUNTER_PAUSE_VAL 0x3FF
 #define WELP_ARM_COMMAND_VAL 0x4
 
diff --git a/drivers/net/wireless/wl12xx/wl1271_sdio.c b/drivers/net/wireless/wl12xx/wl1271_sdio.c
index 0af0dce..4ed097f 100644
--- a/drivers/net/wireless/wl12xx/wl1271_sdio.c
+++ b/drivers/net/wireless/wl12xx/wl1271_sdio.c
@@ -270,6 +270,8 @@ static int wl1271_plat_probe(struct platform_device *pdev)
 	wl->if_plat_priv = pdev;
 	platform_set_drvdata(pdev, wl);
 
+	wl->ref_clock = pdata->board_ref_clock;
+
 	wl->set_embedded_data = pdata->set_embedded_data;
 	if (!wl->set_embedded_data) {
 		wl1271_error("set embedded_data func missing in platform data");
diff --git a/drivers/net/wireless/wl12xx/wl1271_spi.c b/drivers/net/wireless/wl12xx/wl1271_spi.c
index 85a167f..2cb125b 100644
--- a/drivers/net/wireless/wl12xx/wl1271_spi.c
+++ b/drivers/net/wireless/wl12xx/wl1271_spi.c
@@ -373,6 +373,8 @@ static int __devinit wl1271_probe(struct spi_device *spi)
 		goto out_free;
 	}
 
+	wl->ref_clock = pdata->ref_clock;
+
 	wl->irq = spi->irq;
 	if (wl->irq < 0) {
 		wl1271_error("irq missing in platform data");
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index 4106184..9053d9c 100644
--- a/include/linux/wl12xx.h
+++ b/include/linux/wl12xx.h
@@ -31,6 +31,7 @@ struct wl12xx_platform_data {
 	/* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
 	int irq;
 	bool use_eeprom;
+	int board_ref_clock;
 };
 
 #endif
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH 14/15] omap: zoom: add WLAN device
From: Ohad Ben-Cohen @ 2010-07-06  0:37 UTC (permalink / raw)
  To: linux-wireless, linux-mmc, linux-omap
  Cc: linux-arm-kernel, linux, Chikkature Rajashekar Madhusudhan,
	Luciano Coelho, akpm, San Mehat, Ohad Ben-Cohen
In-Reply-To: <1278376666-3509-1-git-send-email-ohad@wizery.com>

From: Ohad Ben-Cohen <ohadb@ti.com>

Add WLAN platform device and control
functions (power and virtual card detect)
in order to allow software to control the
embedded SDIO WLAN device which resides on
the ZOOM board (TI's wl1271 device).

Based on Android's WLAN control functions by
San Mehat <san@android.com>.

Signed-off-by: Ohad Ben-Cohen <ohadb@ti.com>
---
 arch/arm/mach-omap2/board-zoom-wlan.c         |  129 +++++++++++++++++++++++++
 arch/arm/mach-omap2/include/mach/board-zoom.h |    5 +
 2 files changed, 134 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-omap2/board-zoom-wlan.c

diff --git a/arch/arm/mach-omap2/board-zoom-wlan.c b/arch/arm/mach-omap2/board-zoom-wlan.c
new file mode 100644
index 0000000..7ed5139
--- /dev/null
+++ b/arch/arm/mach-omap2/board-zoom-wlan.c
@@ -0,0 +1,129 @@
+/* mach-omap2/board-zoom-wlan.c
+ *
+ * Board support for wl1271 embedded SDIO device.
+ *
+ * Copyright (C) 2010 Texas Instruments, Inc.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2. This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/mmc/host.h>
+#include <linux/mmc/sdio_ids.h>
+#include <linux/err.h>
+#include <linux/gpio.h>
+#include <linux/wl12xx.h>
+
+#include "mux.h"
+
+#ifdef CONFIG_OMAP_ZOOM_WLAN
+
+/* these are zoom-specific board numbers */
+#define OMAP_ZOOM_WLAN_PMENA_GPIO	(101)
+#define OMAP_ZOOM_WLAN_IRQ_GPIO		(162)
+
+/* wl1271 virtual 'card detect' status */
+static int omap_zoom_wlan_cd;
+static void (*wlan_set_virtual_cd)(void *dev_id, int card_present);
+static void (*wlan_set_data)(void *dev_id, void *priv);
+static void *wlan_host_devid;
+
+int omap_zoom_wlan_register_embedded_control(void *dev_id,
+			void (*set_virtual_cd)(void *dev_id, int card_present),
+			void (*set_data)(void *dev_id, void *priv))
+{
+	if (wlan_host_devid || wlan_set_virtual_cd || wlan_set_data)
+		return -EBUSY;
+
+	wlan_set_virtual_cd = set_virtual_cd;
+	wlan_set_data = set_data;
+	wlan_host_devid = dev_id;
+
+	return 0;
+}
+
+int omap_zoom_wlan_get_virtual_cd(void)
+{
+	return omap_zoom_wlan_cd;
+}
+
+static void omap_zoom_wlan_set_embedded_data(void *priv)
+{
+	if (wlan_set_data)
+		wlan_set_data(wlan_host_devid, priv);
+	else
+		pr_err("%s: host controller not registered yet\n", __func__);
+}
+
+static void omap_zoom_wlan_set_carddetect(bool card_present)
+{
+	omap_zoom_wlan_cd = card_present ? 1 : 0;
+
+	pr_info("%s: %d\n", __func__, omap_zoom_wlan_cd);
+
+	if (wlan_set_virtual_cd)
+		wlan_set_virtual_cd(wlan_host_devid, omap_zoom_wlan_cd);
+	else
+		pr_err("%s: host controller not registered yet\n", __func__);
+}
+
+static void omap_zoom_wlan_power(bool enable)
+{
+	int val = enable ? 1 : 0;
+
+	pr_info("%s: set power %d\n", __func__, val);
+
+	gpio_set_value(OMAP_ZOOM_WLAN_PMENA_GPIO, val);
+}
+
+struct wl12xx_platform_data omap_zoom_wlan_control = {
+	.set_power = omap_zoom_wlan_power,
+	.set_carddetect = omap_zoom_wlan_set_carddetect,
+	.set_embedded_data = omap_zoom_wlan_set_embedded_data,
+	/* ZOOM ref clock is 26 MHz */
+	.board_ref_clock = 1,
+	.irq = OMAP_GPIO_IRQ(OMAP_ZOOM_WLAN_IRQ_GPIO),
+};
+
+static struct platform_device omap_zoom_wlan_device = {
+	.name = "wl1271_sdio",
+	.id = 1,
+	.dev = {
+		.platform_data = &omap_zoom_wlan_control,
+	},
+};
+
+int __init omap_zoom_wlan_init(void)
+{
+	int ret;
+
+	ret = gpio_request(OMAP_ZOOM_WLAN_PMENA_GPIO, "wlan_power");
+	if (ret < 0) {
+		pr_err("%s: power gpio request failed: %d\n", __func__, ret);
+		return ret;
+	}
+
+	gpio_direction_output(OMAP_ZOOM_WLAN_PMENA_GPIO, 0);
+
+	ret = gpio_request(OMAP_ZOOM_WLAN_IRQ_GPIO, "wlan_irq");
+	if (ret < 0) {
+		pr_err("%s: gpio request failed: %d\n", __func__, ret);
+		return ret;
+	}
+	gpio_direction_input(OMAP_ZOOM_WLAN_IRQ_GPIO);
+
+	ret = platform_device_register(&omap_zoom_wlan_device);
+
+	return ret;
+}
+
+#else
+int __init omap_zoom_wlan_init(void)
+{
+	return 0;
+}
+#endif /* CONFIG_OMAP_ZOOM_WLAN */
diff --git a/arch/arm/mach-omap2/include/mach/board-zoom.h b/arch/arm/mach-omap2/include/mach/board-zoom.h
index c93b29e..61bbd81 100644
--- a/arch/arm/mach-omap2/include/mach/board-zoom.h
+++ b/arch/arm/mach-omap2/include/mach/board-zoom.h
@@ -3,3 +3,8 @@
  */
 extern int __init zoom_debugboard_init(void);
 extern void __init zoom_peripherals_init(void);
+int __init omap_zoom_wlan_init(void);
+int omap_zoom_wlan_register_embedded_control(void *dev_id,
+			void (*set_virtual_cd)(void *dev_id, int card_present),
+			void (*set_data)(void *dev_id, void *priv));
+int omap_zoom_wlan_get_virtual_cd(void);
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH 15/15] omap: zoom: enable WLAN device
From: Ohad Ben-Cohen @ 2010-07-06  0:37 UTC (permalink / raw)
  To: linux-wireless, linux-mmc, linux-omap
  Cc: linux-arm-kernel, linux, Chikkature Rajashekar Madhusudhan,
	Luciano Coelho, akpm, San Mehat, Ohad Ben-Cohen
In-Reply-To: <1278376666-3509-1-git-send-email-ohad@wizery.com>

From: Ohad Ben-Cohen <ohadb@ti.com>

Make it possible to build and use TI's wl1271
device on the ZOOM boards.

The device is an embedded SDIO WLAN chip
that is hardwired to the 3rd mmc controller
of the ZOOM2/3 boards.

Signed-off-by: Ohad Ben-Cohen <ohadb@ti.com>
---
 arch/arm/mach-omap2/Kconfig                  |    5 +++++
 arch/arm/mach-omap2/Makefile                 |    1 +
 arch/arm/mach-omap2/board-zoom-peripherals.c |   15 +++++++++++++++
 3 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index b31b6f1..7fee11b 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -131,6 +131,11 @@ config MACH_OMAP_ZOOM3
 	depends on ARCH_OMAP3
 	select OMAP_PACKAGE_CBP
 
+config OMAP_ZOOM_WLAN
+	bool "OMAP Zoom board WLAN support"
+	depends on MACH_OMAP_ZOOM2 || MACH_OMAP_ZOOM3
+	select MMC_EMBEDDED_SDIO
+
 config MACH_CM_T35
 	bool "CompuLab CM-T35 module"
 	depends on ARCH_OMAP3
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index ea52b03..ac1bad9 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -129,6 +129,7 @@ obj-$(CONFIG_MACH_OMAP_ZOOM3)		+= board-zoom3.o \
 					   board-zoom-peripherals.o \
 					   hsmmc.o \
 					   board-zoom-debugboard.o
+obj-y					+= board-zoom-wlan.o
 obj-$(CONFIG_MACH_OMAP_3630SDP)		+= board-3630sdp.o \
 					   board-zoom-peripherals.o \
 					   hsmmc.o
diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c
index 6b39849..3128cd4 100644
--- a/arch/arm/mach-omap2/board-zoom-peripherals.c
+++ b/arch/arm/mach-omap2/board-zoom-peripherals.c
@@ -16,11 +16,13 @@
 #include <linux/gpio.h>
 #include <linux/i2c/twl.h>
 #include <linux/regulator/machine.h>
+#include <linux/mmc/host.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
+#include <mach/board-zoom.h>
 #include <plat/common.h>
 #include <plat/usb.h>
 
@@ -168,6 +170,18 @@ static struct omap2_hsmmc_info mmc[] __initdata = {
 		.nonremovable	= true,
 		.power_saving	= true,
 	},
+#ifdef CONFIG_OMAP_ZOOM_WLAN
+	{
+		.mmc		= 3,
+		.wires		= 4,
+		.gpio_cd	= -EINVAL,
+		.gpio_wp	= -EINVAL,
+		.register_embedded_control =
+				omap_zoom_wlan_register_embedded_control,
+		.virtual_get_cd = omap_zoom_wlan_get_virtual_cd,
+		.ocr_mask	= MMC_VDD_165_195,
+	},
+#endif
 	{}      /* Terminator */
 };
 
@@ -282,4 +296,5 @@ void __init zoom_peripherals_init(void)
 	omap_i2c_init();
 	usb_musb_init(&musb_board_data);
 	enable_board_wakeup_source();
+	omap_zoom_wlan_init();
 }
-- 
1.7.0.4


^ permalink raw reply related

* Re: [PATCH 05/15] omap: hsmmc: add virtual card detect support
From: Nicolas Pitre @ 2010-07-06  1:45 UTC (permalink / raw)
  To: Ohad Ben-Cohen
  Cc: linux-wireless, linux-mmc, linux-omap, linux-arm-kernel, linux,
	Chikkature Rajashekar Madhusudhan, Luciano Coelho, Andrew Morton,
	San Mehat, Ohad Ben-Cohen
In-Reply-To: <1278376666-3509-6-git-send-email-ohad@wizery.com>

On Tue, 6 Jul 2010, Ohad Ben-Cohen wrote:

> From: Ohad Ben-Cohen <ohadb@ti.com>
> 
> Add support for software emulation of card detect
> events.
> 
> This is required for specific controllers
> that are hard wired with embedded SDIO devices
> (such as TI's wl1271 WLAN device).

Why?

Many instances of hardwired SDIO based WLAN devices do exist already, 
and they don't need extra card detect events to be generated.  The core 
MMC code already triggers a probe for cards whenever a new host 
controller is registered.

> Board-specific configuration is required to
> enable this software card detect control.

Could you elaborate please?


Nicolas

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox