From: Neil Armstrong <[email protected]>

If we don't reclaim and clear the IRQ bits, we might get a spurious
interrupt from this TCS in Linux:
WARNING: CPU: 0 PID: 0 at drivers/soc/qcom/rpmh-rsc.c:451 tcs_tx_done+0x98/0x270
...
 Call trace:
  tcs_tx_done+0x98/0x270 (P)
  __handle_irq_event_percpu+0x60/0x220
  handle_irq_event+0x54/0xc0
  handle_fasteoi_irq+0xa8/0x1c0
  handle_irq_desc+0x3c/0x68
  generic_handle_domain_irq+0x24/0x40
  gic_handle_irq+0x5c/0xd0
  ...

Signed-off-by: Neil Armstrong <[email protected]>
---
 drivers/soc/qcom/rpmh-rsc.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c
index aee9e55194ed..bc0c3dd005ac 100644
--- a/drivers/soc/qcom/rpmh-rsc.c
+++ b/drivers/soc/qcom/rpmh-rsc.c
@@ -399,8 +399,15 @@ int rpmh_rsc_send_data(struct rsc_drv *drv, const struct 
tcs_request *msg)
                        break;
                udelay(1);
        }
 
+       __tcs_set_trigger(drv, tcs_id, false);
+
+       /* Reclaim the TCS */
+       write_tcs_reg(drv, drv->regs[RSC_DRV_CMD_ENABLE], tcs_id, 0);
+       writel_relaxed(BIT(tcs_id), drv->tcs_base + 
drv->regs[RSC_DRV_IRQ_CLEAR]);
+       generic_clear_bit(tcs_id, drv->tcs_in_use);
+
        if (i == USEC_PER_SEC) {
                log_err("%s: error writing %#x to %d:%#x\n", drv->name,
                        msg->cmds[0].addr, tcs_id, drv->regs[RSC_DRV_CMD_ADDR]);
                return -EINVAL;

-- 
2.51.0

Reply via email to