Skip to contentSkip to conversation

dt-bindings: wireless: wilc1000: Document WILC3000 compatible string

PATCH Superseded Marek Vasut 2 participants 20 messages Sep 9, 2024 – Sep 10, 2024

Subsystems (5)

v5 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/9 dt-bindings: wireless: wilc1000: Document WILC3000 compatible string

Document compatible string for the WILC3000 chip. The chip is similar to WILC1000, except that the register layout is slightly different and it does not support WPA3/SAE.

---
Cc: "David S. Miller" <[email protected]>
Cc: Adham Abozaeid <[email protected]>
Cc: Ajay Singh <[email protected]>
Cc: Alexis Lothoré <[email protected]>
Cc: Claudiu Beznea <[email protected]>
Cc: Conor Dooley <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Paolo Abeni <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
V2: - Use WILC1000 as fallback compatible string for WILC3000
V3: - Swap the wilc1000/wilc3000 compatible order
V4: - Add RB from Krzysztof
V5: No change

---
 .../bindings/net/wireless/microchip,wilc1000.yaml           | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml +5 -1
index 2460ccc082371..5d40f22765bb6 100644
@@ -16,7 +16,11 @@ description:
 
 properties:
   compatible:
-    const: microchip,wilc1000
+    oneOf:
+      - items:
+          - const: microchip,wilc3000
+          - const: microchip,wilc1000
+      - const: microchip,wilc1000
 
   reg: true
 
Signature · 1 line
2.45.2
#1 lore raw

PATCH v5 2/9 wifi: wilc1000: Fold wilc_get_chipid() into wlan.c

Do not use wilc_get_chipid() outside of wlan.c . Instead, call wilc_get_chipid() right after the SDIO/SPI interface has been initialized to cache the device chipid, and then use the cached chipid throughout the driver. Make wilc_get_chipid() static and remove its prototype from wlan.h . Make wilc_get_chipid() return a proper return value instead of a chipid.

---
Cc: "David S. Miller" <[email protected]>
Cc: Adham Abozaeid <[email protected]>
Cc: Ajay Singh <[email protected]>
Cc: Alexis Lothoré <[email protected]>
Cc: Claudiu Beznea <[email protected]>
Cc: Conor Dooley <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Paolo Abeni <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
V2: New patch
V3: - Undo setup in wilc_wlan_init() if chip is neither wilc1000 or wilc3000
- Make wilc_get_chipid() return proper return value
V4: - Drop wilc_get_chipid() from netdev.c
- Add RB from Alexis
V5: No change

---
 .../net/wireless/microchip/wilc1000/netdev.c  |  6 +-
 .../net/wireless/microchip/wilc1000/sdio.c    | 13 ----
 .../net/wireless/microchip/wilc1000/wlan.c    | 74 +++++++++++--------
 .../net/wireless/microchip/wilc1000/wlan.h    |  1 -
 4 files changed, 46 insertions(+), 48 deletions(-)
