Skip to contentSkip to conversation

native support for wl1271 on ZOOM

PATCH Superseded Ohad Ben-Cohen 5 participants 26 messages Aug 10, 2010 – Aug 11, 2010

Subsystems (7)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v3 cover native support for wl1271 on ZOOM

This patch series adds native support for wl1271 on ZOOM.

Changes since v2:
- mmc/sdio power manipulation is removed, and will be posted separately in the shape of mmc/sdio runtime pm.
- the platform device is back, used to deliver board-specific platform data (i.e. irq and ref clock)

Patches are based on linux-next (as of Aug 7th), and tested on ZOOM2.

Please note that I am going to have a very limited email access in the next three weeks, so I might not respond right away.

Thanks,

Ohad Ben-Cohen (9):
wireless: wl1271: make wl12xx.h common to both spi and sdio
wireless: wl1271: support return value for the set power func
wireless: wl1271: add platform driver to get board data
wireless: wl1271: take irq info from private board data
wireless: wl1271: make ref_clock configurable by board
omap: hsmmc: remove unused variable
omap: zoom: add fixed regulator device for wlan
omap: hsmmc: support mmc3 regulator power control
omap: zoom: add mmc3/wl1271 device support

 arch/arm/mach-omap2/board-zoom-peripherals.c |   69 +++++++++++++++
 arch/arm/mach-omap2/hsmmc.c                  |   10 ++-
 drivers/mmc/host/omap_hsmmc.c                |   68 +++++++++++++--
 drivers/net/wireless/wl12xx/wl1251_sdio.c    |    2 +-
 drivers/net/wireless/wl12xx/wl1251_spi.c     |    2 +-
 drivers/net/wireless/wl12xx/wl1271.h         |   15 +++-
 drivers/net/wireless/wl12xx/wl1271_boot.c    |    9 +-
 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    |  120 +++++++++++++++++++++++---
 drivers/net/wireless/wl12xx/wl1271_spi.c     |    8 ++-
 include/linux/spi/wl12xx.h                   |   34 -------
 include/linux/wl12xx.h                       |   35 ++++++++
 14 files changed, 311 insertions(+), 74 deletions(-)
 delete mode 100644 include/linux/spi/wl12xx.h
 create mode 100644 include/linux/wl12xx.h
#1 lore raw

PATCH v3 1/9 wireless: wl1271: make wl12xx.h common to both spi and sdio

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

---
 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
