Skip to content

Commit 538ca00

Browse files
committed
Merge branch 'pci/controller/cadence'
- Clear the ARI Capability Next Function Number of the last function (Jasko-EXT Wojciech) * pci/controller/cadence: PCI: cadence: Clear the ARI Capability Next Function Number of the last function
2 parents cab098b + 667a006 commit 538ca00

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

drivers/pci/controller/cadence/pcie-cadence-ep.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,14 +565,26 @@ static int cdns_pcie_ep_start(struct pci_epc *epc)
565565
struct cdns_pcie *pcie = &ep->pcie;
566566
struct device *dev = pcie->dev;
567567
int max_epfs = sizeof(epc->function_num_map) * 8;
568-
int ret, value, epf;
568+
int ret, epf, last_fn;
569+
u32 reg, value;
569570

570571
/*
571572
* BIT(0) is hardwired to 1, hence function 0 is always enabled
572573
* and can't be disabled anyway.
573574
*/
574575
cdns_pcie_writel(pcie, CDNS_PCIE_LM_EP_FUNC_CFG, epc->function_num_map);
575576

577+
/*
578+
* Next function field in ARI_CAP_AND_CTR register for last function
579+
* should be 0.
580+
* Clearing Next Function Number field for the last function used.
581+
*/
582+
last_fn = find_last_bit(&epc->function_num_map, BITS_PER_LONG);
583+
reg = CDNS_PCIE_CORE_PF_I_ARI_CAP_AND_CTRL(last_fn);
584+
value = cdns_pcie_readl(pcie, reg);
585+
value &= ~CDNS_PCIE_ARI_CAP_NFN_MASK;
586+
cdns_pcie_writel(pcie, reg, value);
587+
576588
if (ep->quirk_disable_flr) {
577589
for (epf = 0; epf < max_epfs; epf++) {
578590
if (!(epc->function_num_map & BIT(epf)))

drivers/pci/controller/cadence/pcie-cadence.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@
130130
#define CDNS_PCIE_EP_FUNC_DEV_CAP_OFFSET 0xc0
131131
#define CDNS_PCIE_EP_FUNC_SRIOV_CAP_OFFSET 0x200
132132

133+
/*
134+
* Endpoint PF Registers
135+
*/
136+
#define CDNS_PCIE_CORE_PF_I_ARI_CAP_AND_CTRL(fn) (0x144 + (fn) * 0x1000)
137+
#define CDNS_PCIE_ARI_CAP_NFN_MASK GENMASK(15, 8)
138+
133139
/*
134140
* Root Port Registers (PCI configuration space for the root port function)
135141
*/

0 commit comments

Comments
 (0)