]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
wil6210: fix device ready detection
authorVladimir Kondratiev <QCA_vkondrat@QCA.qualcomm.com>
Sun, 25 Oct 2015 13:59:23 +0000 (15:59 +0200)
committerKalle Valo <kvalo@qca.qualcomm.com>
Thu, 29 Oct 2015 11:06:47 +0000 (13:06 +0200)
Adjust driver behavior during FW boot. Proper sequence of
events after reset and FW download, is as following:

- FW prepares mailbox structure and reports IRQ "FW_READY"
- driver caches mailbox registers, marks mailbox readiness
- FW sends WMI_FW_READY event, ignore it
- FW sends WMI_READY event with some data
- driver stores relevant data marks FW is operational

Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/wil6210/interrupt.c
drivers/net/wireless/ath/wil6210/wil6210.h
drivers/net/wireless/ath/wil6210/wmi.c

index 06fc46f85c858480092504210c5266b41e3aa3c8..50c136e843c4e71ffcfe69d2d0e40f0b4efb963f 100644 (file)
@@ -236,7 +236,7 @@ static irqreturn_t wil6210_irq_rx(int irq, void *cookie)
 
                isr &= ~(BIT_DMA_EP_RX_ICR_RX_DONE |
                         BIT_DMA_EP_RX_ICR_RX_HTRSH);
-               if (likely(test_bit(wil_status_reset_done, wil->status))) {
+               if (likely(test_bit(wil_status_fwready, wil->status))) {
                        if (likely(test_bit(wil_status_napi_en, wil->status))) {
                                wil_dbg_txrx(wil, "NAPI(Rx) schedule\n");
                                need_unmask = false;
@@ -286,7 +286,7 @@ static irqreturn_t wil6210_irq_tx(int irq, void *cookie)
                isr &= ~BIT_DMA_EP_TX_ICR_TX_DONE;
                /* clear also all VRING interrupts */
                isr &= ~(BIT(25) - 1UL);
-               if (likely(test_bit(wil_status_reset_done, wil->status))) {
+               if (likely(test_bit(wil_status_fwready, wil->status))) {
                        wil_dbg_txrx(wil, "NAPI(Tx) schedule\n");
                        need_unmask = false;
                        napi_schedule(&wil->napi_tx);
@@ -364,7 +364,7 @@ static irqreturn_t wil6210_irq_misc(int irq, void *cookie)
        if (isr & ISR_MISC_FW_READY) {
                wil_dbg_irq(wil, "IRQ: FW ready\n");
                wil_cache_mbox_regs(wil);
-               set_bit(wil_status_reset_done, wil->status);
+               set_bit(wil_status_mbox_ready, wil->status);
                /**
                 * Actual FW ready indicated by the
                 * WMI_FW_READY_EVENTID
index f619bf234353262607cfccc08b3513b4bdb9e96e..ade5f3b8274b00dc64406dc9b15aa90dc987216b 100644 (file)
@@ -402,11 +402,11 @@ struct vring_tx_data {
 };
 
 enum { /* for wil6210_priv.status */
-       wil_status_fwready = 0,
+       wil_status_fwready = 0, /* FW operational */
        wil_status_fwconnecting,
        wil_status_fwconnected,
        wil_status_dontscan,
-       wil_status_reset_done,
+       wil_status_mbox_ready, /* MBOX structures ready */
        wil_status_irqen, /* FIXME: interrupts enabled - for debug */
        wil_status_napi_en, /* NAPI enabled protected by wil->mutex */
        wil_status_resetting, /* reset in progress */
index 361f3d8f7b43eaab7ec91f07c4e87eaf15277cf1..6ed26baca0e51bf4266c1edf04aabe801ece6376 100644 (file)
@@ -293,12 +293,6 @@ static void wmi_evt_ready(struct wil6210_priv *wil, int id, void *d, int len)
        /* ignore MAC address, we already have it from the boot loader */
        snprintf(wdev->wiphy->fw_version, sizeof(wdev->wiphy->fw_version),
                 "%d", wil->fw_version);
-}
-
-static void wmi_evt_fw_ready(struct wil6210_priv *wil, int id, void *d,
-                            int len)
-{
-       wil_dbg_wmi(wil, "WMI: got FW ready event\n");
 
        wil_set_recovery_state(wil, fw_recovery_idle);
        set_bit(wil_status_fwready, wil->status);
@@ -699,7 +693,7 @@ static const struct {
                        void *data, int data_len);
 } wmi_evt_handlers[] = {
        {WMI_READY_EVENTID,             wmi_evt_ready},
-       {WMI_FW_READY_EVENTID,          wmi_evt_fw_ready},
+       {WMI_FW_READY_EVENTID,                  wmi_evt_ignore},
        {WMI_RX_MGMT_PACKET_EVENTID,    wmi_evt_rx_mgmt},
        {WMI_TX_MGMT_PACKET_EVENTID,            wmi_evt_tx_mgmt},
        {WMI_SCAN_COMPLETE_EVENTID,     wmi_evt_scan_complete},
@@ -730,7 +724,7 @@ void wmi_recv_cmd(struct wil6210_priv *wil)
        ulong flags;
        unsigned n;
 
-       if (!test_bit(wil_status_reset_done, wil->status)) {
+       if (!test_bit(wil_status_mbox_ready, wil->status)) {
                wil_err(wil, "Reset in progress. Cannot handle WMI event\n");
                return;
        }