Skip to contentSkip to conversation

rsi driver bringup enhancements

PATCH Superseded Amitkumar Karwar 2 participants 7 messages Jun 16, 2017 – Jun 21, 2017 Redpine wireless driver

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover rsi driver bringup enhancements

This patch series includes the changes for adding USB chipset, frames exchanged with firmware during initialization and false interrupt problem fix for SDIO.

Changes in v2:
Patch 6/6: Get rid of __LITTLE_ENDIAN compiler flag usage(Kalle Valo)

Amitkumar Karwar (1):
rsi: use enum for FSM states

Prameela Rani Garnepudi (5):
rsi: add usb RS9113 chipset support
rsi: Register interrupt handler before firmware load
rsi: receive path enhancement for RS9113
rsi: configure new boot parameters to device
rsi: add tx frame for common device configuration

 drivers/net/wireless/rsi/rsi_91x_hal.c     |   4 +-
 drivers/net/wireless/rsi/rsi_91x_main.c    |   9 ++-
 drivers/net/wireless/rsi/rsi_91x_mgmt.c    | 120 ++++++++++++++++++++++++-----
 drivers/net/wireless/rsi/rsi_91x_sdio.c    |  21 ++---
 drivers/net/wireless/rsi/rsi_91x_usb.c     |   1 +
 drivers/net/wireless/rsi/rsi_boot_params.h |  15 ++--
 drivers/net/wireless/rsi/rsi_hal.h         |   3 +
 drivers/net/wireless/rsi/rsi_main.h        |  28 +++++--
 drivers/net/wireless/rsi/rsi_mgmt.h        |  76 ++++++++++++++++++
 9 files changed, 232 insertions(+), 45 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/6 rsi: add usb RS9113 chipset support

From: Prameela Rani Garnepudi <[email protected]>

usb device id and vendor id for RS9113 chipset are included. So it can be used through usb interface.

---
 drivers/net/wireless/rsi/rsi_91x_usb.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/wireless/rsi/rsi_91x_usb.c +1 -0
index f5de693..bcd7f45 100644
@@ -666,6 +666,7 @@ static const struct usb_device_id rsi_dev_table[] = {
 	{ USB_DEVICE(0x041B, 0x0301) },
 	{ USB_DEVICE(0x041B, 0x0201) },
 	{ USB_DEVICE(0x041B, 0x9330) },
+	{ USB_DEVICE(0x1618, 0x9113) },
 	{ /* Blank */},
 };
 
Signature · 1 line
2.7.4
#2 lore raw

Re: [v2,1/6] rsi: add usb RS9113 chipset support

Quoted 7 lines · amit karwar

From: Prameela Rani Garnepudi <[email protected]>

usb device id and vendor id for RS9113 chipset are included. So it can be used through usb interface.

6 patches applied to wireless-drivers-next.git, thanks.

d2d1831723df rsi: add usb RS9113 chipset support 4833c953fd25 rsi: use enum for FSM states
015e367494c1 rsi: Register interrupt handler before firmware load 61f2a6fcaab1 rsi: receive path enhancement for RS9113 1b1bed016509 rsi: configure new boot parameters to device 9920322ccd8e rsi: add tx frame for common device configuration

Signature · 3 lines
https://patchwork.kernel.org/patch/9791875/

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

PATCH v2 2/6 rsi: use enum for FSM states

In reply to Amitkumar Karwar

From: Amitkumar Karwar <[email protected]>

Currently macros are used for FSM states. We will replace it with enum so that new state can be added easily without worrying about macro value.

---
 drivers/net/wireless/rsi/rsi_main.h | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/net/wireless/rsi/rsi_main.h +9 -7
index ea4fc22..833c66f5 100644
@@ -31,13 +31,15 @@
 #define FSM_ZONE                        BIT(7)  /* For State Machine Msgs     */
 #define ISR_ZONE                        BIT(8)  /* For Interrupt Msgs         */
 
