Re: [PATCH 1/3] pinctrl: msm: Really mask level interrupts to prevent latching
From: Stephen Boyd
Date: Mon Jun 18 2018 - 19:29:34 EST
Quoting Doug Anderson (2018-06-18 15:43:06)
>
> On Mon, Jun 18, 2018 at 1:52 PM, Stephen Boyd <swboyd@xxxxxxxxxxxx> wrote:
>
> > + */
> > + if (irqd_get_trigger_type(d) & IRQ_TYPE_LEVEL_MASK) {
> > + val &= ~BIT(g->intr_raw_status_bit);
> > + writel(val, pctrl->regs + g->intr_cfg_reg);
>
> Do you know if it's important to do a 2nd write here, or could this be
> combined with the next writel()?
I haven't tried combining the writes. It felt safer to keep them split
up so that both bits don't toggle at the same time, but I don't know if
it actually matters.
>
> > + }
> > +
> > val &= ~BIT(g->intr_enable_bit);
> > writel(val, pctrl->regs + g->intr_cfg_reg);
> >
> > @@ -647,6 +660,10 @@ static void msm_gpio_irq_unmask(struct irq_data *d)
> > raw_spin_lock_irqsave(&pctrl->lock, flags);
> >
> > val = readl(pctrl->regs + g->intr_cfg_reg);
> > + if (irqd_get_trigger_type(d) & IRQ_TYPE_LEVEL_MASK) {
> > + val |= BIT(g->intr_raw_status_bit);
> > + writel(val, pctrl->regs + g->intr_cfg_reg);
>
> Same question about whether this could be combined with the next
> writel(). ...although I could imagine that the answer might be
> different for mask and unmask.
We probably need someone from qcom side to determine if these can be
combined. I can give it a try and see if anything goes wrong but my
confidence level will only be anecdotal. It's worth a shot.
>
> ...if it can be combined, you can totally get rid of the "if" test and
> always "OR" in the bit, right?
Yes.