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

qcacmn: Enable QCA6390

1. Allocate and Initialize host and target copy engine configuration
   for QCA6390 based products.
2. Setup Copy engine service map for QCA6390.
3. Add conditional compilation flag QCA_WIFI_QCA6390 to support
   QCA6390 based products.

Change-Id: Ia4dd4d436b8ecae0e9f91faa0c1fe7dbd14f001f
CRs-Fixed: 2259312
Venkata Sharath Chandra Manchala 6 жил өмнө
parent
commit
79860aa182

+ 2 - 0
dp/inc/cdp_txrx_cmn_reg.h

@@ -62,6 +62,8 @@ static inline ol_txrx_soc_handle cdp_soc_attach(u_int16_t devid,
 	case LITHIUM_DP: /*FIXME Add lithium devide IDs */
 	case QCA8074_DEVICE_ID: /* Hawekeye */
 	case QCA6290_DEVICE_ID:
+	case QCA6390_DEVICE_ID:
+	case QCA6390_EMULATION_DEVICE_ID:
 	case RUMIM2M_DEVICE_ID_NODE0: /*lithium emulation */
 	case RUMIM2M_DEVICE_ID_NODE1: /*lithium emulation */
 	case RUMIM2M_DEVICE_ID_NODE2: /*lithium emulation */

+ 1 - 1
hal/wifi3.0/hal_api.h

@@ -35,7 +35,7 @@
 #include "hal_internal.h"
 
 #define MAX_UNWINDOWED_ADDRESS 0x80000
-#ifdef TARGET_TYPE_QCA6390
+#ifdef QCA_WIFI_QCA6390
 #define WINDOW_ENABLE_BIT 0x40000000
 #else
 #define WINDOW_ENABLE_BIT 0x80000000

+ 1 - 0
hal/wifi3.0/hal_srng.c

@@ -220,6 +220,7 @@ static void hal_target_based_configure(struct hal_soc *hal)
 	switch (hal->target_type) {
 #ifdef QCA_WIFI_QCA6290
 	case TARGET_TYPE_QCA6290:
+	case TARGET_TYPE_QCA6390:
 		hal->use_register_windowing = true;
 		hal_qca6290_attach(hal);
 	break;

+ 1 - 0
hif/inc/hif.h

@@ -59,6 +59,7 @@ typedef void *hif_handle_t;
 #define HIF_TYPE_QCA8074 15
 #define HIF_TYPE_QCA6290 16
 #define HIF_TYPE_QCN7605 17
+#define HIF_TYPE_QCA6390 18
 
 #ifdef IPA_OFFLOAD
 #define DMA_COHERENT_MASK_IPA_VER_3_AND_ABOVE   37

+ 2 - 1
hif/inc/hostdef.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2016,2018 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -34,6 +34,7 @@ extern struct hostdef_s *AR900B_HOSTdef;
 extern struct hostdef_s *QCA9984_HOSTdef;
 extern struct hostdef_s *QCA9888_HOSTdef;
 extern struct hostdef_s *QCA6290_HOSTdef;
+extern struct hostdef_s *QCA6390_HOSTdef;
 #ifdef ATH_AHB
 extern struct hostdef_s *IPQ4019_HOSTdef;
 #endif

+ 3 - 3
hif/inc/regtable_pcie.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2018 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -262,7 +262,7 @@
 	(pdev->targetdef->d_RX_ATTENTION_0_MSDU_DONE_MASK)
 #define RX_ATTENTION_0_TCP_UDP_CHKSUM_FAIL_MASK \
 	(pdev->targetdef->d_RX_ATTENTION_0_TCP_UDP_CHKSUM_FAIL_MASK)
-#if !defined(QCA6290_HEADERS_DEF)
+#if !defined(QCA6290_HEADERS_DEF) && !defined(QCA6390_HEADERS_DEF)
 #ifndef RX_MSDU_START_2_DECAP_FORMAT_OFFSET
 #define RX_MSDU_START_2_DECAP_FORMAT_OFFSET \
 	(pdev->targetdef->d_RX_MSDU_START_2_DECAP_FORMAT_OFFSET)
@@ -275,7 +275,7 @@
 #define RX_MSDU_START_2_DECAP_FORMAT_MASK \
 	(pdev->targetdef->d_RX_MSDU_START_2_DECAP_FORMAT_MASK)
 #endif
-#endif /*!QCA6290_HEADERS_DEF*/
+#endif /*!QCA6290_HEADERS_DEF && !QCA6390_HEADERS_DEF */
 /* end */
 #endif
 

+ 3 - 1
hif/inc/target_type.h

@@ -64,7 +64,9 @@ extern "C" {
 #ifndef TARGET_TYPE_QCN7605
 #define TARGET_TYPE_QCN7605   22
 #endif
-
+#ifndef TARGET_TYPE_QCA6390
+#define TARGET_TYPE_QCA6390   23
+#endif
 
 #ifdef __cplusplus
 }

+ 3 - 1
hif/inc/targetdef.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2016,2018 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -34,6 +34,7 @@ extern struct targetdef_s *AR900B_TARGETdef;
 extern struct targetdef_s *QCA9984_TARGETdef;
 extern struct targetdef_s *QCA9888_TARGETdef;
 extern struct targetdef_s *QCA6290_TARGETdef;
+extern struct targetdef_s *QCA6390_TARGETdef;
 #ifdef ATH_AHB
 extern struct targetdef_s *IPQ4019_TARGETdef;
 #endif
@@ -49,6 +50,7 @@ extern struct ce_reg_def *AR900B_CE_TARGETdef;
 extern struct ce_reg_def *QCA9984_CE_TARGETdef;
 extern struct ce_reg_def *QCA9888_CE_TARGETdef;
 extern struct ce_reg_def *QCA6290_CE_TARGETdef;
+extern struct ce_reg_def *QCA6390_CE_TARGETdef;
 #ifdef ATH_AHB
 extern struct ce_reg_def *IPQ4019_CE_TARGETdef;
 #endif

+ 2 - 0
hif/src/ath_procfs.c

@@ -84,6 +84,7 @@ static ssize_t ath_procfs_diag_read(struct file *file, char __user *buf,
 	if (scn->bus_type == QDF_BUS_TYPE_SNOC ||
 			(scn->bus_type ==  QDF_BUS_TYPE_PCI &&
 			 (tgt_info->target_type == TARGET_TYPE_QCA6290 ||
+			  tgt_info->target_type == TARGET_TYPE_QCA6390 ||
 			  tgt_info->target_type == TARGET_TYPE_QCA8074))) {
 		memtype = ((uint32_t)(*pos) & 0xff000000) >> 24;
 		offset = (uint32_t)(*pos) & 0xffffff;
@@ -155,6 +156,7 @@ static ssize_t ath_procfs_diag_write(struct file *file,
 	if (scn->bus_type == QDF_BUS_TYPE_SNOC ||
 			(scn->bus_type ==  QDF_BUS_TYPE_PCI &&
 			 (tgt_info->target_type == TARGET_TYPE_QCA6290 ||
+			  tgt_info->target_type == TARGET_TYPE_QCA6390 ||
 			  tgt_info->target_type == TARGET_TYPE_QCA8074))) {
 		memtype = ((uint32_t)(*pos) & 0xff000000) >> 24;
 		offset = (uint32_t)(*pos) & 0xffffff;

+ 49 - 0
hif/src/ce/ce_assignment.h

@@ -838,4 +838,53 @@ static struct CE_pipe_config target_ce_config_wlan_qca6290[] = {
 	/* CE 9, 10, 11 belong to CoreBsp & MHI driver */
 };
 #endif
+
+#define QCA_6390_CE_COUNT 9
+static struct CE_attr host_ce_config_wlan_qca6390[] = {
+	/* host->target HTC control and raw streams */
+	{ /* CE0 */ CE_ATTR_FLAGS, 0, 16, 2048, 0, NULL,},
+	/* target->host HTT + HTC control */
+	{ /* CE1 */ CE_ATTR_FLAGS, 0, 0,  2048, 512, NULL,},
+	/* target->host WMI */
+	{ /* CE2 */ CE_ATTR_FLAGS, 0, 0,  2048, 32, NULL,},
+	/* host->target WMI */
+	{ /* CE3 */ CE_ATTR_FLAGS, 0, 32, 2048, 0, NULL,},
+	/* host->target HTT */
+	{ /* CE4 */ (CE_ATTR_FLAGS | CE_ATTR_DISABLE_INTR), 0,
+		CE_HTT_H2T_MSG_SRC_NENTRIES, 256, 0, NULL,},
+	/* target -> host PKTLOG */
+	{ /* CE5 */ CE_ATTR_FLAGS, 0, 0, 0, 0, NULL,},
+	/* Target autonomous HIF_memcpy */
+	{ /* CE6 */ CE_ATTR_FLAGS, 0, 0, 0, 0, NULL,},
+	/* ce_diag, the Diagnostic Window */
+	{ /* CE7 */ (CE_ATTR_DIAG_FLAGS | CE_ATTR_DISABLE_INTR), 0,
+		0, DIAG_TRANSFER_LIMIT, 0, NULL,},
+	/* Reserved for target */
+	{ /* CE8 */ CE_ATTR_FLAGS, 0, 0, 0, 0, NULL,},
+	/* CE 9, 10, 11 belong to CoreBsp & MHI driver */
+};
+
+static struct CE_pipe_config target_ce_config_wlan_qca6390[] = {
+	/* host->target HTC control and raw streams */
+	{ /* CE0 */ 0, PIPEDIR_OUT, 32, 2048, CE_ATTR_FLAGS, 0,},
+	/* target->host HTT */
+	{ /* CE1 */ 1, PIPEDIR_IN,  32, 2048, CE_ATTR_FLAGS, 0,},
+	/* target->host WMI  + HTC control */
+	{ /* CE2 */ 2, PIPEDIR_IN,  32, 2048, CE_ATTR_FLAGS, 0,},
+	/* host->target WMI */
+	{ /* CE3 */ 3, PIPEDIR_OUT, 32, 2048, CE_ATTR_FLAGS, 0,},
+	/* host->target HTT */
+	{ /* CE4 */ 4, PIPEDIR_OUT, 256, 256,
+		(CE_ATTR_FLAGS | CE_ATTR_DISABLE_INTR), 0,},
+	/* Target -> host PKTLOG */
+	{ /* CE5 */ 5, PIPEDIR_IN,  32, 2048, CE_ATTR_FLAGS, 0,},
+	/* Reserved for target autonomous HIF_memcpy */
+	{ /* CE6 */ 6, PIPEDIR_INOUT, 32, 16384, CE_ATTR_FLAGS, 0,},
+	/* CE7 used only by Host */
+	{ /* CE7 */ 7, PIPEDIR_INOUT_H2H, 0, 0,
+		(CE_ATTR_FLAGS | CE_ATTR_DISABLE_INTR), 0,},
+	/* Reserved for target */
+	{ /* CE8 */ 8, PIPEDIR_INOUT, 32, 16384, CE_ATTR_FLAGS, 0,},
+	/* CE 9, 10, 11 belong to CoreBsp & MHI driver */
+};
 #endif /* __HIF_PCI_INTERNAL_H__ */

+ 38 - 0
hif/src/ce/ce_main.c

@@ -502,6 +502,30 @@ static struct service_to_pipe target_service_to_ce_map_qca6290[] = {
 };
 #endif
 
+#if (defined(QCA_WIFI_QCA6390))
+static struct service_to_pipe target_service_to_ce_map_qca6390[] = {
+	{ WMI_DATA_VO_SVC, PIPEDIR_OUT, 3, },
+	{ WMI_DATA_VO_SVC, PIPEDIR_IN, 2, },
+	{ WMI_DATA_BK_SVC, PIPEDIR_OUT, 3, },
+	{ WMI_DATA_BK_SVC, PIPEDIR_IN, 2, },
+	{ WMI_DATA_BE_SVC, PIPEDIR_OUT, 3, },
+	{ WMI_DATA_BE_SVC, PIPEDIR_IN, 2, },
+	{ WMI_DATA_VI_SVC, PIPEDIR_OUT, 3, },
+	{ WMI_DATA_VI_SVC, PIPEDIR_IN, 2, },
+	{ WMI_CONTROL_SVC, PIPEDIR_OUT, 3, },
+	{ WMI_CONTROL_SVC, PIPEDIR_IN, 2, },
+	{ HTC_CTRL_RSVD_SVC, PIPEDIR_OUT, 0, },
+	{ HTC_CTRL_RSVD_SVC, PIPEDIR_IN, 2, },
+	{ HTT_DATA_MSG_SVC, PIPEDIR_OUT, 4, },
+	{ HTT_DATA_MSG_SVC, PIPEDIR_IN, 1, },
+	/* (Additions here) */
+	{ 0, 0, 0, },
+};
+#else
+static struct service_to_pipe target_service_to_ce_map_qca6390[] = {
+};
+#endif
+
 static struct service_to_pipe target_service_to_ce_map_ar900b[] = {
 	{
 		WMI_DATA_VO_SVC,
@@ -688,6 +712,11 @@ static void hif_select_service_to_pipe_map(struct hif_softc *scn,
 			*sz_tgt_svc_map_to_use =
 				sizeof(target_service_to_ce_map_qca6290);
 			break;
+		case TARGET_TYPE_QCA6390:
+			*tgt_svc_map_to_use = target_service_to_ce_map_qca6390;
+			*sz_tgt_svc_map_to_use =
+				sizeof(target_service_to_ce_map_qca6390);
+			break;
 		case TARGET_TYPE_QCA8074:
 			*tgt_svc_map_to_use = target_service_to_ce_map_qca8074;
 			*sz_tgt_svc_map_to_use =
@@ -874,6 +903,7 @@ bool ce_srng_based(struct hif_softc *scn)
 	switch (tgt_info->target_type) {
 	case TARGET_TYPE_QCA8074:
 	case TARGET_TYPE_QCA6290:
+	case TARGET_TYPE_QCA6390:
 		return true;
 	default:
 		return false;
@@ -2796,6 +2826,14 @@ void hif_ce_prepare_config(struct hif_softc *scn)
 
 		scn->ce_count = QCA_6290_CE_COUNT;
 		break;
+	case TARGET_TYPE_QCA6390:
+		hif_state->host_ce_config = host_ce_config_wlan_qca6390;
+		hif_state->target_ce_config = target_ce_config_wlan_qca6390;
+		hif_state->target_ce_config_sz =
+					sizeof(target_ce_config_wlan_qca6390);
+
+		scn->ce_count = QCA_6390_CE_COUNT;
+		break;
 	}
 	QDF_BUG(scn->ce_count <= CE_COUNT_MAX);
 }

+ 11 - 2
hif/src/hif_main.c

@@ -486,7 +486,8 @@ void hif_close(struct hif_opaque_softc *hif_ctx)
 	qdf_mem_free(scn);
 }
 
-#ifdef QCA_WIFI_QCA8074
+#if defined(QCA_WIFI_QCA8074) || \
+	defined(QCA_WIFI_QCA6290) || defined(QCA_WIFI_QCA6390)
 static QDF_STATUS hif_hal_attach(struct hif_softc *scn)
 {
 	if (ce_srng_based(scn)) {
@@ -822,8 +823,16 @@ int hif_get_device_type(uint32_t device_id,
 		HIF_INFO(" *********** QCN7605 *************\n");
 		break;
 
+	case QCA6390_DEVICE_ID:
+	case QCA6390_EMULATION_DEVICE_ID:
+		*hif_type = HIF_TYPE_QCA6390;
+		*target_type = TARGET_TYPE_QCA6390;
+		HIF_INFO(" *********** QCA6390 *************\n");
+		break;
+
 	default:
-		HIF_ERROR("%s: Unsupported device ID!", __func__);
+		HIF_ERROR("%s: Unsupported device ID = 0x%x!",
+			  __func__, device_id);
 		ret = -ENODEV;
 		break;
 	}

+ 2 - 0
hif/src/hif_main.h

@@ -80,6 +80,8 @@
 #define AR6320_FW_3_2  (0x32)
 #define QCA6290_EMULATION_DEVICE_ID (0xabcd)
 #define QCA6290_DEVICE_ID (0x1100)
+#define QCA6390_EMULATION_DEVICE_ID (0x0108)
+#define QCA6390_DEVICE_ID (0x1101)
 #define ADRASTEA_DEVICE_ID_P2_E12 (0x7021)
 #define AR9887_DEVICE_ID    (0x0050)
 #define AR900B_DEVICE_ID    (0x0040)

+ 2 - 4
hif/src/pcie/if_pci.c

@@ -2160,13 +2160,10 @@ static int hif_enable_pci_nopld(struct hif_pci_softc *sc,
 		goto err_iomap;
 	}
 
-	pr_err("*****BAR is %pK\n", mem);
+	HIF_INFO("*****BAR is %pK\n", (void *)mem);
 
 	sc->mem = mem;
 
-	HIF_INFO("%s, mem after pci_iomap:%pK\n",
-	       __func__, sc->mem);
-
 	/* Hawkeye emulation specific change */
 	if ((device_id == RUMIM2M_DEVICE_ID_NODE0) ||
 		(device_id == RUMIM2M_DEVICE_ID_NODE1) ||
@@ -4514,6 +4511,7 @@ int hif_pci_addr_in_boundary(struct hif_softc *scn, uint32_t offset)
 	tgt_info = hif_get_target_info_handle(GET_HIF_OPAQUE_HDL(scn));
 
 	if (tgt_info->target_type == TARGET_TYPE_QCA6290 ||
+	    tgt_info->target_type == TARGET_TYPE_QCA6390 ||
 	    tgt_info->target_type == TARGET_TYPE_QCA8074) {
 		/*
 		 * Need to consider offset's memtype for QCA6290/QCA8074,

+ 15 - 1
hif/src/regtable.c

@@ -108,13 +108,20 @@ void hif_target_register_tbl_attach(struct hif_softc *scn, u32 target_type)
 #endif
 
 #if defined(QCA6290_HEADERS_DEF)
-	/* use the same defs for HAWKEYE & NAPIER */
 	case TARGET_TYPE_QCA6290:
 		scn->targetdef = QCA6290_TARGETdef;
 		scn->target_ce_def = QCA6290_CE_TARGETdef;
 		break;
 #endif
 
+#if defined(QCA6390_HEADERS_DEF)
+	case TARGET_TYPE_QCA6390:
+		scn->targetdef = QCA6390_TARGETdef;
+		scn->target_ce_def = QCA6390_CE_TARGETdef;
+		HIF_TRACE("%s: TARGET_TYPE_QCA6390", __func__);
+		break;
+#endif /* QCA6390_HEADERS_DEF */
+
 	default:
 		break;
 	}
@@ -194,6 +201,13 @@ void hif_register_tbl_attach(struct hif_softc *scn, u32 hif_type)
 		break;
 #endif
 
+#if defined(QCA6390_HEADERS_DEF)
+	case HIF_TYPE_QCA6390:
+		scn->hostdef = QCA6390_HOSTdef;
+		HIF_TRACE("%s: HIF_TYPE_QCA6390", __func__);
+		break;
+#endif /* QCA6390_HEADERS_DEF */
+
 	default:
 		break;
 	}