Re: PCI enumeration and IRQ_CONNECT ?

Dmitriy Korovkin

On Sun, 16 Oct 2016, Boie, Andrew P wrote:

On Wed, 2016-10-12 at 10:59 +0100, Marcus Shawcroft wrote:

A question has come up in one of the config_info refactor patches
about the relationship between PCI enumeration and IRQ_CONNECT.... ( )

Can anyone shed some light on how PCI enumeration and IRQ_CONNECT
interact in the DW GPIO, I2C and SPI drivers?

Specifically, the initialization of these drivers appears to be that:
- PCI enumeration populates driver_data->pci_dev via a call to pci_bus_scan()
- irq_num is pulled out of the pci_dev structure and stored in the
driver context.
- irq_enable() is called to enable the  irq_num
- IRQ_CONNECT() is called to connect a hardwired (static) IRQ number
(e.g CONFIG_INTEL_PORT_0_IRQ) to the interrupt service routine.

Hence we have an statically configured interrupt number passed to
IRQ_CONNECT() and an irq_num returned from PCI enumeration, and no
obvious connection between the two.
This might be some cruft that should be fixed. Even on a PCI board like Galileo,
the IRQ lines are fixed in HW so IRQ_CONNECT() uses (and can only use due to the
way it is implemented) defined constants.

In other words, the irq_num pulled out of PCI enumeration doesn't need to be
used/stored and we should just use the defined constant everywhere. Unless
something pathological is going on they should be the same value.
And by "something pathological" you mean insertion of an external card.
PCI_ENUMERATION is enabled for Galileo exactly for this reason.


Join to automatically receive all group messages.