Эх сурвалжийг харах

qcacmn: Init tgt_info->target_type for QCN7605 USB

1) Setup target_type for QCN7605(Genoa) USB.
2) Do not reset soc in hif_usb_diag_write_cold_reset() for QCN7605
3) Skip USB_REQ_SET_CONFIGURATION and usb_set_interface() for QCN7605
4) Return false in hif_needs_bmi() for QCN7605

Change-Id: I159b7043d55c5a1a341defde89cd8ccc760bb830
CRs-Fixed: 2266915
Ajit Pal Singh 6 жил өмнө
parent
commit
a63ed8be19

+ 7 - 0
hif/src/hif_main.c

@@ -815,6 +815,13 @@ int hif_get_device_type(uint32_t device_id,
 		HIF_INFO(" *********** QCA6290EMU *************\n");
 		break;
 
+	case QCN7605_COMPOSITE:
+	case QCN7605_STANDALONE:
+		*target_type = TARGET_TYPE_QCN7605;
+		*hif_type = 0;
+		HIF_INFO(" *********** QCN7605  *************\n");
+		break;
+
 	default:
 		HIF_ERROR("%s: Unsupported device ID!", __func__);
 		ret = -ENODEV;

+ 4 - 0
hif/src/hif_main.h

@@ -92,6 +92,10 @@
 					actual number once available.
 					currently defining this to 0xffff for
 					emulation purpose */
+/* Genoa */
+#define QCN7605_COMPOSITE  (0x9900)
+#define QCN7605_STANDALONE  (0x9901)
+
 #define RUMIM2M_DEVICE_ID_NODE0	0xabc0
 #define RUMIM2M_DEVICE_ID_NODE1	0xabc1
 #define RUMIM2M_DEVICE_ID_NODE2	0xabc2

+ 39 - 11
hif/src/usb/if_usb.c

@@ -52,7 +52,11 @@ static inline QDF_STATUS
 hif_usb_diag_write_cold_reset(struct hif_softc *scn)
 {
 	struct hif_opaque_softc *hif_hdl = GET_HIF_OPAQUE_HDL(scn);
+	struct hif_target_info *tgt_info = &scn->target_info;
 
+	/* For Genoa, chip-reset is handled in CNSS driver */
+	if (tgt_info->target_type == TARGET_TYPE_QCN7605)
+		return QDF_STATUS_SUCCESS;
 
 	HIF_DBG("%s: resetting SOC", __func__);
 
@@ -186,6 +190,10 @@ QDF_STATUS hif_usb_enable_bus(struct hif_softc *scn,
 	struct hif_usb_softc *sc;
 	struct usb_device *usbdev = interface_to_usbdev(interface);
 	int vendor_id, product_id;
+	struct hif_target_info *tgt_info;
+	struct hif_opaque_softc *hif_hdl = GET_HIF_OPAQUE_HDL(scn);
+	u32 hif_type;
+	u32 target_type;
 
 	usb_get_dev(usbdev);
 
@@ -212,14 +220,27 @@ QDF_STATUS hif_usb_enable_bus(struct hif_softc *scn,
 	sc->dev = &usbdev->dev;
 	sc->devid = id->idProduct;
 
-	if ((usb_control_msg(usbdev, usb_sndctrlpipe(usbdev, 0),
-			USB_REQ_SET_CONFIGURATION, 0, 1, 0, NULL, 0,
-			HZ)) < 0) {
-		HIF_ERROR("%s[%d]", __func__, __LINE__);
-		goto err_usb;
+	hif_get_device_type(vendor_id, 0, &hif_type, &target_type);
+	tgt_info = hif_get_target_info_handle(hif_hdl);
+	if (target_type == TARGET_TYPE_QCN7605)
+		tgt_info->target_type = TARGET_TYPE_QCN7605;
+
+	/*
+	 * For Genoa, skip set_configuration, since it is handled
+	 * by CNSS driver.
+	 */
+	if (target_type != TARGET_TYPE_QCN7605) {
+		if ((usb_control_msg(usbdev, usb_sndctrlpipe(usbdev, 0),
+				     USB_REQ_SET_CONFIGURATION, 0, 1, 0,
+				     NULL, 0, HZ)) < 0) {
+			HIF_ERROR("%s[%d]", __func__, __LINE__);
+			goto err_usb;
+		}
+		usb_set_interface(usbdev, 0, 0);
+		sc->reboot_notifier.notifier_call = hif_usb_reboot;
+		register_reboot_notifier(&sc->reboot_notifier);
 	}
 
-	usb_set_interface(usbdev, 0, 0);
 	/* disable lpm to avoid usb2.0 probe timeout */
 	hif_usb_disable_lpm(usbdev);
 
@@ -230,9 +251,6 @@ QDF_STATUS hif_usb_enable_bus(struct hif_softc *scn,
 	 */
 
 	sc->interface = interface;
-	sc->reboot_notifier.notifier_call = hif_usb_reboot;
-	register_reboot_notifier(&sc->reboot_notifier);
-
 	if (hif_usb_device_init(sc) != QDF_STATUS_SUCCESS) {
 		HIF_ERROR("ath: %s: hif_usb_device_init failed", __func__);
 		goto err_reset;
@@ -250,7 +268,8 @@ err_reset:
 	hif_usb_diag_write_cold_reset(scn);
 	g_usb_sc = NULL;
 	hif_usb_unload_dev_num = -1;
-	unregister_reboot_notifier(&sc->reboot_notifier);
+	if (target_type != TARGET_TYPE_QCN7605)
+		unregister_reboot_notifier(&sc->reboot_notifier);
 err_usb:
 	ret = QDF_STATUS_E_FAILURE;
 	usb_put_dev(usbdev);
@@ -280,6 +299,7 @@ void hif_usb_disable_bus(struct hif_softc *hif_ctx)
 	struct hif_usb_softc *sc = HIF_GET_USB_SOFTC(hif_ctx);
 	struct usb_interface *interface = sc->interface;
 	struct usb_device *udev = interface_to_usbdev(interface);
+	struct hif_target_info *tgt_info = &hif_ctx->target_info;
 
 	HIF_TRACE("%s: trying to remove hif_usb!", __func__);
 
@@ -299,7 +319,9 @@ void hif_usb_disable_bus(struct hif_softc *hif_ctx)
 	if (g_usb_sc->suspend_state)
 		hif_bus_resume(GET_HIF_OPAQUE_HDL(hif_ctx));
 
-	unregister_reboot_notifier(&sc->reboot_notifier);
+	if (tgt_info->target_type != TARGET_TYPE_QCN7605)
+		unregister_reboot_notifier(&sc->reboot_notifier);
+
 	usb_put_dev(interface_to_usbdev(interface));
 
 	hif_usb_device_deinit(sc);
@@ -723,5 +745,11 @@ int hif_check_fw_reg(struct hif_opaque_softc *scn)
  */
 bool hif_usb_needs_bmi(struct hif_softc *scn)
 {
+	struct hif_target_info *tgt_info = &scn->target_info;
+
+	/* BMI is not supported in Genoa */
+	if (tgt_info->target_type == TARGET_TYPE_QCN7605)
+		return false;
+
 	return true;
 }