• Sergio Paracuellos's avatar
    staging: mt7621-pci: fix PCIe interrupt mapping · fab6710e
    Sergio Paracuellos authored
    MT7621 has three assigned interrupts for the pcie. This
    interrupts should properly being mapped taking into account
    which devices are finally connected in which bus according
    to link status. So the irq mappings should be as follows
    according to link status (three bits indicating which devices
    are link up):
    
    * For PCIe Bus 1 slot 0:
      - status = 0x2 || status = 0x6 => IRQ = pcie1_irq (24).
      - status = 0x4 => IRQ = pcie2_irq (25).
      - default => IRQ = pcie0_irq (23).
    * For PCIe Bus 2 slot 0:
      - status = 0x5 || status = 0x6 => IRQ = pcie2_irq (25).
      - default => IRQ = pcie1_irq (24).
    * For PCIe Bus 2 slot 1:
      - status = 0x5 || status = 0x6 => IRQ = pcie2_irq (25).
      - default => IRQ = pcie1_irq (24).
    * For PCIe Bus 3 any slot:
      - default => IRQ = pcie2_irq (25).
    
    Because of this, the function 'of_irq_parse_and_map_pci' cannot
    be used and we need to change device tree information from using
    the 'interrupt-map' and 'interrupt-map-mask' properties into an
    'interrupts' property to be able to get irq information from the
    ports using the 'platform_get_irq' and storing an 'irq-map' into
    the pcie driver data node to properly map correct irq using a
    new 'mt7621_map_irq' function where this map will be read and the
    correct irq returned.
    
    Fixes: 46d09312 ("staging: mt7621-pci: improve interrupt mapping")
    Signed-off-by: default avatarSergio Paracuellos <sergio.paracuellos@gmail.com>
    Link: https://lore.kernel.org/r/20200413055942.2714-1-sergio.paracuellos@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    fab6710e
mt7621.dtsi 10.5 KB