dt-bindings: wireless: wilc1000: Document WILC3000 compatible string
Subsystems (5)
PATCH v7 1/7 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
V6: - Rebase on next-20240926
V7: - Rebase on next-20241003 / wireless-next/main 5a4d42c1688c
with v2 wifi: wilc1000: Keep slot powered on during suspend/resume
--- .../bindings/net/wireless/microchip,wilc1000.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml +5 -1
@@ -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
PATCH v7 2/7 wifi: wilc1000: Clean up usage of wilc_get_chipid()
Reduce the use of wilc_get_chipid(), use cached chip ID wherever possible. Remove duplicated partial chip ID read implementations from the driver. Update wilc_get_chipid() to always read the chip ID out of the hardware and update the cached chip ID, and make it return a proper return value instead of a chipid. Call wilc_get_chipid() early to make the cached chip ID available to various sites using is_wilc1000() to access the cached chip ID.
---
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
V6: - Get chipid early in probe
- Drop RB
- Rebase on next-20240926
V7: - Update commit message
- Reinstate RB
- Rebase on next-20241003 / wireless-next/main 5a4d42c1688c with v2 wifi: wilc1000: Keep slot powered on during suspend/resume
--- .../net/wireless/microchip/wilc1000/netdev.c | 6 +- .../net/wireless/microchip/wilc1000/sdio.c | 17 +---- drivers/net/wireless/microchip/wilc1000/spi.c | 2 +- .../net/wireless/microchip/wilc1000/wlan.c | 74 +++++++++++-------- .../net/wireless/microchip/wilc1000/wlan.h | 2 +- 5 files changed, 52 insertions(+), 49 deletions(-)
drivers/net/wireless/microchip/wilc1000/netdev.c +3 -3
@@ -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 +4 -13
@@ -182,6 +182,10 @@ static int wilc_sdio_probe(struct sdio_func *func,wilc_sdio_init (wilc, false); + ret =wilc_get_chipid (wilc); +if (ret) + goto dispose_irq; + ret =wilc_load_mac_from_nv (wilc);if (ret) {pr_err ("Can not retrieve MAC address from chip\n" );
@@ -667,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
@@ -756,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/spi.c +1 -1
@@ -245,7 +245,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 +43 -31
104 lines not on this page · raw message
drivers/net/wireless/microchip/wilc1000/wlan.h +1 -1
@@ -443,6 +443,6 @@ 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_get_chipid (struct wilc *wilc);int wilc_load_mac_from_nv (struct wilc *wilc);#endif
Signature · 1 line
2.45.2
Re: [PATCH v7 2/7] wifi: wilc1000: Clean up usage of wilc_get_chipid()
Quoted 10 lines · Marek Vasut
Reduce the use of
wilc_get_chipid(), use cached chip ID wherever possible. Remove duplicated partial chip ID read implementations from the driver. Updatewilc_get_chipid()to always read the chip ID out of the hardware and update the cached chip ID, and make it return a proper return value instead of a chipid. Callwilc_get_chipid()early to make the cached chip ID available to various sites usingis_wilc1000()to access the cached chip ID.Reviewed-by Alexis Lothoré <[email protected]>Signed-off-by Marek Vasut <[email protected]>
[...]
Quoted 18 lines
drivers/net/wireless/microchip/wilc1000/wlan.c +18
-0+int wilc_get_chipid (struct wilc *wilc) +{ +u32 chipid =0 ; +u32 rfrevid =0 ; + +if (wilc->chipid ==0 ) { + wilc->hif_func->hif_read_reg (wilc,WILC_CHIPID , &chipid); + wilc->hif_func->hif_read_reg (wilc,WILC_RF_REVISION_ID , + &rfrevid); +if (!is_wilc1000 (chipid)) { + wilc->chipid =0 ; +return -EINVAL ; + } +if (chipid ==WILC_1000_BASE_ID_2A ) {/* 0x1002A0 */ +if (rfrevid !=0x1 ) + chipid =WILC_1000_BASE_ID_2A_REV1 ; + }else if (chipid ==WILC_1000_BASE_ID_2B ) {/* 0x1002B0 */ +if (rfrevid ==0x4 )
drivers/net/wireless/microchip/wilc1000/wlan.c int wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, struct wid *wids, · line 1432
Quoted 10 lines
drivers/net/wireless/microchip/wilc1000/wlan.c +10
-0+ chipid =WILC_1000_BASE_ID_2B_REV1 ; + else if (rfrevid != 0x3) + chipid =WILC_1000_BASE_ID_2B_REV2 ; + } + + wilc->chipid = chipid; + } + +return 0 ; +}
My bad for not having spotted it in v6, but you are still missing an EXPORT_SYMBOL_GPL(wilc_get_chipid) here, making the build fail if wilc support is built as module:
ERROR: modpost: "wilc_get_chipid" [drivers/net/wireless/microchip/wilc1000/wilc1000-sdio.ko] undefined!
ERROR: modpost: "wilc_get_chipid" [drivers/net/wireless/microchip/wilc1000/wilc1000-spi.ko] undefined! make[2]: *** [scripts/Makefile.modpost:145: Module.symvers] Error 1 make[1]: *** [/home/alexis/src/microchip/linux/Makefile:1878: modpost] Error 2
make: *** [Makefile:224: __sub-make] Error 2
Signature · 3 lines
Alexis Lothoré, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Re: [PATCH v7 2/7] wifi: wilc1000: Clean up usage of wilc_get_chipid()
Quoted 47 lines · Alexis Lothoré
Quoted 10 lines · Marek Vasut
Reduce the use of
wilc_get_chipid(), use cached chip ID wherever possible. Remove duplicated partial chip ID read implementations from the driver. Updatewilc_get_chipid()to always read the chip ID out of the hardware and update the cached chip ID, and make it return a proper return value instead of a chipid. Callwilc_get_chipid()early to make the cached chip ID available to various sites usingis_wilc1000()to access the cached chip ID.Reviewed-by Alexis Lothoré <[email protected]>Signed-off-by Marek Vasut <[email protected]>[...]
Quoted 18 lines
drivers/net/wireless/microchip/wilc1000/wlan.c +18
-0+int wilc_get_chipid (struct wilc *wilc) +{ +u32 chipid =0 ; +u32 rfrevid =0 ; + +if (wilc->chipid ==0 ) { + wilc->hif_func->hif_read_reg (wilc,WILC_CHIPID , &chipid); + wilc->hif_func->hif_read_reg (wilc,WILC_RF_REVISION_ID , + &rfrevid); +if (!is_wilc1000 (chipid)) { + wilc->chipid =0 ; +return -EINVAL ; + } +if (chipid ==WILC_1000_BASE_ID_2A ) {/* 0x1002A0 */ +if (rfrevid !=0x1 ) + chipid =WILC_1000_BASE_ID_2A_REV1 ; + }else if (chipid ==WILC_1000_BASE_ID_2B ) {/* 0x1002B0 */ +if (rfrevid ==0x4 )drivers/net/wireless/microchip/wilc1000/wlan.c int wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, struct wid *wids, · line 1432
Quoted 10 lines
drivers/net/wireless/microchip/wilc1000/wlan.c +10
-0+ chipid =WILC_1000_BASE_ID_2B_REV1 ; + else if (rfrevid != 0x3) + chipid =WILC_1000_BASE_ID_2B_REV2 ; + } + + wilc->chipid = chipid; + } + +return 0 ; +}My bad for not having spotted it in v6, but you are still missing an
EXPORT_SYMBOL_GPL(wilc_get_chipid)here, making the build fail if wilc support is built as module:
Quoted 7 lines
ERROR: modpost: "
wilc_get_chipid" [drivers/net/wireless/microchip/wilc1000/wilc1000-sdio.ko] undefined!
ERROR: modpost: "wilc_get_chipid" [drivers/net/wireless/microchip/wilc1000/wilc1000-spi.ko] undefined! make[2]: *** [scripts/Makefile.modpost:145: Module.symvers] Error 1 make[1]: *** [/home/alexis/src/microchip/linux/Makefile:1878: modpost] Error 2
make: *** [Makefile:224: __sub-make] Error 2
Fixed in V8, thanks.
Before I send V8, can you have a look at the last two patches in this series? They need some RB/TB.
Thanks !
PATCH v7 3/7 wifi: wilc1000: Fold chip_allow_sleep()/chip_wakeup() into wlan.c
In reply to Marek VasutNeither 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
V6: - Rebase on next-20240926
V7: - Rebase on next-20241003 / wireless-next/main 5a4d42c1688c
with v2 wifi: wilc1000: Keep slot powered on during suspend/resume
--- .../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
@@ -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, ®);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, ®);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, ®);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
@@ -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
PATCH v7 4/7 wifi: wilc1000: Fill in missing error handling
In reply to Marek VasutAdd 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
V6: - Rebase on next-20240926
V7: - Rebase on next-20241003 / wireless-next/main 5a4d42c1688c
with v2 wifi: wilc1000: Keep slot powered on during suspend/resume
--- .../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
@@ -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
@@ -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
PATCH v7 5/7 wifi: wilc1000: Fold wilc_create_wiphy() into cfg80211.c
In reply to Marek VasutThe 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
V6: - Add RB from Alexis
- Rebase on next-20240926
V7: - Rebase on next-20241003 / wireless-next/main 5a4d42c1688c
with v2 wifi: wilc1000: Keep slot powered on during suspend/resume
--- .../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
@@ -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
@@ -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
PATCH v7 6/7 wifi: wilc1000: Register wiphy after reading out chipid
In reply to Marek VasutRegister 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
V6: - Rebase on next-20240926
V7: - Rebase on next-20241003 / wireless-next/main 5a4d42c1688c
with v2 wifi: wilc1000: Keep slot powered on during suspend/resume
--- .../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
@@ -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
@@ -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
@@ -186,6 +186,10 @@ static int wilc_sdio_probe(struct sdio_func *func,if (ret) goto dispose_irq; + ret =wilc_cfg80211_register (wilc); +if (ret) + goto dispose_irq; + 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
@@ -249,6 +249,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
Re: [PATCH v7 6/7] wifi: wilc1000: Register wiphy after reading out chipid
Hello Marek,
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.Signed-off-by Marek Vasut <[email protected]>
[...]
Quoted 13 lines
drivers/net/wireless/microchip/wilc1000/cfg80211.c +0
-1@@ -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)
drivers/net/wireless/microchip/wilc1000/cfg80211.c static struct wilc *wilc_create_wiphy(struct device *dev) · line 1810
Quoted 7 lines
drivers/net/wireless/microchip/wilc1000/cfg80211.c +0
-2@@ -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);
I think you did not address one of my comment in v5 about this change: in wilc_cfg80211_init (wilc_create_wiphy's caller), there is still a wiphy_unregister in the failure path, which does not make sense anymore since this function does not register wiphy anymore.
Once fixed: with this patch iw phy shows correctly on my platform that wilc3000 does not support SAE authenticate command while wilc1000 does. And wilc1000 still works correctly, even with wpa3.
Tested-on: WILC1000SD 07 SDIO WILC_WIFI_FW_REL_16_1_2
Tested-on: WILC3000 A SDIO WILC_WIFI_FW_REL_16_1_1
Thanks,
Alexis
Signature · 3 lines
Alexis Lothoré, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Re: [PATCH v7 6/7] wifi: wilc1000: Register wiphy after reading out chipid
Quoted 1 line · Alexis Lothoré
Hello Marek,
Hi,
Quoted 36 lines · Marek Vasut
Quoted 6 lines
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.Signed-off-by Marek Vasut <[email protected]>[...]
Quoted 13 lines
drivers/net/wireless/microchip/wilc1000/cfg80211.c +0
-1@@ -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)drivers/net/wireless/microchip/wilc1000/cfg80211.c static struct wilc *wilc_create_wiphy(struct device *dev) · line 1810
Quoted 7 lines
drivers/net/wireless/microchip/wilc1000/cfg80211.c +0
-2@@ -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);I think you did not address one of my comment in v5 about this change: in
wilc_cfg80211_init(wilc_create_wiphy's caller), there is still awiphy_unregisterin the failure path, which does not make sense anymore since this function does not register wiphy anymore.
Quoted 7 lines
Once fixed: with this patch iw phy shows correctly on my platform that wilc3000 does not support SAE authenticate command while wilc1000 does. And wilc1000 still works correctly, even with wpa3.
Tested-by Alexis Lothoré <[email protected]>Tested-on: WILC1000SD 07 SDIO
WILC_WIFI_FW_REL_16_1_2
Tested-on: WILC3000 A SDIOWILC_WIFI_FW_REL_16_1_1
Fixed in V8, thank you.
PATCH v7 7/7 wifi: wilc1000: Add WILC3000 support
In reply to Marek VasutFrom: 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()
V6: - Rebase on next-20240926
V7: - Fix firmware name printing in wilc_wlan_get_firmware() netdev_info()
- Rebase on next-20241003 / wireless-next/main 5a4d42c1688c with v2 wifi: wilc1000: Keep slot powered on during suspend/resume
--- .../wireless/microchip/wilc1000/cfg80211.c | 4 +- .../net/wireless/microchip/wilc1000/netdev.c | 29 ++- .../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, 299 insertions(+), 63 deletions(-)
drivers/net/wireless/microchip/wilc1000/cfg80211.c +3 -1
@@ -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 +20 -9
@@ -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" , -WILC1000_FW (WILC1000_API_VER )); +netdev_info (dev,"WILC%d loading firmware [%s]\n" , +is_wilc1000 (wilc->chipid) ?1000 :3000 , + firmware); - 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
@@ -1233,7 +1233,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
Re: [PATCH v7 7/7] 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.
Signed-off-by Ajay Singh <[email protected]>Signed-off-by Marek Vasut <[email protected]>
And for the basic feature set (basic sta scenario, basic ap scenario):
Tested-on: WILC1000SD 07 SDIO WILC_WIFI_FW_REL_16_1_2
Tested-on: WILC1000SD 07 SPI WILC_WIFI_FW_REL_16_1_2
Tested-on: WILC3000 A SDIO WILC_WIFI_FW_REL_16_1_1
Tested-on: WILC3000 A SPI WILC_WIFI_FW_REL_16_1_1
Signature · 3 lines
Alexis Lothoré, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Re: [PATCH v7 7/7] wifi: wilc1000: Add WILC3000 support
Quoted 13 lines · Alexis Lothoré
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.
Signed-off-by Ajay Singh <[email protected]>Signed-off-by Marek Vasut <[email protected]>Reviewed-by Alexis Lothoré <[email protected]>
Quoted 7 lines
And for the basic feature set (basic sta scenario, basic ap scenario):
Tested-by Alexis Lothoré <[email protected]>Tested-on: WILC1000SD 07 SDIO
WILC_WIFI_FW_REL_16_1_2
Tested-on: WILC1000SD 07 SPIWILC_WIFI_FW_REL_16_1_2
Tested-on: WILC3000 A SDIOWILC_WIFI_FW_REL_16_1_1
Tested-on: WILC3000 A SPIWILC_WIFI_FW_REL_16_1_1
Thank you