2019-11-22 20:52:51

by Adham Abozaeid

[permalink] [raw]
Subject: [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.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/Kconfig | 10 ----------
drivers/staging/wilc1000/sdio.c | 7 ++++++-
2 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/wilc1000/Kconfig b/drivers/staging/wilc1000/Kconfig
index 59e58550d139..e556d3c9039b 100644
--- a/drivers/staging/wilc1000/Kconfig
+++ b/drivers/staging/wilc1000/Kconfig
@@ -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.
diff --git a/drivers/staging/wilc1000/sdio.c b/drivers/staging/wilc1000/sdio.c
index 319e039380b0..098094ab5156 100644
--- a/drivers/staging/wilc1000/sdio.c
+++ b/drivers/staging/wilc1000/sdio.c
@@ -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 */
--
2.24.0


2019-11-22 20:53:19

by Adham Abozaeid

[permalink] [raw]
Subject: [PATCH 3/4] staging: wilc1000: use kernel provided struct cast to extract mac header

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.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/netdev.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/netdev.c b/drivers/staging/wilc1000/netdev.c
index d2c0b0f7cf63..3fd8e008f733 100644
--- a/drivers/staging/wilc1000/netdev.c
+++ b/drivers/staging/wilc1000/netdev.c
@@ -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;
}
--
2.24.0

2019-11-22 20:53:22

by Adham Abozaeid

[permalink] [raw]
Subject: [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.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/wlan.c | 23 -----------------------
1 file changed, 23 deletions(-)

diff --git a/drivers/staging/wilc1000/wlan.c b/drivers/staging/wilc1000/wlan.c
index d3de76126b78..ba5446724c93 100644
--- a/drivers/staging/wilc1000/wlan.c
+++ b/drivers/staging/wilc1000/wlan.c
@@ -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 defined WILC_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);
--
2.24.0

2019-11-22 20:53:23

by Adham Abozaeid

[permalink] [raw]
Subject: [PATCH 4/4] staging: wilc1000: use GENMASK to extract wid type

From: Ajay Singh <[email protected]>

Refactor code by make use of 'GENMASK' to extract the WID type from
buffer received from firmware.

Signed-off-by: Ajay Singh <[email protected]>
---
drivers/staging/wilc1000/wlan.h | 1 +
drivers/staging/wilc1000/wlan_cfg.c | 8 ++++----
2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/wlan.h b/drivers/staging/wilc1000/wlan.h
index 1f6957cf2e9c..44ae6ed6882c 100644
--- a/drivers/staging/wilc1000/wlan.h
+++ b/drivers/staging/wilc1000/wlan.h
@@ -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
diff --git a/drivers/staging/wilc1000/wlan_cfg.c b/drivers/staging/wilc1000/wlan_cfg.c
index 6f6b286788d1..2538435b82fd 100644
--- a/drivers/staging/wilc1000/wlan_cfg.c
+++ b/drivers/staging/wilc1000/wlan_cfg.c
@@ -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;
--
2.24.0

2019-11-25 06:55:59

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH 1/4] staging: wilc1000: use runtime configuration for sdio oob interrupt

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

2019-11-25 09:28:20

by Julian Calaby

[permalink] [raw]
Subject: Re: [PATCH 1/4] staging: wilc1000: use runtime configuration for sdio oob interrupt

Hi Adham,

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,

--
Julian Calaby

Email: [email protected]
Profile: http://www.google.com/profiles/julian.calaby/

2019-12-03 19:12:02

by Adham Abozaeid

[permalink] [raw]
Subject: Re: [PATCH 1/4] staging: wilc1000: use runtime configuration for sdio oob interrupt



On 11/25/19 2:26 AM, Julian Calaby wrote:
> 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

2019-12-10 09:28:24

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 1/4] staging: wilc1000: use runtime configuration for sdio oob interrupt

On Tue, Dec 03, 2019 at 07:10:26PM +0000, [email protected] wrote:
>
>
> On 11/25/19 2:26 AM, Julian Calaby wrote:
> > 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!