aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Kazior <michal.kazior@tieto.com>2013-11-25 08:06:25 -0500
committerKalle Valo <kvalo@qca.qualcomm.com>2013-11-27 09:45:33 -0500
commit2685218b3f3dd2af1c9ac09d7b3800725bb34d9c (patch)
tree93f5bb3ee8698054aa6a9c079b80f6d8445ec4bc
parent5d1aa94680f1bf581a4cea2c7137a1423f676795 (diff)
ath10k: extract functions for legacy irq handling
Preparation for code re-use. Also use ioread/write wrappers. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r--drivers/net/wireless/ath/ath10k/pci.c65
1 files changed, 32 insertions, 33 deletions
diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c
index bd673115ec32..1d2939c35d9c 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -220,6 +220,34 @@ static bool ath10k_pci_irq_pending(struct ath10k *ar)
220 return false; 220 return false;
221} 221}
222 222
223static void ath10k_pci_disable_and_clear_legacy_irq(struct ath10k *ar)
224{
225 /* IMPORTANT: INTR_CLR register has to be set after
226 * INTR_ENABLE is set to 0, otherwise interrupt can not be
227 * really cleared. */
228 ath10k_pci_write32(ar, SOC_CORE_BASE_ADDRESS + PCIE_INTR_ENABLE_ADDRESS,
229 0);
230 ath10k_pci_write32(ar, SOC_CORE_BASE_ADDRESS + PCIE_INTR_CLR_ADDRESS,
231 PCIE_INTR_FIRMWARE_MASK | PCIE_INTR_CE_MASK_ALL);
232
233 /* IMPORTANT: this extra read transaction is required to
234 * flush the posted write buffer. */
235 (void) ath10k_pci_read32(ar, SOC_CORE_BASE_ADDRESS +
236 PCIE_INTR_ENABLE_ADDRESS);
237}
238
239static void ath10k_pci_enable_legacy_irq(struct ath10k *ar)
240{
241 ath10k_pci_write32(ar, SOC_CORE_BASE_ADDRESS +
242 PCIE_INTR_ENABLE_ADDRESS,
243 PCIE_INTR_FIRMWARE_MASK | PCIE_INTR_CE_MASK_ALL);
244
245 /* IMPORTANT: this extra read transaction is required to
246 * flush the posted write buffer. */
247 (void) ath10k_pci_read32(ar, SOC_CORE_BASE_ADDRESS +
248 PCIE_INTR_ENABLE_ADDRESS);
249}
250
223/* 251/*
224 * Diagnostic read/write access is provided for startup/config/debug usage. 252 * Diagnostic read/write access is provided for startup/config/debug usage.
225 * Caller must guarantee proper alignment, when applicable, and single user 253 * Caller must guarantee proper alignment, when applicable, and single user
@@ -2128,25 +2156,7 @@ static irqreturn_t ath10k_pci_interrupt_handler(int irq, void *arg)
2128 if (!ath10k_pci_irq_pending(ar)) 2156 if (!ath10k_pci_irq_pending(ar))
2129 return IRQ_NONE; 2157 return IRQ_NONE;
2130 2158
2131 /* 2159 ath10k_pci_disable_and_clear_legacy_irq(ar);
2132 * IMPORTANT: INTR_CLR regiser has to be set after
2133 * INTR_ENABLE is set to 0, otherwise interrupt can not be
2134 * really cleared.
2135 */
2136 iowrite32(0, ar_pci->mem +
2137 (SOC_CORE_BASE_ADDRESS |
2138 PCIE_INTR_ENABLE_ADDRESS));
2139 iowrite32(PCIE_INTR_FIRMWARE_MASK |
2140 PCIE_INTR_CE_MASK_ALL,
2141 ar_pci->mem + (SOC_CORE_BASE_ADDRESS |
2142 PCIE_INTR_CLR_ADDRESS));
2143 /*
2144 * IMPORTANT: this extra read transaction is required to
2145 * flush the posted write buffer.
2146 */
2147 (void) ioread32(ar_pci->mem +
2148 (SOC_CORE_BASE_ADDRESS |
2149 PCIE_INTR_ENABLE_ADDRESS));
2150 } 2160 }
2151 2161
2152 tasklet_schedule(&ar_pci->intr_tq); 2162 tasklet_schedule(&ar_pci->intr_tq);
@@ -2162,20 +2172,9 @@ static void ath10k_pci_tasklet(unsigned long data)
2162 ath10k_pci_fw_interrupt_handler(ar); /* FIXME: Handle FW error */ 2172 ath10k_pci_fw_interrupt_handler(ar); /* FIXME: Handle FW error */
2163 ath10k_ce_per_engine_service_any(ar); 2173 ath10k_ce_per_engine_service_any(ar);
2164 2174
2165 if (ar_pci->num_msi_intrs == 0) { 2175 /* Re-enable legacy irq that was disabled in the irq handler */
2166 /* Enable Legacy PCI line interrupts */ 2176 if (ar_pci->num_msi_intrs == 0)
2167 iowrite32(PCIE_INTR_FIRMWARE_MASK | 2177 ath10k_pci_enable_legacy_irq(ar);
2168 PCIE_INTR_CE_MASK_ALL,
2169 ar_pci->mem + (SOC_CORE_BASE_ADDRESS |
2170 PCIE_INTR_ENABLE_ADDRESS));
2171 /*
2172 * IMPORTANT: this extra read transaction is required to
2173 * flush the posted write buffer
2174 */
2175 (void) ioread32(ar_pci->mem +
2176 (SOC_CORE_BASE_ADDRESS |
2177 PCIE_INTR_ENABLE_ADDRESS));
2178 }
2179} 2178}
2180 2179
2181static int ath10k_pci_request_irq_msix(struct ath10k *ar) 2180static int ath10k_pci_request_irq_msix(struct ath10k *ar)