2012-12-20 14:13:19 -07:00
|
|
|
/*
|
2017-01-20 04:49:46 -07:00
|
|
|
* Copyright (c) 2012-2017 Qualcomm Atheros, Inc.
|
2018-01-21 02:14:38 -07:00
|
|
|
* Copyright (c) 2018, The Linux Foundation. All rights reserved.
|
2012-12-20 14:13:19 -07:00
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
|
|
|
|
#include "wil6210.h"
|
2013-05-12 05:43:35 -06:00
|
|
|
#include "trace.h"
|
2012-12-20 14:13:19 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Theory of operation:
|
|
|
|
*
|
|
|
|
* There is ISR pseudo-cause register,
|
|
|
|
* dma_rgf->DMA_RGF.PSEUDO_CAUSE.PSEUDO_CAUSE
|
|
|
|
* Its bits represents OR'ed bits from 3 real ISR registers:
|
|
|
|
* TX, RX, and MISC.
|
|
|
|
*
|
|
|
|
* Registers may be configured to either "write 1 to clear" or
|
|
|
|
* "clear on read" mode
|
|
|
|
*
|
|
|
|
* When handling interrupt, one have to mask/unmask interrupts for the
|
|
|
|
* real ISR registers, or hardware may malfunction.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-04-26 05:41:41 -06:00
|
|
|
#define WIL6210_IRQ_DISABLE (0xFFFFFFFFUL)
|
|
|
|
#define WIL6210_IRQ_DISABLE_NO_HALP (0xF7FFFFFFUL)
|
2014-12-01 06:33:16 -07:00
|
|
|
#define WIL6210_IMC_RX (BIT_DMA_EP_RX_ICR_RX_DONE | \
|
|
|
|
BIT_DMA_EP_RX_ICR_RX_HTRSH)
|
2016-04-26 05:41:40 -06:00
|
|
|
#define WIL6210_IMC_RX_NO_RX_HTRSH (WIL6210_IMC_RX & \
|
|
|
|
(~(BIT_DMA_EP_RX_ICR_RX_HTRSH)))
|
2012-12-20 14:13:19 -07:00
|
|
|
#define WIL6210_IMC_TX (BIT_DMA_EP_TX_ICR_TX_DONE | \
|
|
|
|
BIT_DMA_EP_TX_ICR_TX_DONE_N(0))
|
2016-04-26 05:41:41 -06:00
|
|
|
#define WIL6210_IMC_MISC_NO_HALP (ISR_MISC_FW_READY | \
|
|
|
|
ISR_MISC_MBOX_EVT | \
|
|
|
|
ISR_MISC_FW_ERROR)
|
|
|
|
#define WIL6210_IMC_MISC (WIL6210_IMC_MISC_NO_HALP | \
|
|
|
|
BIT_DMA_EP_MISC_ICR_HALP)
|
2012-12-20 14:13:19 -07:00
|
|
|
#define WIL6210_IRQ_PSEUDO_MASK (u32)(~(BIT_DMA_PSEUDO_CAUSE_RX | \
|
|
|
|
BIT_DMA_PSEUDO_CAUSE_TX | \
|
|
|
|
BIT_DMA_PSEUDO_CAUSE_MISC))
|
|
|
|
|
|
|
|
#if defined(CONFIG_WIL6210_ISR_COR)
|
|
|
|
/* configure to Clear-On-Read mode */
|
|
|
|
#define WIL_ICR_ICC_VALUE (0xFFFFFFFFUL)
|
2016-04-26 05:41:41 -06:00
|
|
|
#define WIL_ICR_ICC_MISC_VALUE (0xF7FFFFFFUL)
|
2012-12-20 14:13:19 -07:00
|
|
|
|
|
|
|
static inline void wil_icr_clear(u32 x, void __iomem *addr)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
#else /* defined(CONFIG_WIL6210_ISR_COR) */
|
|
|
|
/* configure to Write-1-to-Clear mode */
|
|
|
|
#define WIL_ICR_ICC_VALUE (0UL)
|
2016-04-26 05:41:41 -06:00
|
|
|
#define WIL_ICR_ICC_MISC_VALUE (0UL)
|
2012-12-20 14:13:19 -07:00
|
|
|
|
|
|
|
static inline void wil_icr_clear(u32 x, void __iomem *addr)
|
|
|
|
{
|
2015-07-30 04:52:03 -06:00
|
|
|
writel(x, addr);
|
2012-12-20 14:13:19 -07:00
|
|
|
}
|
|
|
|
#endif /* defined(CONFIG_WIL6210_ISR_COR) */
|
|
|
|
|
|
|
|
static inline u32 wil_ioread32_and_clear(void __iomem *addr)
|
|
|
|
{
|
2015-07-30 04:52:03 -06:00
|
|
|
u32 x = readl(addr);
|
2012-12-20 14:13:19 -07:00
|
|
|
|
|
|
|
wil_icr_clear(x, addr);
|
|
|
|
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void wil6210_mask_irq_tx(struct wil6210_priv *wil)
|
|
|
|
{
|
2015-07-30 04:52:03 -06:00
|
|
|
wil_w(wil, RGF_DMA_EP_TX_ICR + offsetof(struct RGF_ICR, IMS),
|
|
|
|
WIL6210_IRQ_DISABLE);
|
2012-12-20 14:13:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void wil6210_mask_irq_rx(struct wil6210_priv *wil)
|
|
|
|
{
|
2015-07-30 04:52:03 -06:00
|
|
|
wil_w(wil, RGF_DMA_EP_RX_ICR + offsetof(struct RGF_ICR, IMS),
|
|
|
|
WIL6210_IRQ_DISABLE);
|
2012-12-20 14:13:19 -07:00
|
|
|
}
|
|
|
|
|
2016-04-26 05:41:41 -06:00
|
|
|
static void wil6210_mask_irq_misc(struct wil6210_priv *wil, bool mask_halp)
|
2012-12-20 14:13:19 -07:00
|
|
|
{
|
2017-01-20 04:49:46 -07:00
|
|
|
wil_dbg_irq(wil, "mask_irq_misc: mask_halp(%s)\n",
|
2016-04-26 05:41:41 -06:00
|
|
|
mask_halp ? "true" : "false");
|
|
|
|
|
2015-07-30 04:52:03 -06:00
|
|
|
wil_w(wil, RGF_DMA_EP_MISC_ICR + offsetof(struct RGF_ICR, IMS),
|
2016-04-26 05:41:41 -06:00
|
|
|
mask_halp ? WIL6210_IRQ_DISABLE : WIL6210_IRQ_DISABLE_NO_HALP);
|
|
|
|
}
|
|
|
|
|
2016-08-18 07:52:12 -06:00
|
|
|
void wil6210_mask_halp(struct wil6210_priv *wil)
|
2016-04-26 05:41:41 -06:00
|
|
|
{
|
2017-01-20 04:49:46 -07:00
|
|
|
wil_dbg_irq(wil, "mask_halp\n");
|
2016-04-26 05:41:41 -06:00
|
|
|
|
|
|
|
wil_w(wil, RGF_DMA_EP_MISC_ICR + offsetof(struct RGF_ICR, IMS),
|
|
|
|
BIT_DMA_EP_MISC_ICR_HALP);
|
2012-12-20 14:13:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void wil6210_mask_irq_pseudo(struct wil6210_priv *wil)
|
|
|
|
{
|
2017-01-20 04:49:46 -07:00
|
|
|
wil_dbg_irq(wil, "mask_irq_pseudo\n");
|
2012-12-20 14:13:19 -07:00
|
|
|
|
2015-07-30 04:52:03 -06:00
|
|
|
wil_w(wil, RGF_DMA_PSEUDO_CAUSE_MASK_SW, WIL6210_IRQ_DISABLE);
|
2012-12-20 14:13:19 -07:00
|
|
|
|
2014-12-23 00:47:14 -07:00
|
|
|
clear_bit(wil_status_irqen, wil->status);
|
2012-12-20 14:13:19 -07:00
|
|
|
}
|
|
|
|
|
2013-05-12 05:43:36 -06:00
|
|
|
void wil6210_unmask_irq_tx(struct wil6210_priv *wil)
|
2012-12-20 14:13:19 -07:00
|
|
|
{
|
2015-07-30 04:52:03 -06:00
|
|
|
wil_w(wil, RGF_DMA_EP_TX_ICR + offsetof(struct RGF_ICR, IMC),
|
|
|
|
WIL6210_IMC_TX);
|
2012-12-20 14:13:19 -07:00
|
|
|
}
|
|
|
|
|
2013-05-12 05:43:36 -06:00
|
|
|
void wil6210_unmask_irq_rx(struct wil6210_priv *wil)
|
2012-12-20 14:13:19 -07:00
|
|
|
{
|
2018-02-26 11:12:17 -07:00
|
|
|
bool unmask_rx_htrsh = atomic_read(&wil->connected_vifs) > 0;
|
2016-04-26 05:41:40 -06:00
|
|
|
|
2015-07-30 04:52:03 -06:00
|
|
|
wil_w(wil, RGF_DMA_EP_RX_ICR + offsetof(struct RGF_ICR, IMC),
|
2016-04-26 05:41:40 -06:00
|
|
|
unmask_rx_htrsh ? WIL6210_IMC_RX : WIL6210_IMC_RX_NO_RX_HTRSH);
|
2012-12-20 14:13:19 -07:00
|
|
|
}
|
|
|
|
|
2016-04-26 05:41:41 -06:00
|
|
|
static void wil6210_unmask_irq_misc(struct wil6210_priv *wil, bool unmask_halp)
|
2012-12-20 14:13:19 -07:00
|
|
|
{
|
2017-01-20 04:49:46 -07:00
|
|
|
wil_dbg_irq(wil, "unmask_irq_misc: unmask_halp(%s)\n",
|
2016-04-26 05:41:41 -06:00
|
|
|
unmask_halp ? "true" : "false");
|
|
|
|
|
2015-07-30 04:52:03 -06:00
|
|
|
wil_w(wil, RGF_DMA_EP_MISC_ICR + offsetof(struct RGF_ICR, IMC),
|
2016-04-26 05:41:41 -06:00
|
|
|
unmask_halp ? WIL6210_IMC_MISC : WIL6210_IMC_MISC_NO_HALP);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void wil6210_unmask_halp(struct wil6210_priv *wil)
|
|
|
|
{
|
2017-01-20 04:49:46 -07:00
|
|
|
wil_dbg_irq(wil, "unmask_halp\n");
|
2016-04-26 05:41:41 -06:00
|
|
|
|
|
|
|
wil_w(wil, RGF_DMA_EP_MISC_ICR + offsetof(struct RGF_ICR, IMC),
|
|
|
|
BIT_DMA_EP_MISC_ICR_HALP);
|
2012-12-20 14:13:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void wil6210_unmask_irq_pseudo(struct wil6210_priv *wil)
|
|
|
|
{
|
2017-01-20 04:49:46 -07:00
|
|
|
wil_dbg_irq(wil, "unmask_irq_pseudo\n");
|
2012-12-20 14:13:19 -07:00
|
|
|
|
2014-12-23 00:47:14 -07:00
|
|
|
set_bit(wil_status_irqen, wil->status);
|
2012-12-20 14:13:19 -07:00
|
|
|
|
2015-07-30 04:52:03 -06:00
|
|
|
wil_w(wil, RGF_DMA_PSEUDO_CAUSE_MASK_SW, WIL6210_IRQ_PSEUDO_MASK);
|
2012-12-20 14:13:19 -07:00
|
|
|
}
|
|
|
|
|
2014-09-10 07:34:49 -06:00
|
|
|
void wil_mask_irq(struct wil6210_priv *wil)
|
2012-12-20 14:13:19 -07:00
|
|
|
{
|
2017-01-20 04:49:46 -07:00
|
|
|
wil_dbg_irq(wil, "mask_irq\n");
|
2012-12-20 14:13:19 -07:00
|
|
|
|
|
|
|
wil6210_mask_irq_tx(wil);
|
|
|
|
wil6210_mask_irq_rx(wil);
|
2016-04-26 05:41:41 -06:00
|
|
|
wil6210_mask_irq_misc(wil, true);
|
2012-12-20 14:13:19 -07:00
|
|
|
wil6210_mask_irq_pseudo(wil);
|
|
|
|
}
|
|
|
|
|
2014-09-10 07:34:49 -06:00
|
|
|
void wil_unmask_irq(struct wil6210_priv *wil)
|
2012-12-20 14:13:19 -07:00
|
|
|
{
|
2017-01-20 04:49:46 -07:00
|
|
|
wil_dbg_irq(wil, "unmask_irq\n");
|
2012-12-20 14:13:19 -07:00
|
|
|
|
2015-07-30 04:52:03 -06:00
|
|
|
wil_w(wil, RGF_DMA_EP_RX_ICR + offsetof(struct RGF_ICR, ICC),
|
|
|
|
WIL_ICR_ICC_VALUE);
|
|
|
|
wil_w(wil, RGF_DMA_EP_TX_ICR + offsetof(struct RGF_ICR, ICC),
|
|
|
|
WIL_ICR_ICC_VALUE);
|
|
|
|
wil_w(wil, RGF_DMA_EP_MISC_ICR + offsetof(struct RGF_ICR, ICC),
|
2016-04-26 05:41:41 -06:00
|
|
|
WIL_ICR_ICC_MISC_VALUE);
|
2012-12-20 14:13:19 -07:00
|
|
|
|
|
|
|
wil6210_unmask_irq_pseudo(wil);
|
|
|
|
wil6210_unmask_irq_tx(wil);
|
|
|
|
wil6210_unmask_irq_rx(wil);
|
2016-04-26 05:41:41 -06:00
|
|
|
wil6210_unmask_irq_misc(wil, true);
|
2012-12-20 14:13:19 -07:00
|
|
|
}
|
|
|
|
|
2018-06-29 07:28:23 -06:00
|
|
|
void wil_configure_interrupt_moderation_edma(struct wil6210_priv *wil)
|
|
|
|
{
|
|
|
|
u32 moderation;
|
|
|
|
|
|
|
|
wil_s(wil, RGF_INT_GEN_IDLE_TIME_LIMIT, WIL_EDMA_IDLE_TIME_LIMIT_USEC);
|
|
|
|
|
|
|
|
wil_s(wil, RGF_INT_GEN_TIME_UNIT_LIMIT, WIL_EDMA_TIME_UNIT_CLK_CYCLES);
|
|
|
|
|
|
|
|
/* Update RX and TX moderation */
|
|
|
|
moderation = wil->rx_max_burst_duration |
|
|
|
|
(WIL_EDMA_AGG_WATERMARK << WIL_EDMA_AGG_WATERMARK_POS);
|
|
|
|
wil_w(wil, RGF_INT_CTRL_INT_GEN_CFG_0, moderation);
|
|
|
|
wil_w(wil, RGF_INT_CTRL_INT_GEN_CFG_1, moderation);
|
|
|
|
|
|
|
|
/* Treat special events as regular
|
|
|
|
* (set bit 0 to 0x1 and clear bits 1-8)
|
|
|
|
*/
|
|
|
|
wil_c(wil, RGF_INT_COUNT_ON_SPECIAL_EVT, 0x1FE);
|
|
|
|
wil_s(wil, RGF_INT_COUNT_ON_SPECIAL_EVT, 0x1);
|
|
|
|
}
|
|
|
|
|
2015-02-15 05:02:31 -07:00
|
|
|
void wil_configure_interrupt_moderation(struct wil6210_priv *wil)
|
2014-12-23 00:47:19 -07:00
|
|
|
{
|
2018-02-26 11:12:13 -07:00
|
|
|
struct wireless_dev *wdev = wil->main_ndev->ieee80211_ptr;
|
|
|
|
|
2017-01-20 04:49:46 -07:00
|
|
|
wil_dbg_irq(wil, "configure_interrupt_moderation\n");
|
2015-02-15 05:02:31 -07:00
|
|
|
|
|
|
|
/* disable interrupt moderation for monitor
|
|
|
|
* to get better timestamp precision
|
|
|
|
*/
|
2018-02-26 11:12:13 -07:00
|
|
|
if (wdev->iftype == NL80211_IFTYPE_MONITOR)
|
2015-02-15 05:02:31 -07:00
|
|
|
return;
|
|
|
|
|
2014-12-23 00:47:19 -07:00
|
|
|
/* Disable and clear tx counter before (re)configuration */
|
2015-07-30 04:52:03 -06:00
|
|
|
wil_w(wil, RGF_DMA_ITR_TX_CNT_CTL, BIT_DMA_ITR_TX_CNT_CTL_CLR);
|
|
|
|
wil_w(wil, RGF_DMA_ITR_TX_CNT_TRSH, wil->tx_max_burst_duration);
|
2014-12-23 00:47:19 -07:00
|
|
|
wil_info(wil, "set ITR_TX_CNT_TRSH = %d usec\n",
|
|
|
|
wil->tx_max_burst_duration);
|
|
|
|
/* Configure TX max burst duration timer to use usec units */
|
2015-07-30 04:52:03 -06:00
|
|
|
wil_w(wil, RGF_DMA_ITR_TX_CNT_CTL,
|
|
|
|
BIT_DMA_ITR_TX_CNT_CTL_EN | BIT_DMA_ITR_TX_CNT_CTL_EXT_TIC_SEL);
|
2014-12-23 00:47:19 -07:00
|
|
|
|
|
|
|
/* Disable and clear tx idle counter before (re)configuration */
|
2015-07-30 04:52:03 -06:00
|
|
|
wil_w(wil, RGF_DMA_ITR_TX_IDL_CNT_CTL, BIT_DMA_ITR_TX_IDL_CNT_CTL_CLR);
|
|
|
|
wil_w(wil, RGF_DMA_ITR_TX_IDL_CNT_TRSH, wil->tx_interframe_timeout);
|
2014-12-23 00:47:19 -07:00
|
|
|
wil_info(wil, "set ITR_TX_IDL_CNT_TRSH = %d usec\n",
|
|
|
|
wil->tx_interframe_timeout);
|
|
|
|
/* Configure TX max burst duration timer to use usec units */
|
2015-07-30 04:52:03 -06:00
|
|
|
wil_w(wil, RGF_DMA_ITR_TX_IDL_CNT_CTL, BIT_DMA_ITR_TX_IDL_CNT_CTL_EN |
|
|
|
|
BIT_DMA_ITR_TX_IDL_CNT_CTL_EXT_TIC_SEL);
|
2014-12-23 00:47:19 -07:00
|
|
|
|
|
|
|
/* Disable and clear rx counter before (re)configuration */
|
2015-07-30 04:52:03 -06:00
|
|
|
wil_w(wil, RGF_DMA_ITR_RX_CNT_CTL, BIT_DMA_ITR_RX_CNT_CTL_CLR);
|
|
|
|
wil_w(wil, RGF_DMA_ITR_RX_CNT_TRSH, wil->rx_max_burst_duration);
|
2014-12-23 00:47:19 -07:00
|
|
|
wil_info(wil, "set ITR_RX_CNT_TRSH = %d usec\n",
|
|
|
|
wil->rx_max_burst_duration);
|
|
|
|
/* Configure TX max burst duration timer to use usec units */
|
2015-07-30 04:52:03 -06:00
|
|
|
wil_w(wil, RGF_DMA_ITR_RX_CNT_CTL,
|
|
|
|
BIT_DMA_ITR_RX_CNT_CTL_EN | BIT_DMA_ITR_RX_CNT_CTL_EXT_TIC_SEL);
|
2014-12-23 00:47:19 -07:00
|
|
|
|
|
|
|
/* Disable and clear rx idle counter before (re)configuration */
|
2015-07-30 04:52:03 -06:00
|
|
|
wil_w(wil, RGF_DMA_ITR_RX_IDL_CNT_CTL, BIT_DMA_ITR_RX_IDL_CNT_CTL_CLR);
|
|
|
|
wil_w(wil, RGF_DMA_ITR_RX_IDL_CNT_TRSH, wil->rx_interframe_timeout);
|
2014-12-23 00:47:19 -07:00
|
|
|
wil_info(wil, "set ITR_RX_IDL_CNT_TRSH = %d usec\n",
|
|
|
|
wil->rx_interframe_timeout);
|
|
|
|
/* Configure TX max burst duration timer to use usec units */
|
2015-07-30 04:52:03 -06:00
|
|
|
wil_w(wil, RGF_DMA_ITR_RX_IDL_CNT_CTL, BIT_DMA_ITR_RX_IDL_CNT_CTL_EN |
|
|
|
|
BIT_DMA_ITR_RX_IDL_CNT_CTL_EXT_TIC_SEL);
|
2014-12-23 00:47:19 -07:00
|
|
|
}
|
|
|
|
|
2012-12-20 14:13:19 -07:00
|
|
|
static irqreturn_t wil6210_irq_rx(int irq, void *cookie)
|
|
|
|
{
|
|
|
|
struct wil6210_priv *wil = cookie;
|
|
|
|
u32 isr = wil_ioread32_and_clear(wil->csr +
|
|
|
|
HOSTADDR(RGF_DMA_EP_RX_ICR) +
|
|
|
|
offsetof(struct RGF_ICR, ICR));
|
2014-12-01 06:33:16 -07:00
|
|
|
bool need_unmask = true;
|
2012-12-20 14:13:19 -07:00
|
|
|
|
2013-05-12 05:43:35 -06:00
|
|
|
trace_wil6210_irq_rx(isr);
|
2013-01-28 09:31:06 -07:00
|
|
|
wil_dbg_irq(wil, "ISR RX 0x%08x\n", isr);
|
2012-12-20 14:13:19 -07:00
|
|
|
|
2015-02-15 05:02:33 -07:00
|
|
|
if (unlikely(!isr)) {
|
2017-08-28 13:18:41 -06:00
|
|
|
wil_err_ratelimited(wil, "spurious IRQ: RX\n");
|
2012-12-20 14:13:19 -07:00
|
|
|
return IRQ_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
wil6210_mask_irq_rx(wil);
|
|
|
|
|
2014-12-01 06:33:16 -07:00
|
|
|
/* RX_DONE and RX_HTRSH interrupts are the same if interrupt
|
|
|
|
* moderation is not used. Interrupt moderation may cause RX
|
|
|
|
* buffer overflow while RX_DONE is delayed. The required
|
|
|
|
* action is always the same - should empty the accumulated
|
|
|
|
* packets from the RX ring.
|
|
|
|
*/
|
2015-02-15 05:02:33 -07:00
|
|
|
if (likely(isr & (BIT_DMA_EP_RX_ICR_RX_DONE |
|
|
|
|
BIT_DMA_EP_RX_ICR_RX_HTRSH))) {
|
2016-04-26 05:41:39 -06:00
|
|
|
wil_dbg_irq(wil, "RX done / RX_HTRSH received, ISR (0x%x)\n",
|
|
|
|
isr);
|
2014-12-01 06:33:16 -07:00
|
|
|
|
2014-12-23 00:47:18 -07:00
|
|
|
isr &= ~(BIT_DMA_EP_RX_ICR_RX_DONE |
|
|
|
|
BIT_DMA_EP_RX_ICR_RX_HTRSH);
|
2015-10-25 07:59:23 -06:00
|
|
|
if (likely(test_bit(wil_status_fwready, wil->status))) {
|
2015-02-15 05:02:33 -07:00
|
|
|
if (likely(test_bit(wil_status_napi_en, wil->status))) {
|
2014-09-10 07:34:50 -06:00
|
|
|
wil_dbg_txrx(wil, "NAPI(Rx) schedule\n");
|
2014-12-01 06:33:16 -07:00
|
|
|
need_unmask = false;
|
2014-09-10 07:34:50 -06:00
|
|
|
napi_schedule(&wil->napi_rx);
|
|
|
|
} else {
|
2017-08-28 13:18:41 -06:00
|
|
|
wil_err_ratelimited(
|
|
|
|
wil,
|
2014-12-23 00:47:18 -07:00
|
|
|
"Got Rx interrupt while stopping interface\n");
|
2014-09-10 07:34:50 -06:00
|
|
|
}
|
2014-03-17 07:34:18 -06:00
|
|
|
} else {
|
2017-08-28 13:18:41 -06:00
|
|
|
wil_err_ratelimited(wil, "Got Rx interrupt while in reset\n");
|
2014-03-17 07:34:18 -06:00
|
|
|
}
|
2012-12-20 14:13:19 -07:00
|
|
|
}
|
|
|
|
|
2015-02-15 05:02:33 -07:00
|
|
|
if (unlikely(isr))
|
2012-12-20 14:13:19 -07:00
|
|
|
wil_err(wil, "un-handled RX ISR bits 0x%08x\n", isr);
|
|
|
|
|
2013-05-12 05:43:36 -06:00
|
|
|
/* Rx IRQ will be enabled when NAPI processing finished */
|
2012-12-20 14:13:19 -07:00
|
|
|
|
2014-06-16 10:37:22 -06:00
|
|
|
atomic_inc(&wil->isr_count_rx);
|
2014-12-01 06:33:16 -07:00
|
|
|
|
|
|
|
if (unlikely(need_unmask))
|
|
|
|
wil6210_unmask_irq_rx(wil);
|
|
|
|
|
2012-12-20 14:13:19 -07:00
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static irqreturn_t wil6210_irq_tx(int irq, void *cookie)
|
|
|
|
{
|
|
|
|
struct wil6210_priv *wil = cookie;
|
|
|
|
u32 isr = wil_ioread32_and_clear(wil->csr +
|
|
|
|
HOSTADDR(RGF_DMA_EP_TX_ICR) +
|
|
|
|
offsetof(struct RGF_ICR, ICR));
|
2014-12-01 06:33:16 -07:00
|
|
|
bool need_unmask = true;
|
2012-12-20 14:13:19 -07:00
|
|
|
|
2013-05-12 05:43:35 -06:00
|
|
|
trace_wil6210_irq_tx(isr);
|
2013-01-28 09:31:06 -07:00
|
|
|
wil_dbg_irq(wil, "ISR TX 0x%08x\n", isr);
|
2012-12-20 14:13:19 -07:00
|
|
|
|
2015-02-15 05:02:33 -07:00
|
|
|
if (unlikely(!isr)) {
|
2017-08-28 13:18:41 -06:00
|
|
|
wil_err_ratelimited(wil, "spurious IRQ: TX\n");
|
2012-12-20 14:13:19 -07:00
|
|
|
return IRQ_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
wil6210_mask_irq_tx(wil);
|
|
|
|
|
2015-02-15 05:02:33 -07:00
|
|
|
if (likely(isr & BIT_DMA_EP_TX_ICR_TX_DONE)) {
|
2013-01-28 09:31:06 -07:00
|
|
|
wil_dbg_irq(wil, "TX done\n");
|
2012-12-20 14:13:19 -07:00
|
|
|
isr &= ~BIT_DMA_EP_TX_ICR_TX_DONE;
|
2013-05-12 05:43:36 -06:00
|
|
|
/* clear also all VRING interrupts */
|
|
|
|
isr &= ~(BIT(25) - 1UL);
|
2015-10-25 07:59:23 -06:00
|
|
|
if (likely(test_bit(wil_status_fwready, wil->status))) {
|
2014-03-17 07:34:18 -06:00
|
|
|
wil_dbg_txrx(wil, "NAPI(Tx) schedule\n");
|
2014-12-01 06:33:16 -07:00
|
|
|
need_unmask = false;
|
2014-03-17 07:34:18 -06:00
|
|
|
napi_schedule(&wil->napi_tx);
|
|
|
|
} else {
|
2017-08-28 13:18:41 -06:00
|
|
|
wil_err_ratelimited(wil, "Got Tx interrupt while in reset\n");
|
2014-03-17 07:34:18 -06:00
|
|
|
}
|
2012-12-20 14:13:19 -07:00
|
|
|
}
|
|
|
|
|
2015-02-15 05:02:33 -07:00
|
|
|
if (unlikely(isr))
|
2017-08-28 13:18:41 -06:00
|
|
|
wil_err_ratelimited(wil, "un-handled TX ISR bits 0x%08x\n",
|
|
|
|
isr);
|
2012-12-20 14:13:19 -07:00
|
|
|
|
2013-05-12 05:43:36 -06:00
|
|
|
/* Tx IRQ will be enabled when NAPI processing finished */
|
2012-12-20 14:13:19 -07:00
|
|
|
|
2014-06-16 10:37:22 -06:00
|
|
|
atomic_inc(&wil->isr_count_tx);
|
2014-12-01 06:33:16 -07:00
|
|
|
|
|
|
|
if (unlikely(need_unmask))
|
|
|
|
wil6210_unmask_irq_tx(wil);
|
|
|
|
|
2012-12-20 14:13:19 -07:00
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
2013-01-28 09:30:56 -07:00
|
|
|
static void wil_notify_fw_error(struct wil6210_priv *wil)
|
|
|
|
{
|
2018-02-26 11:12:13 -07:00
|
|
|
struct device *dev = &wil->main_ndev->dev;
|
2013-01-28 09:30:56 -07:00
|
|
|
char *envp[3] = {
|
|
|
|
[0] = "SOURCE=wil6210",
|
|
|
|
[1] = "EVENT=FW_ERROR",
|
|
|
|
[2] = NULL,
|
|
|
|
};
|
2014-06-16 10:37:10 -06:00
|
|
|
wil_err(wil, "Notify about firmware error\n");
|
2013-01-28 09:30:56 -07:00
|
|
|
kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, envp);
|
|
|
|
}
|
|
|
|
|
2013-03-13 06:12:49 -06:00
|
|
|
static void wil_cache_mbox_regs(struct wil6210_priv *wil)
|
|
|
|
{
|
|
|
|
/* make shadow copy of registers that should not change on run time */
|
|
|
|
wil_memcpy_fromio_32(&wil->mbox_ctl, wil->csr + HOST_MBOX,
|
|
|
|
sizeof(struct wil6210_mbox_ctl));
|
|
|
|
wil_mbox_ring_le2cpus(&wil->mbox_ctl.rx);
|
|
|
|
wil_mbox_ring_le2cpus(&wil->mbox_ctl.tx);
|
|
|
|
}
|
|
|
|
|
2017-11-14 06:25:37 -07:00
|
|
|
static bool wil_validate_mbox_regs(struct wil6210_priv *wil)
|
|
|
|
{
|
|
|
|
size_t min_size = sizeof(struct wil6210_mbox_hdr) +
|
|
|
|
sizeof(struct wmi_cmd_hdr);
|
|
|
|
|
|
|
|
if (wil->mbox_ctl.rx.entry_size < min_size) {
|
|
|
|
wil_err(wil, "rx mbox entry too small (%d)\n",
|
|
|
|
wil->mbox_ctl.rx.entry_size);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (wil->mbox_ctl.tx.entry_size < min_size) {
|
|
|
|
wil_err(wil, "tx mbox entry too small (%d)\n",
|
|
|
|
wil->mbox_ctl.tx.entry_size);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-12-20 14:13:19 -07:00
|
|
|
static irqreturn_t wil6210_irq_misc(int irq, void *cookie)
|
|
|
|
{
|
|
|
|
struct wil6210_priv *wil = cookie;
|
|
|
|
u32 isr = wil_ioread32_and_clear(wil->csr +
|
|
|
|
HOSTADDR(RGF_DMA_EP_MISC_ICR) +
|
|
|
|
offsetof(struct RGF_ICR, ICR));
|
|
|
|
|
2013-05-12 05:43:35 -06:00
|
|
|
trace_wil6210_irq_misc(isr);
|
2013-01-28 09:31:06 -07:00
|
|
|
wil_dbg_irq(wil, "ISR MISC 0x%08x\n", isr);
|
2012-12-20 14:13:19 -07:00
|
|
|
|
|
|
|
if (!isr) {
|
|
|
|
wil_err(wil, "spurious IRQ: MISC\n");
|
|
|
|
return IRQ_NONE;
|
|
|
|
}
|
|
|
|
|
2016-04-26 05:41:41 -06:00
|
|
|
wil6210_mask_irq_misc(wil, false);
|
2012-12-20 14:13:19 -07:00
|
|
|
|
2013-01-28 09:30:56 -07:00
|
|
|
if (isr & ISR_MISC_FW_ERROR) {
|
2018-01-21 02:14:38 -07:00
|
|
|
u32 fw_assert_code = wil_r(wil, wil->rgf_fw_assert_code_addr);
|
|
|
|
u32 ucode_assert_code =
|
|
|
|
wil_r(wil, wil->rgf_ucode_assert_code_addr);
|
2015-10-04 01:23:20 -06:00
|
|
|
|
|
|
|
wil_err(wil,
|
|
|
|
"Firmware error detected, assert codes FW 0x%08x, UCODE 0x%08x\n",
|
|
|
|
fw_assert_code, ucode_assert_code);
|
2014-12-23 00:47:14 -07:00
|
|
|
clear_bit(wil_status_fwready, wil->status);
|
2013-03-13 06:12:46 -06:00
|
|
|
/*
|
|
|
|
* do not clear @isr here - we do 2-nd part in thread
|
|
|
|
* there, user space get notified, and it should be done
|
|
|
|
* in non-atomic context
|
|
|
|
*/
|
2013-01-28 09:30:56 -07:00
|
|
|
}
|
|
|
|
|
2012-12-20 14:13:19 -07:00
|
|
|
if (isr & ISR_MISC_FW_READY) {
|
2013-01-28 09:31:06 -07:00
|
|
|
wil_dbg_irq(wil, "IRQ: FW ready\n");
|
2013-03-13 06:12:49 -06:00
|
|
|
wil_cache_mbox_regs(wil);
|
2017-11-14 06:25:37 -07:00
|
|
|
if (wil_validate_mbox_regs(wil))
|
|
|
|
set_bit(wil_status_mbox_ready, wil->status);
|
2012-12-20 14:13:19 -07:00
|
|
|
/**
|
|
|
|
* Actual FW ready indicated by the
|
|
|
|
* WMI_FW_READY_EVENTID
|
|
|
|
*/
|
|
|
|
isr &= ~ISR_MISC_FW_READY;
|
|
|
|
}
|
|
|
|
|
2016-04-26 05:41:41 -06:00
|
|
|
if (isr & BIT_DMA_EP_MISC_ICR_HALP) {
|
2017-01-20 04:49:46 -07:00
|
|
|
wil_dbg_irq(wil, "irq_misc: HALP IRQ invoked\n");
|
2016-04-26 05:41:41 -06:00
|
|
|
wil6210_mask_halp(wil);
|
|
|
|
isr &= ~BIT_DMA_EP_MISC_ICR_HALP;
|
|
|
|
complete(&wil->halp.comp);
|
|
|
|
}
|
|
|
|
|
2012-12-20 14:13:19 -07:00
|
|
|
wil->isr_misc = isr;
|
|
|
|
|
|
|
|
if (isr) {
|
|
|
|
return IRQ_WAKE_THREAD;
|
|
|
|
} else {
|
2016-04-26 05:41:41 -06:00
|
|
|
wil6210_unmask_irq_misc(wil, false);
|
2012-12-20 14:13:19 -07:00
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static irqreturn_t wil6210_irq_misc_thread(int irq, void *cookie)
|
|
|
|
{
|
|
|
|
struct wil6210_priv *wil = cookie;
|
|
|
|
u32 isr = wil->isr_misc;
|
|
|
|
|
2013-05-12 05:43:35 -06:00
|
|
|
trace_wil6210_irq_misc_thread(isr);
|
2013-01-28 09:31:06 -07:00
|
|
|
wil_dbg_irq(wil, "Thread ISR MISC 0x%08x\n", isr);
|
2012-12-20 14:13:19 -07:00
|
|
|
|
2013-03-13 06:12:46 -06:00
|
|
|
if (isr & ISR_MISC_FW_ERROR) {
|
2016-03-01 10:18:16 -07:00
|
|
|
wil->recovery_state = fw_recovery_pending;
|
2015-10-04 01:23:26 -06:00
|
|
|
wil_fw_core_dump(wil);
|
2013-03-13 06:12:46 -06:00
|
|
|
wil_notify_fw_error(wil);
|
|
|
|
isr &= ~ISR_MISC_FW_ERROR;
|
2016-03-01 10:18:11 -07:00
|
|
|
if (wil->platform_ops.notify) {
|
2015-12-16 08:51:46 -07:00
|
|
|
wil_err(wil, "notify platform driver about FW crash");
|
2016-03-01 10:18:11 -07:00
|
|
|
wil->platform_ops.notify(wil->platform_handle,
|
|
|
|
WIL_PLATFORM_EVT_FW_CRASH);
|
2015-12-16 08:51:46 -07:00
|
|
|
} else {
|
|
|
|
wil_fw_error_recovery(wil);
|
|
|
|
}
|
2013-03-13 06:12:46 -06:00
|
|
|
}
|
2012-12-20 14:13:19 -07:00
|
|
|
if (isr & ISR_MISC_MBOX_EVT) {
|
2013-01-28 09:31:06 -07:00
|
|
|
wil_dbg_irq(wil, "MBOX event\n");
|
2012-12-20 14:13:19 -07:00
|
|
|
wmi_recv_cmd(wil);
|
|
|
|
isr &= ~ISR_MISC_MBOX_EVT;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isr)
|
2014-04-08 02:36:16 -06:00
|
|
|
wil_dbg_irq(wil, "un-handled MISC ISR bits 0x%08x\n", isr);
|
2012-12-20 14:13:19 -07:00
|
|
|
|
|
|
|
wil->isr_misc = 0;
|
|
|
|
|
2016-04-26 05:41:41 -06:00
|
|
|
wil6210_unmask_irq_misc(wil, false);
|
2012-12-20 14:13:19 -07:00
|
|
|
|
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* thread IRQ handler
|
|
|
|
*/
|
|
|
|
static irqreturn_t wil6210_thread_irq(int irq, void *cookie)
|
|
|
|
{
|
|
|
|
struct wil6210_priv *wil = cookie;
|
|
|
|
|
2013-01-28 09:31:06 -07:00
|
|
|
wil_dbg_irq(wil, "Thread IRQ\n");
|
2012-12-20 14:13:19 -07:00
|
|
|
/* Discover real IRQ cause */
|
|
|
|
if (wil->isr_misc)
|
|
|
|
wil6210_irq_misc_thread(irq, cookie);
|
|
|
|
|
|
|
|
wil6210_unmask_irq_pseudo(wil);
|
|
|
|
|
2017-06-16 01:38:04 -06:00
|
|
|
if (wil->suspend_resp_rcvd) {
|
|
|
|
wil_dbg_irq(wil, "set suspend_resp_comp to true\n");
|
|
|
|
wil->suspend_resp_comp = true;
|
|
|
|
wake_up_interruptible(&wil->wq);
|
|
|
|
}
|
|
|
|
|
2012-12-20 14:13:19 -07:00
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* DEBUG
|
|
|
|
* There is subtle bug in hardware that causes IRQ to raise when it should be
|
|
|
|
* masked. It is quite rare and hard to debug.
|
|
|
|
*
|
|
|
|
* Catch irq issue if it happens and print all I can.
|
|
|
|
*/
|
|
|
|
static int wil6210_debug_irq_mask(struct wil6210_priv *wil, u32 pseudo_cause)
|
|
|
|
{
|
2014-12-23 00:47:14 -07:00
|
|
|
if (!test_bit(wil_status_irqen, wil->status)) {
|
2012-12-20 14:13:19 -07:00
|
|
|
u32 icm_rx = wil_ioread32_and_clear(wil->csr +
|
|
|
|
HOSTADDR(RGF_DMA_EP_RX_ICR) +
|
|
|
|
offsetof(struct RGF_ICR, ICM));
|
|
|
|
u32 icr_rx = wil_ioread32_and_clear(wil->csr +
|
|
|
|
HOSTADDR(RGF_DMA_EP_RX_ICR) +
|
|
|
|
offsetof(struct RGF_ICR, ICR));
|
2015-07-30 04:52:03 -06:00
|
|
|
u32 imv_rx = wil_r(wil, RGF_DMA_EP_RX_ICR +
|
|
|
|
offsetof(struct RGF_ICR, IMV));
|
2012-12-20 14:13:19 -07:00
|
|
|
u32 icm_tx = wil_ioread32_and_clear(wil->csr +
|
|
|
|
HOSTADDR(RGF_DMA_EP_TX_ICR) +
|
|
|
|
offsetof(struct RGF_ICR, ICM));
|
|
|
|
u32 icr_tx = wil_ioread32_and_clear(wil->csr +
|
|
|
|
HOSTADDR(RGF_DMA_EP_TX_ICR) +
|
|
|
|
offsetof(struct RGF_ICR, ICR));
|
2015-07-30 04:52:03 -06:00
|
|
|
u32 imv_tx = wil_r(wil, RGF_DMA_EP_TX_ICR +
|
|
|
|
offsetof(struct RGF_ICR, IMV));
|
2012-12-20 14:13:19 -07:00
|
|
|
u32 icm_misc = wil_ioread32_and_clear(wil->csr +
|
|
|
|
HOSTADDR(RGF_DMA_EP_MISC_ICR) +
|
|
|
|
offsetof(struct RGF_ICR, ICM));
|
|
|
|
u32 icr_misc = wil_ioread32_and_clear(wil->csr +
|
|
|
|
HOSTADDR(RGF_DMA_EP_MISC_ICR) +
|
|
|
|
offsetof(struct RGF_ICR, ICR));
|
2015-07-30 04:52:03 -06:00
|
|
|
u32 imv_misc = wil_r(wil, RGF_DMA_EP_MISC_ICR +
|
|
|
|
offsetof(struct RGF_ICR, IMV));
|
2016-08-18 07:52:12 -06:00
|
|
|
|
|
|
|
/* HALP interrupt can be unmasked when misc interrupts are
|
|
|
|
* masked
|
|
|
|
*/
|
|
|
|
if (icr_misc & BIT_DMA_EP_MISC_ICR_HALP)
|
|
|
|
return 0;
|
|
|
|
|
2012-12-20 14:13:19 -07:00
|
|
|
wil_err(wil, "IRQ when it should be masked: pseudo 0x%08x\n"
|
|
|
|
"Rx icm:icr:imv 0x%08x 0x%08x 0x%08x\n"
|
|
|
|
"Tx icm:icr:imv 0x%08x 0x%08x 0x%08x\n"
|
|
|
|
"Misc icm:icr:imv 0x%08x 0x%08x 0x%08x\n",
|
|
|
|
pseudo_cause,
|
|
|
|
icm_rx, icr_rx, imv_rx,
|
|
|
|
icm_tx, icr_tx, imv_tx,
|
|
|
|
icm_misc, icr_misc, imv_misc);
|
|
|
|
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static irqreturn_t wil6210_hardirq(int irq, void *cookie)
|
|
|
|
{
|
|
|
|
irqreturn_t rc = IRQ_HANDLED;
|
|
|
|
struct wil6210_priv *wil = cookie;
|
2015-07-30 04:52:03 -06:00
|
|
|
u32 pseudo_cause = wil_r(wil, RGF_DMA_PSEUDO_CAUSE);
|
2012-12-20 14:13:19 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* pseudo_cause is Clear-On-Read, no need to ACK
|
|
|
|
*/
|
2015-02-15 05:02:33 -07:00
|
|
|
if (unlikely((pseudo_cause == 0) || ((pseudo_cause & 0xff) == 0xff)))
|
2012-12-20 14:13:19 -07:00
|
|
|
return IRQ_NONE;
|
|
|
|
|
2017-12-14 09:53:12 -07:00
|
|
|
/* IRQ mask debug */
|
2015-02-15 05:02:33 -07:00
|
|
|
if (unlikely(wil6210_debug_irq_mask(wil, pseudo_cause)))
|
2012-12-20 14:13:19 -07:00
|
|
|
return IRQ_NONE;
|
|
|
|
|
2013-05-12 05:43:35 -06:00
|
|
|
trace_wil6210_irq_pseudo(pseudo_cause);
|
2013-01-28 09:31:06 -07:00
|
|
|
wil_dbg_irq(wil, "Pseudo IRQ 0x%08x\n", pseudo_cause);
|
2013-01-28 09:30:57 -07:00
|
|
|
|
2012-12-20 14:13:19 -07:00
|
|
|
wil6210_mask_irq_pseudo(wil);
|
|
|
|
|
|
|
|
/* Discover real IRQ cause
|
|
|
|
* There are 2 possible phases for every IRQ:
|
|
|
|
* - hard IRQ handler called right here
|
|
|
|
* - threaded handler called later
|
|
|
|
*
|
|
|
|
* Hard IRQ handler reads and clears ISR.
|
|
|
|
*
|
|
|
|
* If threaded handler requested, hard IRQ handler
|
|
|
|
* returns IRQ_WAKE_THREAD and saves ISR register value
|
|
|
|
* for the threaded handler use.
|
|
|
|
*
|
|
|
|
* voting for wake thread - need at least 1 vote
|
|
|
|
*/
|
|
|
|
if ((pseudo_cause & BIT_DMA_PSEUDO_CAUSE_RX) &&
|
|
|
|
(wil6210_irq_rx(irq, cookie) == IRQ_WAKE_THREAD))
|
|
|
|
rc = IRQ_WAKE_THREAD;
|
|
|
|
|
|
|
|
if ((pseudo_cause & BIT_DMA_PSEUDO_CAUSE_TX) &&
|
|
|
|
(wil6210_irq_tx(irq, cookie) == IRQ_WAKE_THREAD))
|
|
|
|
rc = IRQ_WAKE_THREAD;
|
|
|
|
|
|
|
|
if ((pseudo_cause & BIT_DMA_PSEUDO_CAUSE_MISC) &&
|
|
|
|
(wil6210_irq_misc(irq, cookie) == IRQ_WAKE_THREAD))
|
|
|
|
rc = IRQ_WAKE_THREAD;
|
|
|
|
|
|
|
|
/* if thread is requested, it will unmask IRQ */
|
|
|
|
if (rc != IRQ_WAKE_THREAD)
|
|
|
|
wil6210_unmask_irq_pseudo(wil);
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2014-09-10 07:34:48 -06:00
|
|
|
/* can't use wil_ioread32_and_clear because ICC value is not set yet */
|
2014-03-17 07:34:13 -06:00
|
|
|
static inline void wil_clear32(void __iomem *addr)
|
|
|
|
{
|
2015-07-30 04:52:03 -06:00
|
|
|
u32 x = readl(addr);
|
2014-03-17 07:34:13 -06:00
|
|
|
|
2015-07-30 04:52:03 -06:00
|
|
|
writel(x, addr);
|
2014-03-17 07:34:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void wil6210_clear_irq(struct wil6210_priv *wil)
|
|
|
|
{
|
|
|
|
wil_clear32(wil->csr + HOSTADDR(RGF_DMA_EP_RX_ICR) +
|
|
|
|
offsetof(struct RGF_ICR, ICR));
|
|
|
|
wil_clear32(wil->csr + HOSTADDR(RGF_DMA_EP_TX_ICR) +
|
|
|
|
offsetof(struct RGF_ICR, ICR));
|
|
|
|
wil_clear32(wil->csr + HOSTADDR(RGF_DMA_EP_MISC_ICR) +
|
|
|
|
offsetof(struct RGF_ICR, ICR));
|
2014-09-10 07:34:30 -06:00
|
|
|
wmb(); /* make sure write completed */
|
2014-03-17 07:34:13 -06:00
|
|
|
}
|
2012-12-20 14:13:19 -07:00
|
|
|
|
2016-04-26 05:41:41 -06:00
|
|
|
void wil6210_set_halp(struct wil6210_priv *wil)
|
|
|
|
{
|
2017-01-20 04:49:46 -07:00
|
|
|
wil_dbg_irq(wil, "set_halp\n");
|
2016-04-26 05:41:41 -06:00
|
|
|
|
|
|
|
wil_w(wil, RGF_DMA_EP_MISC_ICR + offsetof(struct RGF_ICR, ICS),
|
|
|
|
BIT_DMA_EP_MISC_ICR_HALP);
|
|
|
|
}
|
|
|
|
|
|
|
|
void wil6210_clear_halp(struct wil6210_priv *wil)
|
|
|
|
{
|
2017-01-20 04:49:46 -07:00
|
|
|
wil_dbg_irq(wil, "clear_halp\n");
|
2016-04-26 05:41:41 -06:00
|
|
|
|
|
|
|
wil_w(wil, RGF_DMA_EP_MISC_ICR + offsetof(struct RGF_ICR, ICR),
|
|
|
|
BIT_DMA_EP_MISC_ICR_HALP);
|
|
|
|
wil6210_unmask_halp(wil);
|
|
|
|
}
|
|
|
|
|
2015-07-30 04:52:02 -06:00
|
|
|
int wil6210_init_irq(struct wil6210_priv *wil, int irq, bool use_msi)
|
2012-12-20 14:13:19 -07:00
|
|
|
{
|
|
|
|
int rc;
|
2014-09-10 07:34:36 -06:00
|
|
|
|
2017-01-20 04:49:46 -07:00
|
|
|
wil_dbg_misc(wil, "init_irq: %s\n", use_msi ? "MSI" : "INTx");
|
2014-09-10 07:34:36 -06:00
|
|
|
|
2015-07-30 04:52:02 -06:00
|
|
|
rc = request_threaded_irq(irq, wil6210_hardirq,
|
|
|
|
wil6210_thread_irq,
|
|
|
|
use_msi ? 0 : IRQF_SHARED,
|
|
|
|
WIL_NAME, wil);
|
2014-09-10 07:34:37 -06:00
|
|
|
return rc;
|
2012-12-20 14:13:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void wil6210_fini_irq(struct wil6210_priv *wil, int irq)
|
|
|
|
{
|
2017-01-20 04:49:46 -07:00
|
|
|
wil_dbg_misc(wil, "fini_irq:\n");
|
2014-09-10 07:34:36 -06:00
|
|
|
|
2014-09-10 07:34:49 -06:00
|
|
|
wil_mask_irq(wil);
|
2012-12-20 14:13:19 -07:00
|
|
|
free_irq(irq, wil);
|
|
|
|
}
|