Skip to contentSkip to conversation

staging: wilc1000: Don't reset WILC CPU disgracefully

PATCH New [email protected] 1 participant 3 messages Aug 9, 2019 Staging

lore
Share & tools
lore
#0 lore raw

v2 cover staging: wilc1000: Don't reset WILC CPU disgracefully

From: Adham Abozaeid <[email protected]>

This patch series modifies wilc_wlan_stop to send an abort request to wilc instead of disgracefully resetting its CPU.

changes sinces v1:
- return kernel error codes from wilc_wlan_stop
- added missing checks for bus operations

Adham Abozaeid (2):
staging: wilc1000: Don't reset WILC CPU disgracefully
staging: wilc1000: return kernel error codes from wilc_wlan_stop

 drivers/staging/wilc1000/wilc_netdev.c |  4 +-
 drivers/staging/wilc1000/wilc_wlan.c   | 81 +++++++-------------------
 drivers/staging/wilc1000/wilc_wlan.h   |  5 +-
 3 files changed, 27 insertions(+), 63 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/2 staging: wilc1000: Don't reset WILC CPU disgracefully

From: Adham Abozaeid <[email protected]>

Send abort request to WILC from wilc_wlan_stop instead of resetting the CPU.
The abort request was being sent from wilc_wlan_cleanup after the CPU was reset which wasn't the correct order. The abort request handler in the chip will take care of resetting the CPU.

---
 drivers/staging/wilc1000/wilc_netdev.c |  4 +-
 drivers/staging/wilc1000/wilc_wlan.c   | 75 +++++++-------------------
 drivers/staging/wilc1000/wilc_wlan.h   |  5 +-
 3 files changed, 24 insertions(+), 60 deletions(-)
drivers/staging/wilc1000/wilc_netdev.c +2 -2
index 57510400f243..cd11c35adcfe 100644
@@ -475,7 +475,7 @@ static void wilc_wlan_deinitialize(struct net_device *dev)
 		wlan_deinitialize_threads(dev);
 		deinit_irq(dev);
 
-		wilc_wlan_stop(wl);
+		wilc_wlan_stop(wl, vif);
 		wilc_wlan_cleanup(dev);
 		wlan_deinit_locks(dev);
 
@@ -573,7 +573,7 @@ static int wilc_wlan_initialize(struct net_device *dev, struct wilc_vif *vif)
 		return 0;
 
 fail_fw_start:
-		wilc_wlan_stop(wl);
+		wilc_wlan_stop(wl, vif);
 
 fail_irq_enable:
 		if (!wl->dev_irq_num &&
drivers/staging/wilc1000/wilc_wlan.c +19 -56

110 lines not on this page · raw message

drivers/staging/wilc1000/wilc_wlan.h +3 -2
index 802f11807659..f566d040bb72 100644
@@ -98,6 +98,7 @@
 #define WILC_VMM_TBL_RX_SHADOW_BASE	WILC_AHB_SHARE_MEM_BASE
 #define WILC_VMM_TBL_RX_SHADOW_SIZE	256
 
+#define WILC_FW_HOST_COMM		0x13c0
 #define WILC_GP_REG_0			0x149c
 #define WILC_GP_REG_1			0x14a0
 
@@ -129,7 +130,7 @@
 
 #define WILC_PLL_TO_SDIO	4
 #define WILC_PLL_TO_SPI		2
-#define ABORT_INT		BIT(31)
+#define WILC_ABORT_REQ_BIT		BIT(31)
 
 #define WILC_RX_BUFF_SIZE	(96 * 1024)
 #define WILC_TX_BUFF_SIZE	(64 * 1024)
@@ -280,7 +281,7 @@ struct wilc_vif;
 int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer,
 				u32 buffer_size);
 int wilc_wlan_start(struct wilc *wilc);
-int wilc_wlan_stop(struct wilc *wilc);
+int wilc_wlan_stop(struct wilc *wilc, struct wilc_vif *vif);
 int wilc_wlan_txq_add_net_pkt(struct net_device *dev, void *priv, u8 *buffer,
 			      u32 buffer_size,
 			      void (*tx_complete_fn)(void *, int));
Signature · 1 line
2.17.1
#2 lore raw

PATCH v2 2/2 staging: wilc1000: return kernel error codes from wilc_wlan_stop

In reply to [email protected]

From: Adham Abozaeid <[email protected]>

return -EIO for bus failures, 0 otherwise.

---
 drivers/staging/wilc1000/wilc_wlan.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/wilc1000/wilc_wlan.c +5 -5
index 3d902b499a34..2bbb359d2119 100644
@@ -979,7 +979,7 @@ int wilc_wlan_stop(struct wilc *wilc, struct wilc_vif *vif)
 	if (!ret) {
 		netdev_err(vif->ndev, "Error while reading reg\n");
 		release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
-		return ret;
+		return -EIO;
 	}
 
 	ret = wilc->hif_func->hif_write_reg(wilc, WILC_GP_REG_0,
@@ -987,14 +987,14 @@ int wilc_wlan_stop(struct wilc *wilc, struct wilc_vif *vif)
 	if (!ret) {
 		netdev_err(vif->ndev, "Error while writing reg\n");
 		release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
-		return ret;
+		return -EIO;
 	}
 
 	ret = wilc->hif_func->hif_read_reg(wilc, WILC_FW_HOST_COMM, &reg);
 	if (!ret) {
 		netdev_err(vif->ndev, "Error while reading reg\n");
 		release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
-		return ret;
+		return -EIO;
 	}
 	reg = BIT(0);
 
@@ -1002,12 +1002,12 @@ int wilc_wlan_stop(struct wilc *wilc, struct wilc_vif *vif)
 	if (!ret) {
 		netdev_err(vif->ndev, "Error while writing reg\n");
 		release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
-		return ret;
+		return -EIO;
 	}
 
 	release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP);
 
-	return ret;
+	return 0;
 }
 
 void wilc_wlan_cleanup(struct net_device *dev)
Signature · 1 line
2.17.1