-#define FSM_CARD_NOT_READY              0
-#define FSM_BOOT_PARAMS_SENT            1
-#define FSM_EEPROM_READ_MAC_ADDR        2
-#define FSM_RESET_MAC_SENT              3
-#define FSM_RADIO_CAPS_SENT             4
-#define FSM_BB_RF_PROG_SENT             5
-#define FSM_MAC_INIT_DONE               6
+enum RSI_FSM_STATES {
+	FSM_CARD_NOT_READY,
+	FSM_BOOT_PARAMS_SENT,
+	FSM_EEPROM_READ_MAC_ADDR,
+	FSM_RESET_MAC_SENT,
+	FSM_RADIO_CAPS_SENT,
+	FSM_BB_RF_PROG_SENT,
+	FSM_MAC_INIT_DONE
+};
 
 extern u32 rsi_zone_enabled;
 extern __printf(2, 3) void rsi_dbg(u32 zone, const char *fmt, ...);
Signature · 1 line
2.7.4
#4 lore raw

PATCH v2 3/6 rsi: Register interrupt handler before firmware load

In reply to Amitkumar Karwar

From: Prameela Rani Garnepudi <[email protected]>

Before firmware load, sometimes false interrupts are received. System hang is observed if interrupt handler is not registered to receive these interrupts. Hence interrupt handler registration is moved before firmware load. We will drop these false interrupts as these are not from the device.

---
 drivers/net/wireless/rsi/rsi_91x_hal.c  |  1 +
 drivers/net/wireless/rsi/rsi_91x_sdio.c | 21 +++++++++++----------
 drivers/net/wireless/rsi/rsi_main.h     |  1 +
 3 files changed, 13 insertions(+), 10 deletions(-)
drivers/net/wireless/rsi/rsi_91x_hal.c +1 -0
index 3d24e8e..94e074d 100644
@@ -733,6 +733,7 @@ int rsi_hal_device_init(struct rsi_hw *adapter)
 	default:
 		return -EINVAL;
 	}
+	common->fsm_state = FSM_CARD_NOT_READY;
 
 	return 0;
 }
drivers/net/wireless/rsi/rsi_91x_sdio.c +11 -10
index 2ef844a..e5ea99b 100644
@@ -139,6 +139,8 @@ static void rsi_handle_interrupt(struct sdio_func *function)
 {
 	struct rsi_hw *adapter = sdio_get_drvdata(function);
 
+	if (adapter->priv->fsm_state == FSM_FW_NOT_LOADED)
+		return;
 	sdio_release_host(function);
 	rsi_interrupt_handler(adapter);
 	sdio_claim_host(function);
@@ -908,10 +910,19 @@ static int rsi_probe(struct sdio_func *pfunction,
 			__func__);
 		goto fail;
 	}
