summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/microchip
AgeCommit message (Collapse)AuthorFilesLines
2021-04-17wilc1000: Bring MAC address setting in line with typical Linux behaviorDavid Mosberger-Tang1-9/+16
Linux network drivers normally disallow changing the MAC address when the interface is up. This driver has been different in that it allows to change the MAC address *only* when it's up. This patch brings wilc1000 behavior more in line with other network drivers. We could have replaced wilc_set_mac_addr() with eth_mac_addr() but that would break existing documentation on how to change the MAC address. Likewise, return -EADDRNOTAVAIL (not -EINVAL) when the specified MAC address is invalid or unavailable. Signed-off-by: David Mosberger-Tang <davidm@egauge.net> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20210303194846.1823596-1-davidm@egauge.net
2021-04-17wilc1000: Add support for enabling CRCDavid Mosberger-Tang2-64/+115
The driver so far has always disabled CRC protection. This means any data corruption that occurrs during the SPI transfers could go undetected. This patch adds module parameters enable_crc7 and enable_crc16 to selectively turn on CRC7 (for command transfers) and CRC16 (for data transfers), respectively. The default configuration remains unchanged, with both CRC7 and CRC16 off. The performance impact of CRC was measured by running ttcp -t four times in a row on a SAMA5 device: CRC7 CRC16 Throughput: Standard deviation: ---- ----- ----------- ------------------- off off 1720 +/- 48 KB/s on off 1658 +/- 58 KB/s on on 1579 +/- 84 KB/s Signed-off-by: David Mosberger-Tang <davidm@egauge.net> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20210227172818.1711071-4-davidm@egauge.net
2021-04-17wilc1000: Check for errors at end of DMA writeDavid Mosberger-Tang1-1/+61
After a DMA write to the WILC chip, check for and report any errors. This is based on code from the wilc driver in the linux-at91 repository. Signed-off-by: David Mosberger-Tang <davidm@egauge.net> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20210227172818.1711071-3-davidm@egauge.net
2021-04-17wilc1000: Introduce symbolic names for SPI protocol registerDavid Mosberger-Tang1-9/+29
The WILC1000 protocol control register has bits for enabling the CRCs (CRC7 for commands and CRC16 for data) and to set the data packet size. Define symbolic names for those so the code is more easily understood. Signed-off-by: David Mosberger-Tang <davidm@egauge.net> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20210227172818.1711071-2-davidm@egauge.net
2021-04-17wilc1000: Make SPI transfers work at 48MHzDavid Mosberger-Tang1-13/+29
For CMD_SINGLE_READ and CMD_INTERNAL_READ, WILC may insert one or more zero bytes between the command response and the DATA Start tag (0xf3). This behavior appears to be undocumented in "ATWILC1000 USER GUIDE" (https://tinyurl.com/4hhshdts) but we have observed 1-4 zero bytes when the SPI bus operates at 48MHz and none when it operates at 1MHz. This code is derived from the equivalent code of the wilc driver in the linux-at91 repository. Signed-off-by: David Mosberger-Tang <davidm@egauge.net> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20210227172818.1711071-1-davidm@egauge.net
2021-03-15wilc1000: use wilc handler as cookie in request_threaded_irq()Ajay Singh1-9/+5
Use same cookie for request_threaded_irq() & free_irq() to properly free IRQ during module unload. free_irq() already uses *wilc* handler so the changes are required for request_threaded_irq(). Signed-off-by: Ajay Singh <ajay.kathat@microchip.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20210225042302.17048-1-ajay.kathat@microchip.com
2021-03-15wilc1000: write value to WILC_INTR2_ENABLE registerMarcus Folkesson1-1/+1
Write the value instead of reading it twice. Fixes: c5c77ba18ea6 ("staging: wilc1000: Add SDIO/SPI 802.11 driver") Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20210224163706.519658-1-marcus.folkesson@gmail.com
2021-03-15wilc1000: Support chip sleep over SPIDavid Mosberger-Tang2-4/+58
chip_allow_sleep() only supported wakeup via SDIO, which made the driver unusable over SPI. This code is a straight forward port from the driver in the linux-at91 repository. Signed-off-by: David Mosberger-Tang <davidm@egauge.net> Acked-by: Ajay Singh <ajay.kathat@microchip.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20210224033317.1507603-1-davidm@egauge.net
2021-02-11wilc1000: Fix use of void pointer as a wrong struct typeVsevolod Kozlov3-9/+11
ac_classify() expects a struct sk_buff* as its second argument, which is a member of struct tx_complete_data. priv happens to be a pointer to struct tx_complete_data, so passing it directly to ac_classify() leads to wrong behaviour and occasional panics. Since there is only one caller of wilc_wlan_txq_add_net_pkt and it already knows the type behind this pointer, and the structure is already in the header file, change the function signature to use the real type instead of void* in order to prevent confusion. Signed-off-by: Vsevolod Kozlov <zaba@mm.st> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/YCQomJ1mO5BLxYOT@Vsevolods-Mini.lan
2021-02-06Merge tag 'wireless-drivers-next-2021-02-05' of ↵Jakub Kicinski2-5/+5
git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next Kalle Valo says: ==================== wireless-drivers-next patches for v5.12 First set of patches for v5.12. A smaller pull request this time, biggest feature being a better key handling for ath9k. And of course the usual fixes and cleanups all over. Major changes: ath9k * more robust encryption key cache management brcmfmac * support BCM4365E with 43666 ChipCommon chip ID * tag 'wireless-drivers-next-2021-02-05' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next: (35 commits) iwl4965: do not process non-QOS frames on txq->sched_retry path mt7601u: process tx URBs with status EPROTO properly wlcore: Fix command execute failure 19 for wl12xx mt7601u: use ieee80211_rx_list to pass frames to the network stack as a batch rtw88: 8723de: adjust the LTR setting rtlwifi: rtl8821ae: fix bool comparison in expressions rtlwifi: rtl8192se: fix bool comparison in expressions rtlwifi: rtl8188ee: fix bool comparison in expressions rtlwifi: rtl8192c-common: fix bool comparison in expressions rtlwifi: rtl_pci: fix bool comparison in expressions wlcore: Downgrade exceeded max RX BA sessions to debug wilc1000: use flexible-array member instead of zero-length array brcmfmac: clear EAP/association status bits on linkdown events brcmfmac: Delete useless kfree code qtnfmac_pcie: Use module_pci_driver mt7601u: check the status of device in calibration mt7601u: process URBs in status EPROTO properly brcmfmac: support BCM4365E with 43666 ChipCommon chip ID wilc1000: fix spelling mistake in Kconfig "devision" -> "division" mwifiex: pcie: Drop bogus __refdata annotation ... ==================== Link: https://lore.kernel.org/r/20210205161901.C7F83C433ED@smtp.codeaurora.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2021-01-22cfg80211: change netdev registration/unregistration semanticsJohannes Berg3-4/+4
We used to not require anything in terms of registering netdevs with cfg80211, using a netdev notifier instead. However, in the next patch reducing RTNL locking, this causes big problems, and the simplest way is to just require drivers to do things better. Change the registration/unregistration semantics to require the drivers to call cfg80211_(un)register_netdevice() when this is happening due to a cfg80211 request, i.e. add_virtual_intf() or del_virtual_intf() (or if it somehow has to happen in any other cfg80211 callback). Otherwise, in other contexts, drivers may continue to use the normal netdev (un)registration functions as usual. Internally, we still use the netdev notifier and track (by the new wdev->registered bool) if the wdev had already been added to cfg80211 or not. Link: https://lore.kernel.org/r/20210122161942.cf2f4b65e4e9.Ida8234e50da13eb675b557bac52a713ad4eddf71@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2021-01-14wilc1000: use flexible-array member instead of zero-length arrayTian Tao1-4/+4
Use flexible-array member introduced in C99 instead of zero-length array. Most of zero-length array was already taken care in previous patch [1]. [1]. https://patchwork.kernel.org/patch/11394197/ Signed-off-by: Tian Tao <tiantao6@hisilicon.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/1608881703-37060-1-git-send-email-tiantao6@hisilicon.com
2021-01-14wilc1000: fix spelling mistake in Kconfig "devision" -> "division"Colin Ian King1-1/+1
There is a spelling mistake in the Kconfig help text. Fix it. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20201216115808.12987-1-colin.king@canonical.com
2020-12-10wilc1000: changes for SPI communication stall issue found with IperfAjay Singh1-2/+21
Added retry mechanism to ensure VMM enable bit is set during the block transfer of data between host and WILC FW. Signed-off-by: Ajay Singh <ajay.kathat@microchip.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20201208103739.28597-1-ajay.kathat@microchip.com
2020-12-07wilc1000: remove redundant assignment to pointer vifColin Ian King1-1/+0
The assignment to pointer vif is redundant as the assigned value is never read, hence it can be removed. Addresses-Coverity: ("Unused value") Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Ajay Singh <ajay.kathat@microchip.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20201203174316.1071446-1-colin.king@canonical.com
2020-12-02wilc1000: added queue support for WMMAjay Singh4-61/+302
Added multiple queues[BK,BE,VI,VO] to handle different priority data packets. Before adding a packet to the queue, checked its priority from the header, and then add to the suitable queue. The limit for each queue is maintained separately. Also while passing the packets to the firmware via VMM take care to select data packets based on priority and available space. Signed-off-by: Ajay Singh <ajay.kathat@microchip.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20201125114059.10006-6-ajay.kathat@microchip.com
2020-12-02wilc1000: call complete() for failure in wilc_wlan_txq_add_cfg_pkt()Ajay Singh1-1/+3
Added complete() call for failure case in wilc_wlan_txq_add_cfg_pkt(). Signed-off-by: Ajay Singh <ajay.kathat@microchip.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20201125114059.10006-5-ajay.kathat@microchip.com
2020-12-02wilc1000: free resource in wilc_wlan_txq_add_mgmt_pkt() for failure pathAjay Singh1-2/+6
Before returing from wilc_wlan_txq_add_mgmt_pkt() invoke tx_complete_fn() callback to free up allocated memory for failure case. Signed-off-by: Ajay Singh <ajay.kathat@microchip.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20201125114059.10006-4-ajay.kathat@microchip.com
2020-12-02wilc1000: free resource in wilc_wlan_txq_add_net_pkt() for failure pathAjay Singh1-2/+6
Before returing from wilc_wlan_txq_add_net_pkt() invoke tx_complete_fn() callback to free up allocated memory for failure cases. Signed-off-by: Ajay Singh <ajay.kathat@microchip.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20201125114059.10006-3-ajay.kathat@microchip.com
2020-12-02wilc1000: added 'ndo_set_mac_address' callback supportAjay Singh3-0/+56
Added support for 'ndo_set_mac_address call' callback to allow change of interface MAC address. Signed-off-by: Ajay Singh <ajay.kathat@microchip.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20201125114059.10006-2-ajay.kathat@microchip.com
2020-09-21net: wilc1000: clean up resource in error path of init mon interfaceHuang Guobin1-2/+1
The wilc_wfi_init_mon_int() forgets to clean up resource when register_netdevice() failed. Add the missed call to fix it. And the return value of netdev_priv can't be NULL, so remove the unnecessary error handling. Fixes: 588713006ea4 ("staging: wilc1000: avoid the use of 'wilc_wfi_mon' static variable") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Huang Guobin <huangguobin4@huawei.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20200917123019.206382-1-huangguobin4@huawei.com
2020-08-27wilc1000: Fix memleak in wilc_bus_probeDinghao Liu1-2/+3
When devm_clk_get() returns -EPROBE_DEFER, spi_priv should be freed just like when wilc_cfg80211_init() fails. Fixes: 854d66df74aed ("staging: wilc1000: look for rtc_clk clock in spi mode") Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn> Acked-by: Ajay Singh <ajay.kathat@microchip.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20200820055256.24333-1-dinghao.liu@zju.edu.cn
2020-08-27wilc1000: Fix memleak in wilc_sdio_probeDinghao Liu1-2/+3
When devm_clk_get() returns -EPROBE_DEFER, sdio_priv should be freed just like when wilc_cfg80211_init() fails. Fixes: 8692b047e86cf ("staging: wilc1000: look for rtc_clk clock") Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn> Acked-by: Ajay Singh <ajay.kathat@microchip.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20200820054819.23365-1-dinghao.liu@zju.edu.cn
2020-08-02wilc1000: Move wilc1000 SDIO ID's from driver source to common header fileAjay Singh1-4/+2
Moved macros used for Vendor/Device ID from wilc1000 driver to common header file and changed macro name for consistency with other macros. Signed-off-by: Ajay Singh <ajay.kathat@microchip.com> Acked-by: Ulf Hansson <ulf.hansson@linaro.org> Acked-by: Pali Rohár <pali@kernel.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20200717051134.19160-1-ajay.kathat@microchip.com
2020-07-14wilc1000: let wilc_mac_xmit() return NETDEV_TX_OKLuc Van Oostenryck1-3/+3
The method ndo_start_xmit() is defined as returning an 'netdev_tx_t', which is a typedef for an enum type defining 'NETDEV_TX_OK' but this driver returns '0' instead of 'NETDEV_TX_OK'. Fix this by returning 'NETDEV_TX_OK' instead of '0'. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20200629104009.84077-1-luc.vanoostenryck@gmail.com
2020-07-14wilc1000: use API version number info along with firmware filenameAjay Singh2-5/+14
Added version number info along with firmware name so driver can pick the correct revision of FW file. Moved FW filename macro as part of driver code & added MODULE_FIRMWARE to specify FW needed by module. Signed-off-by: Ajay Singh <ajay.kathat@microchip.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20200710051826.3267-6-ajay.kathat@microchip.com
2020-07-14wilc1000: use unified single wilc1000 FW binaryAjay Singh2-13/+8
Modify WILC1000 binary filename to use single unified wilc1000 FW. A single wilc1000 binary is used for different wilc1000 revisions. Signed-off-by: Ajay Singh <ajay.kathat@microchip.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20200710051826.3267-5-ajay.kathat@microchip.com
2020-07-14wilc1000: fix compiler warning for 'wowlan_support' unused variableAjay Singh1-0/+2
Avoid below reported warning found when 'CONFIG_PM' config is undefined. 'warning: unused variable 'wowlan_support' [-Wunused-const-variable]' Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Ajay Singh <ajay.kathat@microchip.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20200710051826.3267-4-ajay.kathat@microchip.com
2020-07-14wilc1000: use strlcpy to avoid 'stringop-truncation' warningAjay Singh1-2/+1
Make use 'strlcpy' instead of 'strncpy' to overcome 'stringop-truncation' compiler warning. Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Ajay Singh <ajay.kathat@microchip.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20200710051826.3267-3-ajay.kathat@microchip.com
2020-06-26wilc1000: move wilc driver out of stagingAjay Singh19-0/+10600
WILC1000 is an IEEE 802.11 b/g/n IoT link controller module. The WILC1000 connects to Microchip AVR/SMART MCUs, SMART MPUs, and other processors with minimal resource requirements with a simple SPI/SDIO-to-Wi-Fi interface. WILC1000 driver has been part of staging for few years. With contributions from the community, it has improved significantly. Full driver review has helped in achieving the current state. The details for those reviews are captured in 1 & 2. [1]. https://lore.kernel.org/linux-wireless/1537957525-11467-1-git-send-email-ajay.kathat@microchip.com/ [2]. https://lore.kernel.org/linux-wireless/1562896697-8002-1-git-send-email-ajay.kathat@microchip.com/ Signed-off-by: Ajay Singh <ajay.kathat@microchip.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>