2014-01-22 21:56:40

by Charles

[permalink] [raw]
Subject: wlcore-spi crash

I am building the TI wireless drivers from backports-3.12-1 for a 3.2 kernel.

When I modprobe wlcore-spi I get a kernel crash. Has anyone
encountered this? I found a similar problem here:
http://marc.info/?l=linux-wireless&m=135212370625698&w=2

I tried adding the patch mentioned there to backports-3.12-1, but I
get this build error: "error: 'struct wl1271' has no member named
'set_power'"

Here's the crash:

[ 98.325693] Unable to handle kernel NULL pointer dereference at
virtual address 00000000
[ 98.334171] pgd = c0004000
[ 98.337031] [00000000] *pgd=00000000
[ 98.340791] Internal error: Oops: 80000007 [#1]
[ 98.345524] Modules linked in: wlcore_spi(O) wl12xx(O) wlcore(O)
mac80211(O) cfg80211(O) compat(O) autofs4
[ 98.355661] CPU: 0 Tainted: G O (3.2.0)
[ 98.364120] PC is at 0x0
[ 98.366846] LR is at wl12xx_set_power_on+0x30/0x150 [wlcore]
[ 98.372764] pc : [<00000000>] lr : [<bf0b213c>] psr: 60000013
[ 98.372772] sp : cf445f28 ip : cf445ec8 fp : cf445f44
[ 98.384761] r10: c061c478 r9 : 00000000 r8 : cf6bd500
[ 98.390219] r7 : cf6bdac0 r6 : 00000000 r5 : cf2a4000 r4 : cf411480
[ 98.397039] r3 : 00000000 r2 : cf49bb6c r1 : 00000001 r0 : cf2a4008
[ 98.403861] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM
Segment kernel
[ 98.411500] Control: 10c5387d Table: 8f3dc019 DAC: 00000015
[ 98.417503] Process firmware/ti-con (pid: 1330, stack limit = 0xcf4442f0)
[ 98.424595] Stack: (0xcf445f28 to 0xcf446000)
[ 98.429153] 5f20: c0076214 c0075c0c cf411480
cf2a4000 cf445f94 cf445f48
[ 98.437706] 5f40: bf0b8dc0 bf0b2118 cf2a4150 cf411480 cf445f94
cf445f60 c025c3ec c024e14c
[ 98.446258] 5f60: c061cff0 cf444000 cf445fac cf470140 00000000
c025c5e4 00000013 00000000
[ 98.454809] 5f80: 00000000 00000000 cf445fbc cf445f98 c025c62c
bf0b8ca4 00000001 00000000
[ 98.463362] 5fa0: cf445fbc cf6bd500 cf34db7c cf470140 cf445ff4
cf445fc0 c005554c c025c5f0
[ 98.471913] 5fc0: cf34db7c 00000000 cf470140 00000000 cf445fd0
cf445fd0 00000000 cf34db7c
[ 98.480463] 5fe0: c00554c0 c0040108 00000000 cf445ff8 c0040108
c00554cc 00000000 00000000
[ 98.489002] Backtrace:
[ 98.491616] [<bf0b210c>] (wl12xx_set_power_on+0x0/0x150 [wlcore])
from [<bf0b8dc0>] (wlcore_nvs_cb+0x128/0x944 [wlcore])
[ 98.502974] r5:cf2a4000 r4:cf411480
[ 98.506766] [<bf0b8c98>] (wlcore_nvs_cb+0x0/0x944 [wlcore]) from
[<c025c62c>] (request_firmware_work_func+0x48/0x7c)
[ 98.517787] [<c025c5e4>] (request_firmware_work_func+0x0/0x7c) from
[<c005554c>] (kthread+0x8c/0x94)
[ 98.527326] r5:cf470140 r4:cf34db7c
[ 98.531089] [<c00554c0>] (kthread+0x0/0x94) from [<c0040108>]
(do_exit+0x0/0x66c)
[ 98.538902] r6:c0040108 r5:c00554c0 r4:cf34db7c
[ 98.543743] Code: bad PC value
[ 98.547128] ---[ end trace 9f4a33769e1819b4 ]---


2014-01-30 22:35:06

by Charles

[permalink] [raw]
Subject: Re: wlcore-spi crash

>>>> When I modprobe wlcore-spi I get a kernel crash. Has anyone
>>>> encountered this? I found a similar problem here:
>>>> http://marc.info/?l=linux-wireless&m=135212370625698&w=2
>>>>
>>>> I tried adding the patch mentioned there to backports-3.12-1, but I
>>>> get this build error: "error: 'struct wl1271' has no member named
>>>> 'set_power'"
>>>>
>>>> Here's the crash:
>>>>
>>>> [ 98.325693] Unable to handle kernel NULL pointer dereference at
>>>> virtual address 00000000
>>>> [ 98.334171] pgd = c0004000
>>>> [ 98.337031] [00000000] *pgd=00000000
>>>> [ 98.340791] Internal error: Oops: 80000007 [#1]
>>>> [ 98.345524] Modules linked in: wlcore_spi(O) wl12xx(O) wlcore(O)
>>>> mac80211(O) cfg80211(O) compat(O) autofs4
>>>> [ 98.355661] CPU: 0 Tainted: G O (3.2.0)
>>>> [ 98.364120] PC is at 0x0
>>>> [ 98.366846] LR is at wl12xx_set_power_on+0x30/0x150 [wlcore]
>>>
>>> I think this should help:
>>> http://www.spinics.net/lists/linux-wireless/msg98589.html
>>>
>>
>> As I mentioned above, I get a compile error with that patch: the
>> wl1271 struct doesn't have "set_power".
>
> I got the patch to compile by adding "void (*set_power)(bool enable);"
> to the wl1271 struct in wlcore.h. Now the driver loads without
> crashing, but I get a new error:
>

So my hack was obviously not the right solution, because I'm not
powering the chip. I know that in wlcore\spi.c, I need to set a
.power function in spi_ops (i.e. .power = wl12xx_spi_power). And I
already have a wl12xx_platform_data with a .set_power function defined
in my board platform file. But I don't know how to access my platform
file's set_power function from the wl12xx_spi_power function in spi.c.

In other words, I can' figure out how to do this from wlcore\spi.c:

static int wl12xx_spi_power(struct device *child, bool enable) {

set_power_function_defined_in_my_board_platform_file(enable);

}

2014-01-31 20:26:56

by Luca Coelho

[permalink] [raw]
Subject: Re: wlcore-spi crash

On Fri, 2014-01-31 at 11:25 -0500, Charles wrote:
> Thanks Luca,
>
> >
> > Try this:
> >
> >
> > diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c
> > index b2c018d..1278583 100644
> > --- a/drivers/net/wireless/ti/wlcore/spi.c
> > +++ b/drivers/net/wireless/ti/wlcore/spi.c
> > @@ -316,6 +316,16 @@ static int __must_check wl12xx_spi_raw_write(struct device *child, int addr,
> > return 0;
> > }
> >
> > +static int wl12xx_spi_power(struct device *child, bool enable)
> > +{
> > + struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent);
> > + struct wlcore_platdev_data *pdev_data = glue->core->dev.platform_data;
> > +
> > + pdev_data->pdata->set_power(enable);
> > +
> > + return 0;
> > +}
> > +
> > static struct wl1271_if_operations spi_ops = {
> > .read = wl12xx_spi_raw_read,
> > .write = wl12xx_spi_raw_write,
> >
> > Note that this is only compile-tested, so I have no clue if it really
> > works.
> >
> > I'm *not* saying this is the right way to do it, I just hacked it up
> > quickly.
> >
>
> I know there are not many wl1271 spi users out there, so I'm not sure
> how far down this lonely road I'll head, but we'll see.

Yeah, not many if any at all (besides you). SPI seems to be so broken
that I'm pretty sure nobody else is using it with recent kernels. :(


> Yes this compiles as you say. But wlcore_spi crashes when I load it:
>
> root@sbc:~# modprobe wl12xx
> [ 72.602903] Disabling lock debugging due to kernel taint
> [ 72.616192] Loading modules backported from Linux version v3.12.8-0-g97f15f1
> [ 72.623593] Backport generated by backports.git v3.12.8-1-0-geb41fad
> [ 72.723635] cfg80211: Calling CRDA to update world regulatory domain
> root@sbc:~# lsmod
> Module Size Used by
> wl12xx 47146 0
> wlcore 164050 1 wl12xx
> mac80211 290411 2 wlcore,wl12xx
> cfg80211 194677 2 mac80211,wlcore
> compat 11642 4 cfg80211,mac80211,wlcore,wl12xx
> autofs4 24712 2
> root@sbc:~# modprobe wlcore_spi

The right order would be to load wlcore_spi and that one would trigger
the other modules to be loaded. But I don't think this will make much
difference in your case.




> root@sbc:~# [ 102.873513] wlcore: loaded
> [ 106.609236] Unable to handle kernel paging request at virtual
> address 00203fec
[...]
> [ 107.124658] [<c02a0210>] (omap2_mcspi_transfer+0x0/0x410) from
> [<c029e280>] (__spi_async+0xb4/0xc0)
> [ 107.134122] [<c029e1cc>] (__spi_async+0x0/0xc0) from [<c029e2dc>]
> (spi_async_locked+0x18/0x20)
> [ 107.143118] r6:cf099000 r5:cd015a84 r4:60000013 r3:00000000
> [ 107.149062] [<c029e2c4>] (spi_async_locked+0x0/0x20) from
> [<c029e528>] (__spi_sync+0x90/0xa4)
> [ 107.157967] r4:cd015adc r3:00000000
> [ 107.161719] [<c029e498>] (__spi_sync+0x0/0xa4) from [<c029e568>]
> (spi_sync+0x14/0x18)
> [ 107.169898] r7:cd08c000 r6:cd015c4c r5:00000000 r4:0000000a
> [ 107.175852] [<c029e554>] (spi_sync+0x0/0x18) from [<bf10145c>]
> (wl12xx_spi_raw_write+0x13c/0x180 [wlcore_spi])
> [ 107.186412] [<bf101320>] (wl12xx_spi_raw_write+0x0/0x180
> [wlcore_spi]) from [<bf0c5a04>]
> (wlcore_boot_upload_firmware+0x1bc/0x488 [wlcore])
> [ 107.199570] [<bf0c5848>] (wlcore_boot_upload_firmware+0x0/0x488
> [wlcore]) from [<bf0ecd58>] (wl12xx_boot+0x954/0xe08 [wl12xx])
> [ 107.211521] [<bf0ec404>] (wl12xx_boot+0x0/0xe08 [wl12xx]) from
> [<bf0b855c>] (wl1271_op_add_interface+0x3a0/0x800 [wlcore])
> [ 107.223243] [<bf0b81bc>] (wl1271_op_add_interface+0x0/0x800
> [wlcore]) from [<bf0658d8>] (ieee80211_do_open+0x508/0xa70 [mac80211])
> [ 107.235627] [<bf0653d0>] (ieee80211_do_open+0x0/0xa70 [mac80211])
> from [<bf065eb8>] (ieee80211_open+0x78/0x7c [mac80211])
> [ 107.247145] [<bf065e40>] (ieee80211_open+0x0/0x7c [mac80211]) from
> [<c03a4a0c>] (__dev_open+0xb0/0x104)

This is crashing in a completely different place.

To tell you the truth, I think wlcore_spi should be completely disabled
in the kernel, because it seems to be *badly* broken. It would be
better not to even pretend it is supported. :(

If you're willing to put the effort into fixing it, great! If not,
switch to SDIO and then we can remove SPI completely from the kernel
code.

--
Cheers,
Luca.


2014-01-23 14:35:46

by Charles

[permalink] [raw]
Subject: Re: wlcore-spi crash

>> When I modprobe wlcore-spi I get a kernel crash. Has anyone
>> encountered this? I found a similar problem here:
>> http://marc.info/?l=linux-wireless&m=135212370625698&w=2
>>
>> I tried adding the patch mentioned there to backports-3.12-1, but I
>> get this build error: "error: 'struct wl1271' has no member named
>> 'set_power'"
>>
>> Here's the crash:
>>
>> [ 98.325693] Unable to handle kernel NULL pointer dereference at
>> virtual address 00000000
>> [ 98.334171] pgd = c0004000
>> [ 98.337031] [00000000] *pgd=00000000
>> [ 98.340791] Internal error: Oops: 80000007 [#1]
>> [ 98.345524] Modules linked in: wlcore_spi(O) wl12xx(O) wlcore(O)
>> mac80211(O) cfg80211(O) compat(O) autofs4
>> [ 98.355661] CPU: 0 Tainted: G O (3.2.0)
>> [ 98.364120] PC is at 0x0
>> [ 98.366846] LR is at wl12xx_set_power_on+0x30/0x150 [wlcore]
>
> I think this should help:
> http://www.spinics.net/lists/linux-wireless/msg98589.html
>

As I mentioned above, I get a compile error with that patch: the
wl1271 struct doesn't have "set_power".

2014-01-23 09:11:19

by Janusz Dziedzic

[permalink] [raw]
Subject: Re: wlcore-spi crash

2014/1/22 Charles <[email protected]>:
> I am building the TI wireless drivers from backports-3.12-1 for a 3.2 kernel.
>
> When I modprobe wlcore-spi I get a kernel crash. Has anyone
> encountered this? I found a similar problem here:
> http://marc.info/?l=linux-wireless&m=135212370625698&w=2
>
> I tried adding the patch mentioned there to backports-3.12-1, but I
> get this build error: "error: 'struct wl1271' has no member named
> 'set_power'"
>
> Here's the crash:
>
> [ 98.325693] Unable to handle kernel NULL pointer dereference at
> virtual address 00000000
> [ 98.334171] pgd = c0004000
> [ 98.337031] [00000000] *pgd=00000000
> [ 98.340791] Internal error: Oops: 80000007 [#1]
> [ 98.345524] Modules linked in: wlcore_spi(O) wl12xx(O) wlcore(O)
> mac80211(O) cfg80211(O) compat(O) autofs4
> [ 98.355661] CPU: 0 Tainted: G O (3.2.0)
> [ 98.364120] PC is at 0x0
> [ 98.366846] LR is at wl12xx_set_power_on+0x30/0x150 [wlcore]

I think this should help:
http://www.spinics.net/lists/linux-wireless/msg98589.html

BR
Janusz

2014-01-31 16:25:01

by Charles

[permalink] [raw]
Subject: Re: wlcore-spi crash

Thanks Luca,

>
> Try this:
>
>
> diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c
> index b2c018d..1278583 100644
> --- a/drivers/net/wireless/ti/wlcore/spi.c
> +++ b/drivers/net/wireless/ti/wlcore/spi.c
> @@ -316,6 +316,16 @@ static int __must_check wl12xx_spi_raw_write(struct device *child, int addr,
> return 0;
> }
>
> +static int wl12xx_spi_power(struct device *child, bool enable)
> +{
> + struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent);
> + struct wlcore_platdev_data *pdev_data = glue->core->dev.platform_data;
> +
> + pdev_data->pdata->set_power(enable);
> +
> + return 0;
> +}
> +
> static struct wl1271_if_operations spi_ops = {
> .read = wl12xx_spi_raw_read,
> .write = wl12xx_spi_raw_write,
>
> Note that this is only compile-tested, so I have no clue if it really
> works.
>
> I'm *not* saying this is the right way to do it, I just hacked it up
> quickly.
>

I know there are not many wl1271 spi users out there, so I'm not sure
how far down this lonely road I'll head, but we'll see.

Yes this compiles as you say. But wlcore_spi crashes when I load it:

root@sbc:~# modprobe wl12xx
[ 72.602903] Disabling lock debugging due to kernel taint
[ 72.616192] Loading modules backported from Linux version v3.12.8-0-g97f15f1
[ 72.623593] Backport generated by backports.git v3.12.8-1-0-geb41fad
[ 72.723635] cfg80211: Calling CRDA to update world regulatory domain
root@sbc:~# lsmod
Module Size Used by
wl12xx 47146 0
wlcore 164050 1 wl12xx
mac80211 290411 2 wlcore,wl12xx
cfg80211 194677 2 mac80211,wlcore
compat 11642 4 cfg80211,mac80211,wlcore,wl12xx
autofs4 24712 2
root@sbc:~# modprobe wlcore_spi
root@sbc:~# [ 102.873513] wlcore: loaded
[ 106.609236] Unable to handle kernel paging request at virtual
address 00203fec
[ 106.616801] pgd = cf6bc000
[ 106.619626] [00203fec] *pgd=00000000
[ 106.623370] Internal error: Oops: 5 [#1]
[ 106.627464] Modules linked in: wlcore_spi(O) crc7 wl12xx(O)
wlcore(O) mac80211(O) cfg80211(O) compat(O) autofs4
[ 106.638055] CPU: 0 Tainted: G O (3.2.0-)
[ 106.646535] PC is at omap2_mcspi_transfer+0x3c/0x410
[ 106.651725] LR is at __spi_async+0xb4/0xc0
[ 106.656006] pc : [<c02a024c>] lr : [<c029e280>] psr: a0000093
[ 106.656015] sp : cd015a00 ip : cd015a48 fp : cd015a44
[ 106.668005] r10: 00000000 r9 : cd015b08 r8 : cd015adc
[ 106.673463] r7 : cf099344 r6 : cf099200 r5 : 00000000 r4 : 60000013
[ 106.680283] r3 : c029e6ec r2 : 00203ff0 r1 : cd015adc r0 : cf099000
[ 106.687105] Flags: NzCv IRQs off FIQs on Mode SVC_32 ISA ARM
Segment user
[ 106.694653] Control: 10c5387d Table: 8f6bc019 DAC: 00000015
[ 106.700657] Process ifconfig (pid: 1679, stack limit = 0xcd0142f0)
[ 106.707112] Stack: (0xcd015a00 to 0xcd016000)
[ 106.711670] 5a00: c044a9bc c044b298 cd015ae0 00000001 cf3ceb80
cf099000 00100100 60000013
[ 106.720220] 5a20: 00000000 cf099200 cf099344 cd015adc cd015b08
00000000 cd015a64 cd015a48
[ 106.728770] 5a40: c029e280 c02a021c 00000000 60000013 cd015a84
cf099000 cd015a7c cd015a68
[ 106.737321] 5a60: c029e2dc c029e1d8 00000000 cd015adc cd015aac
cd015a80 c029e528 c029e2d0
[ 106.745871] 5a80: c029e568 00000000 cd015a88 cd015a88 0000000a
00000000 cd015c4c cd08c000
[ 106.754423] 5aa0: cd015abc cd015ab0 c029e568 c029e4a4 cd015c9c
cd015ac0 bf10145c c029e560
[ 106.762972] 5ac0: cd04f680 00004000 00000000 1ff80000 1ff80ffc
1ff81ff8 1ff82ff4 00203ff0
[ 106.771522] 5ae0: cd015c68 cf099000 00000000 c029e6ec cd015a84
00000000 00000000 00000000
[ 106.780073] 5b00: 00000000 00000000 cd015acc 00000000 00000004
00000000 00000000 00000000
[ 106.788621] 5b20: 00000000 cd015b48 cd015adc cd088000 00000000
00000ffc 00000000 00000000
[ 106.797172] 5b40: 00000000 00000000 cd015b6c cd015b24 cd015ad0
00000000 00000004 00000000
[ 106.805722] 5b60: 00000000 00000000 00000000 cd015b90 cd015b48
cd088ffc 00000000 00000ffc
[ 106.814271] 5b80: 00000000 00000000 00000000 00000000 cd015bb4
cd015b6c cd015ad4 00000000
[ 106.822819] 5ba0: 00000004 00000000 00000000 00000000 00000000
cd015bd8 cd015b90 cd089ff8
[ 106.831369] 5bc0: 00000000 00000ffc 00000000 00000000 00000000
00000000 cd015bfc cd015bb4
[ 106.839918] 5be0: cd015ad8 00000000 00000004 00000000 00000000
00000000 00000000 cd015c20
[ 106.848468] 5c00: cd015bd8 cd08aff4 00000000 00000ffc 00000000
00000000 00000000 00000000
[ 106.857018] 5c20: cd015c44 cd015bfc cd015adc 00000000 00000004
00000000 00000000 00000000
[ 106.865568] 5c40: 00000000 cd015c68 cd015c20 cd08bff0 00000000
00000010 00000000 00000000
[ 106.874118] 5c60: 00000000 00000000 cd015adc cd015c44 bf0be390
00000000 000177c0 00000000
[ 106.882670] 5c80: bf0d4fe4 cd088000 cd061480 d0b1600c cd015d0c
cd015ca0 bf0c5a04 bf10132c
[ 106.891220] 5ca0: 00000000 00000000 00000005 d0b1600c 0000000b
00000000 0002ffc0 d0b1600c
[ 106.899770] 5cc0: 000177c0 00000000 00008800 00300000 00000000
00000000 00000000 00000000
[ 106.908323] 5ce0: bf0eb57c cd061480 00000000 c061e4c8 cd015d1e
ffffb4d8 bf0f4df0 bf0d4fe4
[ 106.916874] 5d00: cd015d4c cd015d10 bf0ecd58 bf0c5854 00000000
cd061480 cd015d4c 0f015d28
[ 106.925426] 5d20: bf0b52e0 00000000 cd0614b4 bf0d4fe4 cd095b60
cd095b64 00000003 cd061480
[ 106.933978] 5d40: cd015dac cd015d50 bf0b855c bf0ec410 00000200
cd095a68 cd060100 cd0616ec
[ 106.942527] 5d60: cd095b48 00000000 00000000 cd095a68 00000000
00000000 cd095a68 00000000
[ 106.951078] 5d80: 00000000 cd0953c8 cd060b20 cd095000 cd0953c0
00000001 cd095a68 ffffffff
[ 106.959629] 5da0: cd015dfc cd015db0 bf0658d8 bf0b81c8 0000000d
00000001 00001002 00008914
[ 106.968179] 5dc0: cd015dfc cd015dd0 00000000 c03af0c0 000000ff
cd095000 bf08e71c 00000001
[ 106.976730] 5de0: 00001002 00008914 cd014000 00000000 cd015e14
cd015e00 bf065eb8 bf0653dc
[ 106.985280] 5e00: bf065e40 cd095000 cd015e2c cd015e18 c03a4a0c
bf065e4c cd095000 00001043
[ 106.993831] 5e20: cd015e4c cd015e30 c03a4c54 c03a4968 cd095000
00001002 cf474a80 00000000
[ 107.002382] 5e40: cd015e6c cd015e50 c03a4d88 c03a4bdc 00000000
cf474a80 cf6412cc cf474a80
[ 107.010933] 5e60: cd015ed4 cd015e70 c03f57ac c03a4d7c beb06bb8
cd095000 cf6412cc 00000014
[ 107.019483] 5e80: cf6412c0 beb06bb8 6e616c77 00000030 00000000
00000000 beb01043 beb06e8c
[ 107.028032] 5ea0: beb06f64 ffffffc1 beb01002 00008914 ffffff24
beb06bb8 c0682298 beb06bb8
[ 107.036584] 5ec0: ce8f5220 00000000 cd015ee4 cd015ed8 c03f62e8
c03f5158 cd015f04 cd015ee8
[ 107.045134] 5ee0: c03901a4 c03f613c cea29718 beb06bb8 00008914
cf45c8c0 cd015f74 cd015f08
[ 107.053685] 5f00: c00b98e0 c0390138 c005a310 c0019a58 ffffffff
cf77401c cf3ceb80 c061cff0
[ 107.062236] 5f20: cf76b800 cf599380 cd015f4c cd015f38 c005a3d0
c005a2d0 00000000 cd015f48
[ 107.070786] 5f40: cd015f64 cd015f50 c005a3f8 00000000 beb06bb8
00008914 cf45c8c0 00000004
[ 107.079336] 5f60: cd014000 00000000 cd015fa4 cd015f78 c00b9dd4
c00b9864 beb06c0c 00000000
[ 107.087888] 5f80: 00000036 beb06c70 0001b5bc 00001043 00000036
c0014a28 00000000 cd015fa8
[ 107.096439] 5fa0: c0014880 c00b9d6c beb06c70 0001b5bc 00000004
00008914 beb06bb8 00001002
[ 107.104991] 5fc0: beb06c70 0001b5bc 00001043 00000036 ffffffc1
00000000 4788f000 00000000
[ 107.113542] 5fe0: 0001b17c beb06bb4 0000b6ac 4795cd8c 60000010
00000004 00000000 00000000
[ 107.122083] Backtrace:
[ 107.124658] [<c02a0210>] (omap2_mcspi_transfer+0x0/0x410) from
[<c029e280>] (__spi_async+0xb4/0xc0)
[ 107.134122] [<c029e1cc>] (__spi_async+0x0/0xc0) from [<c029e2dc>]
(spi_async_locked+0x18/0x20)
[ 107.143118] r6:cf099000 r5:cd015a84 r4:60000013 r3:00000000
[ 107.149062] [<c029e2c4>] (spi_async_locked+0x0/0x20) from
[<c029e528>] (__spi_sync+0x90/0xa4)
[ 107.157967] r4:cd015adc r3:00000000
[ 107.161719] [<c029e498>] (__spi_sync+0x0/0xa4) from [<c029e568>]
(spi_sync+0x14/0x18)
[ 107.169898] r7:cd08c000 r6:cd015c4c r5:00000000 r4:0000000a
[ 107.175852] [<c029e554>] (spi_sync+0x0/0x18) from [<bf10145c>]
(wl12xx_spi_raw_write+0x13c/0x180 [wlcore_spi])
[ 107.186412] [<bf101320>] (wl12xx_spi_raw_write+0x0/0x180
[wlcore_spi]) from [<bf0c5a04>]
(wlcore_boot_upload_firmware+0x1bc/0x488 [wlcore])
[ 107.199570] [<bf0c5848>] (wlcore_boot_upload_firmware+0x0/0x488
[wlcore]) from [<bf0ecd58>] (wl12xx_boot+0x954/0xe08 [wl12xx])
[ 107.211521] [<bf0ec404>] (wl12xx_boot+0x0/0xe08 [wl12xx]) from
[<bf0b855c>] (wl1271_op_add_interface+0x3a0/0x800 [wlcore])
[ 107.223243] [<bf0b81bc>] (wl1271_op_add_interface+0x0/0x800
[wlcore]) from [<bf0658d8>] (ieee80211_do_open+0x508/0xa70 [mac80211])
[ 107.235627] [<bf0653d0>] (ieee80211_do_open+0x0/0xa70 [mac80211])
from [<bf065eb8>] (ieee80211_open+0x78/0x7c [mac80211])
[ 107.247145] [<bf065e40>] (ieee80211_open+0x0/0x7c [mac80211]) from
[<c03a4a0c>] (__dev_open+0xb0/0x104)
[ 107.256957] r4:cd095000 r3:bf065e40
[ 107.260709] [<c03a495c>] (__dev_open+0x0/0x104) from [<c03a4c54>]
(__dev_change_flags+0x84/0x13c)
[ 107.269975] r5:00001043 r4:cd095000
[ 107.273729] [<c03a4bd0>] (__dev_change_flags+0x0/0x13c) from
[<c03a4d88>] (dev_change_flags+0x18/0x50)
[ 107.283450] r7:00000000 r6:cf474a80 r5:00001002 r4:cd095000
[ 107.289396] [<c03a4d70>] (dev_change_flags+0x0/0x50) from
[<c03f57ac>] (devinet_ioctl+0x660/0x774)
[ 107.298753] r6:cf474a80 r5:cf6412cc r4:cf474a80 r3:00000000
[ 107.304694] [<c03f514c>] (devinet_ioctl+0x0/0x774) from
[<c03f62e8>] (inet_ioctl+0x1b8/0x1c8)
[ 107.313621] [<c03f6130>] (inet_ioctl+0x0/0x1c8) from [<c03901a4>]
(sock_ioctl+0x78/0x274)
[ 107.322189] [<c039012c>] (sock_ioctl+0x0/0x274) from [<c00b98e0>]
(do_vfs_ioctl+0x88/0x508)
[ 107.330910] r7:cf45c8c0 r6:00008914 r5:beb06bb8 r4:cea29718
[ 107.336855] [<c00b9858>] (do_vfs_ioctl+0x0/0x508) from [<c00b9dd4>]
(sys_ioctl+0x74/0x84)
[ 107.345422] [<c00b9d60>] (sys_ioctl+0x0/0x84) from [<c0014880>]
(ret_fast_syscall+0x0/0x30)
[ 107.354144] r8:c0014a28 r7:00000036 r6:00001043 r5:0001b5bc r4:beb06c70
[ 107.361178] Code: 0a000084 e5913010 e3530000 0a000081 (e5123004)
[ 107.368147] ---[ end trace 82bc410ad17967c2 ]---

2014-01-31 06:17:22

by Luca Coelho

[permalink] [raw]
Subject: Re: wlcore-spi crash

Hi Charles,

On Thu, 2014-01-30 at 17:20 -0500, Charles wrote:
> So my hack was obviously not the right solution, because I'm not
> powering the chip. I know that in wlcore\spi.c, I need to set a
> .power function in spi_ops (i.e. .power = wl12xx_spi_power). And I
> already have a wl12xx_platform_data with a .set_power function defined
> in my board platform file. But I don't know how to access my platform
> file's set_power function from the wl12xx_spi_power function in spi.c.
>
> In other words, I can' figure out how to do this from wlcore\spi.c:
>
> static int wl12xx_spi_power(struct device *child, bool enable) {
>
> set_power_function_defined_in_my_board_platform_file(enable);
>
> }

Try this:


diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c
index b2c018d..1278583 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -316,6 +316,16 @@ static int __must_check wl12xx_spi_raw_write(struct device *child, int addr,
return 0;
}

+static int wl12xx_spi_power(struct device *child, bool enable)
+{
+ struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent);
+ struct wlcore_platdev_data *pdev_data = glue->core->dev.platform_data;
+
+ pdev_data->pdata->set_power(enable);
+
+ return 0;
+}
+
static struct wl1271_if_operations spi_ops = {
.read = wl12xx_spi_raw_read,
.write = wl12xx_spi_raw_write,

Note that this is only compile-tested, so I have no clue if it really
works.

I'm *not* saying this is the right way to do it, I just hacked it up
quickly.

I hope this helps you go in the right direction.

--
Luca.


2014-01-23 16:19:27

by Charles

[permalink] [raw]
Subject: Re: wlcore-spi crash

>>> When I modprobe wlcore-spi I get a kernel crash. Has anyone
>>> encountered this? I found a similar problem here:
>>> http://marc.info/?l=linux-wireless&m=135212370625698&w=2
>>>
>>> I tried adding the patch mentioned there to backports-3.12-1, but I
>>> get this build error: "error: 'struct wl1271' has no member named
>>> 'set_power'"
>>>
>>> Here's the crash:
>>>
>>> [ 98.325693] Unable to handle kernel NULL pointer dereference at
>>> virtual address 00000000
>>> [ 98.334171] pgd = c0004000
>>> [ 98.337031] [00000000] *pgd=00000000
>>> [ 98.340791] Internal error: Oops: 80000007 [#1]
>>> [ 98.345524] Modules linked in: wlcore_spi(O) wl12xx(O) wlcore(O)
>>> mac80211(O) cfg80211(O) compat(O) autofs4
>>> [ 98.355661] CPU: 0 Tainted: G O (3.2.0)
>>> [ 98.364120] PC is at 0x0
>>> [ 98.366846] LR is at wl12xx_set_power_on+0x30/0x150 [wlcore]
>>
>> I think this should help:
>> http://www.spinics.net/lists/linux-wireless/msg98589.html
>>
>
> As I mentioned above, I get a compile error with that patch: the
> wl1271 struct doesn't have "set_power".

I got the patch to compile by adding "void (*set_power)(bool enable);"
to the wl1271 struct in wlcore.h. Now the driver loads without
crashing, but I get a new error:

[ 70.166191] wl1271_spi spi1.1: SPI read busy-word timeout!
[ 70.208452] wl1271_spi spi1.1: SPI read busy-word timeout!
[ 70.252324] wl1271_spi spi1.1: SPI read busy-word timeout!
[ 70.294749] wl1271_spi spi1.1: SPI read busy-word timeout!
[ 70.300515] wlcore: WARNING Top register access timed out.
[ 70.306260] wlcore: ERROR couldn't get hw info