drivers/net/wireless/wl12xx/wl1251_sdio.c +1 -1
index b901b61..a319df1 100644
@@ -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"
drivers/net/wireless/wl12xx/wl1251_spi.c +1 -1
index 27fdfaa..a6faf3e 100644
@@ -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"
drivers/net/wireless/wl12xx/wl1271_spi.c +1 -1
index 4cb99c5..c3fdab7 100644
@@ -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"
include/linux/spi/wl12xx.h deleted +0 -34
deleted file mode 100644
index a223ecb..0000000
@@ -1,34 +0,0 @@
-/*
- * This file is part of wl12xx
- *
- * Copyright (C) 2009 Nokia Corporation
- *
- * Contact: Kalle Valo <[email protected]>
- *
- * 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
include/linux/wl12xx.h new file +34 -0
new file mode 100644
index 0000000..137ac89
@@ -0,0 +1,34 @@
+/*
+ * This file is part of wl12xx
+ *
+ * Copyright (C) 2009 Nokia Corporation
+ *
+ * Contact: Kalle Valo <[email protected]>
+ *
+ * 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
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH v3 2/9 wireless: wl1271: support return value for the set power func

In reply to Ohad Ben-Cohen

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.

---
 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(-)
drivers/net/wireless/wl12xx/wl1271.h +1 -1
index dd3cee6..faa5925 100644
@@ -313,7 +313,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);
drivers/net/wireless/wl12xx/wl1271_io.h +5 -3
index bc806c7..4a5b92c 100644
@@ -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;
 }
 
 
drivers/net/wireless/wl12xx/wl1271_main.c +3 -1
index 9d68f00..e6e0852 100644
@@ -621,7 +621,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);
drivers/net/wireless/wl12xx/wl1271_sdio.c +3 -1
index 7059b5c..c41293a 100644
@@ -152,7 +152,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);
 
@@ -167,6 +167,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 = {
drivers/net/wireless/wl12xx/wl1271_spi.c +3 -1
index c3fdab7..de56d8d 100644
@@ -312,10 +312,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 = {
Signature · 1 line
1.7.0.4
#3 lore raw

PATCH v3 3/9 wireless: wl1271: add platform driver to get board data

In reply to Ohad Ben-Cohen

Dynamically create and register a platform driver, that will be used to to receive board-specific information like irq and reference clock numbers.

The driver is created dynamically in order to avoid the 1-device limitation of a fixed platform driver name.

---
 drivers/net/wireless/wl12xx/wl1271.h      |   12 ++++
 drivers/net/wireless/wl12xx/wl1271_sdio.c |  103 +++++++++++++++++++++++++++--
 2 files changed, 108 insertions(+), 7 deletions(-)
drivers/net/wireless/wl12xx/wl1271.h +12 -0
index faa5925..013eabb 100644
@@ -31,6 +31,7 @@
 #include <linux/list.h>
 #include <linux/bitops.h>
 #include <net/mac80211.h>
+#include <linux/platform_device.h>
 
 #include "wl1271_conf.h"
 #include "wl1271_ini.h"
@@ -319,8 +320,19 @@ struct wl1271_if_operations {
 	void (*disable_irq)(struct wl1271 *wl);
 };
 
+/* exact size needed for "wl1271_plat.x" */
+#define WL12XX_PLAT_NAME_LEN 14
+
+struct wl12xx_plat_instance {
+	struct platform_driver pdriver;
+	char name[WL12XX_PLAT_NAME_LEN];
+	struct wl12xx_platform_data *pdata;
+	struct completion data_ready;
+};
+
 struct wl1271 {
 	struct platform_device *plat_dev;
+	struct wl12xx_plat_instance *pinstance;
 	struct ieee80211_hw *hw;
 	bool mac80211_registered;
 
drivers/net/wireless/wl12xx/wl1271_sdio.c +96 -7

149 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#4 lore raw

PATCH v3 4/9 wireless: wl1271: take irq info from private board data

In reply to Ohad Ben-Cohen

Remove the hard coded irq information, and instead take the irq information from the board's platform data.

---
 drivers/net/wireless/wl12xx/wl1271_sdio.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
drivers/net/wireless/wl12xx/wl1271_sdio.c +9 -9
index 5b43626..b565e64 100644
@@ -38,9 +38,6 @@
 #include "wl12xx_80211.h"
 #include "wl1271_io.h"
 
-
-#define RX71_WL1271_IRQ_GPIO		42
-
 #ifndef SDIO_VENDOR_ID_TI
 #define SDIO_VENDOR_ID_TI		0x0097
 #endif
@@ -191,6 +188,7 @@ static int wl1271_plat_probe(struct platform_device *pdev)
 	struct wl12xx_platform_data *pdata;
 	struct platform_driver *pdriver;
 	struct wl12xx_plat_instance *pinstance;
+	int irq;
 
 	pdata = pdev->dev.platform_data;
 	if (!pdata) {
@@ -198,6 +196,13 @@ static int wl1271_plat_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
+	irq = platform_get_irq(pdev, 0);
+	if (irq < 0) {
+		wl1271_error("no platform irq data");
+		return -ENODEV;
+	}
+	pdata->irq = irq;
+
 	pdriver = container_of(pdev->dev.driver, struct platform_driver,
 								driver);
 	pinstance = container_of(pdriver, struct wl12xx_plat_instance, pdriver);
@@ -290,12 +295,7 @@ static int __devinit wl1271_probe(struct sdio_func *func,
 		goto out_free;
 	}
 
-	wl->irq = gpio_to_irq(RX71_WL1271_IRQ_GPIO);
-	if (wl->irq < 0) {
-		ret = wl->irq;
-		wl1271_error("could not get irq!");
-		goto put_data;
-	}
+	wl->irq = wlan_data->irq;
 
 	ret = request_irq(wl->irq, wl1271_irq, 0, DRIVER_NAME, wl);
 	if (ret < 0) {
Signature · 1 line
1.7.0.4
#5 lore raw

PATCH v3 5/9 wireless: wl1271: make ref_clock configurable by board

In reply to Ohad Ben-Cohen

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.

---
 drivers/net/wireless/wl12xx/wl1271.h      |    1 +
 drivers/net/wireless/wl12xx/wl1271_boot.c |    9 +++++----
 drivers/net/wireless/wl12xx/wl1271_boot.h |    1 -
 drivers/net/wireless/wl12xx/wl1271_sdio.c |    1 +
 drivers/net/wireless/wl12xx/wl1271_spi.c  |    2 ++
 include/linux/wl12xx.h                    |    1 +
 6 files changed, 10 insertions(+), 5 deletions(-)
drivers/net/wireless/wl12xx/wl1271.h +1 -0
index 013eabb..f0988a4 100644
@@ -342,6 +342,7 @@ struct wl1271 {
 
 	void (*set_power)(bool enable);
 	int irq;
+	int ref_clock;
 
 	spinlock_t wl_lock;
 
drivers/net/wireless/wl12xx/wl1271_boot.c +5 -4
index f36430b..95c636a 100644
@@ -457,17 +457,18 @@ 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;
 
-	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);
@@ -516,7 +517,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]);
drivers/net/wireless/wl12xx/wl1271_boot.h +0 -1
index f829699..f73b0b1 100644
@@ -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
 
drivers/net/wireless/wl12xx/wl1271_sdio.c +1 -0
index b565e64..bfb18b6 100644
@@ -296,6 +296,7 @@ static int __devinit wl1271_probe(struct sdio_func *func,
 	}
 
 	wl->irq = wlan_data->irq;
+	wl->ref_clock = wlan_data->board_ref_clock;
 
 	ret = request_irq(wl->irq, wl1271_irq, 0, DRIVER_NAME, wl);
 	if (ret < 0) {
drivers/net/wireless/wl12xx/wl1271_spi.c +2 -0
index de56d8d..ced0a9e 100644
@@ -372,6 +372,8 @@ static int __devinit wl1271_probe(struct spi_device *spi)
 		goto out_free;
 	}
 
+	wl->ref_clock = pdata->board_ref_clock;
+
 	wl->irq = spi->irq;
 	if (wl->irq < 0) {
 		wl1271_error("irq missing in platform data");
include/linux/wl12xx.h +1 -0
index 137ac89..ef6eed9 100644
@@ -29,6 +29,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
Signature · 1 line
1.7.0.4
#6 lore raw

PATCH v3 6/9 omap: hsmmc: remove unused variable

In reply to Ohad Ben-Cohen

Make this go away:

drivers/mmc/host/omap_hsmmc.c: In function 'omap_hsmmc_suspend':
drivers/mmc/host/omap_hsmmc.c:2328: warning: unused variable 'state'

---
 drivers/mmc/host/omap_hsmmc.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/mmc/host/omap_hsmmc.c +0 -1
index b032828..d50e917 100644
@@ -2272,7 +2272,6 @@ static int omap_hsmmc_suspend(struct device *dev)
 	int ret = 0;
 	struct platform_device *pdev = to_platform_device(dev);
 	struct omap_hsmmc_host *host = platform_get_drvdata(pdev);
-	pm_message_t state = PMSG_SUSPEND; /* unused by MMC core */
 
 	if (host && host->suspended)
 		return 0;
Signature · 1 line
1.7.0.4
#7 lore raw

PATCH v3 6/9 omap: hsmmc: remove unused variable

Quoted 4 lines · Ohad Ben-Cohen

Make this go away:

drivers/mmc/host/omap_hsmmc.c: In function 'omap_hsmmc_suspend':
drivers/mmc/host/omap_hsmmc.c:2328: warning: unused variable 'state'

Was done a while ago.

See 1a13f8fa76c880be41d6b1e6a2b44404bcbfdf9e in linus' tree.

Quoted 18 lines
---
 drivers/mmc/host/omap_hsmmc.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/mmc/host/omap_hsmmc.c +0 -1
index b032828..d50e917 100644
@@ -2272,7 +2272,6 @@ static int omap_hsmmc_suspend(struct device *dev)
 	int ret = 0;
 	struct platform_device *pdev = to_platform_device(dev);
 	struct omap_hsmmc_host *host = platform_get_drvdata(pdev);
-	pm_message_t state = PMSG_SUSPEND; /* unused by MMC core */
 
 	if (host && host->suspended)
 		return 0;
#8 lore raw

PATCH v3 6/9 omap: hsmmc: remove unused variable

Quoted 8 lines · Adrian Hunter
Quoted 5 lines · Ohad Ben-Cohen

Make this go away:

drivers/mmc/host/omap_hsmmc.c: In function 'omap_hsmmc_suspend':
drivers/mmc/host/omap_hsmmc.c:2328: warning: unused variable 'state'

Was done a while ago.

Are you sure ?

I can still see the unused state variable in Linus' tree:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=drivers/mmc/host/omap_hsmmc.c;h=b032828c61263028963bd412a7455546d5e86ce7;hb=HEAD#l2275

Quoted 1 line

See 1a13f8fa76c880be41d6b1e6a2b44404bcbfdf9e in linus' tree.

This commit only seem to adapt to the API change (the state variable is not removed):

drivers/mmc/host/omap_hsmmc.c +1 -1
index d25b19b..b032828 100644
@@ -2292,7 +2292,7 @@ static int omap_hsmmc_suspend(struct device *dev)
                }
                cancel_work_sync(&host->mmc_carddetect_work);
                mmc_host_enable(host->mmc);
-               ret = mmc_suspend_host(host->mmc, state);
+               ret = mmc_suspend_host(host->mmc);
                if (ret == 0) {
                        omap_hsmmc_disable_irq(host);
                        OMAP_HSMMC_WRITE(host->base, HCTL,
Quoted 20 lines
Quoted 18 lines

---
?drivers/mmc/host/omap_hsmmc.c | ? ?1 -
?1 files changed, 0 insertions(+), 1 deletions(-)

drivers/mmc/host/omap_hsmmc.c +0 -1
index b032828..d50e917 100644
@@ -2272,7 +2272,6 @@ static int omap_hsmmc_suspend(struct device *dev)
 ? ? ? ?int ret = 0;
 ? ? ? ?struct platform_device *pdev = to_platform_device(dev);
 ? ? ? ?struct omap_hsmmc_host *host = platform_get_drvdata(pdev);
- ? ? ? pm_message_t state = PMSG_SUSPEND; /* unused by MMC core */
 ? ? ? ?if (host && host->suspended)
 ? ? ? ? ? ? ? ?return 0;
#9 lore raw

PATCH v3 6/9 omap: hsmmc: remove unused variable

Quoted 9 lines · Ohad Ben-Cohen
Quoted 6 lines · Adrian Hunter
Quoted 4 lines · Ohad Ben-Cohen

Make this go away:

drivers/mmc/host/omap_hsmmc.c: In function 'omap_hsmmc_suspend':
drivers/mmc/host/omap_hsmmc.c:2328: warning: unused variable 'state'

Was done a while ago.

Are you sure ?

Oops sorry =0_o= It is still there.

Quoted 43 lines

I can still see the unused state variable in Linus' tree:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=drivers/mmc/host/omap_hsmmc.c;h=b032828c61263028963bd412a7455546d5e86ce7;hb=HEAD#l2275

Quoted 1 line

See 1a13f8fa76c880be41d6b1e6a2b44404bcbfdf9e in linus' tree.

This commit only seem to adapt to the API change (the state variable is not removed):

drivers/mmc/host/omap_hsmmc.c +1 -1
index d25b19b..b032828 100644
@@ -2292,7 +2292,7 @@ static int omap_hsmmc_suspend(struct device *dev)
                }
                cancel_work_sync(&host->mmc_carddetect_work);
                mmc_host_enable(host->mmc);
-               ret = mmc_suspend_host(host->mmc, state);
+               ret = mmc_suspend_host(host->mmc);
                if (ret == 0) {
                        omap_hsmmc_disable_irq(host);
                        OMAP_HSMMC_WRITE(host->base, HCTL,
Quoted 18 lines
Quoted 17 lines
---
 drivers/mmc/host/omap_hsmmc.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
drivers/mmc/host/omap_hsmmc.c +0 -1
index b032828..d50e917 100644
@@ -2272,7 +2272,6 @@ static int omap_hsmmc_suspend(struct device *dev)
       int ret = 0;
       struct platform_device *pdev = to_platform_device(dev);
       struct omap_hsmmc_host *host = platform_get_drvdata(pdev);
-       pm_message_t state = PMSG_SUSPEND; /* unused by MMC core */
       if (host && host->suspended)
               return 0;
#10 lore raw

PATCH v3 7/9 omap: zoom: add fixed regulator device for wlan

In reply to Ohad Ben-Cohen

Add a fixed regulator vmmc device to enable power control of the wl1271 wlan device.

---
 arch/arm/mach-omap2/board-zoom-peripherals.c |   35 ++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-zoom-peripherals.c +35 -0
index 6b39849..de88635 100644
@@ -16,6 +16,7 @@
 #include <linux/gpio.h>
 #include <linux/i2c/twl.h>
 #include <linux/regulator/machine.h>
+#include <linux/regulator/fixed.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -27,6 +28,8 @@
 #include "mux.h"
 #include "hsmmc.h"
 
+#define OMAP_ZOOM_WLAN_PMENA_GPIO	(101)
+
 /* Zoom2 has Qwerty keyboard*/
 static int board_keymap[] = {
 	KEY(0, 0, KEY_E),
@@ -106,6 +109,11 @@ static struct regulator_consumer_supply zoom_vmmc2_supply = {
 	.supply		= "vmmc",
 };
 
+static struct regulator_consumer_supply zoom_vmmc3_supply = {
+	.supply		= "vmmc",
+	.dev_name	= "mmci-omap-hs.2",
+};
+
 /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
 static struct regulator_init_data zoom_vmmc1 = {
 	.constraints = {
@@ -151,6 +159,32 @@ static struct regulator_init_data zoom_vsim = {
 	.consumer_supplies      = &zoom_vsim_supply,
 };
 
+static struct regulator_init_data zoom_vmmc3 = {
+	.constraints = {
+		.valid_ops_mask	= REGULATOR_CHANGE_STATUS,
+	},
+	.num_consumer_supplies = 1,
+	.consumer_supplies = &zoom_vmmc3_supply,
+};
+
+static struct fixed_voltage_config zoom_vwlan = {
+	.supply_name = "vwl1271",
+	.microvolts = 1800000, /* 1.8V */
+	.gpio = OMAP_ZOOM_WLAN_PMENA_GPIO,
+	.startup_delay = 70000, /* 70msec */
+	.enable_high = 1,
+	.enabled_at_boot = 0,
+	.init_data = &zoom_vmmc3,
+};
+
+static struct platform_device omap_vwlan_device = {
+	.name		= "reg-fixed-voltage",
+	.id		= 1,
+	.dev = {
+		.platform_data = &zoom_vwlan,
+	},
+};
+
 static struct omap2_hsmmc_info mmc[] __initdata = {
 	{
 		.name		= "external",
@@ -280,6 +314,7 @@ static void enable_board_wakeup_source(void)
 void __init zoom_peripherals_init(void)
 {
 	omap_i2c_init();
+	platform_device_register(&omap_vwlan_device);
 	usb_musb_init(&musb_board_data);
 	enable_board_wakeup_source();
 }
Signature · 1 line
1.7.0.4
#11 lore raw

PATCH v3 8/9 omap: hsmmc: split mmc23 power control

In reply to Ohad Ben-Cohen

Prepare for mmc3 regulator power control by splitting the power control functions of mmc2 and mmc3, and expecting mmc3 to have a single, dedicated, regulator support.

---
 arch/arm/mach-omap2/hsmmc.c   |   10 ++++--
 drivers/mmc/host/omap_hsmmc.c |   67 ++++++++++++++++++++++++++++++++++++----
 2 files changed, 66 insertions(+), 11 deletions(-)
arch/arm/mach-omap2/hsmmc.c +6 -4
index 1ef54b0..5d3d789 100644
@@ -174,7 +174,7 @@ static void omap4_hsmmc1_after_set_reg(struct device *dev, int slot,
 	}
 }
 
-static void hsmmc23_before_set_reg(struct device *dev, int slot,
+static void hsmmc2_before_set_reg(struct device *dev, int slot,
 				   int power_on, int vdd)
 {
 	struct omap_mmc_platform_data *mmc = dev->platform_data;
@@ -325,14 +325,16 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
 				c->transceiver = 1;
 			if (c->transceiver && c->wires > 4)
 				c->wires = 4;
-			/* FALLTHROUGH */
-		case 3:
 			if (mmc->slots[0].features & HSMMC_HAS_PBIAS) {
 				/* off-chip level shifting, or none */
-				mmc->slots[0].before_set_reg = hsmmc23_before_set_reg;
+				mmc->slots[0].before_set_reg = hsmmc2_before_set_reg;
 				mmc->slots[0].after_set_reg = NULL;
 			}
 			break;
+		case 3:
+			mmc->slots[0].before_set_reg = NULL;
+			mmc->slots[0].after_set_reg = NULL;
+			break;
 		default:
 			pr_err("MMC%d configuration not supported!\n", c->mmc);
 			kfree(mmc);
drivers/mmc/host/omap_hsmmc.c +60 -7

105 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#12 lore raw

PATCH v3 8/9 omap: hsmmc: split mmc23 power control

Hi Ohad,

Quoted 61 lines · ext Ohad Ben-Cohen

Prepare for mmc3 regulator power control by splitting the power control functions of mmc2 and mmc3, and expecting mmc3 to have a single, dedicated, regulator support.

---
  arch/arm/mach-omap2/hsmmc.c   |   10 ++++--
  drivers/mmc/host/omap_hsmmc.c |   67 ++++++++++++++++++++++++++++++++++++----
  2 files changed, 66 insertions(+), 11 deletions(-)
arch/arm/mach-omap2/hsmmc.c +6 -4
index 1ef54b0..5d3d789 100644
@@ -174,7 +174,7 @@ static void omap4_hsmmc1_after_set_reg(struct device *dev, int slot,
  	}
  }
 
-static void hsmmc23_before_set_reg(struct device *dev, int slot,
+static void hsmmc2_before_set_reg(struct device *dev, int slot,
  				   int power_on, int vdd)
  {
  	struct omap_mmc_platform_data *mmc = dev->platform_data;
@@ -325,14 +325,16 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
  				c->transceiver = 1;
  			if (c->transceiver&&  c->wires>  4)
  				c->wires = 4;
-			/* FALLTHROUGH */
-		case 3:
  			if (mmc->slots[0].features&  HSMMC_HAS_PBIAS) {
  				/* off-chip level shifting, or none */
-				mmc->slots[0].before_set_reg = hsmmc23_before_set_reg;
+				mmc->slots[0].before_set_reg = hsmmc2_before_set_reg;
  				mmc->slots[0].after_set_reg = NULL;
  			}
  			break;
+		case 3:
+			mmc->slots[0].before_set_reg = NULL;
+			mmc->slots[0].after_set_reg = NULL;
+			break;
  		default:
  			pr_err("MMC%d configuration not supported!\n", c->mmc);
  			kfree(mmc);
drivers/mmc/host/omap_hsmmc.c +2 -1
index d50e917..6f5cea0 100644
@@ -258,7 +258,7 @@ static int omap_hsmmc_1_set_power(struct device *dev, int slot, int power_on,
  	return ret;
  }
 
-static int omap_hsmmc_23_set_power(struct device *dev, int slot, int power_on,
+static int omap_hsmmc_2_set_power(struct device *dev, int slot, int power_on,
  				   int vdd)
  {
  	struct omap_hsmmc_host *host =
@@ -309,6 +309,31 @@ static int omap_hsmmc_23_set_power(struct device *dev, int slot, int power_on,
  	return ret;
  }
 
+static int omap_hsmmc_3_set_power(struct device *dev, int slot, int power_on,

drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_23_set_power(struct device *dev, int slot, int power_on, · line 322

Quoted 10 lines
drivers/mmc/host/omap_hsmmc.c +9 -0
+				   int vdd)
+{
+	struct omap_hsmmc_host *host =
+		platform_get_drvdata(to_platform_device(dev));
+	int ret = 0;
+
+	if (power_on) {
+		ret = mmc_regulator_set_ocr(host->vcc, vdd);
 
+		/* Enable interface voltage rail, if needed */

Why is this needed? In this case interface voltage rail seems to be the same as card supply.

If you notice mmc_regulator_set_ocr code, it is doing the regulator enable, so don't need to enable it again below.

Quoted 4 lines
drivers/mmc/host/omap_hsmmc.c +4 -0
+		if (ret == 0&&  host->vcc) {
+			ret = regulator_enable(host->vcc);
+			if (ret<  0)
+				ret = mmc_regulator_set_ocr(host->vcc, 0);

drivers/mmc/host/omap_hsmmc.c static int omap_hsmmc_23_set_power(struct device *dev, int slot, int power_on, · line 335

Quoted 10 lines
drivers/mmc/host/omap_hsmmc.c +10 -0
+		}
+	} else {
+		if (host->vcc)
+			ret = regulator_disable(host->vcc);
+		if (ret == 0)
+			ret = mmc_regulator_set_ocr(host->vcc, 0);
+	}
+
+	return ret;
+}

All This can be replaced to the following to simply

if (power_on) {
	return mmc_regulator_set_ocr(host->vcc, vdd);
else
	return mmc_regulator_set_ocr(host->vcc, 0);

regards,
-roger

#13 lore raw

PATCH v3 8/9 omap: hsmmc: split mmc23 power control

In reply to Ohad Ben-Cohen
Quoted 3 lines · Ohad Ben-Cohen

Prepare for mmc3 regulator power control by splitting the power control functions of mmc2 and mmc3, and expecting mmc3 to have a single, dedicated, regulator support.

Why? Can't the controller be connected to an eMMC with 2 power supplies? At a glance, it is not obvious why this patch is needed.

Quoted 155 lines
---
 arch/arm/mach-omap2/hsmmc.c   |   10 ++++--
 drivers/mmc/host/omap_hsmmc.c |   67 ++++++++++++++++++++++++++++++++++++----
 2 files changed, 66 insertions(+), 11 deletions(-)
arch/arm/mach-omap2/hsmmc.c +6 -4
index 1ef54b0..5d3d789 100644
@@ -174,7 +174,7 @@ static void omap4_hsmmc1_after_set_reg(struct device *dev, int slot,
 	}
 }
 
-static void hsmmc23_before_set_reg(struct device *dev, int slot,
+static void hsmmc2_before_set_reg(struct device *dev, int slot,
 				   int power_on, int vdd)
 {
 	struct omap_mmc_platform_data *mmc = dev->platform_data;
@@ -325,14 +325,16 @@ void __init omap2_hsmmc_init(struct omap2_hsmmc_info *controllers)
 				c->transceiver = 1;
 			if (c->transceiver && c->wires > 4)
 				c->wires = 4;
-			/* FALLTHROUGH */
-		case 3:
 			if (mmc->slots[0].features & HSMMC_HAS_PBIAS) {
 				/* off-chip level shifting, or none */
-				mmc->slots[0].before_set_reg = hsmmc23_before_set_reg;
+				mmc->slots[0].before_set_reg = hsmmc2_before_set_reg;
 				mmc->slots[0].after_set_reg = NULL;
 			}
 			break;
+		case 3:
+			mmc->slots[0].before_set_reg = NULL;
+			mmc->slots[0].after_set_reg = NULL;
+			break;
 		default:
 			pr_err("MMC%d configuration not supported!\n", c->mmc);
 			kfree(mmc);
drivers/mmc/host/omap_hsmmc.c +60 -7
index d50e917..6f5cea0 100644
@@ -258,7 +258,7 @@ static int omap_hsmmc_1_set_power(struct device *dev, int slot, int power_on,
 	return ret;
 }
 
-static int omap_hsmmc_23_set_power(struct device *dev, int slot, int power_on,
+static int omap_hsmmc_2_set_power(struct device *dev, int slot, int power_on,
 				   int vdd)
 {
 	struct omap_hsmmc_host *host =
@@ -309,6 +309,31 @@ static int omap_hsmmc_23_set_power(struct device *dev, int slot, int power_on,
 	return ret;
 }
 
+static int omap_hsmmc_3_set_power(struct device *dev, int slot, int power_on,
+				   int vdd)
+{
+	struct omap_hsmmc_host *host =
+		platform_get_drvdata(to_platform_device(dev));
+	int ret = 0;
+
+	if (power_on) {
+		ret = mmc_regulator_set_ocr(host->vcc, vdd);
+		/* Enable interface voltage rail, if needed */
+		if (ret == 0 && host->vcc) {
+			ret = regulator_enable(host->vcc);
+			if (ret < 0)
+				ret = mmc_regulator_set_ocr(host->vcc, 0);
+		}
+	} else {
+		if (host->vcc)
+			ret = regulator_disable(host->vcc);
+		if (ret == 0)
+			ret = mmc_regulator_set_ocr(host->vcc, 0);
+	}
+
+	return ret;
+}
+
 static int omap_hsmmc_1_set_sleep(struct device *dev, int slot, int sleep,
 				  int vdd, int cardsleep)
 {
@@ -319,7 +344,7 @@ static int omap_hsmmc_1_set_sleep(struct device *dev, int slot, int sleep,
 	return regulator_set_mode(host->vcc, mode);
 }
 
-static int omap_hsmmc_23_set_sleep(struct device *dev, int slot, int sleep,
+static int omap_hsmmc_2_set_sleep(struct device *dev, int slot, int sleep,
 				   int vdd, int cardsleep)
 {
 	struct omap_hsmmc_host *host =
@@ -358,6 +383,31 @@ static int omap_hsmmc_23_set_sleep(struct device *dev, int slot, int sleep,
 		return regulator_enable(host->vcc_aux);
 }
 
+static int omap_hsmmc_3_set_sleep(struct device *dev, int slot, int sleep,
+				   int vdd, int cardsleep)
+{
+	struct omap_hsmmc_host *host =
+		platform_get_drvdata(to_platform_device(dev));
+	int err = 0;
+
+	/*
+	 * If we don't see a Vcc regulator, assume it's a fixed
+	 * voltage always-on regulator.
+	 */
+	if (!host->vcc)
+		return 0;
+
+	if (cardsleep) {
+		/* VCC can be turned off if card is asleep */
+		if (sleep)
+			err = mmc_regulator_set_ocr(host->vcc, 0);
+		else
+			err = mmc_regulator_set_ocr(host->vcc, vdd);
+	}
+
+	return err;
+}
+
 static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
 {
 	struct regulator *reg;
@@ -370,10 +420,13 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
 		mmc_slot(host).set_sleep = omap_hsmmc_1_set_sleep;
 		break;
 	case OMAP_MMC2_DEVID:
-	case OMAP_MMC3_DEVID:
 		/* Off-chip level shifting, or none */
-		mmc_slot(host).set_power = omap_hsmmc_23_set_power;
-		mmc_slot(host).set_sleep = omap_hsmmc_23_set_sleep;
+		mmc_slot(host).set_power = omap_hsmmc_2_set_power;
+		mmc_slot(host).set_sleep = omap_hsmmc_2_set_sleep;
+		break;
+	case OMAP_MMC3_DEVID:
+		mmc_slot(host).set_power = omap_hsmmc_3_set_power;
+		mmc_slot(host).set_sleep = omap_hsmmc_3_set_sleep;
 		break;
 	default:
 		pr_err("MMC%d configuration not supported!\n", host->id);
@@ -386,9 +439,9 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
 		/*
 		* HACK: until fixed.c regulator is usable,
 		* we don't require a main regulator
-		* for MMC2 or MMC3
+		* for MMC2
 		*/
-		if (host->id == OMAP_MMC1_DEVID) {
+		if (host->id != OMAP_MMC2_DEVID) {
 			ret = PTR_ERR(reg);
 			goto err;
 		}
#14 lore raw

PATCH v3 8/9 omap: hsmmc: split mmc23 power control

Quoted 8 lines · Hunter Adrian (Nokia-MS/Helsinki)
Quoted 3 lines · Ohad Ben-Cohen

Prepare for mmc3 regulator power control by splitting the power control functions of mmc2 and mmc3, and expecting mmc3 to have a single, dedicated, regulator support.

Why? Can't the controller be connected to an eMMC with 2 power supplies? At a glance, it is not obvious why this patch is needed.

I agree with Adrian. This patch is not required at all.

#15 lore raw

PATCH v3 8/9 omap: hsmmc: split mmc23 power control

Quoted 4 lines · Roger Quadros
Quoted 3 lines · Hunter Adrian (Nokia-MS/Helsinki)
Quoted 1 line · Ohad Ben-Cohen
Quoted 9 lines
Quoted 7 lines
Quoted 3 lines

Prepare for mmc3 regulator power control by splitting the power control functions of mmc2 and mmc3, and expecting mmc3 to have a single, dedicated, regulator support.

Why? ?Can't the controller be connected to an eMMC with 2 power supplies? ?At a glance, it is not obvious why this patch is needed.

I agree with Adrian. This patch is not required at all.

Thanks guys, I'll check it out.

I'm about to leave until e/o August and I still have to sort out some stuff, so I might not respond right away, but please send any comments you may still have.

#16 lore raw

PATCH v3 8/9 omap: hsmmc: split mmc23 power control

In reply to Adrian Hunter
Quoted 8 lines · Adrian Hunter
Quoted 4 lines · Ohad Ben-Cohen

Prepare for mmc3 regulator power control by splitting the power control functions of mmc2 and mmc3, and expecting mmc3 to have a single, dedicated, regulator support.

Why? ?Can't the controller be connected to an eMMC with 2 power supplies? ?At a glance, it is not obvious why this patch is needed.

I had ZOOM too much in mind when I did that. Removed now, thanks !

#17 lore raw

PATCH v3 9/9 omap: zoom: add mmc3/wl1271 device support

In reply to Ohad Ben-Cohen

Add MMC3 support on ZOOM, which has the wl1271 device hardwired to.

The wl1271 is a 4-wire, 1.8V, embedded SDIO WLAN device with an external IRQ line, and power-controlled by a GPIO-based fixed regulator.

---
 arch/arm/mach-omap2/board-zoom-peripherals.c |   34 ++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-zoom-peripherals.c +34 -0
index de88635..82776bc 100644
@@ -17,6 +17,8 @@
 #include <linux/i2c/twl.h>
 #include <linux/regulator/machine.h>
 #include <linux/regulator/fixed.h>
+#include <linux/mmc/host.h>
+#include <linux/wl12xx.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -29,6 +31,7 @@
 #include "hsmmc.h"
 
 #define OMAP_ZOOM_WLAN_PMENA_GPIO	(101)
+#define OMAP_ZOOM_WLAN_IRQ_GPIO		(162)
 
 /* Zoom2 has Qwerty keyboard*/
 static int board_keymap[] = {
@@ -185,6 +188,28 @@ static struct platform_device omap_vwlan_device = {
 	},
 };
 
+struct wl12xx_platform_data omap_zoom_wlan_data = {
+	/* ZOOM ref clock is 26 MHz */
+	.board_ref_clock = 1,
+};
+
+static struct resource omap_zoom_wl1271_resources[] = {
+	{
+		.start = OMAP_GPIO_IRQ(OMAP_ZOOM_WLAN_IRQ_GPIO),
+		.end = OMAP_GPIO_IRQ(OMAP_ZOOM_WLAN_IRQ_GPIO),
+		.flags = IORESOURCE_IRQ,
+	}
+};
+static struct platform_device omap_zoom_wl1271 = {
+	.name		= "wl1271_plat.2",
+	.id		= -1,
+	.resource	= omap_zoom_wl1271_resources,
+	.num_resources	= ARRAY_SIZE(omap_zoom_wl1271_resources),
+	.dev = {
+		.platform_data = &omap_zoom_wlan_data,
+	},
+};
+
 static struct omap2_hsmmc_info mmc[] __initdata = {
 	{
 		.name		= "external",
@@ -202,6 +227,14 @@ static struct omap2_hsmmc_info mmc[] __initdata = {
 		.nonremovable	= true,
 		.power_saving	= true,
 	},
+	{
+		.name		= "wl1271",
+		.mmc		= 3,
+		.wires		= 4,
+		.gpio_wp	= -EINVAL,
+		.gpio_cd	= -EINVAL,
+		.ocr_mask	= MMC_VDD_165_195,
+	},
 	{}      /* Terminator */
 };
 
@@ -313,6 +346,7 @@ static void enable_board_wakeup_source(void)
 
 void __init zoom_peripherals_init(void)
 {
+	platform_device_register(&omap_zoom_wl1271);
 	omap_i2c_init();
 	platform_device_register(&omap_vwlan_device);
 	usb_musb_init(&musb_board_data);
Signature · 1 line
1.7.0.4
#18 lore raw

PATCH v3 9/9 omap: zoom: add mmc3/wl1271 device support

Quoted 61 lines · ext Ohad Ben-Cohen

Add MMC3 support on ZOOM, which has the wl1271 device hardwired to.

The wl1271 is a 4-wire, 1.8V, embedded SDIO WLAN device with an external IRQ line, and power-controlled by a GPIO-based fixed regulator.

---
  arch/arm/mach-omap2/board-zoom-peripherals.c |   34 ++++++++++++++++++++++++++
  1 files changed, 34 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-zoom-peripherals.c +25 -0
index de88635..82776bc 100644
@@ -17,6 +17,8 @@
  #include<linux/i2c/twl.h>
  #include<linux/regulator/machine.h>
  #include<linux/regulator/fixed.h>
+#include<linux/mmc/host.h>
+#include<linux/wl12xx.h>
 
  #include<asm/mach-types.h>
  #include<asm/mach/arch.h>
@@ -29,6 +31,7 @@
  #include "hsmmc.h"
 
  #define OMAP_ZOOM_WLAN_PMENA_GPIO	(101)
+#define OMAP_ZOOM_WLAN_IRQ_GPIO		(162)
 
  /* Zoom2 has Qwerty keyboard*/
  static int board_keymap[] = {
@@ -185,6 +188,28 @@ static struct platform_device omap_vwlan_device = {
  	},
  };
 
+struct wl12xx_platform_data omap_zoom_wlan_data = {
+	/* ZOOM ref clock is 26 MHz */
+	.board_ref_clock = 1,
+};
+
+static struct resource omap_zoom_wl1271_resources[] = {
+	{
+		.start = OMAP_GPIO_IRQ(OMAP_ZOOM_WLAN_IRQ_GPIO),
+		.end = OMAP_GPIO_IRQ(OMAP_ZOOM_WLAN_IRQ_GPIO),
+		.flags = IORESOURCE_IRQ,
+	}
+};
+static struct platform_device omap_zoom_wl1271 = {
+	.name		= "wl1271_plat.2",
+	.id		= -1,
+	.resource	= omap_zoom_wl1271_resources,
+	.num_resources	= ARRAY_SIZE(omap_zoom_wl1271_resources),
+	.dev = {
+		.platform_data =&omap_zoom_wlan_data,
+	},
+};
+
  static struct omap2_hsmmc_info mmc[] __initdata = {
  	{
  		.name		= "external",

arch/arm/mach-omap2/board-zoom-peripherals.c static struct omap2_hsmmc_info mmc[] __initdata = { · line 236

Quoted 10 lines
arch/arm/mach-omap2/board-zoom-peripherals.c +7 -0
@@ -202,6 +227,14 @@ static struct omap2_hsmmc_info mmc[] __initdata = {
  		.nonremovable	= true,
  		.power_saving	= true,
  	},
+	{
+		.name		= "wl1271",
+		.mmc		= 3,
+		.wires		= 4,
+		.gpio_wp	= -EINVAL,
+		.gpio_cd	= -EINVAL,
+		.ocr_mask	= MMC_VDD_165_195,

Do we really need to specify ocr_mask here?
It seems to be set in omap_hsmmc_reg_get() by calling mmc_regulator_get_ocrmask().

This should automatically pick the right mask if you have defined the "vmmc" regulator output voltage correctly.

regards,
-roger

#19 lore raw

PATCH v3 9/9 omap: zoom: add mmc3/wl1271 device support

Quoted 76 lines · Roger Quadros
Quoted 61 lines · ext Ohad Ben-Cohen

Add MMC3 support on ZOOM, which has the wl1271 device hardwired to.

The wl1271 is a 4-wire, 1.8V, embedded SDIO WLAN device with an external IRQ line, and power-controlled by a GPIO-based fixed regulator.

---
   arch/arm/mach-omap2/board-zoom-peripherals.c |   34 ++++++++++++++++++++++++++
   1 files changed, 34 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/board-zoom-peripherals.c +25 -0
index de88635..82776bc 100644
@@ -17,6 +17,8 @@
   #include<linux/i2c/twl.h>
   #include<linux/regulator/machine.h>
   #include<linux/regulator/fixed.h>
+#include<linux/mmc/host.h>
+#include<linux/wl12xx.h>
 
   #include<asm/mach-types.h>
   #include<asm/mach/arch.h>
@@ -29,6 +31,7 @@
   #include "hsmmc.h"
 
   #define OMAP_ZOOM_WLAN_PMENA_GPIO	(101)
+#define OMAP_ZOOM_WLAN_IRQ_GPIO		(162)
 
   /* Zoom2 has Qwerty keyboard*/
   static int board_keymap[] = {
@@ -185,6 +188,28 @@ static struct platform_device omap_vwlan_device = {
   	},
   };
 
+struct wl12xx_platform_data omap_zoom_wlan_data = {
+	/* ZOOM ref clock is 26 MHz */
+	.board_ref_clock = 1,
+};
+
+static struct resource omap_zoom_wl1271_resources[] = {
+	{
+		.start = OMAP_GPIO_IRQ(OMAP_ZOOM_WLAN_IRQ_GPIO),
+		.end = OMAP_GPIO_IRQ(OMAP_ZOOM_WLAN_IRQ_GPIO),
+		.flags = IORESOURCE_IRQ,
+	}
+};
+static struct platform_device omap_zoom_wl1271 = {
+	.name		= "wl1271_plat.2",
+	.id		= -1,
+	.resource	= omap_zoom_wl1271_resources,
+	.num_resources	= ARRAY_SIZE(omap_zoom_wl1271_resources),
+	.dev = {
+		.platform_data =&omap_zoom_wlan_data,
+	},
+};
+
   static struct omap2_hsmmc_info mmc[] __initdata = {
   	{
   		.name		= "external",

arch/arm/mach-omap2/board-zoom-peripherals.c static struct omap2_hsmmc_info mmc[] __initdata = { · line 236

Quoted 10 lines
arch/arm/mach-omap2/board-zoom-peripherals.c +7 -0
@@ -202,6 +227,14 @@ static struct omap2_hsmmc_info mmc[] __initdata = {
   		.nonremovable	= true,
   		.power_saving	= true,
   	},
+	{
+		.name		= "wl1271",
+		.mmc		= 3,
+		.wires		= 4,
+		.gpio_wp	= -EINVAL,
+		.gpio_cd	= -EINVAL,
+		.ocr_mask	= MMC_VDD_165_195,

Do we really need to specify ocr_mask here?
It seems to be set in omap_hsmmc_reg_get() by calling mmc_regulator_get_ocrmask().

Quoted 3 lines

This should automatically pick the right mask if you have defined the "vmmc" regulator output voltage correctly.

Also shouldn't .nonremovable be set to true? as this is a non-removable card slot.

regards,
-roger

#20 lore raw

PATCH v3 9/9 omap: zoom: add mmc3/wl1271 device support

Quoted 2 lines · Roger Quadros

Also shouldn't .nonremovable be set to true? as this is a non-removable card slot.

This doesn't seem to have any effect on SDIO, but it can't hurt.

Thanks!

Quoted 4 lines

regards,
-roger

#21 lore raw

PATCH v3 9/9 omap: zoom: add mmc3/wl1271 device support

In reply to Roger Quadros
Quoted 3 lines · Roger Quadros
Quoted 1 line

+ ? ? ? ? ? ? ? .ocr_mask ? ? ? = MMC_VDD_165_195,

Do we really need to specify ocr_mask here?

Removed, thanks!

#22 lore raw

PATCH v3 9/9 omap: zoom: add mmc3/wl1271 device support

Ohad,

Quoted 4 lines · Ohad Ben-Cohen
Quoted 3 lines · Roger Quadros
Quoted 1 line

+ ? ? ? ? ? ? ? .ocr_mask ? ? ? = MMC_VDD_165_195,

Do we really need to specify ocr_mask here?

Since you specified the voltage source is fixed, and if MMC3 has any dedicated regulator as MMC1 & MMC2 you can go with Roger's comments.
If the LDO is fixed voltage source from TWL then since regulator framework supports only adjustable LDO's, I think you can have ocr_mask defined as above in board file.

Regards,
Kishore

Quoted 7 lines

Removed, thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html

#23 lore raw

PATCH v3 9/9 omap: zoom: add mmc3/wl1271 device support

Hi Kishore,

Quoted 3 lines · kishore kadiyala

Since you specified the voltage source is fixed, and if MMC3 has any dedicated regulator as MMC1 & MMC2 you can go with Roger's comments.

You are reading an old batch of the patches.

Scroll down to v4 ;)

Thanks,
Ohad.

Quoted 14 lines

If the LDO is fixed voltage source from TWL then since regulator framework supports only adjustable LDO's, I think you can have ocr_mask defined as above in board file.

Regards,
Kishore

Quoted 7 lines

Removed, thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html

#24 lore raw

PATCH v3 9/9 omap: zoom: add mmc3/wl1271 device support

Oops didn't notice ,,,

Thanks,
Kishore

Quoted 30 lines · Ohad Ben-Cohen

Hi Kishore,

Quoted 3 lines · kishore kadiyala

Since you specified the voltage source is fixed, and if MMC3 has any dedicated regulator as MMC1 & MMC2 you can go with Roger's comments.

You are reading an old batch of the patches.

Scroll down to v4 ;)

Thanks,
Ohad.

Quoted 14 lines

If the LDO is fixed voltage source from TWL then since regulator framework supports only adjustable LDO's, I think you can have ocr_mask defined as above in board file.

Regards,
Kishore

Quoted 7 lines

Removed, thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html

#25 lore raw

PATCH v3 9/9 omap: zoom: add mmc3/wl1271 device support

In reply to kishore kadiyala
Quoted 2 lines · kishore kadiyala

If the LDO is fixed voltage source from TWL then since regulator framework supports only adjustable LDO's, I think you can

The regulator framework supports fixed voltage regulators just fine.