diff --git a/sys/arch/arm/cortex/gtmr.c b/sys/arch/arm/cortex/gtmr.c index ceff19c..090d40b 100644 --- a/sys/arch/arm/cortex/gtmr.c +++ b/sys/arch/arm/cortex/gtmr.c @@ -129,12 +129,14 @@ gtmr_attach(device_t parent, device_t self, void *aux) evcnt_attach_dynamic(&sc->sc_ev_missing_ticks, EVCNT_TYPE_MISC, NULL, device_xname(self), "missing interrupts"); - sc->sc_global_ih = intr_establish(mpcaa->mpcaa_irq, IPL_CLOCK, - IST_LEVEL | IST_MPSAFE, gtmr_intr, NULL); - if (sc->sc_global_ih == NULL) - panic("%s: unable to register timer interrupt", __func__); - aprint_normal_dev(self, "interrupting on irq %d\n", - mpcaa->mpcaa_irq); + if (mpcaa->mpcaa_irq != -1) { + sc->sc_global_ih = intr_establish(mpcaa->mpcaa_irq, IPL_CLOCK, + IST_LEVEL | IST_MPSAFE, gtmr_intr, NULL); + if (sc->sc_global_ih == NULL) + panic("%s: unable to register timer interrupt", __func__); + aprint_normal_dev(self, "interrupting on irq %d\n", + mpcaa->mpcaa_irq); + } const uint32_t cnt_frq = armreg_cnt_frq_read(); if (cnt_frq == 0) { diff --git a/sys/arch/arm/fdt/gtmr_fdt.c b/sys/arch/arm/fdt/gtmr_fdt.c index 2032bea..e06a827 100644 --- a/sys/arch/arm/fdt/gtmr_fdt.c +++ b/sys/arch/arm/fdt/gtmr_fdt.c @@ -72,8 +72,19 @@ gtmr_fdt_attach(device_t parent, device_t self, void *aux) struct mpcore_attach_args mpcaa = { .mpcaa_name = "armgtmr", - .mpcaa_irq = IRQ_GTMR_PPI_VTIMER + .mpcaa_irq = -1 /* setup handler locally */ }; + struct fdt_attach_args * const faa = aux; + const int phandle = faa->faa_phandle; + +#define GTMR_VTIMER 2 + + void *ih = fdtbus_intr_establish(phandle, GTMR_VTIMER, IPL_SERIAL, FDT_INTR_MPSAFE, + gtmr_intr, NULL); + if (ih == NULL) { + aprint_error_dev(self, "couldn't install interrupt handler\n"); + return; + } config_found(self, &mpcaa, NULL);