Skip to content

Commit d7bc63f

Browse files
mkshahcMarc Zyngier
authored andcommitted
irqchip/qcom-pdc: Reset PDC interrupts during init
Kexec can directly boot into a new kernel without going to complete reboot. This can leave the previous kernel's configuration for PDC interrupts as is. Clear previous kernel's configuration during init by setting interrupts in enable bank to zero. The IRQs specified in qcom,pdc-ranges property are the only ones that can be used by the new kernel so clear only those IRQs. The remaining ones may be in use by a different kernel and should not be set by new kernel. Suggested-by: Stephen Boyd <swboyd@chromium.org> Signed-off-by: Maulik Shah <mkshah@codeaurora.org> Signed-off-by: Marc Zyngier <maz@kernel.org> Tested-by: Stephen Boyd <swboyd@chromium.org> Reviewed-by: Stephen Boyd <swboyd@chromium.org> Reviewed-by: Douglas Anderson <dianders@chromium.org> Acked-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/1601267524-20199-7-git-send-email-mkshah@codeaurora.org
1 parent 299d789 commit d7bc63f

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

drivers/irqchip/qcom-pdc.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,8 @@ static const struct irq_domain_ops qcom_pdc_gpio_ops = {
341341

342342
static int pdc_setup_pin_mapping(struct device_node *np)
343343
{
344-
int ret, n;
344+
int ret, n, i;
345+
u32 irq_index, reg_index, val;
345346

346347
n = of_property_count_elems_of_size(np, "qcom,pdc-ranges", sizeof(u32));
347348
if (n <= 0 || n % 3)
@@ -370,6 +371,14 @@ static int pdc_setup_pin_mapping(struct device_node *np)
370371
&pdc_region[n].cnt);
371372
if (ret)
372373
return ret;
374+
375+
for (i = 0; i < pdc_region[n].cnt; i++) {
376+
reg_index = (i + pdc_region[n].pin_base) >> 5;
377+
irq_index = (i + pdc_region[n].pin_base) & 0x1f;
378+
val = pdc_reg_read(IRQ_ENABLE_BANK, reg_index);
379+
val &= ~BIT(irq_index);
380+
pdc_reg_write(IRQ_ENABLE_BANK, reg_index, val);
381+
}
373382
}
374383

375384
return 0;

0 commit comments

Comments
 (0)