staging: wilc1000: use runtime configuration for sdio oob interrupt
PATCH 1/4 staging: wilc1000: use runtime configuration for sdio oob interrupt
From: Ajay Singh <[email protected]>
Set SDIO Out-of-band interrupt configuration at run time by passing parameter during module load.
--- drivers/staging/wilc1000/Kconfig | 10 ---------- drivers/staging/wilc1000/sdio.c | 7 ++++++- 2 files changed, 6 insertions(+), 11 deletions(-)
drivers/staging/wilc1000/Kconfig +0 -10
@@ -30,13 +30,3 @@ config WILC1000_SPI full-duplex slave synchronous serial interface that is available immediately following reset when pin 9 (SDIO_SPI_CFG) is tied to VDDIO. Select this if your platform is using the SPI bus. - -config WILC1000_HW_OOB_INTR - bool "WILC1000 out of band interrupt" - depends on WILC1000_SDIO - help - This option enables out-of-band interrupt support for the WILC1000 - chipset. This OOB interrupt is intended to provide a faster interrupt - mechanism for SDIO host controllers that don't support SDIO interrupt. - Select this option If the SDIO host controller in your platform - doesn't support SDIO time devision interrupt.
drivers/staging/wilc1000/sdio.c +6 -1
@@ -11,6 +11,11 @@#include "netdev.h" #include "cfg80211.h" +static bool enable_oob_interrupt; +module_param (enable_oob_interrupt, bool,0644 ); +MODULE_PARM_DESC (enable_oob_interrupt, +"enables sdio out-of-band interrupt support" ); +#define SDIO_MODALIAS "wilc1000_sdio"#define SDIO_VENDOR_ID_WILC 0x0296
@@ -131,7 +136,7 @@ static int wilc_sdio_probe(struct sdio_func *func,if (!sdio_priv)return -ENOMEM ; -if (IS_ENABLED (CONFIG_WILC1000_HW_OOB_INTR )) { +if (enable_oob_interrupt) { gpio =gpiod_get (&func->dev,"irq" ,GPIOD_IN );if (IS_ERR (gpio)) {/* get the GPIO descriptor from hardcode GPIO number */
Signature · 1 line
2.24.0
PATCH 2/4 staging: wilc1000: remove unused compile time featurization
From: Ajay Singh <[email protected]>
Removed the unused compile type featurization. It's not recommended to have compile type feature. Currently removing these defines as they are not used. If any of these parameters are needed later should be added using run time feature.
--- drivers/staging/wilc1000/wlan.c | 23 ----------------------- 1 file changed, 23 deletions(-)
drivers/staging/wilc1000/wlan.c +0 -23
@@ -890,29 +890,6 @@ int wilc_wlan_start(struct wilc *wilc)if (wilc->io_type ==WILC_HIF_SDIO && wilc->dev_irq_num) reg |=WILC_HAVE_SDIO_IRQ_GPIO ; -#ifdef WILC_DISABLE_PMU -#else - reg |=WILC_HAVE_USE_PMU ; -#endif - -#ifdef WILC_SLEEP_CLK_SRC_XO - reg |=WILC_HAVE_SLEEP_CLK_SRC_XO ; -#elif definedWILC_SLEEP_CLK_SRC_RTC - reg |=WILC_HAVE_SLEEP_CLK_SRC_RTC ; -#endif - -#ifdef WILC_EXT_PA_INV_TX_RX - reg |=WILC_HAVE_EXT_PA_INV_TX_RX ; -#endif - reg |=WILC_HAVE_USE_IRQ_AS_HOST_WAKE ; - reg |=WILC_HAVE_LEGACY_RF_SETTINGS ; -#ifdef XTAL_24 - reg |=WILC_HAVE_XTAL_24 ; -#endif -#ifdef DISABLE_WILC_UART - reg |=WILC_HAVE_DISABLE_WILC_UART ; -#endif - ret = wilc->hif_func->hif_write_reg (wilc,WILC_GP_REG_1 , reg);if (!ret) {release_bus (wilc,WILC_BUS_RELEASE_ONLY );
Signature · 1 line
2.24.0
PATCH 3/4 staging: wilc1000: use kernel provided struct cast to extract mac header
In reply to [email protected]From: Ajay Singh <[email protected]>
To parse the mac header make use of *struct ieee80211_hdr* instead of extracting individual fields separately using pointer operation.
--- drivers/staging/wilc1000/netdev.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/staging/wilc1000/netdev.c +3 -6
@@ -96,21 +96,18 @@ void wilc_mac_indicate(struct wilc *wilc)static struct net_device *get_if_handler (struct wilc *wilc,u8 *mac_header) { -u8 *bssid, *bssid1;struct net_device *ndev =NULL ;struct wilc_vif *vif; - - bssid = mac_header +10 ; - bssid1 = mac_header +4 ; +struct ieee80211_hdr *h = (struct ieee80211_hdr *)mac_header;list_for_each_entry_rcu (vif, &wilc->vif_list, list) {if (vif->mode ==WILC_STATION_MODE ) -if (ether_addr_equal_unaligned (bssid, vif->bssid)) { +if (ether_addr_equal_unaligned (h->addr2, vif->bssid)) { ndev = vif->ndev; goto out; }if (vif->mode ==WILC_AP_MODE ) -if (ether_addr_equal_unaligned (bssid1, vif->bssid)) { +if (ether_addr_equal_unaligned (h->addr1, vif->bssid)) { ndev = vif->ndev; goto out; }
Signature · 1 line
2.24.0
PATCH 4/4 staging: wilc1000: use GENMASK to extract wid type
In reply to [email protected]From: Ajay Singh <[email protected]>
Refactor code by make use of 'GENMASK' to extract the WID type from buffer received from firmware.
--- drivers/staging/wilc1000/wlan.h | 1 + drivers/staging/wilc1000/wlan_cfg.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/staging/wilc1000/wlan.h +1 -0
@@ -197,6 +197,7 @@#define IS_MANAGMEMENT_CALLBACK 0x080#define IS_MGMT_STATUS_SUCCES 0x040 +#define WILC_WID_TYPE GENMASK(15, 12)/******************************************** * * Tx/Rx Queue Structure
drivers/staging/wilc1000/wlan_cfg.c +4 -4
@@ -4,6 +4,7 @@* All rights reserved. */ +#include <linux/bitfield.h> #include "wlan_if.h" #include "wlan.h" #include "wlan_cfg.h"
@@ -132,7 +133,6 @@ static int wilc_wlan_cfg_set_bin(u8 *frame, u32 offset, u16 id, u8 *b, u32 size)* ********************************************/ -#define GET_WID_TYPE (wid) (((wid) >> 12) & 0x7)static void wilc_wlan_parse_response_frame (struct wilc *wl,u8 *info,int size) {u16 wid;
@@ -142,7 +142,7 @@ static void wilc_wlan_parse_response_frame(struct wilc *wl, u8 *info, int size) i =0 ; wid =get_unaligned_le16 (info); -switch (GET_WID_TYPE (wid)) { +switch (FIELD_GET (WILC_WID_TYPE , wid)) {case WID_CHAR : do { if (wl->cfg.b[i].id == WID_NIL)
@@ -244,7 +244,7 @@ static void wilc_wlan_parse_info_frame(struct wilc *wl, u8 *info)int wilc_wlan_cfg_set_wid (u8 *frame,u32 offset,u16 id,u8 *buf,int size) { -u8 type = (id >>12 ) &0xf ; +u8 type =FIELD_GET (WILC_WID_TYPE , id);int ret =0 ;switch (type) {
@@ -290,7 +290,7 @@ int wilc_wlan_cfg_get_wid(u8 *frame, u32 offset, u16 id)int wilc_wlan_cfg_get_val (struct wilc *wl,u16 wid,u8 *buffer,u32 buffer_size) { -u32 type = (wid >>12 ) &0xf ; +u8 type =FIELD_GET (WILC_WID_TYPE , wid);int i, ret =0 ; i =0 ;
Signature · 1 line
2.24.0
Quoted 5 lines · On Fri, Nov 22, 2019 at 08:52:02PM +0000, [email protected] wrote:
From: Ajay Singh <[email protected]>
Set SDIO Out-of-band interrupt configuration at run time by passing parameter during module load.
This is barely an improvement at all... Why not just make it auto detect?
regards,
dan carpenter
Hi Adham,
Quoted 5 lines · On Sat, Nov 23, 2019 at 7:55 AM <[email protected]> wrote:
From: Ajay Singh <[email protected]>
Set SDIO Out-of-band interrupt configuration at run time by passing parameter during module load.
The OOB interrupt is a GPIO and this is an SDIO card, so why not just set the relevant pin in the devicetree and detect it based on that?
I'm pretty sure that the Broadcom fmac driver does something like this.
Thanks,
Signature · 4 lines
Julian Calaby Email: [email protected] Profile: http://www.google.com/profiles/julian.calaby/
Quoted 6 lines · Julian Calaby
Hi Adham,
The OOB interrupt is a GPIO and this is an SDIO card, so why not just set the relevant pin in the devicetree and detect it based on that?
I'm pretty sure that the Broadcom fmac driver does something like this.
Thanks Julian and Dan for your feedback. We will go through the fmac driver to see how to improve OOB selection based on that, and send v2 of this patch. Greg, will it be possible to ignore this patch for now and merge the rest of the patch series?
Thanks,
Adham
Greg KH
maintainerQuoted 11 lines · On Tue, Dec 03, 2019 at 07:10:26PM +0000, [email protected] wrote:
Quoted 6 lines · Julian Calaby
Hi Adham,
The OOB interrupt is a GPIO and this is an SDIO card, so why not just set the relevant pin in the devicetree and detect it based on that?
I'm pretty sure that the Broadcom fmac driver does something like this.
Thanks Julian and Dan for your feedback. We will go through the fmac driver to see how to improve OOB selection based on that, and send v2 of this patch. Greg, will it be possible to ignore this patch for now and merge the rest of the patch series?
Now ignored!