diff mbox series

[v7,17/17] wilc1000: add Makefile and Kconfig files for wilc1000 compilation

Message ID 20200623110000.31559-18-ajay.kathat@microchip.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show
Series wilc1000: move out of staging | expand

Commit Message

Ajay Singh June 23, 2020, 11 a.m. UTC
From: Ajay Singh <ajay.kathat@microchip.com>

Added Makefile and Kconfig files for compiling wilc1000 module from
'drivers/net/wireless/microchip/'.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
---
 drivers/net/wireless/Kconfig                  |  1 +
 drivers/net/wireless/Makefile                 |  1 +
 drivers/net/wireless/microchip/Kconfig        | 15 ++++++
 drivers/net/wireless/microchip/Makefile       |  2 +
 .../net/wireless/microchip/wilc1000/Kconfig   | 47 +++++++++++++++++++
 .../net/wireless/microchip/wilc1000/Makefile  | 14 ++++++
 drivers/staging/Kconfig                       |  2 -
 drivers/staging/Makefile                      |  1 -
 8 files changed, 80 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/wireless/microchip/Kconfig
 create mode 100644 drivers/net/wireless/microchip/Makefile
 create mode 100644 drivers/net/wireless/microchip/wilc1000/Kconfig
 create mode 100644 drivers/net/wireless/microchip/wilc1000/Makefile

Comments

kernel test robot June 23, 2020, 2:52 p.m. UTC | #1
Hi,

I love your patch! Perhaps something to improve:

[auto build test WARNING on a15a20acc980342c97d804c5fae1cfc0cd7712a9]

url:    https://github.com/0day-ci/linux/commits/Ajay-Kathat-microchip-com/wilc1000-move-out-of-staging/20200623-190333
base:    a15a20acc980342c97d804c5fae1cfc0cd7712a9
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=ia64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/net/wireless/microchip/wilc1000/mon.c: In function 'wilc_wfi_init_mon_interface':
>> drivers/net/wireless/microchip/wilc1000/mon.c:232:2: warning: 'strncpy' specified bound 16 equals destination size [-Wstringop-truncation]
     232 |  strncpy(wl->monitor_dev->name, name, IFNAMSIZ);
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/strncpy +232 drivers/net/wireless/microchip/wilc1000/mon.c

