Browse Source

qcacmn: qcn7605: Add support for HIF_RX_CTRL_PIPE

For QCN7605-USB, WMI_CTRL_SERVICE will use an exclusive
IN USB endpoint.

Change-Id: Ia943c9c3741e91f4b13a85719eee770c08ce8379
CRs-Fixed: 2266915
Ajit Pal Singh 6 years ago
parent
commit
cd4a1c4308
5 changed files with 52 additions and 3 deletions
  1. 4 0
      hif/inc/target_type.h
  2. 1 0
      hif/src/dispatcher/usb_api.h
  3. 29 1
      hif/src/usb/hif_usb.c
  4. 1 0
      hif/src/usb/if_usb.h
  5. 17 2
      hif/src/usb/usbdrv.c

+ 4 - 0
hif/inc/target_type.h

@@ -61,6 +61,10 @@ extern "C" {
 #ifndef TARGET_TYPE_QCA6290
 #define TARGET_TYPE_QCA6290   21
 #endif
+#ifndef TARGET_TYPE_QCN7605
+#define TARGET_TYPE_QCN7605   22
+#endif
+
 
 #ifdef __cplusplus
 }

+ 1 - 0
hif/src/dispatcher/usb_api.h

@@ -46,4 +46,5 @@ void hif_usb_reg_tbl_attach(struct hif_softc *scn);
 void hif_fw_assert_ramdump_pattern(struct hif_usb_softc *sc);
 void hif_usb_ramdump_handler(struct hif_opaque_softc *scn);
 bool hif_usb_needs_bmi(struct hif_softc *scn);
+bool hif_is_supported_rx_ctrl_pipe(struct hif_softc *scn);
 #endif /*_USB_API_H_*/

+ 29 - 1
hif/src/usb/hif_usb.c

@@ -33,6 +33,7 @@
 #include "hif_usb_internal.h"
 #include "if_usb.h"
 #include "usb_api.h"
+#include "target_type.h"
 
 #if defined(WLAN_DEBUG) || defined(DEBUG)
 static ATH_DEBUG_MASK_DESCRIPTION g_hif_debug_description[] = {
@@ -416,6 +417,9 @@ QDF_STATUS hif_usb_device_init(struct hif_usb_softc *sc)
 
 	} while (false);
 
+	if (hif_is_supported_rx_ctrl_pipe(HIF_GET_SOFTC(sc)))
+		device->rx_ctrl_pipe_supported = 1;
+
 	if (status != QDF_STATUS_SUCCESS)
 		HIF_ERROR("%s: abnormal condition", __func__);
 
@@ -551,12 +555,16 @@ int hif_map_service_to_pipe(struct hif_opaque_softc *scn, uint16_t svc_id,
 			    int *ul_is_polled, int *dl_is_polled)
 {
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
+	struct HIF_DEVICE_USB *device = HIF_GET_USB_DEVICE(scn);
 
 	switch (svc_id) {
 	case HTC_CTRL_RSVD_SVC:
 	case WMI_CONTROL_SVC:
 		*ul_pipe = HIF_TX_CTRL_PIPE;
-		*dl_pipe = HIF_RX_DATA_PIPE;
+		if (device->rx_ctrl_pipe_supported)
+			*dl_pipe = HIF_RX_CTRL_PIPE;
+		else
+			*dl_pipe = HIF_RX_DATA_PIPE;
 		break;
 	case WMI_DATA_BE_SVC:
 	case WMI_DATA_BK_SVC:
@@ -927,3 +935,23 @@ void hif_usb_set_bundle_mode(struct hif_softc *scn,
 	HIF_DBG("athusb bundle %s cnt %d", enabled ? "enabled" : "disabled",
 			rx_bundle_cnt);
 }
+
+/**
+ * hif_is_supported_rx_ctrl_pipe() - return true if device supports exclusive
+ * control pipe in the RX direction.
+ * @scn: hif context
+ *
+ * Return: true if device supports RX control pipe.
+ */
+bool hif_is_supported_rx_ctrl_pipe(struct hif_softc *scn)
+{
+	struct hif_opaque_softc *hif_hdl = GET_HIF_OPAQUE_HDL(scn);
+	struct hif_target_info *tgt_info = hif_get_target_info_handle(hif_hdl);
+
+	switch (tgt_info->target_type) {
+	case TARGET_TYPE_QCN7605:
+		return true;
+	default:
+		return false;
+	}
+}

+ 1 - 0
hif/src/usb/if_usb.h

@@ -127,6 +127,7 @@ struct HIF_DEVICE_USB {
 	A_BOOL is_bundle_enabled;
 	uint16_t rx_bundle_cnt;
 	uint32_t rx_bundle_buf_len;
+	bool rx_ctrl_pipe_supported;
 };
 
 struct hif_usb_softc {

+ 17 - 2
hif/src/usb/usbdrv.c

@@ -1004,15 +1004,22 @@ static void usb_hif_post_recv_bundle_transfers(struct HIF_USB_PIPE *recv_pipe,
  */
 void usb_hif_prestart_recv_pipes(struct HIF_DEVICE_USB *device)
 {
-	struct HIF_USB_PIPE *pipe = &device->pipes[HIF_RX_DATA_PIPE];
+	struct HIF_USB_PIPE *pipe;
+	int prestart_cnt = 8;
 
+	if (device->rx_ctrl_pipe_supported) {
+		pipe = &device->pipes[HIF_RX_CTRL_PIPE];
+		prestart_cnt = 4;
+		usb_hif_post_recv_prestart_transfers(pipe, prestart_cnt);
+	}
 	/*
 	 * USB driver learn to support bundle or not until the firmware
 	 * download and ready. Only allocate some URBs for control message
 	 * communication during the initial phase then start the final
 	 * working pipe after all information understood.
 	 */
-	usb_hif_post_recv_prestart_transfers(pipe, 8);
+	pipe = &device->pipes[HIF_RX_DATA_PIPE];
+	usb_hif_post_recv_prestart_transfers(pipe, prestart_cnt);
 }
 
 /**
@@ -1053,6 +1060,14 @@ void usb_hif_start_recv_pipes(struct HIF_DEVICE_USB *device)
 		usb_hif_post_recv_transfers(pipe, HIF_USB_RX_BUFFER_SIZE);
 	}
 
+	if (device->rx_ctrl_pipe_supported) {
+		HIF_TRACE("Post URBs to RX_CONTROL_PIPE: %d",
+			  device->pipes[HIF_RX_CTRL_PIPE].urb_cnt);
+
+		pipe = &device->pipes[HIF_RX_CTRL_PIPE];
+		pipe->urb_cnt_thresh = pipe->urb_alloc / 2;
+		usb_hif_post_recv_transfers(pipe, HIF_USB_RX_BUFFER_SIZE);
+	}
 	HIF_EXIT();
 }