All of lore.kernel.org
 help / color / mirror / Atom feed
From: Troy Kisky <troy.kisky@boundarydevices.com>
To: Ido Yariv <ido@wizery.com>
Cc: Sekhar Nori <nsekhar@ti.com>,
	davinci-linux-open-source@linux.davincidsp.com,
	linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org
Subject: Re: [PATCH v3] davinci: Add wl1271/wlan support for AM18x
Date: Thu, 28 Jul 2011 14:15:41 -0700	[thread overview]
Message-ID: <4E31D17D.6050000@boundarydevices.com> (raw)
In-Reply-To: <1311886373-3060-1-git-send-email-ido@wizery.com>

On 7/28/2011 1:52 PM, Ido Yariv wrote:
> The wl1271 daughter card for AM18x EVMs is a combo wireless connectivity
> add-on card, based on the LS Research TiWi module with Texas
> Instruments' wl1271 solution.
> It is a 4-wire, 1.8V, embedded SDIO WLAN device with an external IRQ
> line and is power-controlled by a GPIO-based fixed regulator.
> 
> Add support for the WLAN capabilities of this expansion board.
> 
> Signed-off-by: Ido Yariv <ido@wizery.com>
> ---
>  arch/arm/mach-davinci/Kconfig           |   10 +++
>  arch/arm/mach-davinci/board-da850-evm.c |  114 +++++++++++++++++++++++++++++++
>  2 files changed, 124 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
> index c0deaca..32d837d 100644
> --- a/arch/arm/mach-davinci/Kconfig
> +++ b/arch/arm/mach-davinci/Kconfig
> @@ -192,6 +192,16 @@ config DA850_UI_RMII
>  
>  endchoice
>  
> +config DA850_WL12XX
> +	bool "AM18x wl1271 daughter board"
> +	depends on MACH_DAVINCI_DA850_EVM
> +	help
> +	  The wl1271 daughter card for AM18x EVMs is a combo wireless
> +	  connectivity add-on card, based on the LS Research TiWi module with
> +	  Texas Instruments' wl1271 solution.
> +	  Say Y if you want to use a wl1271 expansion card connected to the
> +	  AM18x EVM.
> +
>  config GPIO_PCA953X
>  	default MACH_DAVINCI_DA850_EVM
>  
> diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
> index bd53945..d817626 100644
> --- a/arch/arm/mach-davinci/board-da850-evm.c
> +++ b/arch/arm/mach-davinci/board-da850-evm.c
> @@ -31,6 +31,8 @@
>  #include <linux/input/tps6507x-ts.h>
>  #include <linux/spi/spi.h>
>  #include <linux/spi/flash.h>
> +#include <linux/delay.h>
> +#include <linux/wl12xx.h>
>  
>  #include <asm/mach-types.h>
>  #include <asm/mach/arch.h>
> @@ -49,6 +51,9 @@
>  #define DA850_MMCSD_CD_PIN		GPIO_TO_PIN(4, 0)
>  #define DA850_MMCSD_WP_PIN		GPIO_TO_PIN(4, 1)
>  
> +#define DA850_WLAN_EN			GPIO_TO_PIN(6, 9)
> +#define DA850_WLAN_IRQ			GPIO_TO_PIN(6, 10)
> +
>  #define DA850_MII_MDIO_CLKEN_PIN	GPIO_TO_PIN(2, 6)
>  
>  static struct mtd_partition da850evm_spiflash_part[] = {
> @@ -1117,6 +1122,110 @@ static __init int da850_evm_init_cpufreq(void)
>  static __init int da850_evm_init_cpufreq(void) { return 0; }
>  #endif
>  
> +#ifdef CONFIG_DA850_WL12XX
> +
> +static void wl12xx_set_power(int index, bool power_on)
> +{
> +	static bool power_state;
> +
> +	pr_debug("Powering %s wl12xx", power_on ? "on" : "off");
> +
> +	if (power_on == power_state)
> +		return;
> +	power_state = power_on;
> +
> +	if (power_on) {
> +		/* Power up sequence required for wl127x devices */
> +		gpio_set_value(DA850_WLAN_EN, 1);
> +		usleep_range(15000, 15000);
> +		gpio_set_value(DA850_WLAN_EN, 0);
> +		usleep_range(1000, 1000);
> +		gpio_set_value(DA850_WLAN_EN, 1);
> +		msleep(70);


Why turn on, then off, and then back on?
Isn't off, then back on sufficient?

Also, why not use regulator API like panda board does?
>From board-omap4panda.c, we have
_________________________________________
static struct regulator_consumer_supply omap4_panda_vmmc5_supply = {
        .supply = "vmmc",
        .dev_name = "omap_hsmmc.4",
};

static struct regulator_init_data panda_vmmc5 = {
        .constraints = {
                .valid_ops_mask = REGULATOR_CHANGE_STATUS,
        },
        .num_consumer_supplies = 1,
        .consumer_supplies = &omap4_panda_vmmc5_supply,
};

static struct fixed_voltage_config panda_vwlan = {
        .supply_name = "vwl1271",
        .microvolts = 1800000, /* 1.8V */
        .gpio = GPIO_WIFI_PMENA,
        .startup_delay = 70000, /* 70msec */
        .enable_high = 1,
        .enabled_at_boot = 0,
        .init_data = &panda_vmmc5,
};

static struct platform_device omap_vwlan_device = {
        .name           = "reg-fixed-voltage",
        .id             = 1,
        .dev = {
                .platform_data = &panda_vwlan,
        },
};
_________________________________________

If this can't work for you, can you list why in the change log.

If your mmc controller doesn't yet support vmmc control. It should
be very easy to add it first.

Thanks.


> +	} else {
> +		gpio_set_value(DA850_WLAN_EN, 0);
> +	}
> +}
> +
> +static struct davinci_mmc_config da850_wl12xx_mmc_config = {
> +	.set_power	= wl12xx_set_power,
> +	.wires		= 4,
> +	.max_freq	= 25000000,
> +	.caps		= MMC_CAP_4_BIT_DATA | MMC_CAP_NONREMOVABLE |
> +			  MMC_CAP_POWER_OFF_CARD,
> +	.version	= MMC_CTLR_VERSION_2,
> +};
> +
> +static const short da850_wl12xx_pins[] __initconst = {
> +	DA850_MMCSD1_DAT_0, DA850_MMCSD1_DAT_1, DA850_MMCSD1_DAT_2,
> +	DA850_MMCSD1_DAT_3, DA850_MMCSD1_CLK, DA850_MMCSD1_CMD,
> +	DA850_GPIO6_9, DA850_GPIO6_10,
> +	-1
> +};
> +
> +static struct wl12xx_platform_data da850_wl12xx_wlan_data __initdata = {
> +	.irq			= -1,
> +	.board_ref_clock	= WL12XX_REFCLOCK_38,
> +	.platform_quirks	= WL12XX_PLATFORM_QUIRK_EDGE_IRQ,
> +};
> +
> +static __init int da850_wl12xx_init(void)
> +{
> +	int ret;
> +
> +	ret = davinci_cfg_reg_list(da850_wl12xx_pins);
> +	if (ret) {
> +		pr_err("wl12xx/mmc mux setup failed: %d\n", ret);
> +		goto exit;
> +	}
> +
> +	ret = da850_register_mmcsd1(&da850_wl12xx_mmc_config);
> +	if (ret) {
> +		pr_err("wl12xx/mmc registration failed: %d\n", ret);
> +		goto exit;
> +	}
> +
> +	ret = gpio_request_one(DA850_WLAN_EN, GPIOF_OUT_INIT_LOW, "wl12xx_en");
> +	if (ret) {
> +		pr_err("Could not request wl12xx enable gpio: %d\n", ret);
> +		goto exit;
> +	}
> +
> +	ret = gpio_request_one(DA850_WLAN_IRQ, GPIOF_IN, "wl12xx_irq");
> +	if (ret) {
> +		pr_err("Could not request wl12xx irq gpio: %d\n", ret);
> +		goto free_wlan_en;
> +	}
> +
> +	da850_wl12xx_wlan_data.irq = gpio_to_irq(DA850_WLAN_IRQ);
> +
> +	ret = wl12xx_set_platform_data(&da850_wl12xx_wlan_data);
> +	if (ret) {
> +		pr_err("Could not set wl12xx data: %d\n", ret);
> +		goto free_wlan_irq;
> +	}
> +
> +	return 0;
> +
> +free_wlan_irq:
> +	gpio_free(DA850_WLAN_IRQ);
> +
> +free_wlan_en:
> +	gpio_free(DA850_WLAN_EN);
> +
> +exit:
> +	return ret;
> +}
> +
> +#else /* CONFIG_DA850_WL12XX */
> +
> +static __init int da850_wl12xx_init(void)
> +{
> +	return 0;
> +}
> +
> +#endif /* CONFIG_DA850_WL12XX */
> +
>  #define DA850EVM_SATA_REFCLKPN_RATE	(100 * 1000 * 1000)
>  
>  static __init void da850_evm_init(void)
> @@ -1171,6 +1280,11 @@ static __init void da850_evm_init(void)
>  		if (ret)
>  			pr_warning("da850_evm_init: mmcsd0 registration failed:"
>  					" %d\n", ret);
> +
> +		ret = da850_wl12xx_init();
> +		if (ret)
> +			pr_warning("da850_evm_init: wl12xx initialization"
> +				   " failed: %d\n", ret);
>  	}
>  
>  	davinci_serial_init(&da850_evm_uart_config);


