diff mbox series

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

Message ID 20240909193035.69823-7-marex@denx.de
State New
Headers show
Series [v5,1/9] dt-bindings: wireless: wilc1000: Document WILC3000 compatible string | expand

Commit Message

Marek Vasut Sept. 9, 2024, 7:29 p.m. UTC
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.

Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Adham Abozaeid <adham.abozaeid@microchip.com>
Cc: Ajay Singh <ajay.kathat@microchip.com>
Cc: Alexis Lothoré <alexis.lothore@bootlin.com>
Cc: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Cc: Conor Dooley <conor+dt@kernel.org>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Kalle Valo <kvalo@kernel.org>
Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Rob Herring <robh@kernel.org>
Cc: devicetree@vger.kernel.org
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
---
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(-)

Comments

Alexis Lothoré Sept. 10, 2024, 9:01 a.m. UTC | #1
Hello Marek,

On 9/9/24 21:29, Marek Vasut wrote:
> 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
Marek Vasut Sept. 10, 2024, 9:49 a.m. UTC | #2
On 9/10/24 11:01 AM, Alexis Lothoré wrote:
> Hello Marek,

Hi,

> On 9/9/24 21:29, Marek Vasut wrote:
>> 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.
diff mbox series

Patch

diff --git a/drivers/net/wireless/microchip/wilc1000/sdio.c b/drivers/net/wireless/microchip/wilc1000/sdio.c
index 6d01a838ab184..01a96d0f562a6 100644
--- a/drivers/net/wireless/microchip/wilc1000/sdio.c
+++ b/drivers/net/wireless/microchip/wilc1000/sdio.c
@@ -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");
diff --git a/drivers/net/wireless/microchip/wilc1000/spi.c b/drivers/net/wireless/microchip/wilc1000/spi.c
index 5ff940c53ad9c..1b60a13df6cfa 100644
--- a/drivers/net/wireless/microchip/wilc1000/spi.c
+++ b/drivers/net/wireless/microchip/wilc1000/spi.c
@@ -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;
 
diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index 01476f8ecc36f..1aab8eca58169 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -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;
diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.h b/drivers/net/wireless/microchip/wilc1000/wlan.h
index 4e2b0c4ac1e21..552590823e444 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.h
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.h
@@ -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