From: Denis 'GNUtoo' Carikli <GNUtoo@no-log.org>
To: Grazvydas Ignotas <notasas@gmail.com>
Cc: Bob Copeland <me@bobcopeland.com>, Kalle Valo <kvalo@adurom.com>,
"John W.Linville" <linville@tuxdriver.com>,
linux-wireless@vger.kernel.org
Subject: Re: [PATCH 2/2] wl1251: fix ELP_CTRL register reads
Date: Fri, 25 Jun 2010 01:09:00 +0200 [thread overview]
Message-ID: <1277420940.28625.30.camel@gnutoo-laptop> (raw)
In-Reply-To: <1277249607.2233.270.camel@gnutoo-laptop>
[-- Attachment #1: Type: text/plain, Size: 5450 bytes --]
On Wed, 2010-06-23 at 01:33 +0200, Denis 'GNUtoo' Carikli wrote:
> On Tue, 2010-06-22 at 01:48 +0300, Grazvydas Ignotas wrote:
> > >> Probably not relevant to power saving, but:
> > >>
> > >> Are you using the dedicated irq line or sdio interrupt?
> > >> It makes a big difference in overall throughput to use
> > >> the former.
> > > I don't know. what should I grep for?
> >
> > It might actually be related.. Try adding this to your board file to
> > enable GPIO irq:
> >
> > static void wl1251_set_power(bool enable)
> > {
> > }
> >
> > static struct wl12xx_platform_data wl1251_pdata = {
> > .set_power = wl1251_set_power,
> > };
> >
> > static struct platform_device wl1251_data = {
> > .name = "wl1251_data",
> > .id = -1,
> > .dev = {
> > .platform_data = &wl1251_pdata,
> > },
> > };
> >
> > .. then from some init function:
> >
> > // WIFI_IRQ_GPIO is the GPIO number connected to wl1251 irq line
> > wl1251_pdata.irq = gpio_to_irq(WIFI_IRQ_GPIO);
> > platform_device_register(&wl1251_pdata);
> Thanks a lot for the infos,they were really helpfull.
>
> I've applied that patch(as it was not for submitting,just for reading I
> didn't bother sending with git-send-email):
> Index: sources/arch/arm/mach-msm/board-trout.c
> ===================================================================
> --- sources.orig/arch/arm/mach-msm/board-trout.c 2010-06-23
> 00:41:54.601288614 +0200
> +++ sources/arch/arm/mach-msm/board-trout.c 2010-06-23
> 00:43:59.893158944 +0200
> @@ -52,6 +52,7 @@
> #include <asm/mach/mmc.h>
> #include <linux/mmc/sdio_ids.h>
> #include <linux/msm_audio.h>
> +#include <linux/spi/wl12xx.h>
>
> #include "board-trout.h"
>
> @@ -363,6 +364,17 @@
> },
> };
>
> +struct wl12xx_platform_data wl12xx_data = {
> +};
> +
> +static struct platform_device wl12xx = {
> + .name = "wl1251_data",
> + .id = -1,
> + .dev = {
> + .platform_data = &wl12xx_data,
> + },
> +};
> +
> #ifdef CONFIG_HTC_HEADSET
> static void h2w_config_cpld(int route)
> {
> @@ -650,6 +662,7 @@
> &trout_pwr_sink,
> #endif
> &trout_snd,
> + &wl12xx,
> };
>
> extern struct sys_timer msm_timer;
> @@ -745,6 +758,7 @@
>
> static void __init config_gpios(void)
> {
> + wl12xx_data.irq = gpio_to_irq(29);
> config_gpio_table(gpio_table, ARRAY_SIZE(gpio_table));
> config_camera_off_gpios();
> }
> Index: sources/include/linux/spi/wl12xx.h
> ===================================================================
> --- sources.orig/include/linux/spi/wl12xx.h 2010-06-23
> 00:42:03.641283312 +0200
> +++ sources/include/linux/spi/wl12xx.h 2010-06-23 00:42:48.103178185
> +0200
> @@ -26,6 +26,7 @@
>
> struct wl12xx_platform_data {
> void (*set_power)(bool enable);
> + int irq;
> };
>
> #endif
>
> The patch was made from someone in irc and modified by me later.
>
> Then I load the wifi as usual:
> modprobe wl1251_sdio #it doesn't crash
> modprobe msm_wifi
> the modprobe msm_wifi gives the following result:
> [ 1366.500427] wifi probe start
> [ 1366.500457] trout_wifi_power: 1
> [ 1366.927185] trout_wifi_reset: 0
> [ 1367.030944] trout_wifi_set_carddetect: 1
> [ 1367.030975] mmc0: card_present 1
> [ 1367.030975] mmc0: Slot status change detected (0 -> 1)
> [ 1367.031036] wifi probe done
> And then I've an invisible crash/kernel panic which result in the
> machine lockup and then reboot(so it should be a kernel panic).
> Note that I've no serial yet(I think I should really get a serial cable
> for this machine)
>
> msm_wifi comes from here:
> http://bobcopeland.com/srcs/android/msm_wifi.patch
>
> I had already some wifi structures which may have conflicted:
>
> struct wifi_platform_data trout_wifi_control = {
> .set_power = trout_wifi_power,
> .set_reset = trout_wifi_reset,
> .set_carddetect = trout_wifi_set_carddetect,
> #ifdef CONFIG_WIFI_MEM_PREALLOC
> .mem_prealloc = trout_wifi_mem_prealloc,
> #else
> .mem_prealloc = NULL,
> #endif
> };
I've changed that struct to wl12xx_platform_Data and added the irq
int,and I've still the following errors:
[ 541.676849] wl1251: ERROR sdio_writeb failed (-84)
[ 542.006378] mmc0: Command timeout
[ 542.011444] mmc0:0001: error -110 reading SDIO_CCCR_INTx
[ 543.016357] mmc0: Command CRC error
[ 543.016418] mmc0:0001: error -84 reading SDIO_CCCR_INTx
[ 544.026367] mmc0: Command timeout
[ 544.031433] mmc0:0001: error -110 reading SDIO_CCCR_INTx
[ 545.036376] mmc0: Command CRC error
[ 545.036437] mmc0:0001: error -84 reading SDIO_CCCR_INTx
[ 546.066345] mmc0: Command timeout
[ 546.071411] mmc0:0001: error -110 reading SDIO_CCCR_INTx
[ 547.076354] mmc0: Command CRC error
[ 547.076416] mmc0:0001: error -84 reading SDIO_CCCR_INTx
[ 548.106384] mmc0: Command timeout
[ 548.111450] mmc0:0001: error -110 reading SDIO_CCCR_INTx
[ 548.706665] mmc0: Command CRC error
[ 548.706726] wl1251: ERROR sdio_writeb failed (-84)
[ 549.136383] mmc0: Command timeout
[ 549.141479] mmc0:0001: error -110 reading SDIO_CCCR_INTx
[ 549.676635] mmc0: Command CRC error
[ 549.676696] wl1251: ERROR sdio_writeb failed (-84)
[ 550.166381] mmc0: Command timeout
[ 550.171447] mmc0:0001: error -110 reading SDIO_CCCR_INTx
[ 550.676269] wlan0: no IPv6 routers present
[ 551.176361] mmc0: Command CRC error
[ 551.176422] mmc0:0001: error -84 reading SDIO_CCCR_INTx
[ 552.186340] mmc0: Command timeout
The patch is attached.
Denis.
[-- Attachment #2: cleaner_wifi_patch_quilt.patch --]
[-- Type: text/x-patch, Size: 4876 bytes --]
Index: sources/arch/arm/mach-msm/board-trout-wifi.c
===================================================================
--- sources.orig/arch/arm/mach-msm/board-trout-wifi.c 2010-06-24 23:58:13.194099802 +0200
+++ sources/arch/arm/mach-msm/board-trout-wifi.c 2010-06-24 23:58:21.385931197 +0200
@@ -20,7 +20,7 @@
#include <linux/platform_device.h>
#include <linux/vmalloc.h>
#include <linux/err.h>
-#include <linux/wifi_tiwlan.h>
+#include <linux/spi/wl12xx.h>
extern int trout_wifi_set_carddetect(int val);
extern int trout_wifi_power(int on);
@@ -60,7 +60,7 @@
}
#endif
-struct wifi_platform_data trout_wifi_control = {
+struct wl12xx_platform_data trout_wifi_control = {
.set_power = trout_wifi_power,
.set_reset = trout_wifi_reset,
.set_carddetect = trout_wifi_set_carddetect,
Index: sources/arch/arm/mach-msm/board-trout.c
===================================================================
--- sources.orig/arch/arm/mach-msm/board-trout.c 2010-06-24 23:58:13.234055563 +0200
+++ sources/arch/arm/mach-msm/board-trout.c 2010-06-25 00:40:37.324053664 +0200
@@ -66,7 +66,7 @@
#include <mach/htc_headset.h>
#endif
#ifdef CONFIG_WIFI_CONTROL_FUNC
-#include <linux/wifi_tiwlan.h>
+#include <linux/spi/wl12xx.h>
#endif
#include "proc_comm.h"
@@ -80,7 +80,7 @@
#ifdef CONFIG_WIFI_MEM_PREALLOC
extern int trout_init_wifi_mem(void);
#endif
-extern struct wifi_platform_data trout_wifi_control;
+extern struct wl12xx_platform_data trout_wifi_control;
#endif
struct trout_axis_info {
@@ -545,6 +545,28 @@
.ram_console_size = MSM_RAM_CONSOLE_SIZE,
};
+
+static void trout_wl1251_init(void)
+{
+ int ret;
+
+ ret = gpio_request(TROUT_WIFI_IRQ_GPIO, "wl1251 irq");
+ if (ret < 0)
+ goto fail_irq;
+
+ ret = gpio_direction_input(TROUT_WIFI_IRQ_GPIO);
+ if (ret < 0)
+ goto fail_irq;
+
+ trout_wifi_control.irq = gpio_to_irq(TROUT_WIFI_IRQ_GPIO);
+ if (trout_wifi_control.irq < 0)
+ goto fail_irq;
+
+ return;
+
+fail_irq:
+ gpio_free(TROUT_WIFI_IRQ_GPIO);
+}
#ifdef CONFIG_WIFI_CONTROL_FUNC
static struct platform_device trout_wifi = {
.name = "msm_wifi",
@@ -823,6 +845,7 @@
/* SD card door should wake the device */
set_irq_wake(TROUT_GPIO_TO_INT(TROUT_GPIO_SD_DOOR_N), 1);
+ trout_wl1251_init();
}
static struct map_desc trout_io_desc[] __initdata = {
Index: sources/arch/arm/mach-msm/board-trout.h
===================================================================
--- sources.orig/arch/arm/mach-msm/board-trout.h 2010-06-24 23:58:13.294049700 +0200
+++ sources/arch/arm/mach-msm/board-trout.h 2010-06-24 23:58:21.385931197 +0200
@@ -74,6 +74,7 @@
#define TROUT_GPIO_HAPTIC_PWM (28)
#define TROUT_GPIO_PS_HOLD (25)
+#define TROUT_WIFI_IRQ_GPIO (29)
#define TROUT_GPIO_MISC2_BASE (TROUT_GPIO_START + 0x00)
#define TROUT_GPIO_MISC3_BASE (TROUT_GPIO_START + 0x08)
Index: sources/arch/arm/mach-msm/msm_wifi.c
===================================================================
--- sources.orig/arch/arm/mach-msm/msm_wifi.c 2010-06-24 23:58:13.344052459 +0200
+++ sources/arch/arm/mach-msm/msm_wifi.c 2010-06-24 23:58:21.385931197 +0200
@@ -18,12 +18,12 @@
* Copyright (C) 2008 Google Inc
*/
#include <linux/platform_device.h>
-#include <linux/wifi_tiwlan.h>
+#include <linux/spi/wl12xx.h>
static int wifi_probe(struct platform_device *pdev)
{
- struct wifi_platform_data *wifi_ctrl =
- (struct wifi_platform_data *)(pdev->dev.platform_data);
+ struct wl12xx_platform_data *wifi_ctrl =
+ (struct wl12xx_platform_data *)(pdev->dev.platform_data);
printk(KERN_DEBUG "wifi probe start\n");
@@ -43,8 +43,8 @@
static int wifi_remove(struct platform_device *pdev)
{
- struct wifi_platform_data *wifi_ctrl =
- (struct wifi_platform_data *)(pdev->dev.platform_data);
+ struct wl12xx_platform_data *wifi_ctrl =
+ (struct w12xx_platform_data *)(pdev->dev.platform_data);
printk(KERN_DEBUG "wifi remove start\n");
if (!wifi_ctrl)
Index: sources/include/linux/spi/wl12xx.h
===================================================================
--- sources.orig/include/linux/spi/wl12xx.h 2010-06-24 23:58:13.404053597 +0200
+++ sources/include/linux/spi/wl12xx.h 2010-06-24 23:58:21.385931197 +0200
@@ -24,8 +24,19 @@
#ifndef _LINUX_SPI_WL12XX_H
#define _LINUX_SPI_WL12XX_H
+#define WMPA_NUMBER_OF_SECTIONS 3
+#define WMPA_NUMBER_OF_BUFFERS 160
+#define WMPA_SECTION_HEADER 24
+#define WMPA_SECTION_SIZE_0 (WMPA_NUMBER_OF_BUFFERS * 64)
+#define WMPA_SECTION_SIZE_1 (WMPA_NUMBER_OF_BUFFERS * 256)
+#define WMPA_SECTION_SIZE_2 (WMPA_NUMBER_OF_BUFFERS * 2048)
+
struct wl12xx_platform_data {
- void (*set_power)(bool enable);
+ int (*set_power)(bool enable);
+ int (*set_reset)(bool enable);
+ int (*set_carddetect)(bool enable);
+ void *(*mem_prealloc)(int section, unsigned long size);
+ int irq;
};
#endif
next prev parent reply other threads:[~2010-06-24 23:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-04 23:25 [PATCH 1/2] wl1251: fix a memory leak in probe Grazvydas Ignotas
2010-06-04 23:25 ` [PATCH 2/2] wl1251: fix ELP_CTRL register reads Grazvydas Ignotas
2010-06-05 7:04 ` Kalle Valo
2010-06-21 12:46 ` Denis 'GNUtoo' Carikli
2010-06-21 17:54 ` Bob Copeland
2010-06-21 18:45 ` Denis 'GNUtoo' Carikli
2010-06-21 22:48 ` Grazvydas Ignotas
2010-06-22 23:33 ` Denis 'GNUtoo' Carikli
2010-06-24 23:09 ` Denis 'GNUtoo' Carikli [this message]
2010-06-24 23:34 ` Grazvydas Ignotas
2010-06-25 16:01 ` Denis 'GNUtoo' Carikli
2010-06-25 18:06 ` Denis 'GNUtoo' Carikli
2010-06-05 7:00 ` [PATCH 1/2] wl1251: fix a memory leak in probe Kalle Valo
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=1277420940.28625.30.camel@gnutoo-laptop \
--to=gnutoo@no-log.org \
--cc=kvalo@adurom.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=me@bobcopeland.com \
--cc=notasas@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox