Commit graph

873450 commits

Author SHA1 Message Date
Fugang Duan 665ba6f938 dt-bindings: add new property to enable board_type
Add new property to enable board_type for NVRAM suffix.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:45:00 +08:00
Fugang Duan c6d6fce243 brcmfmac: let board_type is optional
Let board_type is optional specified by dts property.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:45:00 +08:00
Fugang Duan 94c8800dae MLK-22364 brcmfmac: double check the D3 ACK state when wait event timeout
When system suspend, pcie bus write BRCMF_H2D_HOST_D3_INFORM cmd
into tcm32 mem to let host enter D3 mode, and wait the D3 ACK
interrupt. But sometime, the interrupt is comming lately then
cause wait event timeout, so double check the D3 ACK state.

Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Acked-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-11-25 15:44:59 +08:00
Fugang Duan c05fe15463 MLK-21756 brcmfmac: bcmsdh: attach device only func1 compatible string match
brcmfamc driver attach mmc func devices only when func1 device's
node exist, and whose compatible string match "brcm,bcm4329-fmac".

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:44:59 +08:00
Fugang Duan b8328d0f95 MLK-19341 brcmfmac: bcmsdh: add shutdown handler to avoid kernel panic on reboot
When running wlan interface up/down stress test in background then run
reboot command, there have kernel panic as below message.
This issue is fixed by doing cleanup in shutdown handler.

Unable to handle kernel paging request at virtual address 7f0e9040
pgd = 86c20000
[7f0e9040] *pgd=86ecd811, *pte=00000000, *ppte=00000000
Internal error: Oops: 7 [#1] PREEMPT SMP ARM
task: 8603c000 task.stack: 86040000
PC is at device_shutdown+0x198/0x204
LR is at _raw_spin_unlock_irq+0x28/0x54
pc : [<804ee520>]    lr : [<809a70dc>]    psr: 20030013
sp : 86041e60  ip : 00000000  fp : 80c5b7e4
r10: 80cb0b24  r9 : 80f7e020  r8 : 86b0b844
r7 : 80fdce84  r6 : 86b0b810  r5 : 80f34ef0  r4 : 86b0b81c
r3 : 7f0e9018  r2 : ffffffff  r1 : 00000002  r0 : 00000000
Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
Control: 10c53c7d  Table: 86c2006a  DAC: 00000051
Process systemd-shutdow (pid: 1, stack limit = 0x86040210)
Stack: (0x86041e60 to 0x86042000)
1e60: 00000000 00000000 80f0f704 aef99500 fee1dead 80107c44 86040000 00000000
1e80: 7eee5fd4 8014bb74 00000000 8014bdcc 00000000 00000000 00000000 8020464c
1ea0: 87336540 00000000 00000000 00000000 861b24e0 87336548 00000024 00000002
1ec0: 00000000 00000005 0000001e 80205c34 00000000 00000000 1c4a66cc 87336540
1ee0: 00000000 86041f08 86041f80 00000000 00000000 80205d5c 86041f04 86041f08
1f00: 00000000 00000000 00000001 00000000 00000024 86041f20 00000005 7eee521c
1f20: 7eee5350 00000004 7eee5f1c 00000010 7eee5364 00000005 7eee53f4 0000000a
1f40: 76ece6fc 00000001 86005b00 00000005 fffffffe fffffffe 86d1a000 fffff000
1f60: 80107c44 87336540 87336540 00000000 7eee5318 80205df0 00000000 00000004
1f80: 00000000 00000000 00000000 7eee53f4 7eee5318 00000000 00000000 00000000
1fa0: 00000058 80107a60 00000000 00000000 fee1dead 28121969 01234567 aef99500
1fc0: 00000000 00000000 00000000 00000058 00000000 ffffffff 00000000 7eee5fd4
1fe0: 004a0e18 7eee5c44 0048afa4 76d0b5e0 60030010 fee1dead 00000000 00000000
[<804ee520>] (device_shutdown) from [<8014bb74>] (kernel_restart+0xc/0x50)
[<8014bb74>] (kernel_restart) from [<8014bdcc>] (SyS_reboot+0xc8/0x1ac)
[<8014bdcc>] (SyS_reboot) from [<80107a60>] (ret_fast_syscall+0x0/0x54)
Code: eaffffb5 e5943040 e3530000 0afffff3 (e5933028)
---[ end trace cb8c3d96d6f26a91 ]---

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:44:59 +08:00
Fugang Duan 60561138a9 MLK-21611 brcmfmac: change message level for reading optional iovar data
Not all firmware set channel/ulp_sdioctrl, so change the error message
to debug level for reading chanspec/ulp_sdioctrl iovar data.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:44:58 +08:00
Fugang Duan c5a54a59cf MLK-21071 brcmfmac: add PCIe shutdown handler to avoid system warning on reboot
If reboot command is issued when PCIe WLAN device is in connected
state, system kernel dump while booting as below log. This issue
is fixed by doing cleanup and disable PCIe interrupt in shutdown handler.

[    6.405135] irq 304: nobody cared (try booting with the "irqpoll" option)
[    6.425581] Call trace:
[    6.428034] [<ffff000008089c48>] dump_backtrace+0x0/0x3c8
[    6.433433] [<ffff00000808a024>] show_stack+0x14/0x20
[    6.438485] [<ffff000008d8bec0>] dump_stack+0x9c/0xbc
[    6.443538] [<ffff00000811e7e4>] __report_bad_irq+0x34/0xf0
[    6.449110] [<ffff00000811ec84>] note_interrupt+0x2ec/0x338
[    6.454682] [<ffff00000811bc2c>] handle_irq_event_percpu+0x44/0x58
[    6.460861] [<ffff00000811bc88>] handle_irq_event+0x48/0x78
[    6.466433] [<ffff00000811fa88>] handle_fasteoi_irq+0xa8/0x180
[    6.472265] [<ffff00000811ac1c>] generic_handle_irq+0x24/0x38
[    6.478009] [<ffff00000811b29c>] __handle_domain_irq+0x5c/0xb8
[    6.483841] [<ffff000008081960>] gic_handle_irq+0x78/0x174
[    6.489325] Exception stack(0xffff0000094f3d80 to 0xffff0000094f3ec0)
[    6.495765] 3d80: 0000000000000000 ffff000009502580 0000000000000709 ffff000008ac5b28
[    6.503593] 3da0: 0000000002222221 00ffffffffffffff 0000000008cd6205 00000000000000c0
[    6.511421] 3dc0: 00000032b5503510 ffff000008082000 0000000000001000 0000000000000000
[    6.519249] 3de0: 0000000034d5d91d 00008000b4a78000 ffff000009502580 0000000000000000
[    6.527077] 3e00: 0000000000000000 0000000000000000 0000000000000000 000000016cb15db1
[    6.534905] 3e20: 0000000000000001 ffff8000b900ce00 ffff8000b925e000 0000000000000001
[    6.542733] 3e40: 000000016c9c1569 ffff8000b925e000 ffff000009502580 0000000000000400
[    6.550561] 3e60: 00000000417b0018 ffff0000094f3ec0 ffff000008a308a8 ffff0000094f3ec0
[    6.558389] 3e80: ffff000008a307f4 0000000040000045 ffff8000b925e060 0000000000000001
[    6.566217] 3ea0: ffffffffffffffff ffff8000b925e000 ffff0000094f3ec0 ffff000008a307f4
[    6.574045] [<ffff000008083230>] el1_irq+0xb0/0x124
[    6.578925] [<ffff000008a307f4>] cpuidle_enter_state+0x134/0x228
[    6.584930] [<ffff000008a30920>] cpuidle_enter+0x18/0x20
[    6.590242] [<ffff00000810c75c>] call_cpuidle+0x1c/0x40
[    6.595465] [<ffff00000810c9ac>] do_idle+0x1a4/0x1e0
[    6.600428] [<ffff00000810cb84>] cpu_startup_entry+0x24/0x28
[    6.606088] [<ffff000008d9e798>] rest_init+0xd0/0xe0
[    6.611056] [<ffff0000093b0b70>] start_kernel+0x398/0x3ac

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:44:57 +08:00
Fugang Duan bbed664da4 MLK-21580 brcmfmac: add BRCMF_FEAT_WOWL check when set wowlan parameters
Only set wowlan parameters when the interface's BRCMF_FEAT_WOWL
flag is set.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:44:57 +08:00
Fugang Duan 24aa2e3334 MLK-21579 brcmfmac: bcmsdh: move the func->num check early in .brcmf_ops_sdio_suspend()
Move the func->num check early in .brcmf_ops_sdio_suspend() to
save suspend time.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:44:57 +08:00
Fugang Duan 9eecd7fab1 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>
2019-11-25 15:44:53 +08:00
Fugang Duan a0f14445b3 MLK-21493 brcmfmac: move .brcmf_bus_preinit() after changing bus state
Moving the brcmf_bus_preinit() call allows the bus code to do some
required initialization before handling firmware control messages.

.brcmf_bus_preinit() already is called in .brcmf_bus_started() when
bus is ready. So remove it from .brcmf_c_preinit_dcmds().

Fixes: 383c26d2ea2f(MLK-18675-20 brcmfmac: Support wake on ping packet)
Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:44:53 +08:00
Fugang Duan 41d3b41dd5 MLK-21492 brcmfmac: remove func0 that is not provied by mmc stack
func0 is not provided by the mmc stack as a function when probing.
commit 99d7b6fdfc8c(brcmfmac: Remove func0 from function array)
already remove the func0.

But commit c37fa19e0128(brcmfmac: Remove array of functions) add
fun0 again. That cause NULL pointer issue.

Fixes: c37fa19e0128(brcmfmac: Remove array of functions)
Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-11-25 15:44:52 +08:00
Stefan Wahren 731c91883d brcmfmac: Fix access point mode
commit 861cb5eb46 ("brcmfmac: Fix access point mode") upstream.

Since commit 1204aa17f3 ("brcmfmac: set WIPHY_FLAG_HAVE_AP_SME flag")
the Raspberry Pi 3 A+ (BCM43455) isn't able to operate in AP mode with
hostapd (device_ap_sme=1 use_monitor=0):

brcmfmac: brcmf_cfg80211_stop_ap: setting AP mode failed -52

So add the missing mgmt_stypes for AP mode to fix this.

Fixes: 1204aa17f3 ("brcmfmac: set WIPHY_FLAG_HAVE_AP_SME flag")
Suggested-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-11-25 15:44:52 +08:00
Wright Feng 28b7c0bc8d MLK-21161-04 brcmfmac: fix 43455 CRC error under SDIO 3.0 SDR104 mode
This patch fixes 43455 CRC error while running throughput test with
suspend/resume stress test.

The continuous failure messages before system crash:
brcmfmac: brcmf_sdiod_sglist_rw: CMD53 sg block read failed -84
brcmfmac: brcmf_sdio_rxglom: glom read of 25600 bytes failed: -5
brcmfmac: brcmf_sdio_rxfail: abort command, terminate frame
brcmfmac: brcmf_sdiod_sglist_rw: CMD53 sg block read failed -84
brcmfmac: brcmf_sdio_rxglom: glom read of 24576 bytes failed: -5
brcmfmac: brcmf_sdio_rxfail: abort command, terminate frame

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit d6e37c2eb0f6fc2b50172321a464337073038228)
2019-11-25 15:44:52 +08:00
Wright Feng 02bf1d13f6 MLK-21161-03 brcmfmac: add sleep in bus suspend and cfg80211 resume functions
With asynchronous suspend/resume feature, suspend and resume callbacks to
be executed in parallel with each other. It makes bus changes the state to
BRCMF_BUS_DOWN before all brcmf_cfg80211_suspend IOVAR executions.
The same situation also happens in resume procedure and causes PM mode
keeps in PM_MAX after resume. In order to fix the race condition, We add
one second sleep in bus suspend and cfg80211 resume function.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit fdb676ce002039d7359b200b6c2cc728f41c05fa)
2019-11-25 15:44:51 +08:00
Wright Feng 475eade733 MLK-21161-02 brcmfmac: validate ifp pointer in brcmf_txfinalize
We got ifp null pointer kernel panic in brcmf_txfinalize after removing
Wi-Fi USB dongle when data was transmitting, The root cause is that
interface was removed before calling brcmf_txfinalize in
brcmf_fws_dequeue_worker and finally caused kernel panic.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit 3f94bfe6febc9762e340a69b6520242f27d20c85)
2019-11-25 15:44:50 +08:00
Raveendran Somu 7b00dfee5a MLK-21161-01 brcmfmac: To fix kernel crash on out of boundary access
To trunkcate the addtional bytes, if extra bytes are received.
Current code only have a warning and proceed without handling it.
But in one crash dump reported by DVT, these causes the
crash intermittently. So the processing is limit to the skb->len.

Signed-off-by: Raveendran Somu <raveendran.somu@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit f7112c027e0c7447b05474b72934589bbbb8e298)
2019-11-25 15:44:50 +08:00
Andy Duan 9198db3a1a MLK-20681 brcmfmac: add brcmfmac platform device pinctrl state support
Add brcmfmac platform device pinctrl state support. That is useful
for dynamically configurate pin group for different wlan chips.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit 88f2834cd5b8cb8864af68d265b5bdee3000c4bf)
2019-11-25 15:44:49 +08:00
Andy Duan 0536e4052d MLK-20680 brcmfmac: add time delay for pcie device exit D3 mode
- The current timeout value is not enough for MB transaction read
when modem enter D3 mode, so increase the timeout value to match
the D3 mode timing requirement.
- Add 10 ms delay for pcie device to exit D3 state and enter D0 state.
- Remove the duplicated code for SBMBX register access.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit 05601af462145e27142e3d140e10a66d4a493d40)
2019-11-25 15:44:49 +08:00
Wright Feng 00175c4567 MLK-20679 brcmfmac: reset two D11 cores if chip has two D11 cores
There are two D11 cores in RSDB chips like 4359. We have to reset two
D11 cores simutaneously before firmware download, or the firmware may
not be initialized correctly and cause "fw initialized failed" error.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked commit from 8f50bea9357af3088dba0103f0017d56763b0ae9)
2019-11-25 15:44:49 +08:00
Andy Duan 6d246f2947 MLK-20678 brcmfmac: avoid the error log print when get the wowl_wakeind failed
Not all chips support wowlan, then get wowlan wakeup event failed.
Change the log into debug level.

Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit 47b205952ca6be6216e19a121f1fb400c5fcf7e7)
2019-11-25 15:44:48 +08:00
Andy Duan 5d13e5b656 MLK-20190-03 brcmfmac: check thre return value of .brcmf_fil_iovar_data_get()
Check the return value of .brcmf_fil_iovar_data_get() to fix
the coverity issue of "error handling issue".

Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
2019-11-25 15:44:47 +08:00
Andy Duan fc786002e6 MLK-20190-02 brcmfmac: init the wlfc_mode variable before it is used
Init the wlfc_mode variable before it is used to fix
coverity issue of "Uninitialized variable".

Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Arulpandiyan Vadivel <arulpandiyan_vadivel@mentor.com>
2019-11-25 15:44:47 +08:00
Lo-Hsiang Lo 9eb0713d6c MLK-18993 brcmfmac: configure wowl parameters only if firmware support wowl
Configure wowl parameters only if firmware support wowl.

Tested-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Lo-Hsiang Lo <double.lo@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit:ceccd33fb63e49cb816a827c0dfcb8abf7059e7f)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:47 +08:00
Saravanan Shanmugham 0d62633290 MLK-19517-18 brcmfmac: map 802.1d priority to precedence level based on AP WMM params
In WLAN, priority among various access categories of traffic is
always set by the AP using WMM parameters and this may not always
follow the standard 802.1d priority.
In this change, priority is adjusted based on the AP WMM params
received as part of the Assoc Response and the same is later used
to map the priority of all incoming traffic.

This change should fix the following 802.11n certification tests:
* 5.2.31 ACM Bit Conformance test
* 5.2.32 AC Parameter Modification test

Signed-off-by: Saravanan Shanmugham <sasm@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit:62657fc5931db1c1d48c3181f2f4effebf37a74b)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:46 +08:00
Madhan Mohan R 8e9b368c6e MLK-19517-14 brcmfmac: increase max hanger slots from 1K to 3K in fws layer
Will enable FMAC to push more packets to bus tx queue and help
improve throughput when fws queuing is enabled. This change is
required to tune the throughput for passing WMM CERT tests.

Signed-off-by: Madhan Mohan R <MadhanMohan.R@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit:48195bf1b7dea8c6030dfce45900dda60f2d0ea4)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:46 +08:00
Chi-Hsien Lin 94cecc296b MLK-19517-12 brcmfmac: only generate random p2p address when needed
P2p spec mentioned that the p2p device address should be the globally
administered address with locally administered bit set. Therefore,
follow this guideline by default.

When the primary interface is set to a locally administered address, the
locally administered bit cannot be set again. Generate a random locally
administered address for this case.

Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit:930ac6e9230a48a775e55ee6cb31c4dffe5d5dcc)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:46 +08:00
Madhan Mohan R 6a0c5c1cfa MLK-19517-11 brcmfmac: P2P CERT 6.1.9-Support GOUT handling P2P Presence Request
Send P2P Presence Response from the p2p interface address instead
of the p2p device address.

Signed-off-by: Madhan Mohan R <MadhanMohan.R@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit:1ce946c329e68457fd8e72da33d17251a7f2377c)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:45 +08:00
Wright Feng 10143c9661 MLK-19517-08 brcmfmac: fix unused variable building warning message
The variable "wq_flags" is not used anymore. Remove it.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit:453591909a747bede4ff3fabe1d4073370f920f4)
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:45 +08:00
Wright Feng 7967e27e83 MLK-19517-04 brcmfmac: make setting SDIO workqueue WQ_HIGHPRI a module parameter
With setting sdio_wq_highpri=1 in module parameters, tasks submitted to
SDIO workqueue will put at the head of the queue and run immediately.
This parameter is for getting higher TX/RX throughput with SDIO bus.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit: 7c2b310299f051be555c6928f0f858fdbac35abb)
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:44 +08:00
Wright Feng d776333793 MLK-19517-03 revert: brcmfmac: add a module parameter to set scheduling priority of sdio_dpc
will use WQ_HIGHPRI instead.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(cherry picked from commit: 2925b73171942933311e87ab51747a055cfd8abf)
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:44 +08:00
Double Lo d848f03913 MLK-19516 brcmfmac: fix 4339 CRC error under SDIO 3.0 SDR104 mode
This patch fixes 4339 CRC error while running Tput test with
suspend/resume test script. Update F2 Watermark to 48 to avoid
CRC error.

The continuous failure messages before system crash:
brcmfmac: brcmf_sdiod_sglist_rw: CMD53 sg block read failed -84
brcmfmac: brcmf_sdio_rxglom: glom read of 25600 bytes failed: -5
brcmfmac: brcmf_sdio_rxfail: abort command, terminate frame
brcmfmac: brcmf_sdiod_sglist_rw: CMD53 sg block read failed -84
brcmfmac: brcmf_sdio_rxglom: glom read of 24576 bytes failed: -5
brcmfmac: brcmf_sdio_rxfail: abort command, terminate frame

Tested-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Lo-Hsiang Lo <double.lo@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:43 +08:00
Double Lo 30ad29bbf7 MLK-18675-21 brcmfmac: Remove WOWL configuration in disconnect state
Set wowl configuration in disconnect state is redundant.
Remove it to fix no scan result issue after resume.

Signed-off-by: Lo-Hsiang Lo <double.lo@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:43 +08:00
Double Lo 6aeb870197 MLK-18675-20 brcmfmac: Support wake on ping packet
FMAC driver need to provide a dummy wowlan filter for kernel and
provided the well configured wowlan stack. So the system will
keep driver in connected state in suspend mode and can be wake
up by ping packet.

Enable unicast packet filter before system suspend and
disable it after resume.

Signed-off-by: Lo-Hsiang Lo <double.lo@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:42 +08:00
Wright Feng bf8d6bbcc4 MLK-18675-19 brcmfmac: make firmware eap_restrict a module parameter
When eap_restrict is enabled, firmware will toss non-802.1x frames from
tx/rx data path if station not yet authorized.
Internal firmware eap_restrict is disabled by default. This patch makes
it possible to enable firmware eap_restrict by specifying
eap_restrict=1 as module parameter.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:41 +08:00
Wright Feng 23235ce8d9 MLK-18675-18 brcmfmac: add a module parameter to set scheduling priority of sdio_dpc
To enhance RX throughput, we add a module parameter "sdio_dpc_prio" to let
user can set scheduling  priority for sdio_dpc. It can improve RX
throughput by reducing the receiving time in sdio_dpc.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:41 +08:00
Naveen aca283a438 MLK-18675-16 brcmfmac: do not print ulp_sdioctrl get error
Don't print ulp_sdioctrl get error as errors are expected for non ulp
cases.

Signed-off-by: Naveen Gupta <nagu@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:41 +08:00
Wright Feng dd38337def MLK-18675-15 brcmfmac: support AP isolation
Hostap daemon has a parameter "ap_isolate which is used to prevent
low-level bridging of frames between associated stations in the BSS.
For driver side, we add cfg80211 ops method change_bss to support
setting AP isolation from user space.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Chi-hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:40 +08:00
Wright Feng 02aca044c6 MLK-18675-14 brcmfmac: Add support for 43428 SDIO device ID
The device 43428 is a new SDIO device ID but shares the same WLAN core
with device 43430a1. It is a 1x1 802.11b/g/n 2.4GHz HT20,
256-QAM/Turbo QAM WLAN chip.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Chi-hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:40 +08:00
Vipul Kumar 72f8f2a80c brcmfmac: Fix compilation error
This patch fix the below compilation errors.

drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c: In function ‘brcmf_sdio_ulp_pre_redownload_check’:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:2631:10: error: implicit declaration of function ‘brcmf_sdiod_regrb’; did you mean ‘brcmf_sdiod_readb’? [-Werror=implicit-function-declaration]
  value = brcmf_sdiod_regrb(bus->sdiodev, SDIO_CCCR_IOEx, &err);
          ^~~~~~~~~~~~~~~~~
          brcmf_sdiod_readb
In file included from drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:42:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h:437:2: error: implicit declaration of function ‘brcmf_sdiod_regrl’; did you mean ‘brcmf_sdiod_readl’? [-Werror=implicit-function-declaration]
  brcmf_sdiod_regrl(sdh, D11SHM_ADDR(offset), ret)
  ^~~~~~~~~~~~~~~~~
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:2636:18: note: in expansion of macro ‘D11SHM_RD’
   ulp_wake_ind = D11SHM_RD(bus->sdiodev, M_ULP_WAKE_IND(
                  ^~~~~~~~~
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h:434:2: error: implicit declaration of function ‘brcmf_sdiod_regwl’; did you mean ‘brcmf_sdiod_readl’? [-Werror=implicit-function-declaration]
  brcmf_sdiod_regwl(sdh, D11SHM_ADDR(offset), val, ret)
  ^~~~~~~~~~~~~~~~~
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:2654:4: note: in expansion of macro ‘D11SHM_WR’
    D11SHM_WR(bus->sdiodev, M_DS1_CTRL_SDIO(
    ^~~~~~~~~
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c: In function ‘brcmf_sdio_firmware_callback’:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:4388:9: error: implicit declaration of function ‘brcmf_bus_started’; did you mean ‘brcmf_bus_txctl’? [-Werror=implicit-function-declaration]
   err = brcmf_bus_started(dev);
         ^~~~~~~~~~~~~~~~~
         brcmf_bus_txctl
cc1: some warnings being treated as errors
scripts/Makefile.build:303: recipe for target 'drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.o' failed
make[6]: *** [drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.o] Error 1

Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:40 +08:00
Vipul Kumar 2ce630c00f brcmfmac: pass struct in brcmf_fw_get_firmwares()
As per 'commit d09ae51a4b ("brcmfmac: pass struct in
brcmf_fw_get_firmwares()")', make changes in the brcmf_fw_get_firmwares()
call to fix the compilation error.

drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c: In function ‘brcmf_sdio_ulp_reinit_fw’:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:2597:45: error: ‘BRCMF_FW_REQUEST_NVRAM’ undeclared (first use in this function); did you mean ‘BRCMF_FW_TYPE_NVRAM’?
  err = brcmf_fw_get_firmwares(sdiodev->dev, BRCMF_FW_REQUEST_NVRAM,
                                             ^~~~~~~~~~~~~~~~~~~~~~
                                             BRCMF_FW_TYPE_NVRAM
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:2597:45: note: each undeclared identifier is reported only once for each function it appears in
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:2598:17: error: passing argument 3 of ‘brcmf_fw_get_firmwares’ from incompatible pointer type [-Werror=incompatible-pointer-types]
          sdiodev->fw_name, sdiodev->nvram_name,
          ~~~~~~~^~~~~~~~~
In file included from drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h:22,
                 from drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:42:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h:93:14: note: expected ‘void (*)(struct device *, int,  struct brcmf_fw_request *)’ but argument is of type ‘char *’
       void (*fw_cb)(struct device *dev, int err,
       ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       struct brcmf_fw_request *req));
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:2597:8: error: too many arguments to function ‘brcmf_fw_get_firmwares’
  err = brcmf_fw_get_firmwares(sdiodev->dev, BRCMF_FW_REQUEST_NVRAM,
        ^~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h:22,
                 from drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c:42:
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.h:92:5: note: declared here
 int brcmf_fw_get_firmwares(struct device *dev, struct brcmf_fw_request *req,
     ^~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:39 +08:00
Naveen a709b000cc MLK-18675-12 brcmfmac: DS1 Exit should re download the firmware.
In Deep Sleep mode ARM is off and once Exit trigger comes than
Mail Box Interrupt comes to Host and whole Re Initiation should be done
in the ARM to start TX/RX.

Signed-off-by: Naveen Gupta <nagu@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>

Vipul: Fixed merge conflicts
Conflict:
	drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:39 +08:00
Wright Feng 288a2e34b7 MLK-18675-10 brcmfmac: calling skb_orphan before sending skb to SDIO bus
Linux 3.6 introduces TSQ which has a per socket threshold for TCP Tx
packet to reduce latency. In fcmode 1/2, host driver enqueues skb in
hanger and TCP doesn't push new skb frees until host frees the skb when
receiving fwstatus event. So using skb_orphan before sending skb to bus
will make the skb removing the ownership of socket. With this patch, we
got better throughput in fcmode 1/2.

Tested 43455 TCP throughput in 20 MHz bandwidth with/without this patch.
fcmode 0: 59.5 / 59.6 (Mbps)
fcmode 1: 59.3 / 23.4 (Mbps)
fcmode 2: 59.6 / 21.5 (Mbps)

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:37 +08:00
Wright Feng a97e286fdc MLK-18675-06 brcmfmac: set apsta to 1 when AP start on primary interface.
APSTA can work on two band concurrently with using VSDB(Virtual
Simultaneous Dual-Band) or RSDB(Real Simultaneous Dual-Band) features.
In this case, we have to keep apsta is 1 in firmware side. However, if
we start wpa_supplicant on wlan0 and then start hostapd on wlan 1, the
apsta will be set to 0, and we will see data stall on wlan0(station)
So that, we only set apsta to 1 when AP start on primary interface.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:37 +08:00
Wright Feng 6fce59f3da MLK-18675-04 brcmfmac: return -EPERM when getting error in vendor command handler
Firmware returns proprietary error code when getting error in
fil_cmd_data_set or fil_cmd_data_get. Sometimes the vendor tool or
utilities which uses libnl may stuck in some commands when wl is down.
For example, issue "scan" command after issuing "down" command, the
"scan" command will be the blocking call and stuck as no response from
firmware. It is caused by that firmware returns BCME_NOTUP(-4) when wl
is down, but in Linux the -4 is -EINTR, so libnl catches the error and
not pass to upper layer.
Because of that, the driver should return Linux error code instead of the
proprietary error code, and the tools or utilities need to get the real
firmware error code by another command "bcmerrorstr" after receiving
the error.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:37 +08:00
Chi-Hsien Lin bfb37fbab4 MLK-18675-03 brcmfmac: Add sg parameters dts parsing
broken_sg_support, sd_head_align, and sd_sgentry_align are used in
brcmfmac code but not configurable in dts file. Add the parsing logic.
Now they can be configured like below in dts:
	brcm,broken_sg_support;
	brcm,sd_head_align = /bits/ 16 <4>;
	brcm,sd_sgentry_align = /bits/ 16 <4>;

Signed-off-by: Chi-hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:36 +08:00
Wright Feng 5b0d72e6ce MLK-18675-02 brcmfmac: Set F2 blksz and Watermark to 256 for 4373
We got SDIO_CRC_ERROR with 4373 on SDR104 when doing bi-directional
throughput test. Setting F2 blocksize and enable watermark to 256 to
guarantee the operation stability.

Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(Vipul: Fixed merge conflictts)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:36 +08:00
Sherry Sun 0f2229eedc MLK-22746-3 wireless: Changes for wireless and cfg80211 support
Pulling the following commits and some general changes from custom
v3.10 kernel for supporting qcacld2.0 on kernel v4.9.11.
1. cfg80211: Using new wiphy flag WIPHY_FLAG_DFS_OFFLOAD
When flag WIPHY_FLAG_DFS_OFFLOAD is defined, the driver would handle
all the DFS related operations. Therefore the kernel needs to ignore
the DFS state that it uses to block the userspace calls to the driver
through cfg80211 APIs. Also it should treat the userspace calls to
start radar detection as a no-op.

Please note that changes in util.c is not picked up explicitly.
Kernel v4.9.11 uses wrapper cfg80211_get_chans_dfs_required which takes
care of this change.

Change-Id: I9dd2076945581ca67e54dfc96dd3dbc526c6f0a2
IRs-Fixed: 202686

2. New db.txt from git/sforshee/wireless-regdb.git
CONFIG_CFG80211_INTERNAL_REGDB is enabled in build. This causes
kernel warn messages as db.txt is empty. A new db.txt is added
from:
git://git.kernel.org/pub/scm/linux/kernel/git/sforshee/wireless-regdb.git

IRs-Fixed: 202686

3. Picked up the declaration and definition of the function
cfg80211_is_gratuitous_arp_unsolicited_na

Change-Id: I1e4083a2327c121073226aa6b75bb6b5b97cec00
CRs-fixed: 1079453

Signed-off-by: Nakul Kachhwaha <nkachh@codeaurora.org>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
(Vipul: Fixed merge conflicts)
(TODO: checkpatch warnings)
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
2019-11-25 15:44:36 +08:00
Linus Torvalds 219d54332a Linux 5.4 2019-11-24 16:32:01 -08:00
Linus Torvalds b8387f6f34 Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull cramfs fix from Al Viro:
 "Regression fix, fallen through the cracks"

* 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  cramfs: fix usage on non-MTD device
2019-11-24 12:36:39 -08:00