Skip to contentSkip to conversation

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

PATCH Superseded Marek Vasut 5 participants 20 messages Aug 29, 2024 – Sep 10, 2024

Subsystems (5)

v4 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/5 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: Marek Vasut <[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

---
 .../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 v4 2/5 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: Marek Vasut <[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

---
 .../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 v4 3/5 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: Marek Vasut <[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

---
 .../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 v4 4/5 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: Marek Vasut <[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

---
 .../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

PATCH v4 5/5 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: Marek Vasut <[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

---
 .../wireless/microchip/wilc1000/cfg80211.c    |   7 +
 .../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, 302 insertions(+), 61 deletions(-)
drivers/net/wireless/microchip/wilc1000/cfg80211.c +7 -0
index eb37b228d54ea..69c66a7b41654 100644
@@ -313,6 +313,13 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
 
 	vif->connecting = true;
 
+	if (sme->auth_type == NL80211_AUTHTYPE_SAE &&
+	    is_wilc3000(vif->wilc->chipid)) {
+		netdev_err(dev, "WILC3000: WPA3 not supported\n");
+		ret = -EOPNOTSUPP;
+		goto out_error;
+	}
+
 	cipher_group = sme->crypto.cipher_group;
 	if (cipher_group != 0) {
 		if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) {
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 5ff940c53ad9c..8913703e10e26 100644
@@ -1232,7 +1232,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
#5 lore raw

Re: [PATCH v4 5/5] wifi: wilc1000: Add WILC3000 support

Quoted 8 lines · 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.

[...]

drivers/net/wireless/microchip/wilc1000/cfg80211.c static int connect(struct wiphy *wiphy, struct net_device *dev, · line 321

Quoted 12 lines
drivers/net/wireless/microchip/wilc1000/cfg80211.c +6 -0
@@ -313,6 +313,13 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
 
 	vif->connecting = true;
 
+	if (sme->auth_type == NL80211_AUTHTYPE_SAE &&
+	    is_wilc3000(vif->wilc->chipid)) {
+		netdev_err(dev, "WILC3000: WPA3 not supported\n");
+		ret = -EOPNOTSUPP;
+		goto out_error;
+	}

This looks wrong. If wilc3000 doesn't support SAE you shouldn't advertise NL80211_FEATURE_SAE to user space. I think the check for wilc3000 should be in wilc_create_wiphy():

if (!is_wilc3000(vif->wilc->chipid))

	wiphy->features |= NL80211_FEATURE_SAE;
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#6 lore raw

Re: [PATCH v4 5/5] wifi: wilc1000: Add WILC3000 support

Quoted 30 lines · Kalle Valo
Quoted 8 lines · 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.

[...]

drivers/net/wireless/microchip/wilc1000/cfg80211.c static int connect(struct wiphy *wiphy, struct net_device *dev, · line 321

Quoted 12 lines
drivers/net/wireless/microchip/wilc1000/cfg80211.c +6 -0
@@ -313,6 +313,13 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
 
  	vif->connecting = true;
 
+	if (sme->auth_type == NL80211_AUTHTYPE_SAE &&
+	    is_wilc3000(vif->wilc->chipid)) {
+		netdev_err(dev, "WILC3000: WPA3 not supported\n");
+		ret = -EOPNOTSUPP;
+		goto out_error;
+	}

This looks wrong. If wilc3000 doesn't support SAE you shouldn't advertise NL80211_FEATURE_SAE to user space. I think the check for wilc3000 should be in wilc_create_wiphy():

Quoted 1 line

if (!is_wilc3000(vif->wilc->chipid))

It is probably better to do "if (is_wilc1000(wl->chipid))" here. This way, fixed in V5, thanks.

Quoted 1 line
	wiphy->features |= NL80211_FEATURE_SAE;
#7 lore raw

Re: [PATCH v4 5/5] wifi: wilc1000: Add WILC3000 support

Quoted 29 lines · Marek Vasut
Quoted 12 lines · Kalle Valo
Quoted 8 lines · 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.

[...]

Quoted 14 lines

drivers/net/wireless/microchip/wilc1000/cfg80211.c static int connect(struct wiphy *wiphy, struct net_device *dev, · line 319

Quoted 10 lines
drivers/net/wireless/microchip/wilc1000/cfg80211.c +5 -0
@@ -313,6 +313,13 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
    	vif->connecting = true;
  +	if (sme->auth_type == NL80211_AUTHTYPE_SAE &&
+	    is_wilc3000(vif->wilc->chipid)) {
+		netdev_err(dev, "WILC3000: WPA3 not supported\n");
+		ret = -EOPNOTSUPP;
+		goto out_error;
+	}

This looks wrong. If wilc3000 doesn't support SAE you shouldn't advertise NL80211_FEATURE_SAE to user space. I think the check for wilc3000 should be in wilc_create_wiphy():
if (!is_wilc3000(vif->wilc->chipid))

Quoted 1 line

It is probably better to do "if (is_wilc1000(wl->chipid))" here.

Good point.

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#8 lore raw

Re: [PATCH v4 5/5] wifi: wilc1000: Add WILC3000 support

Quoted 31 lines · Kalle Valo
Quoted 29 lines · Marek Vasut
Quoted 26 lines · Kalle Valo
Quoted 8 lines · 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.

[...]

drivers/net/wireless/microchip/wilc1000/cfg80211.c static int connect(struct wiphy *wiphy, struct net_device *dev, · line 319

Quoted 10 lines
drivers/net/wireless/microchip/wilc1000/cfg80211.c +5 -0
@@ -313,6 +313,13 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
     	vif->connecting = true;
   +	if (sme->auth_type == NL80211_AUTHTYPE_SAE &&
+	    is_wilc3000(vif->wilc->chipid)) {
+		netdev_err(dev, "WILC3000: WPA3 not supported\n");
+		ret = -EOPNOTSUPP;
+		goto out_error;
+	}

This looks wrong. If wilc3000 doesn't support SAE you shouldn't advertise NL80211_FEATURE_SAE to user space. I think the check for wilc3000 should be in wilc_create_wiphy():
if (!is_wilc3000(vif->wilc->chipid))

Quoted 3 lines
Quoted 1 line

It is probably better to do "if (is_wilc1000(wl->chipid))" here.

Good point.

I did send v5 which grew a few more patches to address getting chipid early.

#9 lore raw

Re: [PATCH v4 5/5] wifi: wilc1000: Add WILC3000 support

In reply to Kalle Valo
Quoted 21 lines · Kalle Valo

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Quoted 8 lines · 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.

[...]

Quoted 6 lines
drivers/net/wireless/microchip/wilc1000/cfg80211.c +0 -0
@@ -313,6 +313,13 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
 
      vif->connecting = true;
 
Quoted 11 lines

drivers/net/wireless/microchip/wilc1000/cfg80211.c static int connect(struct wiphy *wiphy, struct net_device *dev, · line 321

Quoted 6 lines
drivers/net/wireless/microchip/wilc1000/cfg80211.c +6 -0
+     if (sme->auth_type == NL80211_AUTHTYPE_SAE &&
+         is_wilc3000(vif->wilc->chipid)) {
+             netdev_err(dev, "WILC3000: WPA3 not supported\n");
+             ret = -EOPNOTSUPP;
+             goto out_error;
+     }

This looks wrong. If wilc3000 doesn't support SAE you shouldn't advertise NL80211_FEATURE_SAE to user space. I think the check for wilc3000 should be in wilc_create_wiphy():

Actually, the chip ID is not available when wilc_create_wiphy() is called but is set later in the device probe function. Therefore, adding the 'is_wilc3000(vif->wilc->chipid)' condition may not work as expected. Also, I think there is no API to change "wiphy->features" after wiphy is registered to set it later when chip ID information is available.

Does it make sense to add a module parameter for device type(wilc1000 or wilc3000) to address device-specific featurization.

Quoted 7 lines

if (!is_wilc3000(vif->wilc->chipid))

        wiphy->features |= NL80211_FEATURE_SAE;

--
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

#10 lore raw

Re: [PATCH v4 5/5] wifi: wilc1000: Add WILC3000 support

Quoted 35 lines · <[email protected]> writes:
Quoted 21 lines · Kalle Valo

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Quoted 8 lines · 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.

[...]

Quoted 6 lines
drivers/net/wireless/microchip/wilc1000/cfg80211.c +0 -0
@@ -313,6 +313,13 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
 
      vif->connecting = true;
 
Quoted 11 lines

drivers/net/wireless/microchip/wilc1000/cfg80211.c static int connect(struct wiphy *wiphy, struct net_device *dev, · line 321

Quoted 6 lines
drivers/net/wireless/microchip/wilc1000/cfg80211.c +6 -0
+     if (sme->auth_type == NL80211_AUTHTYPE_SAE &&
+         is_wilc3000(vif->wilc->chipid)) {
+             netdev_err(dev, "WILC3000: WPA3 not supported\n");
+             ret = -EOPNOTSUPP;
+             goto out_error;
+     }

This looks wrong. If wilc3000 doesn't support SAE you shouldn't advertise NL80211_FEATURE_SAE to user space. I think the check for wilc3000 should be in wilc_create_wiphy():

Quoted 5 lines

Actually, the chip ID is not available when wilc_create_wiphy() is called but is set later in the device probe function. Therefore, adding the 'is_wilc3000(vif->wilc->chipid)' condition may not work as expected. Also, I think there is no API to change "wiphy->features" after wiphy is registered to set it later when chip ID information is available.

Sounds like the driver is doing something funky in the registration, the idea is that the device capabilities are probed before calling wiphy_register().

Quoted 2 lines

Does it make sense to add a module parameter for device type(wilc1000 or wilc3000) to address device-specific featurization.

We don't do hacks like that in upstream, it's expected that the driver does this all automatically.

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#11 lore raw

Re: [PATCH v4 5/5] wifi: wilc1000: Add WILC3000 support

Quoted 45 lines · Kalle Valo

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Quoted 35 lines · <[email protected]> writes:
Quoted 21 lines · Kalle Valo

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Quoted 8 lines · 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.

[...]

Quoted 6 lines
drivers/net/wireless/microchip/wilc1000/cfg80211.c +0 -0
@@ -313,6 +313,13 @@ static int connect(struct wiphy *wiphy, struct net_device *dev,
 
      vif->connecting = true;
 
Quoted 11 lines

drivers/net/wireless/microchip/wilc1000/cfg80211.c static int connect(struct wiphy *wiphy, struct net_device *dev, · line 321

Quoted 6 lines
drivers/net/wireless/microchip/wilc1000/cfg80211.c +6 -0
+     if (sme->auth_type == NL80211_AUTHTYPE_SAE &&
+         is_wilc3000(vif->wilc->chipid)) {
+             netdev_err(dev, "WILC3000: WPA3 not supported\n");
+             ret = -EOPNOTSUPP;
+             goto out_error;
+     }

This looks wrong. If wilc3000 doesn't support SAE you shouldn't advertise NL80211_FEATURE_SAE to user space. I think the check for wilc3000 should be in wilc_create_wiphy():

Quoted 5 lines

Actually, the chip ID is not available when wilc_create_wiphy() is called but is set later in the device probe function. Therefore, adding the 'is_wilc3000(vif->wilc->chipid)' condition may not work as expected. Also, I think there is no API to change "wiphy->features" after wiphy is registered to set it later when chip ID information is available.

Quoted 4 lines

Sounds like the driver is doing something funky in the registration, the idea is that the device capabilities are probed before calling wiphy_register().

Agree, this approach will configure the wiphy based on connected device.

Quoted 5 lines
Quoted 2 lines

Does it make sense to add a module parameter for device type(wilc1000 or wilc3000) to address device-specific featurization.

We don't do hacks like that in upstream, it's expected that the driver does this all automatically.

Marek has already submitted the patch to delay calling wiphy_register() so it should work at run time for both the devices.
I'm just curious to know for which scenario the module parameters should be used. Can it be used for enabling or disabling any feature, configuring any parameters, instead of complete device-specific featurization.

Regards,
Ajay

#12 lore raw

Re: [PATCH v4 5/5] wifi: wilc1000: Add WILC3000 support

On 9/9/24 11:11 PM, [email protected] wrote:

[...]

Quoted 11 lines
Quoted 5 lines
Quoted 2 lines

Does it make sense to add a module parameter for device type(wilc1000 or wilc3000) to address device-specific featurization.

We don't do hacks like that in upstream, it's expected that the driver does this all automatically.

Marek has already submitted the patch to delay calling wiphy_register() so it should work at run time for both the devices.
I'm just curious to know for which scenario the module parameters should be used. Can it be used for enabling or disabling any feature, configuring any parameters, instead of complete device-specific featurization.

Module parameters are applicable for tunables which cannot be otherwise configured at runtime. Runtime configuration is always preferable. For the wilc, I don't think there is anything which has to be a module parameter, maybe firmware filename could be it.

#13 lore raw

Re: [PATCH v4 5/5] wifi: wilc1000: Add WILC3000 support

Quoted 17 lines · Marek Vasut

On 9/9/24 11:11 PM, [email protected] wrote:

[...]

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

Does it make sense to add a module parameter for device type(wilc1000 or wilc3000) to address device-specific featurization.

We don't do hacks like that in upstream, it's expected that the driver does this all automatically.

Quoted 6 lines

Marek has already submitted the patch to delay calling wiphy_register() so it
should work at run time for both the devices.
I'm just curious to know for which scenario the module parameters should be used. Can it be used for enabling or disabling any feature, configuring any parameters, instead of complete device-specific featurization.

Quoted 4 lines

Module parameters are applicable for tunables which cannot be otherwise configured at runtime. Runtime configuration is always preferable. For the wilc, I don't think there is anything which has to be a module parameter, maybe firmware filename could be it.

Nowadays module parameters are frowned upon, apparently some subsystems have even banned adding new module parameters. In wireless we have been more lax and have allowed new module parameters in some cases with good justification, but it's still rare.

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#14 lore raw
In reply to Marek Vasut

Hello everyone,

Quoted 6 lines · Marek Vasut

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.

[...]

Quoted 9 lines
 .../bindings/net/wireless/microchip,wilc1000.yaml           | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml +0 -0
index 2460ccc082371..5d40f22765bb6 100644
@@ -16,7 +16,11 @@ description:
 

Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml description: · line 25

Quoted 10 lines
Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml +5 -1
 properties:
   compatible:
-    const: microchip,wilc1000
+    oneOf:
+      - items:
+          - const: microchip,wilc3000
+          - const: microchip,wilc1000
+      - const: microchip,wilc1000
 
   reg: true

Following this series first revision, I have been taking a look at how to implement bluetooth feature for wilc3000 (the chip supports Bluetooth LE through a separated UART, see [1]), and I am facing some constraints. I feel like the possible solutions would conflict with this new binding, so even if I am a bit late to the party, I would like to expose the issue before the binding is merged in case we can find something which would allow to add bluetooth support without too much pain after the wlan part.

Downstream driver currently does not implement bluetooth as a standard bluetooth driver (module in drivers/bluetooth, registering a HCI device) but only performs a minimal set of operations directly in the wlan part ([2]). Getting a version valid for upstream would need the following points to be addressed:
1. despite being controlled from a serial port for nominal operations, the bluetooth part also depends on the "wlan" bus (spi or sdio) for initialization
2. yet init steps are not performed on any kind of subsystem ops but through writes to a custom chardev
3. the driver does not register itself a hci interface, it is expected to be done by userspace (hciattach).

It is only after those 3 steps that the chip can be used with standard hci commands over serial port. IMHO 1 is the biggest point, because it means that **a bluetooth driver for wilc3000 needs access to the bus used by wlan part** (so only describing the bluetooth part of the chip as a child node of an uart controller is not enough). Aside from bus access, I also expect some interactions between bluetooth and wifi (eg: power management, sleep/wakeup)

After considering multiple solutions to try to share this bus between existing wlan driver and a new bt driver (mfd device, auxiliary bus, device link + some handles, etc), my current best guess is to convert wilc driver to a MFD driver for wilc3000. I guess some work can be done so that the driver can still be shared between wilc1000 and wilc3000 _while_ remaining compatible with current wilc1000 description, but it would impact the DT description for wilc3000, which would need to switch from this:

  spi {
    wifi@0 {
      compatible = "microchip,wilc3000";
      [...]
    };
  };

To something like this:

  spi {
    wilc@0 {
      compatible = "microchip,wilc3000"; /* mfd driver */
      wifi {
        compatible = "microchip,wilc3000-wlan";
        [...]
      };
      bt {
        compatible = "microchip,wilc3000-bt";
        XXXX; /* some link to the uart controller connected to the chip */
        [...]
      };
    };
  };

(and similar thing when wilc is driven over a sdio bus)

Any opinion on this ? Would it make sense to describe wilc3000 chip that way ?

Thanks,
Alexis

[1] https://www.microchip.com/en-us/product/atwilc3000
[2]
https://github.com/linux4sam/linux-at91/blob/linux-6.6-mchp/drivers/net/wireless/microchip/wilc1000/bt.c

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

Hello everyone,

Quoted 6 lines · Marek Vasut

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.

[...]

Quoted 9 lines
 .../bindings/net/wireless/microchip,wilc1000.yaml           | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml +0 -0
index 2460ccc082371..5d40f22765bb6 100644
@@ -16,7 +16,11 @@ description:
 

Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml description: · line 25

Quoted 10 lines
Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml +5 -1
 properties:
   compatible:
-    const: microchip,wilc1000
+    oneOf:
+      - items:
+          - const: microchip,wilc3000
+          - const: microchip,wilc1000
+      - const: microchip,wilc1000
 
   reg: true

Following this series first revision, I have been taking a look at how to implement bluetooth feature for wilc3000 (the chip supports Bluetooth LE through a separated UART, see [1]), and I am facing some constraints. I feel like the possible solutions would conflict with this new binding, so even if I am a bit late to the party, I would like to expose the issue before the binding is merged in case we can find something which would allow to add bluetooth support without too much pain after the wlan part.

Downstream driver currently does not implement bluetooth as a standard bluetooth driver (module in drivers/bluetooth, registering a HCI device) but only performs a minimal set of operations directly in the wlan part ([2]). Getting a version valid for upstream would need the following points to be addressed:
1. despite being controlled from a serial port for nominal operations, the bluetooth part also depends on the "wlan" bus (spi or sdio) for initialization
2. yet init steps are not performed on any kind of subsystem ops but through writes to a custom chardev
3. the driver does not register itself a hci interface, it is expected to be done by userspace (hciattach).

It is only after those 3 steps that the chip can be used with standard hci commands over serial port. IMHO 1 is the biggest point, because it means that **a bluetooth driver for wilc3000 needs access to the bus used by wlan part** (so only describing the bluetooth part of the chip as a child node of an uart controller is not enough). Aside from bus access, I also expect some interactions between bluetooth and wifi (eg: power management, sleep/wakeup)

Quoted 2 lines

After considering multiple solutions to try to share this bus between existing wlan driver and a new bt driver (mfd device, auxiliary bus, device link + some

Driver design should not have impact on bindings.

Quoted 13 lines

handles, etc), my current best guess is to convert wilc driver to a MFD driver for wilc3000. I guess some work can be done so that the driver can still be shared between wilc1000 and wilc3000 _while_ remaining compatible with current wilc1000 description, but it would impact the DT description for wilc3000, which would need to switch from this:

  spi {
    wifi@0 {
      compatible = "microchip,wilc3000";
      [...]
    };
  };
Quoted 5 lines

To something like this:

  spi {
    wilc@0 {
      compatible = "microchip,wilc3000"; /* mfd driver */

I do not see any reason why... or rather: What is MFD here? MFD is Linux stuff and we talk about hardware.

Quoted 2 lines
      wifi {
        compatible = "microchip,wilc3000-wlan";

Why? Just merge it to parent...

Quoted 5 lines
        [...]
      };
      bt {
        compatible = "microchip,wilc3000-bt";
        XXXX; /* some link to the uart controller connected to the chip */

That's not how we represent UART devices. I don't understand why do you need these - if for power sequencing, then use power sequencing framework and describe associated hardware (there are some talks coming about it in 2 weeks). If for something else, then for what?

Quoted 9 lines
        [...]
      };
    };

};

(and similar thing when wilc is driven over a sdio bus)

Any opinion on this ? Would it make sense to describe wilc3000 chip that way ?

You described drivers, not wilc3000 chip...

Best regards,
Krzysztof

#16 lore raw

Hi Krzysztof,

Quoted 1 line · Krzysztof Kozlowski

On 03/09/2024 18:09, Alexis Lothoré wrote:

[...]

Quoted 38 lines
Quoted 2 lines

After considering multiple solutions to try to share this bus between existing wlan driver and a new bt driver (mfd device, auxiliary bus, device link + some

Driver design should not have impact on bindings.

Quoted 13 lines

handles, etc), my current best guess is to convert wilc driver to a MFD driver for wilc3000. I guess some work can be done so that the driver can still be shared between wilc1000 and wilc3000 _while_ remaining compatible with current wilc1000 description, but it would impact the DT description for wilc3000, which would need to switch from this:

  spi {
    wifi@0 {
      compatible = "microchip,wilc3000";
      [...]
    };
  };
Quoted 5 lines

To something like this:

  spi {
    wilc@0 {
      compatible = "microchip,wilc3000"; /* mfd driver */

I do not see any reason why... or rather: What is MFD here? MFD is Linux stuff and we talk about hardware.

Quoted 2 lines
      wifi {
        compatible = "microchip,wilc3000-wlan";

Why? Just merge it to parent...

Quoted 5 lines
        [...]
      };
      bt {
        compatible = "microchip,wilc3000-bt";
        XXXX; /* some link to the uart controller connected to the chip */
Quoted 4 lines

That's not how we represent UART devices. I don't understand why do you need these - if for power sequencing, then use power sequencing framework and describe associated hardware (there are some talks coming about it in 2 weeks). If for something else, then for what?

I have to check more for this power sequencing framework, it look likes it could handle parts of the wifi/bt shared power management, but it will not cover everything. The need for this bus on the BT side is not only for power sequencing, there is some chip initialization to be performed over this bus, like firmware upload to the chip (not the wifi firmware, it is an additional bluetooth firmware).

I guess you are referring to Bartosz Golaszewski's talk at Plumbers. Unfortunately I can not attend, but I'll make sure to check the materials once available :)

Thanks,

Alexis

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

Hello everyone,

Hi,

Quoted 49 lines · Marek Vasut
Quoted 6 lines

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.

[...]

Quoted 9 lines
  .../bindings/net/wireless/microchip,wilc1000.yaml           | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml +0 -0
index 2460ccc082371..5d40f22765bb6 100644
@@ -16,7 +16,11 @@ description:
 

Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml description: · line 25

Quoted 10 lines
Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml +5 -1
  properties:
    compatible:
-    const: microchip,wilc1000
+    oneOf:
+      - items:
+          - const: microchip,wilc3000
+          - const: microchip,wilc1000
+      - const: microchip,wilc1000
 
    reg: true

Following this series first revision, I have been taking a look at how to implement bluetooth feature for wilc3000 (the chip supports Bluetooth LE through a separated UART, see [1]), and I am facing some constraints. I feel like the possible solutions would conflict with this new binding, so even if I am a bit late to the party, I would like to expose the issue before the binding is merged in case we can find something which would allow to add bluetooth support without too much pain after the wlan part.

Downstream driver currently does not implement bluetooth as a standard bluetooth driver (module in drivers/bluetooth, registering a HCI device) but only performs a minimal set of operations directly in the wlan part ([2]). Getting a version valid for upstream would need the following points to be addressed:
1. despite being controlled from a serial port for nominal operations, the bluetooth part also depends on the "wlan" bus (spi or sdio) for initialization
2. yet init steps are not performed on any kind of subsystem ops but through writes to a custom chardev
3. the driver does not register itself a hci interface, it is expected to be done by userspace (hciattach).

Quoted 6 lines

It is only after those 3 steps that the chip can be used with standard hci commands over serial port. IMHO 1 is the biggest point, because it means that **a bluetooth driver for wilc3000 needs access to the bus used by wlan part** (so only describing the bluetooth part of the chip as a child node of an uart controller is not enough). Aside from bus access, I also expect some interactions between bluetooth and wifi (eg: power management, sleep/wakeup)

Just a quick idea -- what about having a phandle to the BT UART node in the wilc3000 node ? Then the wilc driver can check if the phandle is available and valid, and attach the BT part to the UART, while also doing all the necessary power sequencing and bus accesses via SDIO/SPI.

Like this:

&uart10 {
status = "okay";
};

&mmc20 {
...

  wifi@0 {
    compatible = "microchip,wilc1000";
    microchip,bt-uart = <&uart10>; // OPTIONAL
    ...

};
};

#18 lore raw

Hello Marek,

Quoted 1 line · Marek Vasut

On 9/3/24 6:09 PM, Alexis Lothoré wrote:

[...]

Quoted 18 lines
Quoted 6 lines

It is only after those 3 steps that the chip can be used with standard hci commands over serial port. IMHO 1 is the biggest point, because it means that **a bluetooth driver for wilc3000 needs access to the bus used by wlan part** (so only describing the bluetooth part of the chip as a child node of an uart controller is not enough). Aside from bus access, I also expect some interactions between bluetooth and wifi (eg: power management, sleep/wakeup)

Just a quick idea -- what about having a phandle to the BT UART node in the wilc3000 node ? Then the wilc driver can check if the phandle is available and valid, and attach the BT part to the UART, while also doing all the necessary power sequencing and bus accesses via SDIO/SPI.

Like this:

&uart10 {
  status = "okay";
};

Quoted 8 lines

&mmc20 {
  ...
  wifi@0 {
    compatible = "microchip,wilc1000";
    microchip,bt-uart = <&uart10>; // OPTIONAL
    ...
  };
};

I thought about something like this too, indeed (but somehow inverted, a reference to wilc node in the bt node under uart, to allow the bluetooth part to ask wilc to perform operations over sdio/spi). The design would likely be simpler in this case, but some internal discussions with colleagues raised some concerns, for example with power management (but Krzysztof's suggestion about power sequencing may help with this).

Thanks,

Alexis

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

Hello Marek,

Hi,

Quoted 27 lines
Quoted 18 lines
Quoted 6 lines

It is only after those 3 steps that the chip can be used with standard hci commands over serial port. IMHO 1 is the biggest point, because it means that **a bluetooth driver for wilc3000 needs access to the bus used by wlan part** (so only describing the bluetooth part of the chip as a child node of an uart controller is not enough). Aside from bus access, I also expect some interactions between bluetooth and wifi (eg: power management, sleep/wakeup)

Just a quick idea -- what about having a phandle to the BT UART node in the wilc3000 node ? Then the wilc driver can check if the phandle is available and valid, and attach the BT part to the UART, while also doing all the necessary power sequencing and bus accesses via SDIO/SPI.

Like this:

&uart10 {
  status = "okay";
};

Quoted 8 lines

&mmc20 {
  ...
  wifi@0 {
    compatible = "microchip,wilc1000";
    microchip,bt-uart = <&uart10>; // OPTIONAL
    ...
  };
};

Quoted 6 lines

I thought about something like this too, indeed (but somehow inverted, a reference to wilc node in the bt node under uart, to allow the bluetooth part to ask wilc to perform operations over sdio/spi). The design would likely be simpler in this case, but some internal discussions with colleagues raised some concerns, for example with power management (but Krzysztof's suggestion about power sequencing may help with this).

Maybe switching the current WILC power management to runtime PM would simplify things greatly ?