linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* htc dream wl1251 and MSM_GPIO_TO_INT(29)
@ 2011-01-14 23:33 Denis 'GNUtoo' Carikli
  2011-01-17 15:08 ` Bob Copeland
  0 siblings, 1 reply; 3+ messages in thread
From: Denis 'GNUtoo' Carikli @ 2011-01-14 23:33 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Grazvydas Ignotas, linux-wireless, Bob Copeland

hi,
In the TI driver available here:
http://android.git.kernel.org/?p=platform/system/wlan/ti.git;a=blob;f=sta_dk_4_0_4_32/pform/linux/src/esta_drv.c;h=a968e20bebf6c22f9983d0a6db50b40f04f1f1e8;hb=refs/heads/froyo
there is:
#define TROUT_IRQ MSM_GPIO_TO_INT(29)
[...]
if (drv->irq)
    [...]
    if ((rc = request_irq (drv->irq, (irq_handler_t)tiwlan_interrupt,
IRQF_SHARED | IRQF_TRIGGER_FALLING /*Dm:*/, drv->netdev->name,
drv))){//error message}
    [...]
    set_irq_type (drv->irq, IRQ_TYPE_EDGE_FALLING);
    [...]
    disable_irq (drv->irq);

So we learn several things here:
*it uses MSM_GPIO_TO_INT(29)
*the irq configuration.

So I took the 2.6.32 kernel version available here:
http://gitorious.org/htc-msm-2-6-32/leviathan-incoming/commits/android-msm-2.6.32-rebase

I also took an old compat-wireless driver(because more recent ones have
the runtime PM capability and I don't know how to make it work with an
old 2.6.32 kernel that lacks such patches)
The version is this one compat-wireless-2010-10-04

I modified both the kernel and compat wireless to be able to pass the
wl12xx struct directly, like in recent kernels, and it seem to work.

The problem is the following:
When I do that:
modprobe msm_wifi, wich is the old wifi activator from bob copeland
available here:
http://bobcopeland.com/srcs/android/msm_wifi.patch

it freeze the phone, and watch -n 0.1 cat /proc/interupts trough ssh
seem frozen too

Here's the code for passing the data :

static void trout_wl1251_init(void)
{
        struct wl12xx_platform_data trout_wl1251_pdata;
        int ret;

        trout_wl1251_pdata.irq = MSM_GPIO_TO_INT(29);
        if (trout_wl1251_pdata.irq < 0)
                goto fail_irq;
        trout_wl1251_pdata.use_eeprom = false;
        ret = wl12xx_set_platform_data(&trout_wl1251_pdata);
        if (ret < 0)
                goto fail_irq;
fail_irq:
        printk("trout wifi GPIO failed\n");
        gpio_free(TROUT_WIFI_IRQ_GPIO);

}

The data is beeing passed(else it wouldn't freesze) and the phone
freezes.

note that the compat wireless irq handling code is different from the ti
driver:
if (wl->irq) {
    ret = request_irq(wl->irq, wl1251_line_irq, 0, "wl1251", wl);
    if (ret < 0) {
        wl1251_error("request_irq() failed: %d", ret);
                goto disable;
    }

     set_irq_type(wl->irq, IRQ_TYPE_EDGE_RISING);
     disable_irq(wl->irq);

     wl1251_sdio_ops.enable_irq = wl1251_enable_line_irq;
     wl1251_sdio_ops.disable_irq = wl1251_disable_line_irq;

     wl1251_info("using dedicated interrupt line");
}

in the TI driver there is IRQ_TYPE_EDGE_FALLING while here there is
IRQ_TYPE_EDGE_RISING.

How should I start debugging that issue? do I need a serial cable for my
device and kgdb(doesn't serial need IRQ?, maybe I should look how msm
serial works)?

Denis.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: htc dream wl1251 and MSM_GPIO_TO_INT(29)
  2011-01-14 23:33 htc dream wl1251 and MSM_GPIO_TO_INT(29) Denis 'GNUtoo' Carikli
@ 2011-01-17 15:08 ` Bob Copeland
  2011-01-20 12:55   ` Denis 'GNUtoo' Carikli
  0 siblings, 1 reply; 3+ messages in thread
From: Bob Copeland @ 2011-01-17 15:08 UTC (permalink / raw)
  To: Denis 'GNUtoo' Carikli
  Cc: Kalle Valo, Grazvydas Ignotas, linux-wireless

On Sat, Jan 15, 2011 at 12:33:13AM +0100, Denis 'GNUtoo' Carikli wrote:
> The problem is the following:
> When I do that:
> modprobe msm_wifi, wich is the old wifi activator from bob copeland
> available here:
> http://bobcopeland.com/srcs/android/msm_wifi.patch
> 
> it freeze the phone, and watch -n 0.1 cat /proc/interupts trough ssh
> seem frozen too
> 
> Here's the code for passing the data :
> 
> static void trout_wl1251_init(void)
> {
>         struct wl12xx_platform_data trout_wl1251_pdata;
>         int ret;
> 
>         trout_wl1251_pdata.irq = MSM_GPIO_TO_INT(29);
>         if (trout_wl1251_pdata.irq < 0)
>                 goto fail_irq;

This can't ever be true, right?

>         trout_wl1251_pdata.use_eeprom = false;
>         ret = wl12xx_set_platform_data(&trout_wl1251_pdata);
>         if (ret < 0)
>                 goto fail_irq;

More often one uses "if (ret)" unless ret > 0 has special meaning.

> fail_irq:
>         printk("trout wifi GPIO failed\n");
>         gpio_free(TROUT_WIFI_IRQ_GPIO);

But you always free a gpio here, shouldn't there be a return in there
before the fail_irq label?

> }
>

> How should I start debugging that issue? do I need a serial cable for my
> device and kgdb(doesn't serial need IRQ?, maybe I should look how msm
> serial works)?

It could be an interrupt storm, but check the above code, and
also make sure you still have the dummy msm_wifi platform device too, and
that the msm_wifi driver is getting a struct wifi_platform_data.

Unfortunately, I don't know of an easy way to debug livelocks due to
interrupt storms other than by disabling everything and then enabling one
thing at a time until it breaks again.

It's obviously going to be a lot of work, but if you can manage to get
a current kernel booting on your hardware and dump the msm_wifi module,
that would be the ideal approach.

-- 
Bob Copeland %% www.bobcopeland.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: htc dream wl1251 and MSM_GPIO_TO_INT(29)
  2011-01-17 15:08 ` Bob Copeland
