Skip to content

Commit c0f05a6

Browse files
repkLorenzo Pieralisi
authored andcommitted
PCI: aardvark: Fix PCI_EXP_RTCTL register configuration
PCI_EXP_RTCTL is used to activate PME interrupt only, so writing into it should not modify other interrupts' mask. The ISR mask polarity was also inverted, when PCI_EXP_RTCTL_PMEIE is set PCIE_MSG_PM_PME_MASK mask bit should actually be cleared. Fixes: 8a3ebd8 ("PCI: aardvark: Implement emulated root PCI bridge config space") Signed-off-by: Remi Pommarel <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]> Acked-by: Thomas Petazzoni <[email protected]>
1 parent f4c7d05 commit c0f05a6

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

drivers/pci/controller/pci-aardvark.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ advk_pci_bridge_emul_pcie_conf_read(struct pci_bridge_emul *bridge,
436436

437437
case PCI_EXP_RTCTL: {
438438
u32 val = advk_readl(pcie, PCIE_ISR0_MASK_REG);
439-
*value = (val & PCIE_MSG_PM_PME_MASK) ? PCI_EXP_RTCTL_PMEIE : 0;
439+
*value = (val & PCIE_MSG_PM_PME_MASK) ? 0 : PCI_EXP_RTCTL_PMEIE;
440440
return PCI_BRIDGE_EMUL_HANDLED;
441441
}
442442

@@ -486,10 +486,15 @@ advk_pci_bridge_emul_pcie_conf_write(struct pci_bridge_emul *bridge,
486486
advk_pcie_wait_for_retrain(pcie);
487487
break;
488488

489-
case PCI_EXP_RTCTL:
490-
new = (new & PCI_EXP_RTCTL_PMEIE) << 3;
491-
advk_writel(pcie, new, PCIE_ISR0_MASK_REG);
489+
case PCI_EXP_RTCTL: {
490+
/* Only mask/unmask PME interrupt */
491+
u32 val = advk_readl(pcie, PCIE_ISR0_MASK_REG) &
492+
~PCIE_MSG_PM_PME_MASK;
493+
if ((new & PCI_EXP_RTCTL_PMEIE) == 0)
494+
val |= PCIE_MSG_PM_PME_MASK;
495+
advk_writel(pcie, val, PCIE_ISR0_MASK_REG);
492496
break;
497+
}
493498

494499
case PCI_EXP_RTSTA:
495500
new = (new & PCI_EXP_RTSTA_PME) >> 9;

0 commit comments

Comments
 (0)