WARNING: multiple messages have this Message-ID (diff)
From: troy.kisky@boundarydevices.com (Troy Kisky)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3] davinci: Add wl1271/wlan support for AM18x
Date: Thu, 28 Jul 2011 14:15:41 -0700	[thread overview]
Message-ID: <4E31D17D.6050000@boundarydevices.com> (raw)
In-Reply-To: <1311886373-3060-1-git-send-email-ido@wizery.com>

On 7/28/2011 1:52 PM, Ido Yariv wrote:
> The wl1271 daughter card for AM18x EVMs is a combo wireless connectivity
> add-on card, based on the LS Research TiWi module with Texas
> Instruments' wl1271 solution.
> It is a 4-wire, 1.8V, embedded SDIO WLAN device with an external IRQ
> line and is power-controlled by a GPIO-based fixed regulator.
> 
> Add support for the WLAN capabilities of this expansion board.
> 
> Signed-off-by: Ido Yariv <ido@wizery.com>
> ---
>  arch/arm/mach-davinci/Kconfig           |   10 +++
>  arch/arm/mach-davinci/board-da850-evm.c |  114 +++++++++++++++++++++++++++++++
>  2 files changed, 124 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
> index c0deaca..32d837d 100644
> --- a/arch/arm/mach-davinci/Kconfig
> +++ b/arch/arm/mach-davinci/Kconfig
> @@ -192,6 +192,16 @@ config DA850_UI_RMII
>  
>  endchoice
>  
> +config DA850_WL12XX
> +	bool "AM18x wl1271 daughter board"
> +	depends on MACH_DAVINCI_DA850_EVM
> +	help
> +	  The wl1271 daughter card for AM18x EVMs is a combo wireless
> +	  connectivity add-on card, based on the LS Research TiWi module with
> +	  Texas Instruments' wl1271 solution.
> +	  Say Y if you want to use a wl1271 expansion card connected to the
> +	  AM18x EVM.
> +
>  config GPIO_PCA953X
>  	default MACH_DAVINCI_DA850_EVM
>  
> diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
> index bd53945..d817626 100644
> --- a/arch/arm/mach-davinci/board-da850-evm.c
> +++ b/arch/arm/mach-davinci/board-da850-evm.c
> @@ -31,6 +31,8 @@
>  #include <linux/input/tps6507x-ts.h>
>  #include <linux/spi/spi.h>
>  #include <linux/spi/flash.h>
> +#include <linux/delay.h>
> +#include <linux/wl12xx.h>
>  
>  #include <asm/mach-types.h>
>  #include <asm/mach/arch.h>
> @@ -49,6 +51,9 @@
>  #define DA850_MMCSD_CD_PIN		GPIO_TO_PIN(4, 0)
>  #define DA850_MMCSD_WP_PIN		GPIO_TO_PIN(4, 1)
>  
> +#define DA850_WLAN_EN			GPIO_TO_PIN(6, 9)
> +#define DA850_WLAN_IRQ			GPIO_TO_PIN(6, 10)
> +
>  #define DA850_MII_MDIO_CLKEN_PIN	GPIO_TO_PIN(2, 6)
>  
>  static struct mtd_partition da850evm_spiflash_part[] = {
> @@ -1117,6 +1122,110 @@ static __init int da850_evm_init_cpufreq(void)
>  static __init int da850_evm_init_cpufreq(void) { return 0; }
>  #endif
>  
> +#ifdef CONFIG_DA850_WL12XX
> +
> +static void wl12xx_set_power(int index, bool power_on)
> +{
> +	static bool power_state;
> +
> +	pr_debug("Powering %s wl12xx", power_on ? "on" : "off");
> +
> +	if (power_on == power_state)
> +		return;
> +	power_state = power_on;
> +
> +	if (power_on) {
> +		/* Power up sequence required for wl127x devices */
> +		gpio_set_value(DA850_WLAN_EN, 1);
> +		usleep_range(15000, 15000);
> +		gpio_set_value(DA850_WLAN_EN, 0);
> +		usleep_range(1000, 1000);
> +		gpio_set_value(DA850_WLAN_EN, 1);
> +		msleep(70);


Why turn on, then off, and then back on?
Isn't off, then back on sufficient?

Also, why not use regulator API like panda board does?

  reply	other threads:[~2011-07-28 21:15 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-10 13:14 [PATCH v2 0/6] arm: davinci: DA850: wl12xx expansion card Ido Yariv
2011-07-10 13:14 ` Ido Yariv
2011-07-10 13:14 ` [PATCH v2 1/6] arm: davinci: Fix low level gpio irq handlers' argument Ido Yariv
2011-07-10 13:14   ` Ido Yariv
2011-07-11 11:58   ` Nori, Sekhar
2011-07-11 11:58     ` Nori, Sekhar
2011-07-11 20:33     ` Ido Yariv
2011-07-11 20:33       ` Ido Yariv
2011-07-11 21:03     ` [PATCH v3 " Ido Yariv
2011-07-11 21:03       ` Ido Yariv
2011-07-12  9:22       ` Nori, Sekhar
2011-07-12  9:22         ` Nori, Sekhar
2011-07-12 22:19         ` Ido Yariv
2011-07-12 22:19           ` Ido Yariv
2011-07-10 13:14 ` [PATCH v2 2/6] arm: davinci: Explicitly set channel controllers' default queues Ido Yariv
2011-07-10 13:14   ` Ido Yariv
2011-07-25 13:15   ` Nori, Sekhar
2011-07-25 13:15     ` Nori, Sekhar
2011-07-25 13:33     ` Sergei Shtylyov
2011-07-25 13:33       ` Sergei Shtylyov
2011-07-25 16:31       ` Nori, Sekhar
2011-07-25 16:31         ` Nori, Sekhar
2011-07-29 14:42         ` Ben Gardiner
2011-07-29 14:42           ` Ben Gardiner
2011-07-10 13:14 ` [PATCH v2 3/6] arm: davinci: mmc: Add support for set_power callback Ido Yariv
2011-07-10 13:14   ` Ido Yariv
2011-07-25 13:19   ` Nori, Sekhar
2011-07-25 13:19     ` Nori, Sekhar
2011-07-28 20:49     ` [PATCH REPOST v2] mmc: davinci: " Ido Yariv
2011-07-28 20:49       ` Ido Yariv
2011-07-28 22:02       ` Chris Ball
2011-07-28 22:02         ` Chris Ball
2011-07-10 13:14 ` [PATCH v2 4/6] arm: davinci: DA850: Add MMC/SD1 pinmux configuration Ido Yariv
2011-07-10 13:14   ` Ido Yariv
2011-07-10 13:14 ` [PATCH v2 5/6] arm: davinci: DA850: Add GPIO pinmux configuration for wl1271 Ido Yariv
2011-07-10 13:14   ` Ido Yariv
2011-07-25 13:23   ` Nori, Sekhar
2011-07-25 13:23   ` Nori, Sekhar
2011-07-10 13:14 ` [PATCH v2 6/6] arm: davinci: DA850: Add wl1271/wlan support Ido Yariv
2011-07-10 13:14   ` Ido Yariv
2011-07-25 17:40   ` Nori, Sekhar
2011-07-25 17:40   ` Nori, Sekhar
2011-07-28 18:34     ` Ido Yariv
2011-07-28 18:34       ` Ido Yariv
2011-08-22  7:37       ` Harishkumar V
2011-07-28 20:52     ` [PATCH v3] davinci: Add wl1271/wlan support for AM18x Ido Yariv
2011-07-28 20:52       ` Ido Yariv
2011-07-28 21:15       ` Troy Kisky [this message]
2011-07-28 21:15         ` Troy Kisky
2011-07-28 22:06         ` Ido Yariv
2011-07-28 22:06           ` Ido Yariv
2011-07-29 18:51           ` Troy Kisky
2011-07-29 18:51             ` Troy Kisky
2011-08-03 13:27       ` Nori, Sekhar
2011-08-04  7:51         ` [PATCH v4] ARM: davinci: AM18x: Add wl1271/wlan support Ido Yariv
2011-08-04  7:51           ` Ido Yariv
2011-08-04  8:40           ` Jaya Kumar
2011-08-04  8:40             ` Jaya Kumar
2011-08-04  9:22             ` Ido Yariv
2011-08-04  9:22               ` Ido Yariv
2011-09-01 11:59           ` Nori, Sekhar
2011-09-01 11:59             ` Nori, Sekhar

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=4E31D17D.6050000@boundarydevices.com \
    --to=troy.kisky@boundarydevices.com \
    --cc=davinci-linux-open-source@linux.davincidsp.com \
    --cc=ido@wizery.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=nsekhar@ti.com \
    /path/to/YOUR_REPLY

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

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.