irq: Tidy up of-platdata irq support

This function is available but not exported. More generally it does not
really work as intended.

Reimplement it and add a sandbox test too.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2021-08-07 07:24:11 -06:00
parent f521be6083
commit 3e57ad907c
9 changed files with 119 additions and 19 deletions

View File

@@ -64,8 +64,8 @@ int irq_read_and_clear(struct irq *irq)
}
#if CONFIG_IS_ENABLED(OF_PLATDATA)
int irq_get_by_driver_info(struct udevice *dev,
struct phandle_1_arg *cells, struct irq *irq)
int irq_get_by_phandle(struct udevice *dev, const struct phandle_2_arg *cells,
struct irq *irq)
{
int ret;
@@ -74,6 +74,12 @@ int irq_get_by_driver_info(struct udevice *dev,
return ret;
irq->id = cells->arg[0];
/*
* Note: we could call irq_of_xlate_default() here to do this properly.
* For now, this is good enough for existing cases.
*/
irq->flags = cells->arg[1];
return 0;
}
#else