rsi: miscallaneous changes for 9116 and common
authorSiva Rebbagondla <siva8118@gmail.com>
Wed, 3 Apr 2019 04:13:09 +0000 (09:43 +0530)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 25 Apr 2019 16:44:29 +0000 (19:44 +0300)
Below changes are done:
* Device 80MHz clock should be disabled for 9116 in 20MHz band.
* Default edca parameters should be used initially before
  connection.
* Default TA aggregation is 3 for 9116.
* Bootup parameters should be loaded first when channel is
  changed.
* 4 byte register writes are possible for 9116.

Signed-off-by: Siva Rebbagondla <siva8118@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/rsi/rsi_91x_mgmt.c
drivers/net/wireless/rsi/rsi_91x_usb.c

index f328532..6c7f26e 100644 (file)
@@ -424,6 +424,10 @@ static int rsi_load_radio_caps(struct rsi_common *common)
        }
        radio_caps->radio_info |= radio_id;
 
+       if (adapter->device_model == RSI_DEV_9116 &&
+           common->channel_width == BW_20MHZ)
+               radio_caps->radio_cfg_info &= ~0x3;
+
        radio_caps->sifs_tx_11n = cpu_to_le16(SIFS_TX_11N_VALUE);
        radio_caps->sifs_tx_11b = cpu_to_le16(SIFS_TX_11B_VALUE);
        radio_caps->slot_rx_11n = cpu_to_le16(SHORT_SLOT_VALUE);
@@ -439,14 +443,16 @@ static int rsi_load_radio_caps(struct rsi_common *common)
        }
 
        for (ii = 0; ii < NUM_EDCA_QUEUES; ii++) {
-               radio_caps->qos_params[ii].cont_win_min_q =
-                       cpu_to_le16(common->edca_params[ii].cw_min);
-               radio_caps->qos_params[ii].cont_win_max_q =
-                       cpu_to_le16(common->edca_params[ii].cw_max);
-               radio_caps->qos_params[ii].aifsn_val_q =
-                       cpu_to_le16((common->edca_params[ii].aifs) << 8);
-               radio_caps->qos_params[ii].txop_q =
-                       cpu_to_le16(common->edca_params[ii].txop);
+               if (common->edca_params[ii].cw_max > 0) {
+                       radio_caps->qos_params[ii].cont_win_min_q =
+                               cpu_to_le16(common->edca_params[ii].cw_min);
+                       radio_caps->qos_params[ii].cont_win_max_q =
+                               cpu_to_le16(common->edca_params[ii].cw_max);
+                       radio_caps->qos_params[ii].aifsn_val_q =
+                               cpu_to_le16(common->edca_params[ii].aifs << 8);
+                       radio_caps->qos_params[ii].txop_q =
+                               cpu_to_le16(common->edca_params[ii].txop);
+               }
        }
 
        radio_caps->qos_params[BROADCAST_HW_Q].txop_q = cpu_to_le16(0xffff);
@@ -1026,6 +1032,11 @@ static int rsi_send_reset_mac(struct rsi_common *common)
        mgmt_frame->desc_word[1] = cpu_to_le16(RESET_MAC_REQ);
        mgmt_frame->desc_word[4] = cpu_to_le16(RETRY_COUNT << 8);
 
+#define RSI_9116_DEF_TA_AGGR   3
+       if (common->priv->device_model == RSI_DEV_9116)
+               mgmt_frame->desc_word[3] |=
+                       cpu_to_le16(RSI_9116_DEF_TA_AGGR << 8);
+
        skb_put(skb, FRAME_DESC_SZ);
 
        return rsi_send_internal_mgmt_frame(common, skb);
index f0475b2..f5048d4 100644 (file)
@@ -213,7 +213,7 @@ static int rsi_usb_reg_read(struct usb_device *usbdev,
  */
 static int rsi_usb_reg_write(struct usb_device *usbdev,
                             u32 reg,
-                            u16 value,
+                            u32 value,
                             u16 len)
 {
        u8 *usb_reg_buf;
@@ -226,17 +226,17 @@ static int rsi_usb_reg_write(struct usb_device *usbdev,
        if (!usb_reg_buf)
                return status;
 
-       usb_reg_buf[0] = (value & 0x00ff);
-       usb_reg_buf[1] = (value & 0xff00) >> 8;
-       usb_reg_buf[2] = 0x0;
-       usb_reg_buf[3] = 0x0;
+       usb_reg_buf[0] = (cpu_to_le32(value) & 0x00ff);
+       usb_reg_buf[1] = (cpu_to_le32(value) & 0xff00) >> 8;
+       usb_reg_buf[2] = (cpu_to_le32(value) & 0x00ff0000) >> 16;
+       usb_reg_buf[3] = (cpu_to_le32(value) & 0xff000000) >> 24;
 
        status = usb_control_msg(usbdev,
                                 usb_sndctrlpipe(usbdev, 0),
                                 USB_VENDOR_REGISTER_WRITE,
                                 RSI_USB_REQ_OUT,
-                                ((reg & 0xffff0000) >> 16),
-                                (reg & 0xffff),
+                                ((cpu_to_le32(reg) & 0xffff0000) >> 16),
+                                (cpu_to_le32(reg) & 0xffff),
                                 (void *)usb_reg_buf,
                                 len,
                                 USB_CTRL_SET_TIMEOUT);
@@ -263,8 +263,10 @@ static void rsi_rx_done_handler(struct urb *urb)
        struct rsi_91x_usbdev *dev = (struct rsi_91x_usbdev *)rx_cb->data;
        int status = -EINVAL;
 
-       if (urb->status)
-               goto out;
+       if (urb->status) {
+               dev_kfree_skb(rx_cb->rx_skb);
+               return;
+       }
 
        if (urb->actual_length <= 0 ||
            urb->actual_length > rx_cb->rx_skb->len) {