summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPatrick Rudolph <[email protected]>2024-10-23 15:20:05 +0200
committerTom Rini <[email protected]>2024-10-27 17:24:13 -0600
commitf116feadea7be9afe412c25779dfcf241c121715 (patch)
treed2393bdb3a798da9bf23a6d909f8fa8a4ba7c658 /test
parentdf8d759d9db17b55d6283a9a1d84d196e9cc1dd4 (diff)
drivers: misc: irq-uclass: Update irq_get_by_index
Support reading the "interrupts" property from the devicetree in case the "interrupts-extended" property isn't found. As the "interrupts" property is commonly used, this allows to parse all existing FDT and makes irq_get_by_index() more useful. The "interrupts" property doesn't contain a phandle as "interrupts-extended" does, so implement a new method to locate the interrupt-parent called irq_get_interrupt_parent(). TEST: Read the interrupts from the GIC node for ACPI MADT generation. Signed-off-by: Patrick Rudolph <[email protected]> Reviewed-by: Moritz Fischer <[email protected]>
Diffstat (limited to 'test')
-rw-r--r--test/dm/irq.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/dm/irq.c b/test/dm/irq.c
index 836f2d82e71..ca3e1880656 100644
--- a/test/dm/irq.c
+++ b/test/dm/irq.c
@@ -76,6 +76,21 @@ static int dm_test_request(struct unit_test_state *uts)
}
DM_TEST(dm_test_request, UTF_SCAN_PDATA | UTF_SCAN_FDT);
+/* Test of irq_get_by_index() */
+static int dm_test_irq_get_by_index(struct unit_test_state *uts)
+{
+ struct udevice *dev;
+ struct irq irq;
+
+ ut_assertok(uclass_get_device_by_name(UCLASS_TEST_FDT, "f-test",
+ &dev));
+ ut_assertok(irq_get_by_index(dev, 0, &irq));
+ ut_asserteq(4, irq.id);
+
+ return 0;
+}
+DM_TEST(dm_test_irq_get_by_index, UTF_SCAN_PDATA | UTF_SCAN_FDT);
+
/* Test of irq_get_acpi() */
static int dm_test_irq_get_acpi(struct unit_test_state *uts)
{