MLK-21502 brcmfmac: fix the load issue for bcm4339
authorFugang Duan <fugang.duan@nxp.com>
Fri, 19 Apr 2019 08:56:08 +0000 (16:56 +0800)
committerFugang Duan <fugang.duan@nxp.com>
Fri, 19 Apr 2019 09:30:22 +0000 (17:30 +0800)
commitc45e02541e026c53c595a0fce78e5e5a3aca6879
tree46fd211e8e8e2254f64899a0c7fcc1158cd36a9a
parent106be32e3da9bd0b25e0622256024c2341cb8a76
MLK-21502 brcmfmac: fix the load issue for bcm4339

Current brcmfmac driver cannot load cyw4339 module and always report
bus timeout as below log.

brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4339-sdio for chip BCM4339/2
brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4339-sdio for chip BCM4339/2
brcmfmac: brcmf_c_process_clm_blob: no clm_blob available (err=-11), device may have limited channels available
brcmfmac: brcmf_sdio_bus_rxctl: resumed on timeout
brcmfmac: brcmf_bus_started: failed: -110
brcmfmac: brcmf_attach: dongle is not responding: err=-110
brcmfmac: brcmf_sdio_bus_rxctl: resumed on timeout
brcmfmac: brcmf_bus_started: failed: -110
brcmfmac: brcmf_attach: dongle is not responding: err=-110
brcmfmac: brcmf_sdio_firmware_callback: brcmf_attach failed
brcmfmac: brcmf_sdio_bus_rxctl: resumed on timeout
brcmfmac: brcmf_c_preinit_dcmds: Retreiving version information failed, -110
brcmfmac: brcmf_bus_started: failed: -110
Unable to handle kernel NULL pointer dereference at virtual address 00000004
pgd = 50d469b0
[00000004] *pgd=00000000
Internal error: Oops: 817 [#1] PREEMPT SMP ARM
Modules linked in: mxc_vadc mxc_dcic mx6s_capture ov5640_camera_v2 brcmfmac brcmutil
CPU: 0 PID: 91 Comm: kworker/0:3 Not tainted 4.19.35-04384-g50ca4a9 #1147
Hardware name: Freescale i.MX6 SoloX (Device Tree)
Workqueue: events request_firmware_work_func
PC is at brcmf_attach+0x234/0x3d8 [brcmfmac]
LR is at __slab_free+0x1a4/0x308
pc : [<7f022500>]    lr : [<8020d7a8>]    psr: 20010013
sp : a8679e78  ip : a8679de8  fp : 00000000
r10: 00000000  r9 : a8ef0c00  r8 : a9ffa1a0
r7 : a868b808  r6 : a9ff8460  r5 : ffffff92  r4 : a9ff81a0
r3 : 00000000  r2 : 588fd8f8  r1 : 00000000  r0 : 00000000
Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
Control: 10c53c7d  Table: a901c04a  DAC: 00000051
Process kworker/0:3 (pid: 91, stack limit = 0xbe6d797a)
Stack: (0xa8679e78 to 0xa867a000)
9e60:                                                       7f03540c 00000000
9e80: a97cecc0 00000008 00000001 a8ecf800 81004d08 a8ecfc00 a868b808 7f0328b8
9ea0: 00000002 00000008 00000001 7f02adfc 00000840 00010000 00000840 bc3ef180
9ec0: a92abcc0 00000000 00000000 588fd8f8 ab731d80 a92ab454 a8398340 00000014
9ee0: 81004d08 00000000 a92ab440 a9461140 ab731d80 7f023620 a9eec980 588fd8f8
9f00: a9461480 81004d08 ab731d80 ab734f00 00000000 a9461484 00000000 8054c058
9f20: 00000000 00000003 a9461140 588fd8f8 ab731d80 a9461480 a865a280 80146690
9f40: 81003d00 ab731d98 a865a280 a865a294 ab731d80 81003d00 ab731d98 a8678000
9f60: 00000008 8014697c 00000000 a8643e00 a8643dc0 00000000 a865a280 80146950
9f80: a8643e1c a8075ebc 00000000 8014bfc8 a8643dc0 8014bea4 00000000 00000000
9fa0: 00000000 00000000 00000000 801010e8 00000000 00000000 00000000 00000000
9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[<7f022500>] (brcmf_attach [brcmfmac]) from [<7f02adfc>] (brcmf_sdio_firmware_callback+0x4c4/0x74c [brcmfmac])
[<7f02adfc>] (brcmf_sdio_firmware_callback [brcmfmac]) from [<7f023620>] (brcmf_fw_request_done+0x188/0x214 [brcmfmac])
[<7f023620>] (brcmf_fw_request_done [brcmfmac]) from [<8054c058>] (request_firmware_work_func+0x4c/0x88)
[<8054c058>] (request_firmware_work_func) from [<80146690>] (process_one_work+0x138/0x3f8)
[<80146690>] (process_one_work) from [<8014697c>] (worker_thread+0x2c/0x554)
[<8014697c>] (worker_thread) from [<8014bfc8>] (kthread+0x124/0x154)
[<8014bfc8>] (kthread) from [<801010e8>] (ret_from_fork+0x14/0x2c)
Exception stack(0xa8679fb0 to 0xa8679ff8)
9fa0:                                     00000000 00000000 00000000 00000000
9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
Code: e3530000 0a000011 e59432cc e3a00000 (e5839004)
---[ end trace 8b8e3996f6f715bf ]---

cyw4339 doesn't support ulp_sdioctrl iovar and ulp mode, the current logic make
sdio bus down/up, and trigger firmware load twice. So remove the ulp status
check for cyw4339.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c