@ 2011-01-20 12:55   ` Denis 'GNUtoo' Carikli
  0 siblings, 0 replies; 3+ messages in thread
From: Denis 'GNUtoo' Carikli @ 2011-01-20 12:55 UTC (permalink / raw)
  To: Bob Copeland; +Cc: Kalle Valo, Grazvydas Ignotas, linux-wireless

> > fail_irq:
> >         printk("trout wifi GPIO failed\n");
> >         gpio_free(TROUT_WIFI_IRQ_GPIO);
> 
> But you always free a gpio here, shouldn't there be a return in there
> before the fail_irq label?
I forgot the return, I wrote/copied(from omap3-pandora ) the code when I
was tired,I shouldn't write code when I'm that tired.

> also make sure you still have the dummy msm_wifi platform device too,
yes I have it

>  and
> that the msm_wifi driver is getting a struct wifi_platform_data.
it seem to get it

> Unfortunately, I don't know of an easy way to debug livelocks due to
> interrupt storms other than by disabling everything and then enabling one
> thing at a time until it breaks again.
> 
> It's obviously going to be a lot of work, but if you can manage to get
> a current kernel booting on your hardware and dump the msm_wifi module,
> that would be the ideal approach.
I've an old linux-next kernel booting but with no way to control the
phone, fortunately the gadget driver was merged in linux-next recently.
I'll try to resolve some compilation issues and to make it work first.

Denis.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-01-20 12:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-14 23:33 htc dream wl1251 and MSM_GPIO_TO_INT(29) Denis 'GNUtoo' Carikli
2011-01-17 15:08 ` Bob Copeland
2011-01-20 12:55   ` Denis 'GNUtoo' Carikli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).