drivers/net/wireless/microchip/wilc1000/netdev.c +3 -3
index 9ecf3fb29b558..086e70d833e06 100644
@@ -195,13 +195,13 @@ static int wilc_wlan_get_firmware(struct net_device *dev)
 {
 	struct wilc_vif *vif = netdev_priv(dev);
 	struct wilc *wilc = vif->wilc;
-	int chip_id;
 	const struct firmware *wilc_fw;
 	int ret;
 
-	chip_id = wilc_get_chipid(wilc, false);
+	if (!is_wilc1000(wilc->chipid))
+		return -EINVAL;
 
-	netdev_info(dev, "ChipID [%x] loading firmware [%s]\n", chip_id,
+	netdev_info(dev, "WILC1000 loading firmware [%s]\n",
 		    WILC1000_FW(WILC1000_API_VER));
 
 	ret = request_firmware(&wilc_fw, WILC1000_FW(WILC1000_API_VER),
drivers/net/wireless/microchip/wilc1000/sdio.c +0 -13
index 41122199d51eb..90357c89ae29b 100644
@@ -671,7 +671,6 @@ static int wilc_sdio_init(struct wilc *wilc, bool resume)
 	struct wilc_sdio *sdio_priv = wilc->bus_data;
 	struct sdio_cmd52 cmd;
 	int loop, ret;
-	u32 chipid;
 
 	/**
 	 *      function 0 csa enable
@@ -760,18 +759,6 @@ static int wilc_sdio_init(struct wilc *wilc, bool resume)
 		return ret;
 	}
 
-	/**
-	 *      make sure can read back chip id correctly
-	 **/
-	if (!resume) {
-		ret = wilc_sdio_read_reg(wilc, WILC_CHIPID, &chipid);
-		if (ret) {
-			dev_err(&func->dev, "Fail cmd read chip id...\n");
-			return ret;
-		}
-		dev_err(&func->dev, "chipid (%08x)\n", chipid);
-	}
-
 	sdio_priv->isinit = true;
 	return 0;
 }
drivers/net/wireless/microchip/wilc1000/wlan.c +43 -31

104 lines not on this page · raw message

drivers/net/wireless/microchip/wilc1000/wlan.h +0 -1
index dd2fb3c2f06a2..ae187192a79c6 100644
@@ -443,6 +443,5 @@ void chip_wakeup(struct wilc *wilc);
 int wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, struct wid *wids,
 			 u32 count);
 int wilc_wlan_init(struct net_device *dev);
-u32 wilc_get_chipid(struct wilc *wilc, bool update);
 int wilc_load_mac_from_nv(struct wilc *wilc);
 #endif
Signature · 1 line
2.45.2
#2 lore raw

PATCH v5 3/9 wifi: wilc1000: Fold chip_allow_sleep()/chip_wakeup() into wlan.c

In reply to Marek Vasut

Neither chip_allow_sleep()/chip_wakeup() is used outside of wlan.c . Make both functions static and remove both the exported symbol and entries from wlan.h .

Make chip_allow_sleep() return error code in preparation for the follow up patches.

Move acquire_bus() and release_bus() to avoid forward declaration of chip_allow_sleep()/chip_wakeup().

---
Cc: "David S. Miller" <[email protected]>
Cc: Adham Abozaeid <[email protected]>
Cc: Ajay Singh <[email protected]>
Cc: Alexis Lothoré <[email protected]>
Cc: Claudiu Beznea <[email protected]>
Cc: Conor Dooley <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Paolo Abeni <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
V2: New patch
V3: No change
V4: Add RB from Alexis
V5: No change

---
 .../net/wireless/microchip/wilc1000/wlan.c    | 47 +++++++++----------
 .../net/wireless/microchip/wilc1000/wlan.h    |  2 -
 2 files changed, 23 insertions(+), 26 deletions(-)
drivers/net/wireless/microchip/wilc1000/wlan.c +23 -24
index 5b7dd37267de0..d228c5df82628 100644
@@ -12,20 +12,6 @@
 
 #define WAKE_UP_TRIAL_RETRY		10000
 
-static inline void acquire_bus(struct wilc *wilc, enum bus_acquire acquire)
-{
-	mutex_lock(&wilc->hif_cs);
-	if (acquire == WILC_BUS_ACQUIRE_AND_WAKEUP && wilc->power_save_mode)
-		chip_wakeup(wilc);
-}
-
-static inline void release_bus(struct wilc *wilc, enum bus_release release)
-{
-	if (release == WILC_BUS_RELEASE_ALLOW_SLEEP && wilc->power_save_mode)
-		chip_allow_sleep(wilc);
-	mutex_unlock(&wilc->hif_cs);
-}
-
 static void wilc_wlan_txq_remove(struct wilc *wilc, u8 q_num,
 				 struct txq_entry_t *tqe)
 {
@@ -555,7 +541,7 @@ static struct rxq_entry_t *wilc_wlan_rxq_remove(struct wilc *wilc)
 	return rqe;
 }
 
-void chip_allow_sleep(struct wilc *wilc)
+static int chip_allow_sleep(struct wilc *wilc)
 {
 	u32 reg = 0;
 	const struct wilc_hif_func *hif_func = wilc->hif_func;
@@ -584,7 +570,7 @@ void chip_allow_sleep(struct wilc *wilc)
 	while (--trials) {
 		ret = hif_func->hif_read_reg(wilc, to_host_from_fw_reg, &reg);
 		if (ret)
-			return;
+			return ret;
 		if ((reg & to_host_from_fw_bit) == 0)
 			break;
 	}
@@ -594,28 +580,28 @@ void chip_allow_sleep(struct wilc *wilc)
 	/* Clear bit 1 */
 	ret = hif_func->hif_read_reg(wilc, wakeup_reg, &reg);
 	if (ret)
-		return;
+		return ret;
 	if (reg & wakeup_bit) {
 		reg &= ~wakeup_bit;
 		ret = hif_func->hif_write_reg(wilc, wakeup_reg, reg);
 		if (ret)
-			return;
+			return ret;
 	}
 
 	ret = hif_func->hif_read_reg(wilc, from_host_to_fw_reg, &reg);
 	if (ret)
-		return;
+		return ret;
 	if (reg & from_host_to_fw_bit) {
 		reg &= ~from_host_to_fw_bit;
 		ret = hif_func->hif_write_reg(wilc, from_host_to_fw_reg, reg);
 		if (ret)
-			return;
-
+			return ret;
 	}
+
+	return 0;
 }
-EXPORT_SYMBOL_GPL(chip_allow_sleep);
 
-void chip_wakeup(struct wilc *wilc)
+static void chip_wakeup(struct wilc *wilc)
 {
 	u32 ret = 0;
 	u32 clk_status_val = 0, trials = 0;
@@ -674,7 +660,20 @@ void chip_wakeup(struct wilc *wilc)
 	if (wilc->io_type == WILC_HIF_SPI)
 		wilc->hif_func->hif_reset(wilc);
 }
-EXPORT_SYMBOL_GPL(chip_wakeup);
+
+static inline void acquire_bus(struct wilc *wilc, enum bus_acquire acquire)
+{
+	mutex_lock(&wilc->hif_cs);
+	if (acquire == WILC_BUS_ACQUIRE_AND_WAKEUP && wilc->power_save_mode)
+		chip_wakeup(wilc);
+}
+
+static inline void release_bus(struct wilc *wilc, enum bus_release release)
+{
+	if (release == WILC_BUS_RELEASE_ALLOW_SLEEP && wilc->power_save_mode)
+		chip_allow_sleep(wilc);
+	mutex_unlock(&wilc->hif_cs);
+}
 
 void host_wakeup_notify(struct wilc *wilc)
 {
drivers/net/wireless/microchip/wilc1000/wlan.h +0 -2
index ae187192a79c6..e75a5c8aaecec 100644
@@ -438,8 +438,6 @@ void wilc_wfi_p2p_rx(struct wilc_vif *vif, u8 *buff, u32 size);
 bool wilc_wfi_mgmt_frame_rx(struct wilc_vif *vif, u8 *buff, u32 size);
 void host_wakeup_notify(struct wilc *wilc);
 void host_sleep_notify(struct wilc *wilc);
-void chip_allow_sleep(struct wilc *wilc);
-void chip_wakeup(struct wilc *wilc);
 int wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, struct wid *wids,
 			 u32 count);
 int wilc_wlan_init(struct net_device *dev);
Signature · 1 line
2.45.2
#3 lore raw

PATCH v5 4/9 wifi: wilc1000: Fill in missing error handling

In reply to Marek Vasut

Add error handling to chip_wakeup() and propagate the errors throughout the entire driver. Add error handling to acquire_bus()/release_bus() and host_sleep_notify()/host_wakeup_notify() functions as a result as well. Fill the error handling to all call sites.

---
Cc: "David S. Miller" <[email protected]>
Cc: Adham Abozaeid <[email protected]>
Cc: Ajay Singh <[email protected]>
Cc: Alexis Lothoré <[email protected]>
Cc: Claudiu Beznea <[email protected]>
Cc: Conor Dooley <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Paolo Abeni <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
V3: New patch
V4: No change
V4: Add RB from Alexis
V5: No change

---
 .../net/wireless/microchip/wilc1000/sdio.c    |  11 +-
 .../net/wireless/microchip/wilc1000/wlan.c    | 154 +++++++++++++-----
 .../net/wireless/microchip/wilc1000/wlan.h    |   4 +-
 3 files changed, 118 insertions(+), 51 deletions(-)
drivers/net/wireless/microchip/wilc1000/sdio.c +7 -4
index 90357c89ae29b..c26447289b71b 100644
@@ -960,6 +960,7 @@ static int wilc_sdio_suspend(struct device *dev)
 {
 	struct sdio_func *func = dev_to_sdio_func(dev);
 	struct wilc *wilc = sdio_get_drvdata(func);
+	int ret;
 
 	dev_info(dev, "sdio suspend\n");
 
@@ -969,7 +970,11 @@ static int wilc_sdio_suspend(struct device *dev)
 	if (!IS_ERR(wilc->rtc_clk))
 		clk_disable_unprepare(wilc->rtc_clk);
 
-	host_sleep_notify(wilc);
+	ret = host_sleep_notify(wilc);
+	if (ret) {
+		clk_prepare_enable(wilc->rtc_clk);
+		return ret;
+	}
 
 	wilc_sdio_disable_interrupt(wilc);
 
@@ -992,9 +997,7 @@ static int wilc_sdio_resume(struct device *dev)
 	wilc_sdio_init(wilc, true);
 	wilc_sdio_enable_interrupt(wilc);
 
-	host_wakeup_notify(wilc);
-
-	return 0;
+	return host_wakeup_notify(wilc);
 }
 
 static const struct of_device_id wilc_of_match[] = {
drivers/net/wireless/microchip/wilc1000/wlan.c +109 -45

350 lines not on this page · raw message

drivers/net/wireless/microchip/wilc1000/wlan.h +2 -2
index e75a5c8aaecec..4e2b0c4ac1e21 100644
@@ -436,8 +436,8 @@ netdev_tx_t wilc_mac_xmit(struct sk_buff *skb, struct net_device *dev);
 
 void wilc_wfi_p2p_rx(struct wilc_vif *vif, u8 *buff, u32 size);
 bool wilc_wfi_mgmt_frame_rx(struct wilc_vif *vif, u8 *buff, u32 size);
-void host_wakeup_notify(struct wilc *wilc);
-void host_sleep_notify(struct wilc *wilc);
+int host_wakeup_notify(struct wilc *wilc);
+int host_sleep_notify(struct wilc *wilc);
 int wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, struct wid *wids,
 			 u32 count);
 int wilc_wlan_init(struct net_device *dev);
Signature · 1 line
2.45.2
#4 lore raw

Re: [PATCH v5 4/9] wifi: wilc1000: Fill in missing error handling

Quoted 4 lines · Marek Vasut

Add error handling to chip_wakeup() and propagate the errors throughout the entire driver. Add error handling to acquire_bus()/release_bus() and host_sleep_notify()/host_wakeup_notify() functions as a result as well. Fill the error handling to all call sites.

Out of curiosity, what tree/branch are you using as a base for this series ? I wanted to pull it locally to also test it on wilc1000, but it fails to apply this patch, and the failure points to a conflict with one of my patch which has been merged quite some time ago in wireless-next:
https://lore.kernel.org/all/[email protected]/

Thanks,
Alexis

Signature · 3 lines
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#5 lore raw

Re: [PATCH v5 4/9] wifi: wilc1000: Fill in missing error handling

Quoted 11 lines · Alexis Lothoré
Quoted 4 lines · Marek Vasut

Add error handling to chip_wakeup() and propagate the errors throughout the entire driver. Add error handling to acquire_bus()/release_bus() and host_sleep_notify()/host_wakeup_notify() functions as a result as well. Fill the error handling to all call sites.

Out of curiosity, what tree/branch are you using as a base for this series ? I wanted to pull it locally to also test it on wilc1000, but it fails to apply this patch, and the failure points to a conflict with one of my patch which has been merged quite some time ago in wireless-next:
https://lore.kernel.org/all/[email protected]/

next-20240909 with this extra patch:

wifi: wilc1000: Keep slot powered on during suspend/resume

#6 lore raw

PATCH v5 5/9 wifi: wilc1000: Fold wilc_create_wiphy() into cfg80211.c

In reply to Marek Vasut

The wilc_create_wiphy() is not used outside of cfg80211.c . Make the function static and remove its entry from cfg80211.h

---
Cc: "David S. Miller" <[email protected]>
Cc: Adham Abozaeid <[email protected]>
Cc: Ajay Singh <[email protected]>
Cc: Alexis Lothoré <[email protected]>
Cc: Claudiu Beznea <[email protected]>
Cc: Conor Dooley <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Paolo Abeni <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
V5: New patch

---
 .../wireless/microchip/wilc1000/cfg80211.c    | 94 +++++++++----------
 .../wireless/microchip/wilc1000/cfg80211.h    |  1 -
 2 files changed, 47 insertions(+), 48 deletions(-)
drivers/net/wireless/microchip/wilc1000/cfg80211.c +47 -47
index eb37b228d54ea..11e0f8a473467 100644
@@ -1757,53 +1757,7 @@ void wlan_deinit_locks(struct wilc *wilc)
 	cleanup_srcu_struct(&wilc->srcu);
 }
 
-int wilc_cfg80211_init(struct wilc **wilc, struct device *dev, int io_type,
-		       const struct wilc_hif_func *ops)
-{
-	struct wilc *wl;
-	int ret, i;
-
-	wl = wilc_create_wiphy(dev);
-	if (!wl)
-		return -EINVAL;
-
-	wlan_init_locks(wl);
-
-	ret = wilc_wlan_cfg_init(wl);
-	if (ret)
-		goto free_wl;
-
-	*wilc = wl;
-	wl->io_type = io_type;
-	wl->hif_func = ops;
-
-	for (i = 0; i < NQUEUES; i++)
-		INIT_LIST_HEAD(&wl->txq[i].txq_head.list);
-
-	INIT_LIST_HEAD(&wl->rxq_head.list);
-	INIT_LIST_HEAD(&wl->vif_list);
-
-	wl->hif_workqueue = alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM,
-						    wiphy_name(wl->wiphy));
-	if (!wl->hif_workqueue) {
-		ret = -ENOMEM;
-		goto free_cfg;
-	}
-
-	return 0;
-
-free_cfg:
-	wilc_wlan_cfg_deinit(wl);
-
-free_wl:
-	wlan_deinit_locks(wl);
-	wiphy_unregister(wl->wiphy);
-	wiphy_free(wl->wiphy);
-	return ret;
-}
-EXPORT_SYMBOL_GPL(wilc_cfg80211_init);
-
-struct wilc *wilc_create_wiphy(struct device *dev)
+static struct wilc *wilc_create_wiphy(struct device *dev)
 {
 	struct wiphy *wiphy;
 	struct wilc *wl;
@@ -1861,6 +1815,52 @@ struct wilc *wilc_create_wiphy(struct device *dev)
 	return wl;
 }
 
