DriverDev-Devel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 1/4] staging: wilc1000: use runtime configuration for sdio oob interrupt
@ 2019-11-22 20:52 Adham.Abozaeid
  2019-11-22 20:52 ` [PATCH 2/4] staging: wilc1000: remove unused compile time featurization Adham.Abozaeid
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Adham.Abozaeid @ 2019-11-22 20:52 UTC (permalink / raw)
  To: linux-wireless; +Cc: devel, gregkh, johannes, Ajay.Kathat

From: Ajay Singh <ajay.kathat@microchip.com>

Set SDIO Out-of-band interrupt configuration at run time by passing
parameter during module load.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 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

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/4] staging: wilc1000: remove unused compile time featurization
  2019-11-22 20:52 [PATCH 1/4] staging: wilc1000: use runtime configuration for sdio oob interrupt Adham.Abozaeid
@ 2019-11-22 20:52 ` Adham.Abozaeid
  2019-11-22 20:52 ` [PATCH 3/4] staging: wilc1000: use kernel provided struct cast to extract mac header Adham.Abozaeid
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Adham.Abozaeid @ 2019-11-22 20:52 UTC (permalink / raw)
  To: linux-wireless; +Cc: devel, gregkh, johannes, Ajay.Kathat

From: Ajay Singh <ajay.kathat@microchip.com>

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 <ajay.kathat@microchip.com>
---
 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

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 3/4] staging: wilc1000: use kernel provided struct cast to extract mac header
  2019-11-22 20:52 [PATCH 1/4] staging: wilc1000: use runtime configuration for sdio oob interrupt Adham.Abozaeid
  2019-11-22 20:52 ` [PATCH 2/4] staging: wilc1000: remove unused compile time featurization Adham.Abozaeid
@ 2019-11-22 20:52 ` Adham.Abozaeid
  2019-11-22 20:52 ` [PATCH 4/4] staging: wilc1000: use GENMASK to extract wid type Adham.Abozaeid
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Adham.Abozaeid @ 2019-11-22 20:52 UTC (permalink / raw)
  To: linux-wireless; +Cc: devel, gregkh, johannes, Ajay.Kathat

From: Ajay Singh <ajay.kathat@microchip.com>

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 <ajay.kathat@microchip.com>
---
 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

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 4/4] staging: wilc1000: use GENMASK to extract wid type
  2019-11-22 20:52 [PATCH 1/4] staging: wilc1000: use runtime configuration for sdio oob interrupt Adham.Abozaeid
  2019-11-22 20:52 ` [PATCH 2/4] staging: wilc1000: remove unused compile time featurization Adham.Abozaeid
  2019-11-22 20:52 ` [PATCH 3/4] staging: wilc1000: use kernel provided struct cast to extract mac header Adham.Abozaeid
@ 2019-11-22 20:52 ` Adham.Abozaeid
  2019-11-25  6:54 ` [PATCH 1/4] staging: wilc1000: use runtime configuration for sdio oob interrupt Dan Carpenter
  2019-11-25  9:26 ` Julian Calaby
  4 siblings, 0 replies; 7+ messages in thread
From: Adham.Abozaeid @ 2019-11-22 20:52 UTC (permalink / raw)
  To: linux-wireless; +Cc: devel, gregkh, johannes, Ajay.Kathat

From: Ajay Singh <ajay.kathat@microchip.com>

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

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 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

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/4] staging: wilc1000: use runtime configuration for sdio oob interrupt
  2019-11-22 20:52 [PATCH 1/4] staging: wilc1000: use runtime configuration for sdio oob interrupt Adham.Abozaeid
                   ` (2 preceding siblings ...)
  2019-11-22 20:52 ` [PATCH 4/4] staging: wilc1000: use GENMASK to extract wid type Adham.Abozaeid
@ 2019-11-25  6:54 ` Dan Carpenter
  2019-11-25  9:26 ` Julian Calaby
  4 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2019-11-25  6:54 UTC (permalink / raw)
  To: Adham.Abozaeid; +Cc: devel, gregkh, johannes, linux-wireless, Ajay.Kathat

On Fri, Nov 22, 2019 at 08:52:02PM +0000, Adham.Abozaeid@microchip.com wrote:
> From: Ajay Singh <ajay.kathat@microchip.com>
> 
> 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

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/4] staging: wilc1000: use runtime configuration for sdio oob interrupt
  2019-11-22 20:52 [PATCH 1/4] staging: wilc1000: use runtime configuration for sdio oob interrupt Adham.Abozaeid
                   ` (3 preceding siblings ...)
  2019-11-25  6:54 ` [PATCH 1/4] staging: wilc1000: use runtime configuration for sdio oob interrupt Dan Carpenter
@ 2019-11-25  9:26 ` Julian Calaby
  2019-12-03 19:10   ` Adham.Abozaeid
  4 siblings, 1 reply; 7+ messages in thread
From: Julian Calaby @ 2019-11-25  9:26 UTC (permalink / raw)
  To: Adham Abozaeid; +Cc: devel, Greg KH, Johannes Berg, linux-wireless, Ajay Singh

Hi Adham,

On Sat, Nov 23, 2019 at 7:55 AM <Adham.Abozaeid@microchip.com> wrote:
>
> From: Ajay Singh <ajay.kathat@microchip.com>
>
> 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: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/4] staging: wilc1000: use runtime configuration for sdio oob interrupt
  2019-11-25  9:26 ` Julian Calaby
@ 2019-12-03 19:10   ` Adham.Abozaeid
  0 siblings, 0 replies; 7+ messages in thread
From: Adham.Abozaeid @ 2019-12-03 19:10 UTC (permalink / raw)
  To: julian.calaby; +Cc: devel, gregkh, johannes, linux-wireless, Ajay.Kathat



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
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-22 20:52 [PATCH 1/4] staging: wilc1000: use runtime configuration for sdio oob interrupt Adham.Abozaeid
2019-11-22 20:52 ` [PATCH 2/4] staging: wilc1000: remove unused compile time featurization Adham.Abozaeid
2019-11-22 20:52 ` [PATCH 3/4] staging: wilc1000: use kernel provided struct cast to extract mac header Adham.Abozaeid
2019-11-22 20:52 ` [PATCH 4/4] staging: wilc1000: use GENMASK to extract wid type Adham.Abozaeid
2019-11-25  6:54 ` [PATCH 1/4] staging: wilc1000: use runtime configuration for sdio oob interrupt Dan Carpenter
2019-11-25  9:26 ` Julian Calaby
2019-12-03 19:10   ` Adham.Abozaeid

DriverDev-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/driverdev-devel/0 driverdev-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 driverdev-devel driverdev-devel/ https://lore.kernel.org/driverdev-devel \
		driverdev-devel@linuxdriverproject.org devel@driverdev.osuosl.org
	public-inbox-index driverdev-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.linuxdriverproject.driverdev-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git