daf8b5f14a7066 Ajay Singh 2020-06-23  216  
daf8b5f14a7066 Ajay Singh 2020-06-23  217  struct net_device *wilc_wfi_init_mon_interface(struct wilc *wl,
daf8b5f14a7066 Ajay Singh 2020-06-23  218  					       const char *name,
daf8b5f14a7066 Ajay Singh 2020-06-23  219  					       struct net_device *real_dev)
daf8b5f14a7066 Ajay Singh 2020-06-23  220  {
daf8b5f14a7066 Ajay Singh 2020-06-23  221  	struct wilc_wfi_mon_priv *priv;
daf8b5f14a7066 Ajay Singh 2020-06-23  222  
daf8b5f14a7066 Ajay Singh 2020-06-23  223  	/* If monitor interface is already initialized, return it */
daf8b5f14a7066 Ajay Singh 2020-06-23  224  	if (wl->monitor_dev)
daf8b5f14a7066 Ajay Singh 2020-06-23  225  		return wl->monitor_dev;
daf8b5f14a7066 Ajay Singh 2020-06-23  226  
daf8b5f14a7066 Ajay Singh 2020-06-23  227  	wl->monitor_dev = alloc_etherdev(sizeof(struct wilc_wfi_mon_priv));
daf8b5f14a7066 Ajay Singh 2020-06-23  228  	if (!wl->monitor_dev)
daf8b5f14a7066 Ajay Singh 2020-06-23  229  		return NULL;
daf8b5f14a7066 Ajay Singh 2020-06-23  230  
daf8b5f14a7066 Ajay Singh 2020-06-23  231  	wl->monitor_dev->type = ARPHRD_IEEE80211_RADIOTAP;
daf8b5f14a7066 Ajay Singh 2020-06-23 @232  	strncpy(wl->monitor_dev->name, name, IFNAMSIZ);
daf8b5f14a7066 Ajay Singh 2020-06-23  233  	wl->monitor_dev->name[IFNAMSIZ - 1] = 0;
daf8b5f14a7066 Ajay Singh 2020-06-23  234  	wl->monitor_dev->netdev_ops = &wilc_wfi_netdev_ops;
daf8b5f14a7066 Ajay Singh 2020-06-23  235  	wl->monitor_dev->needs_free_netdev = true;
daf8b5f14a7066 Ajay Singh 2020-06-23  236  
daf8b5f14a7066 Ajay Singh 2020-06-23  237  	if (register_netdevice(wl->monitor_dev)) {
daf8b5f14a7066 Ajay Singh 2020-06-23  238  		netdev_err(real_dev, "register_netdevice failed\n");
daf8b5f14a7066 Ajay Singh 2020-06-23  239  		return NULL;
daf8b5f14a7066 Ajay Singh 2020-06-23  240  	}
daf8b5f14a7066 Ajay Singh 2020-06-23  241  	priv = netdev_priv(wl->monitor_dev);
daf8b5f14a7066 Ajay Singh 2020-06-23  242  	if (!priv)
daf8b5f14a7066 Ajay Singh 2020-06-23  243  		return NULL;
daf8b5f14a7066 Ajay Singh 2020-06-23  244  
daf8b5f14a7066 Ajay Singh 2020-06-23  245  	priv->real_ndev = real_dev;
daf8b5f14a7066 Ajay Singh 2020-06-23  246  
daf8b5f14a7066 Ajay Singh 2020-06-23  247  	return wl->monitor_dev;
daf8b5f14a7066 Ajay Singh 2020-06-23  248  }
daf8b5f14a7066 Ajay Singh 2020-06-23  249  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Ajay Singh June 24, 2020, 5:26 a.m. UTC | #2
On 23/06/20 8:22 pm, kernel test robot wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Hi,
> 
> I love your patch! Perhaps something to improve:
> 
> [auto build test WARNING on a15a20acc980342c97d804c5fae1cfc0cd7712a9]
> 
> url:    https://github.com/0day-ci/linux/commits/Ajay-Kathat-microchip-com/wilc1000-move-out-of-staging/20200623-190333
> base:    a15a20acc980342c97d804c5fae1cfc0cd7712a9
> config: ia64-allmodconfig (attached as .config)
> compiler: ia64-linux-gcc (GCC) 9.3.0
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=ia64
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
>    drivers/net/wireless/microchip/wilc1000/mon.c: In function 'wilc_wfi_init_mon_interface':
>>> drivers/net/wireless/microchip/wilc1000/mon.c:232:2: warning: 'strncpy' specified bound 16 equals destination size [-Wstringop-truncation]
>      232 |  strncpy(wl->monitor_dev->name, name, IFNAMSIZ);
>          |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Though replacing 'strncpy' with 'strlcpy' will help to suppress this
warning but not sure if its true alarm because next line sets NULL
termination for string.
I agree 'strlcpy' is better candidate here and reduces one extra line.

> 
> vim +/strncpy +232 drivers/net/wireless/microchip/wilc1000/mon.c
> 
> daf8b5f14a7066 Ajay Singh 2020-06-23  216
> daf8b5f14a7066 Ajay Singh 2020-06-23  217  struct net_device *wilc_wfi_init_mon_interface(struct wilc *wl,
> daf8b5f14a7066 Ajay Singh 2020-06-23  218                                              const char *name,
> daf8b5f14a7066 Ajay Singh 2020-06-23  219                                              struct net_device *real_dev)
> daf8b5f14a7066 Ajay Singh 2020-06-23  220  {
> daf8b5f14a7066 Ajay Singh 2020-06-23  221       struct wilc_wfi_mon_priv *priv;
> daf8b5f14a7066 Ajay Singh 2020-06-23  222
> daf8b5f14a7066 Ajay Singh 2020-06-23  223       /* If monitor interface is already initialized, return it */
> daf8b5f14a7066 Ajay Singh 2020-06-23  224       if (wl->monitor_dev)
> daf8b5f14a7066 Ajay Singh 2020-06-23  225               return wl->monitor_dev;
> daf8b5f14a7066 Ajay Singh 2020-06-23  226
> daf8b5f14a7066 Ajay Singh 2020-06-23  227       wl->monitor_dev = alloc_etherdev(sizeof(struct wilc_wfi_mon_priv));
> daf8b5f14a7066 Ajay Singh 2020-06-23  228       if (!wl->monitor_dev)
> daf8b5f14a7066 Ajay Singh 2020-06-23  229               return NULL;
> daf8b5f14a7066 Ajay Singh 2020-06-23  230
> daf8b5f14a7066 Ajay Singh 2020-06-23  231       wl->monitor_dev->type = ARPHRD_IEEE80211_RADIOTAP;
> daf8b5f14a7066 Ajay Singh 2020-06-23 @232       strncpy(wl->monitor_dev->name, name, IFNAMSIZ);
> daf8b5f14a7066 Ajay Singh 2020-06-23  233       wl->monitor_dev->name[IFNAMSIZ - 1] = 0;
> daf8b5f14a7066 Ajay Singh 2020-06-23  234       wl->monitor_dev->netdev_ops = &wilc_wfi_netdev_ops;
> daf8b5f14a7066 Ajay Singh 2020-06-23  235       wl->monitor_dev->needs_free_netdev = true;
> daf8b5f14a7066 Ajay Singh 2020-06-23  236
> daf8b5f14a7066 Ajay Singh 2020-06-23  237       if (register_netdevice(wl->monitor_dev)) {
> daf8b5f14a7066 Ajay Singh 2020-06-23  238               netdev_err(real_dev, "register_netdevice failed\n");
> daf8b5f14a7066 Ajay Singh 2020-06-23  239               return NULL;
> daf8b5f14a7066 Ajay Singh 2020-06-23  240       }
> daf8b5f14a7066 Ajay Singh 2020-06-23  241       priv = netdev_priv(wl->monitor_dev);
> daf8b5f14a7066 Ajay Singh 2020-06-23  242       if (!priv)
> daf8b5f14a7066 Ajay Singh 2020-06-23  243               return NULL;
> daf8b5f14a7066 Ajay Singh 2020-06-23  244
> daf8b5f14a7066 Ajay Singh 2020-06-23  245       priv->real_ndev = real_dev;
> daf8b5f14a7066 Ajay Singh 2020-06-23  246
> daf8b5f14a7066 Ajay Singh 2020-06-23  247       return wl->monitor_dev;
> daf8b5f14a7066 Ajay Singh 2020-06-23  248  }
> daf8b5f14a7066 Ajay Singh 2020-06-23  249
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
>
diff mbox series

Patch

diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index 8ab62bb6b853..be0de242d8fd 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -47,6 +47,7 @@  source "drivers/net/wireless/st/Kconfig"
 source "drivers/net/wireless/ti/Kconfig"
 source "drivers/net/wireless/zydas/Kconfig"
 source "drivers/net/wireless/quantenna/Kconfig"
+source "drivers/net/wireless/microchip/Kconfig"
 
 config PCMCIA_RAYCS
 	tristate "Aviator/Raytheon 2.4GHz wireless support"
diff --git a/drivers/net/wireless/Makefile b/drivers/net/wireless/Makefile
index 6cfe74515c95..f9a51c2889ca 100644
--- a/drivers/net/wireless/Makefile
+++ b/drivers/net/wireless/Makefile
@@ -19,6 +19,7 @@  obj-$(CONFIG_WLAN_VENDOR_ST) += st/
 obj-$(CONFIG_WLAN_VENDOR_TI) += ti/
 obj-$(CONFIG_WLAN_VENDOR_ZYDAS) += zydas/
 obj-$(CONFIG_WLAN_VENDOR_QUANTENNA) += quantenna/
+obj-$(CONFIG_WLAN_VENDOR_MICROCHIP) += microchip/
 
 # 16-bit wireless PCMCIA client drivers
 obj-$(CONFIG_PCMCIA_RAYCS)	+= ray_cs.o
diff --git a/drivers/net/wireless/microchip/Kconfig b/drivers/net/wireless/microchip/Kconfig
new file mode 100644
index 000000000000..a6b46fb6b1ec
--- /dev/null
+++ b/drivers/net/wireless/microchip/Kconfig
@@ -0,0 +1,15 @@ 
+# SPDX-License-Identifier: GPL-2.0
+config WLAN_VENDOR_MICROCHIP
+	bool "Microchip devices"
+	default y
+	help
+	If you have a wireless card belonging to this class, say Y.
+
+	Note that the answer to this question doesn't directly affect the
+	kernel: saying N will just cause the configurator to skip all the
+	questions about these cards. If you say Y, you will be asked for
+	your specific card in the following questions.
+
+if WLAN_VENDOR_MICROCHIP
+source "drivers/net/wireless/microchip/wilc1000/Kconfig"
+endif # WLAN_VENDOR_MICROCHIP
diff --git a/drivers/net/wireless/microchip/Makefile b/drivers/net/wireless/microchip/Makefile
new file mode 100644
index 000000000000..73b763c7393e
--- /dev/null
+++ b/drivers/net/wireless/microchip/Makefile
@@ -0,0 +1,2 @@ 
+# SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_WILC1000)		+= wilc1000/
diff --git a/drivers/net/wireless/microchip/wilc1000/Kconfig b/drivers/net/wireless/microchip/wilc1000/Kconfig
new file mode 100644
index 000000000000..80c92e8bf8a5
--- /dev/null
+++ b/drivers/net/wireless/microchip/wilc1000/Kconfig
@@ -0,0 +1,47 @@ 
+# SPDX-License-Identifier: GPL-2.0
+config WILC1000
+	tristate
+	help
+	  Add support for the Atmel WILC1000 802.11 b/g/n SoC.
+	  This provides Wi-FI over an SDIO or SPI interface, and
+	  is usually found in IoT devices.
+
+	  This module only support IEEE 802.11n WiFi.
+
+config WILC1000_SDIO
+	tristate "Atmel WILC1000 SDIO (WiFi only)"
+	depends on CFG80211 && INET && MMC
+	select WILC1000
+	help
+	  This module adds support for the SDIO interface of adapters using
+	  WILC1000 chipset. The Atmel WILC1000 SDIO is a full speed interface.
+	  It meets SDIO card specification version 2.0. The interface supports
+	  the 1-bit/4-bit SD transfer mode at the clock range of 0-50 MHz.
+	  The host can use this interface to read and write from any register
+	  within the chip as well as configure the WILC1000 for data DMA.
+	  To use this interface, pin9 (SDIO_SPI_CFG) must be grounded. Select
+	  this if your platform is using the SDIO bus.
+
+config WILC1000_SPI
+	tristate "Atmel WILC1000 SPI (WiFi only)"
+	depends on CFG80211 && INET && SPI
+	select WILC1000
+	select CRC7
+	help
+	  This module adds support for the SPI interface of adapters using
+	  WILC1000 chipset. The Atmel WILC1000 has a Serial Peripheral
+	  Interface (SPI) that operates as a SPI slave. This SPI interface can
+	  be used for control and for serial I/O of 802.11 data. The SPI is a
+	  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/net/wireless/microchip/wilc1000/Makefile b/drivers/net/wireless/microchip/wilc1000/Makefile
new file mode 100644
index 000000000000..a3305a0a888a
--- /dev/null
+++ b/drivers/net/wireless/microchip/wilc1000/Makefile
@@ -0,0 +1,14 @@ 
+# SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_WILC1000) += wilc1000.o
+
+ccflags-y += -DFIRMWARE_1002=\"atmel/wilc1002_firmware.bin\" \
+		-DFIRMWARE_1003=\"atmel/wilc1003_firmware.bin\"
+
+wilc1000-objs := cfg80211.o netdev.o mon.o \
+			hif.o wlan_cfg.o wlan.o
+
+obj-$(CONFIG_WILC1000_SDIO) += wilc1000-sdio.o
+wilc1000-sdio-objs += sdio.o
+
+obj-$(CONFIG_WILC1000_SPI) += wilc1000-spi.o
+wilc1000-spi-objs += spi.o
diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index 4ec5528f89fa..b3fb4d41e231 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -84,8 +84,6 @@  source "drivers/staging/fbtft/Kconfig"
 
 source "drivers/staging/fsl-dpaa2/Kconfig"
 
-source "drivers/staging/wilc1000/Kconfig"
-
 source "drivers/staging/most/Kconfig"
 
 source "drivers/staging/ks7010/Kconfig"
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index 4d34198151b3..3d8c7ea21a10 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -32,7 +32,6 @@  obj-$(CONFIG_UNISYSSPAR)	+= unisys/
 obj-$(CONFIG_COMMON_CLK_XLNX_CLKWZRD)	+= clocking-wizard/
 obj-$(CONFIG_FB_TFT)		+= fbtft/
 obj-$(CONFIG_FSL_DPAA2)		+= fsl-dpaa2/
-obj-$(CONFIG_WILC1000)		+= wilc1000/
 obj-$(CONFIG_MOST)		+= most/
 obj-$(CONFIG_KS7010)		+= ks7010/
 obj-$(CONFIG_GREYBUS)		+= greybus/