* [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
* Re: [ath9k] ath9k: Expose virtual wiphy indexes to debugfs.
From: Vasanthakumar Thiagarajan @ 2010-07-06 4:59 UTC (permalink / raw)
To: greearb@gmail.com; +Cc: linux-wireless@vger.kernel.org, Ben Greear
In-Reply-To: <1278359545-29013-1-git-send-email-greearb@candelatech.com>
On Tue, Jul 06, 2010 at 01:22:25AM +0530, greearb@gmail.com wrote:
> 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.
>
It does not make much sense to give an index while creating a new
virtual wiphy interface. This is unncessary, only wiphy name
matters.
Vasanth
^ permalink raw reply
* Re: [ath9k] ath9k: Expose virtual wiphy indexes to debugfs.
From: Ben Greear @ 2010-07-06 5:15 UTC (permalink / raw)
To: Vasanthakumar Thiagarajan
Cc: greearb@gmail.com, linux-wireless@vger.kernel.org
In-Reply-To: <20100706045945.GF5053@vasanth-laptop>
On 07/05/2010 09:59 PM, Vasanthakumar Thiagarajan wrote:
> On Tue, Jul 06, 2010 at 01:22:25AM +0530, greearb@gmail.com wrote:
>> 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.
>>
>
> It does not make much sense to give an index while creating a new
> virtual wiphy interface. This is unncessary, only wiphy name
> matters.
Will the underlying code allow you to specify a phy name though? It
seems to me that once a phyX is used, you cannot have a new phy
with that name again, even if the old one has been unloaded:
modprobe ath9k
rmmod ath9k
modprobe ath9k, and the now it's using phy1 instead of phy0,
and you cannot even rename the phy1 to phy0 with 'iw'.
It would be great if phy names were reusable like network
device names, but I'm guessing that must be difficult or
it would already be like that.
For virtual PHYs at least, the parent phy and index is a unique
identifier, so it sort of helps work around the phy naming
issues.
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply
* Re: [ath9k] ath9k: Expose virtual wiphy indexes to debugfs.
From: Vasanthakumar Thiagarajan @ 2010-07-06 6:18 UTC (permalink / raw)
To: Ben Greear
Cc: Vasanth Thiagarajan, greearb@gmail.com,
linux-wireless@vger.kernel.org
In-Reply-To: <4C32BBF4.9090907@candelatech.com>
On Tue, Jul 06, 2010 at 10:45:32AM +0530, Ben Greear wrote:
> On 07/05/2010 09:59 PM, Vasanthakumar Thiagarajan wrote:
> > On Tue, Jul 06, 2010 at 01:22:25AM +0530, greearb@gmail.com wrote:
> >> 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.
> >>
> >
> > It does not make much sense to give an index while creating a new
> > virtual wiphy interface. This is unncessary, only wiphy name
> > matters.
>
> Will the underlying code allow you to specify a phy name though? It
> seems to me that once a phyX is used, you cannot have a new phy
> with that name again, even if the old one has been unloaded
Driver has nothing to do with assigning phy names. This is done in
cfg80211.
Vasanth
^ permalink raw reply
* Re: [PATCH 02/15] wireless: wl1271: remove SDIO IDs from driver
From: Luciano Coelho @ 2010-07-06 7:04 UTC (permalink / raw)
To: ext Ohad Ben-Cohen
Cc: linux-wireless@vger.kernel.org, linux-mmc@vger.kernel.org,
linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux@arm.linux.org.uk, Chikkature Rajashekar Madhusudhan,
akpm@linux-foundation.org, San Mehat, Ohad Ben-Cohen
In-Reply-To: <1278376666-3509-3-git-send-email-ohad@wizery.com>
On Tue, 2010-07-06 at 02:37 +0200, ext Ohad Ben-Cohen wrote:
> 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>
> ---
Acked-by: Luciano Coelho <luciano.coelho@nokia.com>
--
Cheers,
Luca.
^ permalink raw reply
* Re: [PATCH 10/15] wireless: wl1271: support return value for the set power func
From: Luciano Coelho @ 2010-07-06 7:11 UTC (permalink / raw)
To: ext Ohad Ben-Cohen
Cc: linux-wireless@vger.kernel.org, linux-mmc@vger.kernel.org,
linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux@arm.linux.org.uk, Chikkature Rajashekar Madhusudhan,
akpm@linux-foundation.org, San Mehat, Ohad Ben-Cohen
In-Reply-To: <1278376666-3509-11-git-send-email-ohad@wizery.com>
On Tue, 2010-07-06 at 02:37 +0200, ext Ohad Ben-Cohen wrote:
> 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>
> ---
Acked-by: Luciano Coelho <luciano.coelho@nokia.com>
--
Cheers,
Luca.
^ permalink raw reply
* Re: [PATCH 08/15] wireless: wl1271: make wl12xx.h common to both spi and sdio
From: Luciano Coelho @ 2010-07-06 7:08 UTC (permalink / raw)
To: ext Ohad Ben-Cohen
Cc: linux-wireless@vger.kernel.org, linux-mmc@vger.kernel.org,
linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux@arm.linux.org.uk, Chikkature Rajashekar Madhusudhan,
akpm@linux-foundation.org, San Mehat, Ohad Ben-Cohen, kalle.valo
In-Reply-To: <1278376666-3509-9-git-send-email-ohad@wizery.com>
On Tue, 2010-07-06 at 02:37 +0200, ext Ohad Ben-Cohen wrote:
> 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
For the wl1271 part:
Acked-by: Luciano Coelho <luciano.coelho@nokia.com>
For the wl12xx.h and wl1251 parts, this needs to be acked by Kalle Valo.
--
Cheers,
Luca.
^ permalink raw reply
* Re: ath9k doesn't clean up virtual wifis on rmmod, and crashes.
From: Rajkumar Manoharan @ 2010-07-06 8:36 UTC (permalink / raw)
To: Ben Greear; +Cc: Vasanth Thiagarajan, linux-wireless@vger.kernel.org
In-Reply-To: <4C322B26.7080701@candelatech.com>
On Tue, Jul 06, 2010 at 12:27:42AM +0530, Ben Greear wrote:
> 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
Can you please try this patch?
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index fe730cb..243c177 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -787,12 +787,12 @@ void ath9k_deinit_device(struct ath_softc *sc)
ieee80211_unregister_hw(aphy->hw);
ieee80211_free_hw(aphy->hw);
}
- kfree(sc->sec_wiphy);
ieee80211_unregister_hw(hw);
ath_rx_cleanup(sc);
ath_tx_cleanup(sc);
ath9k_deinit_softc(sc);
+ kfree(sc->sec_wiphy);
}
void ath_descdma_cleanup(struct ath_softc *sc,
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 4c0831f..a6b6af2 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1264,6 +1264,7 @@ static void ath9k_stop(struct ieee80211_hw *hw)
struct ath_softc *sc = aphy->sc;
struct ath_hw *ah = sc->sc_ah;
struct ath_common *common = ath9k_hw_common(ah);
+ int i;
mutex_lock(&sc->mutex);
@@ -1276,11 +1277,15 @@ static void ath9k_stop(struct ieee80211_hw *hw)
cancel_work_sync(&sc->paprd_work);
cancel_work_sync(&sc->hw_check_work);
- if (!sc->num_sec_wiphy) {
+ for (i = 0; i < sc->num_sec_wiphy; i++) {
+ if (sc->sec_wiphy[i])
+ break;
+ }
+
+ if (i == sc->num_sec_wiphy) {
cancel_delayed_work_sync(&sc->wiphy_work);
cancel_work_sync(&sc->chan_work);
}
-
if (sc->sc_flags & SC_OP_INVALID) {
ath_print(common, ATH_DBG_ANY, "Device not present\n");
mutex_unlock(&sc->mutex);
---
Rajkumar
^ permalink raw reply related
* Re: [PATCH 11/15] wireless: wl1271: introduce platform device support
From: Roger Quadros @ 2010-07-06 8:53 UTC (permalink / raw)
To: ext Ohad Ben-Cohen
Cc: linux-wireless@vger.kernel.org, linux-mmc@vger.kernel.org,
linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux@arm.linux.org.uk, Chikkature Rajashekar Madhusudhan,
Coelho Luciano (Nokia-MS/Helsinki), akpm@linux-foundation.org,
San Mehat, Ohad Ben-Cohen
In-Reply-To: <1278376666-3509-12-git-send-email-ohad@wizery.com>
Hi,
On 07/06/2010 03:37 AM, ext Ohad Ben-Cohen wrote:
> 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.
Is this the right approach? Why should you emulate a card disconnect event when
the wlan interface is brought down?
Physically the card is never disconnected. So I don't see why we should fake it.
Could you please explain why you need to do this?
br,
-roger
^ permalink raw reply
* Re: [PATCH 11/15] wireless: wl1271: introduce platform device support
From: Ohad Ben-Cohen @ 2010-07-06 9:30 UTC (permalink / raw)
To: Roger Quadros
Cc: linux-wireless@vger.kernel.org, linux-mmc@vger.kernel.org,
linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux@arm.linux.org.uk, Chikkature Rajashekar Madhusudhan,
Coelho Luciano (Nokia-MS/Helsinki), akpm@linux-foundation.org,
San Mehat, Ohad Ben-Cohen
In-Reply-To: <4C32EF19.1000604@nokia.com>
Hi Roger,
On Tue, Jul 6, 2010 at 11:53 AM, Roger Quadros <roger.quadros@nokia.com> wrote:
> Could you please explain why you need to do this?
To minimize power consumption when the wlan device is not in use, we
would like to keep the device powered off as long as the interface is
down, and only power it on when the user brings up the interface.
Whenever the chip is powered on, it must be initialized and
reconfigured by mmc_attach_sdio, and the wl1271 driver have to wait
for that phase to successfully complete (essentially waiting for the
sdio_driver's probe function to be called).
To make sure this SDIO init step occurs correctly every time we toggle
the device's power back on, and to prevent potential races, we also
have to make sure that the sdio function is removed every time we
power off the chip (the driver waits for the sdio_driver's remove
function to be called).
That's why we let the mmc layer think that the card is removed:
physically it is still there, but for all practical purposes it is
really removed, because once you power off the chip, you must
reinitialize it again next time you power it on, as if the card was
really removed and re-inserted.
Thanks,
Ohad.
>
> br,
> -roger
>
^ permalink raw reply
* Re: [PATCH 05/15] omap: hsmmc: add virtual card detect support
From: Ohad Ben-Cohen @ 2010-07-06 10:22 UTC (permalink / raw)
To: Nicolas Pitre
Cc: linux-wireless, linux-mmc, linux-omap, linux-arm-kernel, linux,
Chikkature Rajashekar Madhusudhan, Luciano Coelho, Andrew Morton,
San Mehat, Pandita, Vikram
In-Reply-To: <alpine.LFD.2.00.1007052134460.6020@xanadu.home>
Hi Nicolas,
On Tue, Jul 6, 2010 at 4:45 AM, Nicolas Pitre <nico@fluxnic.net> wrote:
> 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.
We prefer not to power up the chip as early as boot time; instead, we
would like to have it powered off until the wlan interface is brought
up, power it on when the interface is brought up,
and power it off again as soon as the interface is brought down again
(to minimize power consumption when the wlan is not in use).
For that we can't rely on the probing done when the controller is
registered, we want to have a mechanism to allow dynamic detection and
removal of the card.
Note: the wl1271 device does support standard card detection, but
AFAIK there's a limitation to use that with the specific omap
controller the device is hardwired to. I will try to get more info
about that, but probably Madhu can comment on that better.
>> Board-specific configuration is required to
>> enable this software card detect control.
>
> Could you elaborate please?
Please check out the last patch - that patch is doing that configuration.
In essence, this virtual card detect mechanism is enabled only for
specific controllers which we know there's an embedded sdio device
hardwired to. This knowledge is board-specific, and that's why we
enable this mechanism in the board files, per a specific mmc
controller.
Thanks,
Ohad.
>
>
> Nicolas
>
^ permalink raw reply
* Re: [PATCH 11/15] wireless: wl1271: introduce platform device support
From: Roger Quadros @ 2010-07-06 10:35 UTC (permalink / raw)
To: ext Ohad Ben-Cohen
Cc: linux-wireless@vger.kernel.org, linux-mmc@vger.kernel.org,
linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux@arm.linux.org.uk, Chikkature Rajashekar Madhusudhan,
Coelho Luciano (Nokia-MS/Helsinki), akpm@linux-foundation.org,
San Mehat, Ohad Ben-Cohen
In-Reply-To: <AANLkTintIz-N7MwwtqhVq2LR3Ln5JTNYSbJUBSSClcA-@mail.gmail.com>
Hi Ohad,
On 07/06/2010 12:30 PM, ext Ohad Ben-Cohen wrote:
> Hi Roger,
>
> On Tue, Jul 6, 2010 at 11:53 AM, Roger Quadros<roger.quadros@nokia.com> wrote:
>> Could you please explain why you need to do this?
>
> To minimize power consumption when the wlan device is not in use, we
> would like to keep the device powered off as long as the interface is
> down, and only power it on when the user brings up the interface.
>
Agreed.
> Whenever the chip is powered on, it must be initialized and
> reconfigured by mmc_attach_sdio, and the wl1271 driver have to wait
> for that phase to successfully complete (essentially waiting for the
> sdio_driver's probe function to be called).
>
> To make sure this SDIO init step occurs correctly every time we toggle
> the device's power back on, and to prevent potential races, we also
> have to make sure that the sdio function is removed every time we
> power off the chip (the driver waits for the sdio_driver's remove
> function to be called).
>
> That's why we let the mmc layer think that the card is removed:
> physically it is still there, but for all practical purposes it is
> really removed, because once you power off the chip, you must
> reinitialize it again next time you power it on, as if the card was
> really removed and re-inserted.
>
My point is that shouldn't this be handled by SDIO core?
If there are no users for the SDIO function and the card, doesn't the SDIO core
power down the slot, and take care of re-initialization when it is powered up?
^ permalink raw reply
* Re: [PATCH 05/15] omap: hsmmc: add virtual card detect support
From: Roger Quadros @ 2010-07-06 11:02 UTC (permalink / raw)
To: ext Ohad Ben-Cohen
Cc: Nicolas Pitre, linux-wireless@vger.kernel.org,
linux-mmc@vger.kernel.org, linux-omap@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux@arm.linux.org.uk,
Chikkature Rajashekar Madhusudhan,
Coelho Luciano (Nokia-MS/Helsinki), Andrew Morton, San Mehat,
Pandita, Vikram
In-Reply-To: <AANLkTim4E4LlFERmfYA1M0HLBOoRAsQuvdW6QBNu6pC0@mail.gmail.com>
On 07/06/2010 01:22 PM, ext Ohad Ben-Cohen wrote:
> Hi Nicolas,
>
> On Tue, Jul 6, 2010 at 4:45 AM, Nicolas Pitre<nico@fluxnic.net> wrote:
>> 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.
>
> We prefer not to power up the chip as early as boot time; instead, we
Why? if the card is hard wired with no card detect then it should be powered up.
The function driver should power it down later if required. no?
> would like to have it powered off until the wlan interface is brought
> up, power it on when the interface is brought up,
If it was powered OFF then how did the wlan interface come into picture?
> and power it off again as soon as the interface is brought down again
> (to minimize power consumption when the wlan is not in use).
I agree, we some how need to power down the card when not in use in the right way.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox