Return-path: Received: from emh01.mail.saunalahti.fi ([62.142.5.107]:52442 "EHLO emh01.mail.saunalahti.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932271AbaAaU04 (ORCPT ); Fri, 31 Jan 2014 15:26:56 -0500 Message-ID: <1391200013.5159.5.camel@porter.coelho.fi> (sfid-20140131_212659_526742_5B3347BE) Subject: Re: wlcore-spi crash From: Luca Coelho To: Charles Cc: linux-wireless Date: Fri, 31 Jan 2014 22:26:53 +0200 In-Reply-To: References: <1391149038.22155.33.camel@porter.coelho.fi> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org List-ID: 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] [] (omap2_mcspi_transfer+0x0/0x410) from > [] (__spi_async+0xb4/0xc0) > [ 107.134122] [] (__spi_async+0x0/0xc0) from [] > (spi_async_locked+0x18/0x20) > [ 107.143118] r6:cf099000 r5:cd015a84 r4:60000013 r3:00000000 > [ 107.149062] [] (spi_async_locked+0x0/0x20) from > [] (__spi_sync+0x90/0xa4) > [ 107.157967] r4:cd015adc r3:00000000 > [ 107.161719] [] (__spi_sync+0x0/0xa4) from [] > (spi_sync+0x14/0x18) > [ 107.169898] r7:cd08c000 r6:cd015c4c r5:00000000 r4:0000000a > [ 107.175852] [] (spi_sync+0x0/0x18) from [] > (wl12xx_spi_raw_write+0x13c/0x180 [wlcore_spi]) > [ 107.186412] [] (wl12xx_spi_raw_write+0x0/0x180 > [wlcore_spi]) from [] > (wlcore_boot_upload_firmware+0x1bc/0x488 [wlcore]) > [ 107.199570] [] (wlcore_boot_upload_firmware+0x0/0x488 > [wlcore]) from [] (wl12xx_boot+0x954/0xe08 [wl12xx]) > [ 107.211521] [] (wl12xx_boot+0x0/0xe08 [wl12xx]) from > [] (wl1271_op_add_interface+0x3a0/0x800 [wlcore]) > [ 107.223243] [] (wl1271_op_add_interface+0x0/0x800 > [wlcore]) from [] (ieee80211_do_open+0x508/0xa70 [mac80211]) > [ 107.235627] [] (ieee80211_do_open+0x0/0xa70 [mac80211]) > from [] (ieee80211_open+0x78/0x7c [mac80211]) > [ 107.247145] [] (ieee80211_open+0x0/0x7c [mac80211]) from > [] (__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.