net: ipa: get another clock for ipa_setup()
authorAlex Elder <elder@linaro.org>
Tue, 27 Jul 2021 21:19:30 +0000 (16:19 -0500)
committerDavid S. Miller <davem@davemloft.net>
Tue, 27 Jul 2021 23:06:27 +0000 (00:06 +0100)
Two places call ipa_setup().  The first, ipa_probe(), holds an IPA
clock reference when calling ipa_setup() (if the AP is responsible
for IPA firmware loading).  But if the modem is loading IPA
firmware, ipa_smp2p_modem_setup_ready_isr() calls ipa_setup() after
the modem has signaled the hardware is ready.  This can happen at
any time, and there is no guarantee the hardware is active.

Have ipa_smp2p_modem_setup() take an IPA clock reference before it
calls ipa_setup(), and release it once setup is complete.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ipa/ipa_smp2p.c

index 93270e5..0d15438 100644 (file)
@@ -156,11 +156,16 @@ static irqreturn_t ipa_smp2p_modem_setup_ready_isr(int irq, void *dev_id)
        if (!smp2p->disabled) {
                int ret;
 
+               /* The clock needs to be active for setup */
+               ipa_clock_get(smp2p->ipa);
+
                ret = ipa_setup(smp2p->ipa);
                if (ret)
                        dev_err(&smp2p->ipa->pdev->dev,
                                "error %d from ipa_setup()\n", ret);
                smp2p->disabled = true;
+
+               ipa_clock_put(smp2p->ipa);
        }
 
        mutex_unlock(&smp2p->mutex);