Skip to content

Commit 4446272

Browse files
dcpleungnashif
authored andcommitted
timer: hpet: make legacy interrupt routing optional
On some platforms, HPET is not wired to trigger IRQ 2. This would make HPET non-functional if the legacy interrupt routing bit is set in the global config register. This adds a DTS flag so the driver won't set the bit to enable legacy interrupt. Signed-off-by: Daniel Leung <[email protected]>
1 parent 1d3c710 commit 4446272

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

drivers/timer/hpet.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,14 +435,19 @@ static int sys_clock_driver_init(const struct device *dev)
435435
cyc_per_tick = hz / CONFIG_SYS_CLOCK_TICKS_PER_SEC;
436436
#endif
437437

438+
reg = hpet_gconf_get();
439+
reg |= GCONF_ENABLE;
440+
441+
#if (DT_INST_PROP(0, no_legacy_irq) == 0)
438442
/* Note: we set the legacy routing bit, because otherwise
439443
* nothing in Zephyr disables the PIT which then fires
440444
* interrupts into the same IRQ. But that means we're then
441445
* forced to use IRQ2 contra the way the kconfig IRQ selection
442446
* is supposed to work. Should fix this.
443447
*/
444-
reg = hpet_gconf_get();
445-
reg |= GCONF_LR | GCONF_ENABLE;
448+
reg |= GCONF_LR;
449+
#endif
450+
446451
hpet_gconf_set(reg);
447452

448453
last_count = hpet_counter_get();

dts/bindings/timer/intel,hpet.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,8 @@ properties:
1313

1414
interrupts:
1515
required: true
16+
17+
no-legacy-irq:
18+
type: boolean
19+
required: false
20+
description: Do not set legacy IRQ bit

0 commit comments

Comments
 (0)