+	sdio_claim_host(pfunction);
+	if (sdio_claim_irq(pfunction, rsi_handle_interrupt)) {
+		rsi_dbg(ERR_ZONE, "%s: Failed to request IRQ\n", __func__);
+		sdio_release_host(pfunction);
+		goto fail;
+	}
+	sdio_release_host(pfunction);
+	rsi_dbg(INIT_ZONE, "%s: Registered Interrupt handler\n", __func__);
 
 	if (rsi_hal_device_init(adapter)) {
 		rsi_dbg(ERR_ZONE, "%s: Failed in device init\n", __func__);
 		sdio_claim_host(pfunction);
+		sdio_release_irq(pfunction);
 		sdio_disable_func(pfunction);
 		sdio_release_host(pfunction);
 		goto fail;
@@ -923,16 +934,6 @@ static int rsi_probe(struct sdio_func *pfunction,
 		return -EIO;
 	}
 
-	sdio_claim_host(pfunction);
-	if (sdio_claim_irq(pfunction, rsi_handle_interrupt)) {
-		rsi_dbg(ERR_ZONE, "%s: Failed to request IRQ\n", __func__);
-		sdio_release_host(pfunction);
-		goto fail;
-	}
-
-	sdio_release_host(pfunction);
-	rsi_dbg(INIT_ZONE, "%s: Registered Interrupt handler\n", __func__);
-
 	return 0;
 fail:
 	rsi_91x_deinit(adapter);
drivers/net/wireless/rsi/rsi_main.h +1 -0
index 833c66f5..74ae0ac 100644
@@ -32,6 +32,7 @@
 #define ISR_ZONE                        BIT(8)  /* For Interrupt Msgs         */
 
 enum RSI_FSM_STATES {
+	FSM_FW_NOT_LOADED,
 	FSM_CARD_NOT_READY,
 	FSM_BOOT_PARAMS_SENT,
 	FSM_EEPROM_READ_MAC_ADDR,
Signature · 1 line
2.7.4
#5 lore raw

PATCH v2 4/6 rsi: receive path enhancement for RS9113

In reply to Amitkumar Karwar

From: Prameela Rani Garnepudi <[email protected]>

RS9113 chipset supports Coex feature. Initial frame exchanges during device initialization happens on coex queue. This patch adds the handling for coex queue.

---
 drivers/net/wireless/rsi/rsi_91x_main.c | 9 ++++++++-
 drivers/net/wireless/rsi/rsi_main.h     | 1 +
 2 files changed, 9 insertions(+), 1 deletion(-)
drivers/net/wireless/rsi/rsi_91x_main.c +8 -1
index 8810862..f1cde0c 100644
@@ -123,9 +123,16 @@ int rsi_read_pkt(struct rsi_common *common, s32 rcv_pkt_len)
 
 		queueno = rsi_get_queueno(frame_desc, offset);
 		length = rsi_get_length(frame_desc, offset);
-		extended_desc = rsi_get_extended_desc(frame_desc, offset);
+
+		/* Extended descriptor is valid for WLAN queues only */
+		if (queueno == RSI_WIFI_DATA_Q || queueno == RSI_WIFI_MGMT_Q)
+			extended_desc = rsi_get_extended_desc(frame_desc,
+							      offset);
 
 		switch (queueno) {
+		case RSI_COEX_Q:
+			rsi_mgmt_pkt_recv(common, (frame_desc + offset));
+			break;
 		case RSI_WIFI_DATA_Q:
 			skb = rsi_prepare_skb(common,
 					      (frame_desc + offset),
drivers/net/wireless/rsi/rsi_main.h +1 -0
index 74ae0ac..f12e5d9 100644
@@ -63,6 +63,7 @@ extern __printf(2, 3) void rsi_dbg(u32 zone, const char *fmt, ...);
 #define MAX_CONTINUOUS_VI_PKTS          4
 
 /* Queue information */
+#define RSI_COEX_Q			0x0
 #define RSI_WIFI_MGMT_Q                 0x4
 #define RSI_WIFI_DATA_Q                 0x5
 #define IEEE80211_MGMT_FRAME            0x00
Signature · 1 line
2.7.4
#6 lore raw

PATCH v2 5/6 rsi: configure new boot parameters to device

In reply to Amitkumar Karwar

From: Prameela Rani Garnepudi <[email protected]>

Boot parameters are changed in new firmware. Also three new sdio sleep parameters are added for ultra low power save.

---
 drivers/net/wireless/rsi/rsi_91x_mgmt.c    | 20 +++++++++++++-------
 drivers/net/wireless/rsi/rsi_boot_params.h | 15 +++++++++------
 2 files changed, 22 insertions(+), 13 deletions(-)
drivers/net/wireless/rsi/rsi_91x_mgmt.c +13 -7
index fac87c0..b2950aa 100644
@@ -45,10 +45,10 @@ static struct bootup_params boot_params_20 = {
 			}
 		},
 		.switch_clk_g = {
-			.switch_clk_info = cpu_to_le16(BIT(3)),
-			.bbp_lmac_clk_reg_val = cpu_to_le16(0x121),
-			.umac_clock_reg_config = 0x0,
-			.qspi_uart_clock_reg_config = 0x0
+			.switch_clk_info = cpu_to_le16(0xb),
+			.bbp_lmac_clk_reg_val = cpu_to_le16(0x111),
+			.umac_clock_reg_config = cpu_to_le16(0x48),
+			.qspi_uart_clock_reg_config = cpu_to_le16(0x1211)
 		}
 	},
 	{
@@ -106,7 +106,10 @@ static struct bootup_params boot_params_20 = {
 	.wdt_prog_value = 0x0,
 	.wdt_soc_rst_delay = 0x0,
 	.dcdc_operation_mode = 0x0,
-	.soc_reset_wait_cnt = 0x0
+	.soc_reset_wait_cnt = 0x0,
+	.waiting_time_at_fresh_sleep = 0x0,
+	.max_threshold_to_avoid_sleep = 0x0,
+	.beacon_resedue_alg_en = 0,
 };
 
 static struct bootup_params boot_params_40 = {
@@ -139,7 +142,7 @@ static struct bootup_params boot_params_40 = {
 			.switch_clk_info = cpu_to_le16(0x09),
 			.bbp_lmac_clk_reg_val = cpu_to_le16(0x1121),
 			.umac_clock_reg_config = cpu_to_le16(0x48),
-			.qspi_uart_clock_reg_config = 0x0
+			.qspi_uart_clock_reg_config = cpu_to_le16(0x1211)
 		}
 	},
 	{
@@ -197,7 +200,10 @@ static struct bootup_params boot_params_40 = {
 	.wdt_prog_value = 0x0,
 	.wdt_soc_rst_delay = 0x0,
 	.dcdc_operation_mode = 0x0,
-	.soc_reset_wait_cnt = 0x0
+	.soc_reset_wait_cnt = 0x0,
+	.waiting_time_at_fresh_sleep = 0x0,
+	.max_threshold_to_avoid_sleep = 0x0,
+	.beacon_resedue_alg_en = 0,
 };
 
 static u16 mcs[] = {13, 26, 39, 52, 78, 104, 117, 130};
drivers/net/wireless/rsi/rsi_boot_params.h +9 -6
index 5e2721f..238ee96 100644
@@ -24,19 +24,19 @@
 #define WIFI_AFEPLL_CONFIGS              BIT(7)
 #define WIFI_SWITCH_CLK_CONFIGS          BIT(8)
 
-#define TA_PLL_M_VAL_20                  8
-#define TA_PLL_N_VAL_20                  1
+#define TA_PLL_M_VAL_20                  9
+#define TA_PLL_N_VAL_20                  0
 #define TA_PLL_P_VAL_20                  4
 
 #define PLL960_M_VAL_20                  0x14
 #define PLL960_N_VAL_20                  0
 #define PLL960_P_VAL_20                  5
 
-#define UMAC_CLK_40MHZ                   40
+#define UMAC_CLK_40MHZ                   80
 
-#define TA_PLL_M_VAL_40                  46
-#define TA_PLL_N_VAL_40                  3
-#define TA_PLL_P_VAL_40                  3
+#define TA_PLL_M_VAL_40                  9
+#define TA_PLL_N_VAL_40                  0
+#define TA_PLL_P_VAL_40                  4
 
 #define PLL960_M_VAL_40                  0x14
 #define PLL960_N_VAL_40                  0
@@ -122,5 +122,8 @@ struct bootup_params {
 	/* dcdc modes configs */
 	__le32 dcdc_operation_mode;
 	__le32 soc_reset_wait_cnt;
+	__le32 waiting_time_at_fresh_sleep;
+	__le32 max_threshold_to_avoid_sleep;
+	u8 beacon_resedue_alg_en;
 } __packed;
 #endif
Signature · 1 line
2.7.4