dt-bindings: wireless: wilc1000: Document WILC3000 compatible string
Subsystems (5)
PATCH v2 1/4 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
--- .../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,wilc1000 + - const: microchip,wilc3000 + - const: microchip,wilc1000 reg: true
Signature · 1 line
2.43.0
PATCH v2 2/4 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 .
---
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
--- .../net/wireless/microchip/wilc1000/sdio.c | 13 ---- .../net/wireless/microchip/wilc1000/wlan.c | 69 +++++++++++-------- .../net/wireless/microchip/wilc1000/wlan.h | 1 - 3 files changed, 40 insertions(+), 43 deletions(-)
drivers/net/wireless/microchip/wilc1000/sdio.c +0 -13
@@ -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 +40 -29
102 lines not on this page · raw message
drivers/net/wireless/microchip/wilc1000/wlan.h +0 -1
@@ -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.43.0
Simon Horman
reviewerRe: [PATCH v2 2/4] wifi: wilc1000: Fold wilc_get_chipid() into wlan.c
Quoted 7 lines · Marek Vasut
Do not use
wilc_get_chipid()outside ofwlan.c. Instead, callwilc_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. Makewilc_get_chipid()static and remove its prototype fromwlan.h.Signed-off-by Marek Vasut <[email protected]>
...
Quoted 1 line
drivers/net/wireless/microchip/wilc1000/wlan.c +0
-0
...
drivers/net/wireless/microchip/wilc1000/wlan.c int wilc_wlan_init(struct net_device *dev) · line 1548
Quoted 13 lines
drivers/net/wireless/microchip/wilc1000/wlan.c +6
-0@@ -1535,9 +1537,18 @@ int wilc_wlan_init(struct net_device *dev)if (!wilc->hif_func->hif_is_init (wilc)) {acquire_bus (wilc,WILC_BUS_ACQUIRE_ONLY ); ret = wilc->hif_func->hif_init (wilc, false); +if (!ret) + chipid =wilc_get_chipid (wilc);release_bus (wilc,WILC_BUS_RELEASE_ONLY );if (ret) goto fail; + +if (!is_wilc1000 (chipid)) { +netdev_err (dev,"Unsupported chipid: %x\n" , chipid); +return -EINVAL ;
Hi Marek,
Should this unwind as is the case elsewhere in this function?
ret = -EINVAL; goto fail;
Flagged by Smatch.
Quoted 6 lines
drivers/net/wireless/microchip/wilc1000/wlan.c +3
-0+ } + +netdev_dbg (dev,"chipid (%08x)\n" , chipid); }if (!wilc->vmm_table)
...
Re: [PATCH v2 2/4] wifi: wilc1000: Fold wilc_get_chipid() into wlan.c
Quoted 31 lines · Simon Horman
Quoted 7 lines · Marek Vasut
Do not use
wilc_get_chipid()outside ofwlan.c. Instead, callwilc_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. Makewilc_get_chipid()static and remove its prototype fromwlan.h.Signed-off-by Marek Vasut <[email protected]>...
Quoted 1 line
drivers/net/wireless/microchip/wilc1000/wlan.c +0
-0...
drivers/net/wireless/microchip/wilc1000/wlan.c int wilc_wlan_init(struct net_device *dev) · line 1548
Quoted 13 lines
drivers/net/wireless/microchip/wilc1000/wlan.c +6
-0@@ -1535,9 +1537,18 @@ int wilc_wlan_init(struct net_device *dev)if (!wilc->hif_func->hif_is_init (wilc)) {acquire_bus (wilc,WILC_BUS_ACQUIRE_ONLY ); ret = wilc->hif_func->hif_init (wilc, false); +if (!ret) + chipid =wilc_get_chipid (wilc);release_bus (wilc,WILC_BUS_RELEASE_ONLY );if (ret) goto fail; + +if (!is_wilc1000 (chipid)) { +netdev_err (dev,"Unsupported chipid: %x\n" , chipid); +return -EINVAL ;Hi Marek,
Quoted 1 line
Should this unwind as is the case elsewhere in this function?
It should, will fix in V3, thanks.
Quoted 4 lines
ret = -EINVAL; goto fail;Flagged by Smatch.
What's the trick here ?
Simon Horman
reviewerRe: [PATCH v2 2/4] wifi: wilc1000: Fold wilc_get_chipid() into wlan.c
+ Dan
Quoted 34 lines · Marek Vasut
Quoted 31 lines · Simon Horman
Quoted 7 lines · Marek Vasut
Do not use
wilc_get_chipid()outside ofwlan.c. Instead, callwilc_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. Makewilc_get_chipid()static and remove its prototype fromwlan.h.Signed-off-by Marek Vasut <[email protected]>...
Quoted 1 line
drivers/net/wireless/microchip/wilc1000/wlan.c +0
-0...
drivers/net/wireless/microchip/wilc1000/wlan.c int wilc_wlan_init(struct net_device *dev) · line 1548
Quoted 13 lines
drivers/net/wireless/microchip/wilc1000/wlan.c +6
-0@@ -1535,9 +1537,18 @@ int wilc_wlan_init(struct net_device *dev)if (!wilc->hif_func->hif_is_init (wilc)) {acquire_bus (wilc,WILC_BUS_ACQUIRE_ONLY ); ret = wilc->hif_func->hif_init (wilc, false); +if (!ret) + chipid =wilc_get_chipid (wilc);release_bus (wilc,WILC_BUS_RELEASE_ONLY );if (ret) goto fail; + +if (!is_wilc1000 (chipid)) { +netdev_err (dev,"Unsupported chipid: %x\n" , chipid); +return -EINVAL ;Hi Marek,
Quoted 1 line
Should this unwind as is the case elsewhere in this function?
Quoted 8 lines
It should, will fix in V3, thanks.
Quoted 4 lines
ret = -EINVAL; goto fail;Flagged by Smatch.
What's the trick here ?
Smatch is here. I don't think there is much of a trick other than running it :)
Re: [PATCH v2 2/4] wifi: wilc1000: Fold wilc_get_chipid() into wlan.c
Quoted 42 lines · Simon Horman
+ Dan
Quoted 39 lines · Marek Vasut
Quoted 31 lines · Simon Horman
Quoted 7 lines · Marek Vasut
Do not use
wilc_get_chipid()outside ofwlan.c. Instead, callwilc_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. Makewilc_get_chipid()static and remove its prototype fromwlan.h.Signed-off-by Marek Vasut <[email protected]>...
Quoted 1 line
drivers/net/wireless/microchip/wilc1000/wlan.c +0
-0...
drivers/net/wireless/microchip/wilc1000/wlan.c int wilc_wlan_init(struct net_device *dev) · line 1548
Quoted 13 lines
drivers/net/wireless/microchip/wilc1000/wlan.c +6
-0@@ -1535,9 +1537,18 @@ int wilc_wlan_init(struct net_device *dev)if (!wilc->hif_func->hif_is_init (wilc)) {acquire_bus (wilc,WILC_BUS_ACQUIRE_ONLY ); ret = wilc->hif_func->hif_init (wilc, false); +if (!ret) + chipid =wilc_get_chipid (wilc);release_bus (wilc,WILC_BUS_RELEASE_ONLY );if (ret) goto fail; + +if (!is_wilc1000 (chipid)) { +netdev_err (dev,"Unsupported chipid: %x\n" , chipid); +return -EINVAL ;Hi Marek,
Quoted 1 line
Should this unwind as is the case elsewhere in this function?
It should, will fix in V3, thanks.
Quoted 3 lines
ret = -EINVAL; goto fail;
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Flagged by Smatch.
What's the trick here ?
Smatch is here. I don't think there is much of a trick other than running it :)
Thanks !
Re: [PATCH v2 2/4] wifi: wilc1000: Fold wilc_get_chipid() into wlan.c
In reply to Marek VasutHello Marek,
Quoted 27 lines · Marek Vasut
Do not use
wilc_get_chipid()outside ofwlan.c. Instead, callwilc_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. Makewilc_get_chipid()static and remove its prototype fromwlan.h.Signed-off-by Marek Vasut <[email protected]>---
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
---
[...]
drivers/net/wireless/microchip/wilc1000/wlan.c int wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, struct wid *wids, · line 1411
Quoted 7 lines
drivers/net/wireless/microchip/wilc1000/wlan.c +7
-0+static u32 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);
If we search for WILC_CHIPID in the whole driver, there are still two places manually reading this register. Shouldn't those places also benefit from wilc_get_chipid ?
drivers/net/wireless/microchip/wilc1000/wlan.c int wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, struct wid *wids, · line 1415
Quoted 4 lines
drivers/net/wireless/microchip/wilc1000/wlan.c +4
-0+ wilc->hif_func->hif_read_reg (wilc,WILC_RF_REVISION_ID , + &rfrevid); +if (!is_wilc1000 (chipid)) { + wilc->chipid =0 ;
While at it, since you have trimmed the update parameter, it would be nice to also fix this return value (ie make wilc_getchipid() not return 0 but a real error code if we can not read the chip id.
Thanks,
Alexis
Signature · 3 lines
Alexis Lothoré, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Re: [PATCH v2 2/4] wifi: wilc1000: Fold wilc_get_chipid() into wlan.c
On 8/27/24 9:51 AM, Alexis Lothoré wrote:
Hi,
Quoted 10 lines
drivers/net/wireless/microchip/wilc1000/wlan.c int wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, struct wid *wids, · line 1411
Quoted 7 lines
drivers/net/wireless/microchip/wilc1000/wlan.c +7
-0+static u32 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);If we search for
WILC_CHIPIDin the whole driver, there are still two places manually reading this register. Shouldn't those places also benefit fromwilc_get_chipid?
Both the one in wilc_wlan_start() and wilc_validate_chipid() look more like some sort of communication check attempt, rather than reading out the chipid for any sort of actual chip identification purpose. I could simply remove those ?
Quoted 8 lines
drivers/net/wireless/microchip/wilc1000/wlan.c int wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, struct wid *wids, · line 1415
Quoted 4 lines
drivers/net/wireless/microchip/wilc1000/wlan.c +4
-0+ wilc->hif_func->hif_read_reg (wilc,WILC_RF_REVISION_ID , + &rfrevid); +if (!is_wilc1000 (chipid)) { + wilc->chipid =0 ;While at it, since you have trimmed the update parameter, it would be nice to also fix this return value (ie make
wilc_getchipid()not return 0 but a real error code if we can not read the chip id.
Fixed in V3, thanks .
Re: [PATCH v2 2/4] wifi: wilc1000: Fold wilc_get_chipid() into wlan.c
Quoted 15 lines · Marek Vasut
On 8/27/24 9:51 AM, Alexis Lothoré wrote:
Hi,
Quoted 10 lines
drivers/net/wireless/microchip/wilc1000/wlan.c int wilc_send_config_pkt(struct wilc_vif *vif, u8 mode, struct wid *wids, · line 1411
Quoted 7 lines
drivers/net/wireless/microchip/wilc1000/wlan.c +7
-0+static u32 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);If we search for
WILC_CHIPIDin the whole driver, there are still two places manually reading this register. Shouldn't those places also benefit fromwilc_get_chipid?
Quoted 3 lines
Both the one in
wilc_wlan_start()andwilc_validate_chipid()look more like some sort of communication check attempt, rather than reading out the chipid for any sort of actual chip identification purpose. I could simply remove those ?
Agree about the purpose of this reading in wilc_wlan_start and wilc_validate_chipid. And about removing those: I would say why not. wilc_validate_chipid has proven to be quite useful to diagnose some early communication failure, but I guess there are enough communications attempts around (wilc_spi_configure_bus_protocol, wilc_load_mac_from_nv) to still validate than we are able to communicate with the chip at probe time.
Quoted 11 lines
Quoted 9 lines
Quoted 5 lines
+
wilc->hif_func->hif_read_reg(wilc, WILC_RF_REVISION_ID, + &rfrevid);
+ if (!is_wilc1000(chipid)) {
+wilc->chipid= 0;While at it, since you have trimmed the update parameter, it would be nice to also fix this return value (ie make
wilc_getchipid()not return 0 but a real error code if we can not read the chip id.Fixed in V3, thanks .
Great, thanks
Alexis
Signature · 3 lines
Alexis Lothoré, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v2 3/4 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: 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
--- .../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.43.0
Re: [PATCH v2 3/4] wifi: wilc1000: Fold chip_allow_sleep()/chip_wakeup() into wlan.c
Quoted 70 lines · 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 fromwlan.h.Make
chip_allow_sleep()return error code in preparation for the follow up patches.Move
acquire_bus()andrelease_bus()to avoid forward declaration of chip_allow_sleep()/chip_wakeup().Signed-off-by Marek Vasut <[email protected]>---
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--- .../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 +1
-15@@ -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;
drivers/net/wireless/microchip/wilc1000/wlan.c void chip_allow_sleep(struct wilc *wilc) · line 573
Quoted 5 lines
drivers/net/wireless/microchip/wilc1000/wlan.c +1
-1@@ -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;
Forwarding error codes sounds like a good idea, but neither this patch nor the next one is reading the return value from any chip_allow_sleep[XXX] function, so it does not bring much value.
Alexis
Signature · 3 lines
Alexis Lothoré, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Re: [PATCH v2 3/4] wifi: wilc1000: Fold chip_allow_sleep()/chip_wakeup() into wlan.c
Quoted 65 lines · Alexis Lothoré
Quoted 64 lines · 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 fromwlan.h.Make
chip_allow_sleep()return error code in preparation for the follow up patches.Move
acquire_bus()andrelease_bus()to avoid forward declaration of chip_allow_sleep()/chip_wakeup().Signed-off-by Marek Vasut <[email protected]>---
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--- .../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 +0
-14@@ -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; }
Quoted 15 lines
drivers/net/wireless/microchip/wilc1000/wlan.c void chip_allow_sleep(struct wilc *wilc) · line 573
Quoted 11 lines
drivers/net/wireless/microchip/wilc1000/wlan.c +2
-2-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;Forwarding error codes sounds like a good idea, but neither this patch nor the next one is reading the return value from any chip_allow_sleep[XXX] function, so it does not bring much value.
I will add a follow up patch to this one which adds the error handling, since there is a lot of it to propagate the errors through. It will be in V3.
PATCH v2 4/4 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: 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
--- .../wireless/microchip/wilc1000/cfg80211.c | 7 + .../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 | 217 +++++++++++++++--- .../net/wireless/microchip/wilc1000/wlan.h | 43 +++- 6 files changed, 298 insertions(+), 62 deletions(-)
drivers/net/wireless/microchip/wilc1000/cfg80211.c +7 -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; + } + 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 +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;
@@ -195,20 +201,24 @@ 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; +char *firmware;int ret; - chip_id =wilc_get_chipid (wilc, false); +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,"ChipID [%x] loading firmware [%s]\n" , chip_id, +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
@@ -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 +184 -33
292 lines not on this page · raw message
drivers/net/wireless/microchip/wilc1000/wlan.h +35 -8
83 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [PATCH v2 4/4] wifi: wilc1000: Add WILC3000 support
Quoted 45 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]>---
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-EINVALinwilc_sdio_init()if chip ID is not supported
- Dispose ofwilc_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--- .../wireless/microchip/wilc1000/cfg80211.c | 7 + .../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 | 217 +++++++++++++++--- .../net/wireless/microchip/wilc1000/wlan.h | 43 +++- 6 files changed, 298 insertions(+), 62 deletions(-)
[...]
drivers/net/wireless/microchip/wilc1000/wlan.c static int init_chip(struct net_device *dev) · line 1608
Quoted 6 lines
drivers/net/wireless/microchip/wilc1000/wlan.c +2
-0@@ -1467,6 +1604,20 @@ static int init_chip(struct net_device *dev) } } +if (is_wilc3000 (wilc->chipid)) { + ret = wilc->hif_func->hif_read_reg (wilc,0x207ac , ®);
Some defines would be nice here instead of hardcoded addresses. I have asked Ajay about those while working on wilc3000, the meaning is roughly the following:
- 0x000207ac: WILC_3000_BOOTROM_STATUS_REGISTER
- 0x004f0000: WILC_3000_CORTUS_BOOT_REGISTER_2
- 0x71: WILC_CORTUS_BOOT_FROM_IRAM
Thanks,
Alexis
Signature · 3 lines
Alexis Lothoré, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Re: [PATCH v2 4/4] wifi: wilc1000: Add WILC3000 support
On 8/27/24 10:28 AM, Alexis Lothoré wrote:
Hi,
Quoted 4 lines
Quoted 4 lines
(quoted diff) +0
-0@@ -1467,6 +1604,20 @@ static int init_chip(struct net_device *dev) } }
Quoted 8 lines
drivers/net/wireless/microchip/wilc1000/wlan.c static int init_chip(struct net_device *dev) · line 1608
Quoted 2 lines
drivers/net/wireless/microchip/wilc1000/wlan.c +2
-0+if (is_wilc3000 (wilc->chipid)) { + ret = wilc->hif_func->hif_read_reg (wilc,0x207ac , ®);Some defines would be nice here instead of hardcoded addresses. I have asked Ajay about those while working on wilc3000, the meaning is roughly the following:
-0x000207ac:WILC_3000_BOOTROM_STATUS_REGISTER
-0x004f0000:WILC_3000_CORTUS_BOOT_REGISTER_2
-0x71:WILC_CORTUS_BOOT_FROM_IRAM
Fixed in V3, thanks.
Quoted 33 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.
Signed-off-by Marek Vasut <[email protected]>---
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--- .../bindings/net/wireless/microchip,wilc1000.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml +0
-0
Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml description: · line 22
Quoted 8 lines
Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml +4
-1@@ -16,7 +16,11 @@ description: properties: compatible: - const: microchip,wilc1000 + oneOf: + - items: + - const: microchip,wilc1000 + - const: microchip,wilc3000
That's wrong order of compatibles. Fallback is wilc1000, so should be the last item.
Best regards,
Krzysztof
On 8/24/24 8:22 AM, Krzysztof Kozlowski wrote:
Hi,
Quoted 6 lines
Quoted 6 lines
Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml +0
-0@@ -16,7 +16,11 @@ description:
Quoted 10 lines
Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml description: · line 22
Quoted 7 lines
Documentation/devicetree/bindings/net/wireless/microchip,wilc1000.yaml +4
-1properties: compatible: - const: microchip,wilc1000 + oneOf: + - items: + - const: microchip,wilc1000 + - const: microchip,wilc3000That's wrong order of compatibles. Fallback is wilc1000, so should be the last item.
Right, fixed, thanks.