+int wilc_cfg80211_init(struct wilc **wilc, struct device *dev, int io_type,
+		       const struct wilc_hif_func *ops)
+{
+	struct wilc *wl;
+	int ret, i;
+
+	wl = wilc_create_wiphy(dev);
+	if (!wl)
+		return -EINVAL;
+
+	wlan_init_locks(wl);
+
+	ret = wilc_wlan_cfg_init(wl);
+	if (ret)
+		goto free_wl;
+
+	*wilc = wl;
+	wl->io_type = io_type;
+	wl->hif_func = ops;
+
+	for (i = 0; i < NQUEUES; i++)
+		INIT_LIST_HEAD(&wl->txq[i].txq_head.list);
+
+	INIT_LIST_HEAD(&wl->rxq_head.list);
+	INIT_LIST_HEAD(&wl->vif_list);
+
+	wl->hif_workqueue = alloc_ordered_workqueue("%s", WQ_MEM_RECLAIM,
+						    wiphy_name(wl->wiphy));
+	if (!wl->hif_workqueue) {
+		ret = -ENOMEM;
+		goto free_cfg;
+	}
+
+	return 0;
+
+free_cfg:
+	wilc_wlan_cfg_deinit(wl);
+
+free_wl:
+	wlan_deinit_locks(wl);
+	wiphy_unregister(wl->wiphy);
+	wiphy_free(wl->wiphy);
+	return ret;
+}
+EXPORT_SYMBOL_GPL(wilc_cfg80211_init);
+
 int wilc_init_host_int(struct net_device *net)
 {
 	int ret;
drivers/net/wireless/microchip/wilc1000/cfg80211.h +0 -1
index 8c65951cfaf96..fc04cc6615c1f 100644
@@ -10,7 +10,6 @@
 
 int wilc_cfg80211_init(struct wilc **wilc, struct device *dev, int io_type,
 		       const struct wilc_hif_func *ops);
-struct wilc *wilc_create_wiphy(struct device *dev);
 void wilc_deinit_host_int(struct net_device *net);
 int wilc_init_host_int(struct net_device *net);
 void wilc_wfi_monitor_rx(struct net_device *mon_dev, u8 *buff, u32 size);
Signature · 1 line
2.45.2
#7 lore raw

Re: [PATCH v5 5/9] wifi: wilc1000: Fold wilc_create_wiphy() into cfg80211.c

Quoted 4 lines · Marek Vasut

The wilc_create_wiphy() is not used outside of cfg80211.c . Make the function static and remove its entry from cfg80211.h

Signed-off-by Marek Vasut <[email protected]: Alexis Lothoré <[email protected]>
Signature · 3 lines
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Reviewed-by on v5 5/9
#8 lore raw

Re: [PATCH v5 5/9] wifi: wilc1000: Fold wilc_create_wiphy() into cfg80211.c

In reply to Marek Vasut
Quoted 4 lines · Marek Vasut

The wilc_create_wiphy() is not used outside of cfg80211.c . Make the function static and remove its entry from cfg80211.h

It looks like I messed up my r-b on previous email, so in case it could have confused some scripts or automation:

Signature · 3 lines
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#9 lore raw

PATCH v5 6/9 wifi: wilc1000: Remove cmd53_buf() allocation

In reply to Marek Vasut

The cmd53_buf is a 4 byte buffer, embed it into the struct wilc_sdio.

---
Cc: "David S. Miller" <[email protected]>
Cc: Adham Abozaeid <[email protected]>
Cc: Ajay Singh <[email protected]>
Cc: Alexis Lothoré <[email protected]>
Cc: Claudiu Beznea <[email protected]>
Cc: Conor Dooley <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Paolo Abeni <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
V5: New patch

---
 drivers/net/wireless/microchip/wilc1000/sdio.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/net/wireless/microchip/wilc1000/sdio.c +1 -9
index c26447289b71b..6d01a838ab184 100644
@@ -31,7 +31,7 @@ struct wilc_sdio {
 	bool irq_gpio;
 	u32 block_size;
 	bool isinit;
-	u8 *cmd53_buf;
+	u8 cmd53_buf[4];
 };
 
 struct sdio_cmd52 {
@@ -149,12 +149,6 @@ static int wilc_sdio_probe(struct sdio_func *func,
 	if (!sdio_priv)
 		return -ENOMEM;
 
-	sdio_priv->cmd53_buf = kzalloc(sizeof(u32), GFP_KERNEL);
-	if (!sdio_priv->cmd53_buf) {
-		ret = -ENOMEM;
-		goto free;
-	}
-
 	ret = wilc_cfg80211_init(&wilc, &func->dev, WILC_HIF_SDIO,
 				 &wilc_hif_sdio);
 	if (ret)
@@ -207,7 +201,6 @@ static int wilc_sdio_probe(struct sdio_func *func,
 	irq_dispose_mapping(wilc->dev_irq_num);
 	wilc_netdev_cleanup(wilc);
 free:
-	kfree(sdio_priv->cmd53_buf);
 	kfree(sdio_priv);
 	return ret;
 }
@@ -219,7 +212,6 @@ static void wilc_sdio_remove(struct sdio_func *func)
 
 	clk_disable_unprepare(wilc->rtc_clk);
 	wilc_netdev_cleanup(wilc);
-	kfree(sdio_priv->cmd53_buf);
 	kfree(sdio_priv);
 }
 
Signature · 1 line
2.45.2
#10 lore raw

Re: [PATCH v5 6/9] wifi: wilc1000: Remove cmd53_buf() allocation

Quoted 1 line · Marek Vasut

The cmd53_buf is a 4 byte buffer, embed it into the struct wilc_sdio.

Is this change really desirable ? I mean, looking at git log, it looks like this kzalloc is voluntary, for usage with DMA (see [1] as initial fix and [2] as the final patch which has landed in the driver)

[1]
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/

Alexis

Signature · 3 lines
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#11 lore raw

Re: [PATCH v5 6/9] wifi: wilc1000: Remove cmd53_buf() allocation

Quoted 6 lines · Alexis Lothoré
Quoted 1 line · Marek Vasut

The cmd53_buf is a 4 byte buffer, embed it into the struct wilc_sdio.

Is this change really desirable ? I mean, looking at git log, it looks like this kzalloc is voluntary, for usage with DMA (see [1] as initial fix and [2] as the final patch which has landed in the driver)

It is unrelated to the series, so I'll just drop it for now.

#12 lore raw

PATCH v5 7/9 wifi: wilc1000: Get chipid early

In reply to Marek Vasut

Export wilc_get_chipid() again and call it in driver probe to get wilc->chipid assigned early on. This is necessary to discern WILC 1000 from 3000 to disable WPA3/SAE on the later.

---
Cc: "David S. Miller" <[email protected]>
Cc: Adham Abozaeid <[email protected]>
Cc: Ajay Singh <[email protected]>
Cc: Alexis Lothoré <[email protected]>
Cc: Claudiu Beznea <[email protected]>
Cc: Conor Dooley <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Paolo Abeni <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
V5: New patch

---
 drivers/net/wireless/microchip/wilc1000/sdio.c | 4 ++++
 drivers/net/wireless/microchip/wilc1000/spi.c  | 2 +-
 drivers/net/wireless/microchip/wilc1000/wlan.c | 2 +-
 drivers/net/wireless/microchip/wilc1000/wlan.h | 1 +
 4 files changed, 7 insertions(+), 2 deletions(-)
drivers/net/wireless/microchip/wilc1000/sdio.c +4 -0
index 6d01a838ab184..01a96d0f562a6 100644
@@ -177,6 +177,10 @@ static int wilc_sdio_probe(struct sdio_func *func,
 
 	wilc_sdio_init(wilc, false);
 
+	ret = wilc_get_chipid(wilc);
+	if (ret)
+		goto clk_disable_unprepare;
+
 	ret = wilc_load_mac_from_nv(wilc);
 	if (ret) {
 		pr_err("Can not retrieve MAC address from chip\n");
drivers/net/wireless/microchip/wilc1000/spi.c +1 -1
index 5ff940c53ad9c..1b60a13df6cfa 100644
@@ -246,7 +246,7 @@ static int wilc_bus_probe(struct spi_device *spi)
 	if (ret)
 		goto power_down;
 
-	ret = wilc_validate_chipid(wilc);
+	ret = wilc_get_chipid(wilc);
 	if (ret)
 		goto power_down;
 
drivers/net/wireless/microchip/wilc1000/wlan.c +1 -1
index 01476f8ecc36f..1aab8eca58169 100644
@@ -1456,7 +1456,7 @@ int wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, struct wid *wids,
 	return ret;
 }
 
-static int wilc_get_chipid(struct wilc *wilc)
+int wilc_get_chipid(struct wilc *wilc)
 {
 	u32 chipid = 0;
 	u32 rfrevid = 0;
drivers/net/wireless/microchip/wilc1000/wlan.h +1 -0
index 4e2b0c4ac1e21..552590823e444 100644
@@ -441,5 +441,6 @@ int host_sleep_notify(struct wilc *wilc);
 int wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, struct wid *wids,
 			 u32 count);
 int wilc_wlan_init(struct net_device *dev);
+int wilc_get_chipid(struct wilc *wilc);
 int wilc_load_mac_from_nv(struct wilc *wilc);
 #endif
Signature · 1 line
2.45.2
#13 lore raw

Re: [PATCH v5 7/9] wifi: wilc1000: Get chipid early

Hello Marek,

Quoted 3 lines · Marek Vasut

Export wilc_get_chipid() again and call it in driver probe to get wilc->chipid assigned early on. This is necessary to discern WILC 1000 from 3000 to disable WPA3/SAE on the later.

I like the general change (reading chipid early enough so we can enable/disable NL80211_FEATURE_SAE accordingly before wiphy_register), but then there is no point in making wilc_get_chipid private in wlan.c in patch 2, to make it public to the module again in patch 7.

Thanks,
Alexis

Signature · 3 lines
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#14 lore raw

Re: [PATCH v5 7/9] wifi: wilc1000: Get chipid early

Quoted 1 line · Alexis Lothoré

Hello Marek,

Hi,

Quoted 9 lines · Marek Vasut
Quoted 3 lines

Export wilc_get_chipid() again and call it in driver probe to get wilc->chipid assigned early on. This is necessary to discern WILC 1000 from 3000 to disable WPA3/SAE on the later.

I like the general change (reading chipid early enough so we can enable/disable NL80211_FEATURE_SAE accordingly before wiphy_register), but then there is no point in making wilc_get_chipid private in wlan.c in patch 2, to make it public to the module again in patch 7.

I was worried squashing it into 2/9 would be messy, but apparently not, so squashed into 2/9 for V6.

#15 lore raw

PATCH v5 8/9 wifi: wilc1000: Register wiphy after reading out chipid

In reply to Marek Vasut

Register wiphy after reading out chipid, so the chipid can be used to determine chip features and not advertise WPA3/SAE support to userspace on WILC3000. Note that wilc_netdev_cleanup() will deregister the wiphy in fail path.

---
Cc: "David S. Miller" <[email protected]>
Cc: Adham Abozaeid <[email protected]>
Cc: Ajay Singh <[email protected]>
Cc: Alexis Lothoré <[email protected]>
Cc: Claudiu Beznea <[email protected]>
Cc: Conor Dooley <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Paolo Abeni <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
V5: New patch

---
 .../net/wireless/microchip/wilc1000/cfg80211.c    | 15 ++++++++-------
 .../net/wireless/microchip/wilc1000/cfg80211.h    |  1 +
 drivers/net/wireless/microchip/wilc1000/sdio.c    |  4 ++++
 drivers/net/wireless/microchip/wilc1000/spi.c     |  4 ++++
 4 files changed, 17 insertions(+), 7 deletions(-)
drivers/net/wireless/microchip/wilc1000/cfg80211.c +8 -7
index 11e0f8a473467..30015c5920467 100644
@@ -1761,7 +1761,6 @@ static struct wilc *wilc_create_wiphy(struct device *dev)
 {
 	struct wiphy *wiphy;
 	struct wilc *wl;
-	int ret;
 
 	wiphy = wiphy_new(&wilc_cfg80211_ops, sizeof(*wl));
 	if (!wiphy)
@@ -1804,14 +1803,8 @@ static struct wilc *wilc_create_wiphy(struct device *dev)
 				BIT(NL80211_IFTYPE_P2P_GO) |
 				BIT(NL80211_IFTYPE_P2P_CLIENT);
 	wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
-	wiphy->features |= NL80211_FEATURE_SAE;
 	set_wiphy_dev(wiphy, dev);
 	wl->wiphy = wiphy;
-	ret = wiphy_register(wiphy);
-	if (ret) {
-		wiphy_free(wiphy);
-		return NULL;
-	}
 	return wl;
 }
 
@@ -1861,6 +1854,14 @@ int wilc_cfg80211_init(struct wilc **wilc, struct device *dev, int io_type,
 }
 EXPORT_SYMBOL_GPL(wilc_cfg80211_init);
 
+int wilc_cfg80211_register(struct wilc *wilc)
+{
+	wilc->wiphy->features |= NL80211_FEATURE_SAE;
+
+	return wiphy_register(wilc->wiphy);
+}
+EXPORT_SYMBOL_GPL(wilc_cfg80211_register);
+
 int wilc_init_host_int(struct net_device *net)
 {
 	int ret;
drivers/net/wireless/microchip/wilc1000/cfg80211.h +1 -0
index fc04cc6615c1f..2dc9c1c42d609 100644
@@ -10,6 +10,7 @@
 
 int wilc_cfg80211_init(struct wilc **wilc, struct device *dev, int io_type,
 		       const struct wilc_hif_func *ops);
+int wilc_cfg80211_register(struct wilc *wilc);
 void wilc_deinit_host_int(struct net_device *net);
 int wilc_init_host_int(struct net_device *net);
 void wilc_wfi_monitor_rx(struct net_device *mon_dev, u8 *buff, u32 size);
drivers/net/wireless/microchip/wilc1000/sdio.c +4 -0
index 01a96d0f562a6..0240f66e70bc1 100644
@@ -181,6 +181,10 @@ static int wilc_sdio_probe(struct sdio_func *func,
 	if (ret)
 		goto clk_disable_unprepare;
 
+	ret = wilc_cfg80211_register(wilc);
+	if (ret)
+		goto clk_disable_unprepare;
+
 	ret = wilc_load_mac_from_nv(wilc);
 	if (ret) {
 		pr_err("Can not retrieve MAC address from chip\n");
drivers/net/wireless/microchip/wilc1000/spi.c +4 -0
index 1b60a13df6cfa..edc518c3b0253 100644
@@ -250,6 +250,10 @@ static int wilc_bus_probe(struct spi_device *spi)
 	if (ret)
 		goto power_down;
 
+	ret = wilc_cfg80211_register(wilc);
+	if (ret)
+		goto power_down;
+
 	ret = wilc_load_mac_from_nv(wilc);
 	if (ret) {
 		pr_err("Can not retrieve MAC address from chip\n");
Signature · 1 line
2.45.2
#16 lore raw

Re: [PATCH v5 8/9] wifi: wilc1000: Register wiphy after reading out chipid

Quoted 6 lines · Marek Vasut

Register wiphy after reading out chipid, so the chipid can be used to determine chip features and not advertise WPA3/SAE support to userspace on WILC3000. Note that wilc_netdev_cleanup() will deregister the wiphy in fail path.

[...]

drivers/net/wireless/microchip/wilc1000/cfg80211.c static struct wilc *wilc_create_wiphy(struct device *dev) · line 1814

Quoted 12 lines
drivers/net/wireless/microchip/wilc1000/cfg80211.c +0 -6
@@ -1804,14 +1803,8 @@ static struct wilc *wilc_create_wiphy(struct device *dev)
 				BIT(NL80211_IFTYPE_P2P_GO) |
 				BIT(NL80211_IFTYPE_P2P_CLIENT);
 	wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
-	wiphy->features |= NL80211_FEATURE_SAE;
 	set_wiphy_dev(wiphy, dev);
 	wl->wiphy = wiphy;
-	ret = wiphy_register(wiphy);
-	if (ret) {
-		wiphy_free(wiphy);
-		return NULL;
-	}

If I am reading the patch correctly, there are still some failure paths in wilc_cfg80211_init which try to call wiphy_unregister on the (not registered anymore in there) wphy.

drivers/net/wireless/microchip/wilc1000/cfg80211.c int wilc_cfg80211_init(struct wilc **wilc, struct device *dev, int io_type, · line 1859

Quoted 10 lines
drivers/net/wireless/microchip/wilc1000/cfg80211.c +3 -0
 	return wl;
 }
 
@@ -1861,6 +1854,14 @@ int wilc_cfg80211_init(struct wilc **wilc, struct device *dev, int io_type,
 }
 EXPORT_SYMBOL_GPL(wilc_cfg80211_init);
 
+int wilc_cfg80211_register(struct wilc *wilc)
+{
+	wilc->wiphy->features |= NL80211_FEATURE_SAE;

Even if I get the general need, it feels weird to have parts of the wphy init performed in wilc_create_wiphy, and some parts (the features field) here. Wouldn't it work to just move wilc_create_wiphy content here, since wphy will not be usable anyway before eventually registering it ?

Alexis

Signature · 3 lines
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#17 lore raw

Re: [PATCH v5 8/9] wifi: wilc1000: Register wiphy after reading out chipid

Quoted 33 lines · Alexis Lothoré
Quoted 6 lines · Marek Vasut

Register wiphy after reading out chipid, so the chipid can be used to determine chip features and not advertise WPA3/SAE support to userspace on WILC3000. Note that wilc_netdev_cleanup() will deregister the wiphy in fail path.

[...]

drivers/net/wireless/microchip/wilc1000/cfg80211.c static struct wilc *wilc_create_wiphy(struct device *dev) · line 1814

Quoted 12 lines
drivers/net/wireless/microchip/wilc1000/cfg80211.c +0 -6
@@ -1804,14 +1803,8 @@ static struct wilc *wilc_create_wiphy(struct device *dev)
  				BIT(NL80211_IFTYPE_P2P_GO) |
  				BIT(NL80211_IFTYPE_P2P_CLIENT);
  	wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
-	wiphy->features |= NL80211_FEATURE_SAE;
  	set_wiphy_dev(wiphy, dev);
  	wl->wiphy = wiphy;
-	ret = wiphy_register(wiphy);
-	if (ret) {
-		wiphy_free(wiphy);
-		return NULL;
-	}

If I am reading the patch correctly, there are still some failure paths in wilc_cfg80211_init which try to call wiphy_unregister on the (not registered anymore in there) wphy.

Quoted 7 lines
drivers/net/wireless/microchip/wilc1000/cfg80211.c +0 -0
  	return wl;
  }
 
@@ -1861,6 +1854,14 @@ int wilc_cfg80211_init(struct wilc **wilc, struct device *dev, int io_type,
  }
  EXPORT_SYMBOL_GPL(wilc_cfg80211_init);
 
Quoted 8 lines

drivers/net/wireless/microchip/wilc1000/cfg80211.c int wilc_cfg80211_init(struct wilc **wilc, struct device *dev, int io_type, · line 1859

Quoted 3 lines
drivers/net/wireless/microchip/wilc1000/cfg80211.c +3 -0
+int wilc_cfg80211_register(struct wilc *wilc)
+{
+	wilc->wiphy->features |= NL80211_FEATURE_SAE;

Even if I get the general need, it feels weird to have parts of the wphy init performed in wilc_create_wiphy, and some parts (the features field) here. Wouldn't it work to just move wilc_create_wiphy content here, since wphy will not be usable anyway before eventually registering it ?

That's what I thought initially too, but look closely at wilc_create_wiphy():

struct wilc *wilc_create_wiphy(struct device *dev)
{
...
struct wiphy *wiphy;
struct wilc *wl;
...
wiphy = wiphy_new(&wilc_cfg80211_ops, sizeof(*wl));
...
wl = wiphy_priv(wiphy); // <----------- HERE , *wl is struct wilc
...
return wl;
}

That 'struct wilc' is allocated as part of wiphy_new() and used all around the place before we reach wiphy_register() much later on.

#18 lore raw

Re: [PATCH v5 8/9] wifi: wilc1000: Register wiphy after reading out chipid

Quoted 2 lines · Marek Vasut
Quoted 1 line · Alexis Lothoré

On 9/9/24 21:29, Marek Vasut wrote:

[...]

Quoted 24 lines
Quoted 9 lines
Quoted 4 lines

  EXPORT_SYMBOL_GPL(wilc_cfg80211_init); +int wilc_cfg80211_register(struct wilc *wilc) +{
+    wilc->wiphy->features |= NL80211_FEATURE_SAE;

Even if I get the general need, it feels weird to have parts of the wphy init performed in wilc_create_wiphy, and some parts (the features field) here. Wouldn't it work to just move wilc_create_wiphy content here, since wphy will not be usable anyway before eventually registering it ?

That's what I thought initially too, but look closely at wilc_create_wiphy():

struct wilc *wilc_create_wiphy(struct device *dev)
{
...
struct wiphy *wiphy;
struct wilc *wl;
...
wiphy = wiphy_new(&wilc_cfg80211_ops, sizeof(*wl));
...
wl = wiphy_priv(wiphy); // <----------- HERE , *wl is struct wilc
...
return wl;
}

Quoted 2 lines

That 'struct wilc' is allocated as part of wiphy_new() and used all around the place before we reach wiphy_register() much later on.

Meh, true. We could still let any part affecting the struct wilc in wilc_create_wiphy, and move any wphy configuration in wilc_cfg80211_register, but then I am not sure anymore if it makes things better.

Signature · 3 lines
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#19 lore raw

PATCH v5 9/9 wifi: wilc1000: Add WILC3000 support

In reply to Marek Vasut

From: Ajay Singh <[email protected]>

Add support for the WILC3000 chip. The chip is similar to WILC1000, except that the register layout is slightly different and it does not support WPA3/SAE.

---
Note: Squashed and updated from the following downstream patches:
wifi: wilc1000: wilc3000 support added
wifi: wilc1000: wilc3000 interrupt handling
wifi: wilc1000: wilc3000 added chip wake and sleep support
wifi: wilc1000: wilc3000 FW file sepecific changes
---
Cc: "David S. Miller" <[email protected]>
Cc: Adham Abozaeid <[email protected]>
Cc: Ajay Singh <[email protected]>
Cc: Alexis Lothoré <[email protected]>
Cc: Claudiu Beznea <[email protected]>
Cc: Conor Dooley <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: Krzysztof Kozlowski <[email protected]>
Cc: Paolo Abeni <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
V2: - Return -EINVAL in wilc_sdio_init() if chip ID is not supported
- Dispose of wilc_chip_type, replace with is_wilc1000()/is_wilc3000()
- Remove wilc3000 DT compatible string handling, match on wilc1000 only, the device type can be auto-detected based on chipID
V3: - Define and use WILC3000_BOOTROM_STATUS and WILC3000_CORTUS_BOOT_REGISTER_2
V4: - Fix up after dropping wilc_get_chipid() in netdev.c in 2/5
V5: - Advertise WPA3/SAE to userspace only on WILC1000 in wilc_create_wiphy()

---
 .../wireless/microchip/wilc1000/cfg80211.c    |   4 +-
 .../net/wireless/microchip/wilc1000/netdev.c  |  27 ++-
 .../net/wireless/microchip/wilc1000/sdio.c    |  62 ++++-
 drivers/net/wireless/microchip/wilc1000/spi.c |   2 +-
 .../net/wireless/microchip/wilc1000/wlan.c    | 220 +++++++++++++++---
 .../net/wireless/microchip/wilc1000/wlan.h    |  45 +++-
 6 files changed, 298 insertions(+), 62 deletions(-)
drivers/net/wireless/microchip/wilc1000/cfg80211.c +3 -1
index 30015c5920467..cdb4b0bbeab3b 100644
@@ -1856,7 +1856,9 @@ EXPORT_SYMBOL_GPL(wilc_cfg80211_init);
 
 int wilc_cfg80211_register(struct wilc *wilc)
 {
-	wilc->wiphy->features |= NL80211_FEATURE_SAE;
+	/* WPA3/SAE supported only on WILC1000 */
+	if (is_wilc1000(wilc->chipid))
+		wilc->wiphy->features |= NL80211_FEATURE_SAE;
 
 	return wiphy_register(wilc->wiphy);
 }
drivers/net/wireless/microchip/wilc1000/netdev.c +19 -8
index 086e70d833e06..178f3241cef9f 100644
@@ -23,6 +23,12 @@
 #define __WILC1000_FW(api)		WILC1000_FW_PREFIX #api ".bin"
 #define WILC1000_FW(api)		__WILC1000_FW(api)
 
+#define WILC3000_API_VER		1
+
+#define WILC3000_FW_PREFIX		"atmel/wilc3000_wifi_firmware-"
+#define __WILC3000_FW(api)		WILC3000_FW_PREFIX #api ".bin"
+#define WILC3000_FW(api)		__WILC3000_FW(api)
+
 static irqreturn_t isr_uh_routine(int irq, void *user_data)
 {
 	struct wilc *wilc = user_data;
@@ -196,19 +202,23 @@ static int wilc_wlan_get_firmware(struct net_device *dev)
 	struct wilc_vif *vif = netdev_priv(dev);
 	struct wilc *wilc = vif->wilc;
 	const struct firmware *wilc_fw;
+	char *firmware;
 	int ret;
 
-	if (!is_wilc1000(wilc->chipid))
+	if (is_wilc1000(wilc->chipid))
+		firmware = WILC1000_FW(WILC1000_API_VER);
+	else if (is_wilc3000(wilc->chipid))
+		firmware = WILC3000_FW(WILC3000_API_VER);
+	else
 		return -EINVAL;
 
-	netdev_info(dev, "WILC1000 loading firmware [%s]\n",
+	netdev_info(dev, "WILC%d loading firmware [%s]\n",
+		    is_wilc1000(wilc->chipid) ? 1000 : 3000,
 		    WILC1000_FW(WILC1000_API_VER));
 
-	ret = request_firmware(&wilc_fw, WILC1000_FW(WILC1000_API_VER),
-			       wilc->dev);
+	ret = request_firmware(&wilc_fw, firmware, wilc->dev);
 	if (ret != 0) {
-		netdev_err(dev, "%s - firmware not available\n",
-			   WILC1000_FW(WILC1000_API_VER));
+		netdev_err(dev, "%s - firmware not available\n", firmware);
 		return -EINVAL;
 	}
 	wilc->firmware = wilc_fw;
@@ -233,7 +243,7 @@ static int wilc_start_firmware(struct net_device *dev)
 	return 0;
 }
 
-static int wilc1000_firmware_download(struct net_device *dev)
+static int wilc_firmware_download(struct net_device *dev)
 {
 	struct wilc_vif *vif = netdev_priv(dev);
 	struct wilc *wilc = vif->wilc;
@@ -528,7 +538,7 @@ static int wilc_wlan_initialize(struct net_device *dev, struct wilc_vif *vif)
 		if (ret)
 			goto fail_irq_enable;
 
-		ret = wilc1000_firmware_download(dev);
+		ret = wilc_firmware_download(dev);
 		if (ret)
 			goto fail_irq_enable;
 
@@ -1014,3 +1024,4 @@ EXPORT_SYMBOL_GPL(wilc_netdev_ifc_init);
 MODULE_DESCRIPTION("Atmel WILC1000 core wireless driver");
 MODULE_LICENSE("GPL");
 MODULE_FIRMWARE(WILC1000_FW(WILC1000_API_VER));
+MODULE_FIRMWARE(WILC3000_FW(WILC3000_API_VER));
drivers/net/wireless/microchip/wilc1000/sdio.c +51 -11

86 lines not on this page · raw message

drivers/net/wireless/microchip/wilc1000/spi.c +1 -1
index edc518c3b0253..ad837d2b7af67 100644
@@ -1236,7 +1236,7 @@ static int wilc_validate_chipid(struct wilc *wilc)
 		dev_err(&spi->dev, "Fail cmd read chip id...\n");
 		return ret;
 	}
-	if (!is_wilc1000(chipid)) {
+	if (!is_wilc1000(chipid) && !is_wilc3000(chipid)) {
 		dev_err(&spi->dev, "Unknown chip id 0x%x\n", chipid);
 		return -ENODEV;
 	}
drivers/net/wireless/microchip/wilc1000/wlan.c +187 -33

295 lines not on this page · raw message

drivers/net/wireless/microchip/wilc1000/wlan.h +37 -8

85 lines not on this page · raw message

Signature · 1 line
2.45.2