Ver Fonte

qcacmn: Move relevent hif_pci_softc members from ol_softc

Few members are relevant only for PCIe based solutions, hence
move those to hif_pci_softc structure.

Change-Id: I1f38da4cfc9f69c05a9c80e67abc70fd97e22af9
CRs-Fixed: 967765
Komal Seelam há 9 anos atrás
pai
commit
aa72bb719e
4 ficheiros alterados com 66 adições e 31 exclusões
  1. 0 6
      hif/inc/hif.h
  2. 3 3
      hif/src/pcie/hif_io32_pci.h
  3. 45 21
      hif/src/pcie/if_pci.c
  4. 18 1
      hif/src/pcie/if_pci.h

+ 0 - 6
hif/inc/hif.h

@@ -192,7 +192,6 @@ struct ol_softc {
 	 */
 	struct _NIC_DEV aps_osdev;
 	enum ath_hal_bus_type bus_type;
-	uint32_t lcr_val;
 	bool pkt_log_init;
 	bool request_irq_done;
 	/*
@@ -224,10 +223,6 @@ struct ol_softc {
 	/* length of last response */
 	OS_DMA_MEM_CONTEXT(bmirsp_dmacontext)
 
-	void *msi_magic;
-	dma_addr_t msi_magic_da;
-	OS_DMA_MEM_CONTEXT(msi_dmacontext)
-
 	/* Handles for Lower Layers : filled in at init time */
 	hif_handle_t hif_hdl;
 #ifdef HIF_PCI
@@ -274,7 +269,6 @@ struct ol_softc {
 	atomic_t active_tasklet_cnt;
 	bool notice_send;
 #ifdef HIF_PCI
-	cdf_spinlock_t irq_lock;
 	uint32_t ce_irq_summary;
 #endif
 	uint32_t *vaddr_rri_on_ddr;

+ 3 - 3
hif/src/pcie/hif_io32_pci.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -258,7 +258,7 @@ static inline void ce_irq_enable(struct ol_softc *scn, int ce_id)
 	uint32_t tmp = 1 << ce_id;
 	struct hif_pci_softc *sc = scn->hif_sc;
 
-	cdf_spin_lock_irqsave(&scn->irq_lock);
+	cdf_spin_lock_irqsave(&sc->irq_lock);
 	scn->ce_irq_summary &= ~tmp;
 	if (scn->ce_irq_summary == 0) {
 		/* Enable Legacy PCI line interrupts */
@@ -278,7 +278,7 @@ static inline void ce_irq_enable(struct ol_softc *scn, int ce_id)
 	}
 	if (scn->hif_init_done == true)
 		A_TARGET_ACCESS_END(scn);
-	cdf_spin_unlock_irqrestore(&scn->irq_lock);
+	cdf_spin_unlock_irqrestore(&sc->irq_lock);
 
 	/* check for missed firmware crash */
 	hif_fw_interrupt_handler(0, scn);

+ 45 - 21
hif/src/pcie/if_pci.c

@@ -789,18 +789,16 @@ static irqreturn_t ce_per_engine_handler(int irq, void *arg)
 #ifdef CONFIG_SLUB_DEBUG_ON
 
 /* worker thread to schedule wlan_tasklet in SLUB debug build */
-static void reschedule_tasklet_work_handler(struct work_struct *recovery)
+static void reschedule_tasklet_work_handler(void *arg)
 {
-	struct ol_softc *scn = cds_get_context(CDF_MODULE_ID_HIF);
-	struct hif_pci_softc *sc;
+	struct hif_pci_softc *sc = arg;
+	struct ol_softc *scn = sc->ol_sc;
 
-	if (NULL == scn) {
-		HIF_ERROR("%s: tasklet scn is null", __func__);
+	if (!scn) {
+		HIF_ERROR("%s: ol_softc is NULL", __func__);
 		return;
 	}
 
-	sc = scn->hif_sc;
-
 	if (scn->hif_init_done == false) {
 		HIF_ERROR("%s: wlan driver is unloaded", __func__);
 		return;
@@ -810,9 +808,21 @@ static void reschedule_tasklet_work_handler(struct work_struct *recovery)
 	return;
 }
 
-static DECLARE_WORK(reschedule_tasklet_work, reschedule_tasklet_work_handler);
-
-#endif
+/**
+ * hif_init_reschedule_tasklet_work() - API to initialize reschedule tasklet
+ * work
+ * @sc: HIF PCI Context
+ *
+ * Return: void
+ */
+static void hif_init_reschedule_tasklet_work(struct hif_pci_softc *sc)
+{
+	cdf_create_work(&sc->reschedule_tasklet_work,
+				reschedule_tasklet_work_handler, sc);
+}
+#else
+static void hif_init_reschedule_tasklet_work(struct hif_pci_softc *sc) { }
+#endif /* CONFIG_SLUB_DEBUG_ON */
 
 static void wlan_tasklet(unsigned long data)
 {
@@ -1194,7 +1204,7 @@ CDF_STATUS hif_bus_open(struct ol_softc *ol_sc, enum ath_hal_bus_type bus_type)
 	ol_sc->bus_type = bus_type;
 	hif_pm_runtime_open(sc);
 
-	cdf_spinlock_init(&ol_sc->irq_lock);
+	cdf_spinlock_init(&sc->irq_lock);
 
 	return CDF_STATUS_SUCCESS;
 }
@@ -2159,19 +2169,31 @@ int hif_runtime_resume(void)
 	return status;
 }
 
+#if CONFIG_PCIE_64BIT_MSI
+static void hif_free_msi_ctx(struct ol_softc *scn)
+{
+	struct hif_pci_softc *sc = scn->hif_sc;
+	struct hif_msi_info *info = &sc->msi_info;
+
+	OS_FREE_CONSISTENT(&scn->aps_osdev, 4,
+			info->magic, info->magic_dma,
+			OS_GET_DMA_MEM_CONTEXT(scn, dmacontext));
+	info->magic = NULL;
+	info->magic_dma = 0;
+}
+#else
+static void hif_free_msi_ctx(struct ol_softc *scn)
+{
+}
+#endif
+
 void hif_disable_isr(void *ol_sc)
 {
 	struct ol_softc *scn = (struct ol_softc *)ol_sc;
 	struct hif_pci_softc *sc = scn->hif_sc;
 
 	hif_nointrs(ol_sc);
-#if CONFIG_PCIE_64BIT_MSI
-	OS_FREE_CONSISTENT(&scn->aps_osdev, 4,
-			   scn->msi_magic, scn->msi_magic_dma,
-			   OS_GET_DMA_MEM_CONTEXT(scn, MSI_dmacontext));
-	scn->msi_magic = NULL;
-	scn->msi_magic_dma = 0;
-#endif
+	hif_free_msi_ctx(scn);
 	/* Cancel the pending tasklet */
 	ce_tasklet_kill(scn->hif_hdl);
 	tasklet_kill(&sc->intr_tq);
@@ -2213,8 +2235,8 @@ void hif_disable_aspm(void)
 	sc = scn->hif_sc;
 
 	/* Disable ASPM when pkt log is enabled */
-	pci_read_config_dword(sc->pdev, 0x80, &scn->lcr_val);
-	pci_write_config_dword(sc->pdev, 0x80, (scn->lcr_val & 0xffffff00));
+	pci_read_config_dword(sc->pdev, 0x80, &sc->lcr_val);
+	pci_write_config_dword(sc->pdev, 0x80, (sc->lcr_val & 0xffffff00));
 }
 
 /**
@@ -2237,7 +2259,7 @@ void hif_enable_power_gating(void *hif_ctx)
 	sc = scn->hif_sc;
 
 	/* Re-enable ASPM after firmware/OTP download is complete */
-	pci_write_config_dword(sc->pdev, 0x80, scn->lcr_val);
+	pci_write_config_dword(sc->pdev, 0x80, sc->lcr_val);
 	if (scn->pkt_log_init == false) {
 		PKT_LOG_MOD_INIT(scn);
 		scn->pkt_log_init = true;
@@ -2614,6 +2636,8 @@ int hif_configure_irq(struct hif_pci_softc *sc)
 
 	HIF_TRACE("%s: E", __func__);
 
+	hif_init_reschedule_tasklet_work(sc);
+
 	if (ENABLE_MSI) {
 		ret = hif_configure_msi(sc);
 		if (ret == 0)

+ 18 - 1
hif/src/pcie/if_pci.h

@@ -98,6 +98,20 @@ struct hif_pci_pm_stats {
 };
 #endif
 
+/**
+ * struct hif_msi_info - Structure to hold msi info
+ * @magic: cookie
+ * @magic_da: dma address
+ * @dmaContext: dma address
+ *
+ * Structure to hold MSI information for PCIe interrupts
+ */
+struct hif_msi_info {
+	void *magic;
+	dma_addr_t magic_da;
+	OS_DMA_MEM_CONTEXT(dmacontext)
+};
+
 struct hif_pci_softc {
 	void __iomem *mem;      /* PCI address. */
 	/* For efficiency, should be first in struct */
@@ -109,7 +123,7 @@ struct hif_pci_softc {
 	/* 0 --> using legacy PCI line interrupts */
 	struct tasklet_struct intr_tq;  /* tasklet */
 
-
+	struct hif_msi_info msi_info;
 	int irq;
 	int irq_event;
 	int cacheline_sz;
@@ -117,6 +131,9 @@ struct hif_pci_softc {
 	cdf_dma_addr_t soc_pcie_bar0;
 	struct hif_tasklet_entry tasklet_entries[HIF_MAX_TASKLET_NUM];
 	bool pci_enabled;
+	cdf_spinlock_t irq_lock;
+	cdf_work_t reschedule_tasklet_work;
+	uint32_t lcr_val;
 #ifdef FEATURE_RUNTIME_PM
 	atomic_t pm_state;
 	uint32_t prevent_suspend_cnt;