Skip to content

Commit 49e427e

Browse files
committed
Merge branch 'pci/host-probe-refactor'
- Use pci_host_bridge.windows list directly instead of splicing in a temporary list for cadence, mvebu, host-common (Rob Herring) - Use pci_host_probe() instead of open-coding all the pieces for altera, brcmstb, iproc, mobiveil, rcar, rockchip, tegra, v3, versatile, xgene, xilinx, xilinx-nwl (Rob Herring) - Convert to devm_platform_ioremap_resource_byname() instead of open-coding platform_get_resource_byname() and devm_ioremap_resource() for altera, cadence, mediatek, rockchip, tegra, xgene (Dejin Zheng) - Convert to devm_platform_ioremap_resource() instead of open-coding platform_get_resource() and devm_ioremap_resource() for aardvark, brcmstb, exynos, ftpci100, versatile (Dejin Zheng) - Remove redundant error messages from devm_pci_remap_cfg_resource() callers (Dejin Zheng) - Drop useless PCI_ENABLE_PROC_DOMAINS from versatile driver (Rob Herring) - Default host bridge parent device to the platform device (Rob Herring) - Drop unnecessary zeroing of host bridge fields (Rob Herring) - Use pci_is_root_bus() instead of tracking root bus number separately in aardvark, designware (imx6, keystone, designware-host), mobiveil, xilinx-nwl, xilinx, rockchip, rcar (Rob Herring) - Set host bridge bus number in pci_scan_root_bus_bridge() instead of each driver for aardvark, designware-host, host-common, mediatek, rcar, tegra, v3-semi (Rob Herring) - Use bridge resources instead of parsing DT 'ranges' again for cadence (Rob Herring) - Remove private bus number and range from cadence (Rob Herring) - Use devm_pci_alloc_host_bridge() to simplify rcar (Rob Herring) - Use struct pci_host_bridge.windows list directly rather than a temporary (Rob Herring) - Reduce OF "missing non-prefetchable window" from error to warning message (Rob Herring) - Convert rcar-gen2 from old Arm-specific pci_common_init_dev() to new arch-independent interfaces (Rob Herring) - Move DT resource setup into devm_pci_alloc_host_bridge() (Rob Herring) - Set bridge map_irq and swizzle_irq to default functions; drivers that don't support legacy IRQs (iproc) need to undo this (Rob Herring) * pci/host-probe-refactor: PCI: Set bridge map_irq and swizzle_irq to default functions PCI: Move DT resource setup into devm_pci_alloc_host_bridge() PCI: rcar-gen2: Convert to use modern host bridge probe functions PCI: of: Reduce missing non-prefetchable memory region to a warning PCI: rcar: Use struct pci_host_bridge.windows list directly PCI: rcar: Use devm_pci_alloc_host_bridge() PCI: cadence: Remove private bus number and range storage PCI: cadence: Use bridge resources for outbound window setup PCI: Move setting pci_host_bridge.busnr out of host drivers PCI: rcar: Use pci_is_root_bus() to check if bus is root bus PCI: rockchip: Use pci_is_root_bus() to check if bus is root bus PCI: xilinx: Use pci_is_root_bus() to check if bus is root bus PCI: xilinx-nwl: Use pci_is_root_bus() to check if bus is root bus PCI: mobiveil: Use pci_is_root_bus() to check if bus is root bus PCI: designware: Use pci_is_root_bus() to check if bus is root bus PCI: aardvark: Use pci_is_root_bus() to check if bus is root bus PCI: Drop unnecessary zeroing of bridge fields PCI: Set default bridge parent device PCI: versatile: Drop flag PCI_ENABLE_PROC_DOMAINS PCI: controller: Remove duplicate error message PCI: controller: Convert to devm_platform_ioremap_resource() PCI: controller: Convert to devm_platform_ioremap_resource_byname() PCI: xilinx: Use pci_host_probe() to register host PCI: xilinx-nwl: Use pci_host_probe() to register host PCI: rockchip: Use pci_host_probe() to register host PCI: rcar: Use pci_host_probe() to register host PCI: iproc: Use pci_host_probe() to register host PCI: altera: Use pci_host_probe() to register host PCI: xgene: Use pci_host_probe() to register host PCI: versatile: Use pci_host_probe() to register host PCI: v3: Use pci_host_probe() to register host PCI: tegra: Use pci_host_probe() to register host PCI: mobiveil: Use pci_host_probe() to register host PCI: brcmstb: Use pci_host_probe() to register host PCI: host-common: Use struct pci_host_bridge.windows list directly PCI: mvebu: Use struct pci_host_bridge.windows list directly PCI: cadence: Use struct pci_host_bridge.windows list directly # Conflicts: # drivers/pci/controller/cadence/pcie-cadence-host.c
2 parents f8917db + b64aa11 commit 49e427e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+240
-817
lines changed

drivers/pci/controller/cadence/pci-j721e.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,7 @@ static int j721e_pcie_ctrl_init(struct j721e_pcie *pcie)
245245
static int cdns_ti_pcie_config_read(struct pci_bus *bus, unsigned int devfn,
246246
int where, int size, u32 *value)
247247
{
248-
struct pci_host_bridge *bridge = pci_find_host_bridge(bus);
249-
struct cdns_pcie_rc *rc = pci_host_bridge_priv(bridge);
250-
unsigned int busn = bus->number;
251-
252-
if (busn == rc->bus_range->start)
248+
if (pci_is_root_bus(bus))
253249
return pci_generic_config_read32(bus, devfn, where, size,
254250
value);
255251

@@ -259,11 +255,7 @@ static int cdns_ti_pcie_config_read(struct pci_bus *bus, unsigned int devfn,
259255
static int cdns_ti_pcie_config_write(struct pci_bus *bus, unsigned int devfn,
260256
int where, int size, u32 value)
261257
{
262-
struct pci_host_bridge *bridge = pci_find_host_bridge(bus);
263-
struct cdns_pcie_rc *rc = pci_host_bridge_priv(bridge);
264-
unsigned int busn = bus->number;
265-
266-
if (busn == rc->bus_range->start)
258+
if (pci_is_root_bus(bus))
267259
return pci_generic_config_write32(bus, devfn, where, size,
268260
value);
269261

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ static int cdns_pcie_ep_map_addr(struct pci_epc *epc, u8 fn, phys_addr_t addr,
161161
return -EINVAL;
162162
}
163163

164-
cdns_pcie_set_outbound_region(pcie, fn, r, false, addr, pci_addr, size);
164+
cdns_pcie_set_outbound_region(pcie, 0, fn, r, false, addr, pci_addr, size);
165165

166166
set_bit(r, &ep->ob_region_map);
167167
ep->ob_addr[r] = addr;
@@ -289,7 +289,7 @@ static void cdns_pcie_ep_assert_intx(struct cdns_pcie_ep *ep, u8 fn,
289289
if (unlikely(ep->irq_pci_addr != CDNS_PCIE_EP_IRQ_PCI_ADDR_LEGACY ||
290290
ep->irq_pci_fn != fn)) {
291291
/* First region was reserved for IRQ writes. */
292-
cdns_pcie_set_outbound_region_for_normal_msg(pcie, fn, 0,
292+
cdns_pcie_set_outbound_region_for_normal_msg(pcie, 0, fn, 0,
293293
ep->irq_phys_addr);
294294
ep->irq_pci_addr = CDNS_PCIE_EP_IRQ_PCI_ADDR_LEGACY;
295295
ep->irq_pci_fn = fn;
@@ -370,7 +370,7 @@ static int cdns_pcie_ep_send_msi_irq(struct cdns_pcie_ep *ep, u8 fn,
370370
if (unlikely(ep->irq_pci_addr != (pci_addr & ~pci_addr_mask) ||
371371
ep->irq_pci_fn != fn)) {
372372
/* First region was reserved for IRQ writes. */
373-
cdns_pcie_set_outbound_region(pcie, fn, 0,
373+
cdns_pcie_set_outbound_region(pcie, 0, fn, 0,
374374
false,
375375
ep->irq_phys_addr,
376376
pci_addr & ~pci_addr_mask,
@@ -415,7 +415,7 @@ static int cdns_pcie_ep_send_msix_irq(struct cdns_pcie_ep *ep, u8 fn,
415415
if (ep->irq_pci_addr != (msg_addr & ~pci_addr_mask) ||
416416
ep->irq_pci_fn != fn) {
417417
/* First region was reserved for IRQ writes. */
418-
cdns_pcie_set_outbound_region(pcie, fn, 0,
418+
cdns_pcie_set_outbound_region(pcie, 0, fn, 0,
419419
false,
420420
ep->irq_phys_addr,
421421
msg_addr & ~pci_addr_mask,
@@ -518,8 +518,7 @@ int cdns_pcie_ep_setup(struct cdns_pcie_ep *ep)
518518

519519
pcie->is_rc = false;
520520

521-
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "reg");
522-
pcie->reg_base = devm_ioremap_resource(dev, res);
521+
pcie->reg_base = devm_platform_ioremap_resource_byname(pdev, "reg");
523522
if (IS_ERR(pcie->reg_base)) {
524523
dev_err(dev, "missing \"reg\"\n");
525524
return PTR_ERR(pcie->reg_base);

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

Lines changed: 35 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void __iomem *cdns_pci_map_bus(struct pci_bus *bus, unsigned int devfn,
3232
unsigned int busn = bus->number;
3333
u32 addr0, desc0;
3434

35-
if (busn == rc->bus_range->start) {
35+
if (pci_is_root_bus(bus)) {
3636
/*
3737
* Only the root port (devfn == 0) is connected to this bus.
3838
* All other PCI devices are behind some bridge hence on another
@@ -62,7 +62,7 @@ void __iomem *cdns_pci_map_bus(struct pci_bus *bus, unsigned int devfn,
6262
* The bus number was already set once for all in desc1 by
6363
* cdns_pcie_host_init_address_translation().
6464
*/
65-
if (busn == rc->bus_range->start + 1)
65+
if (busn == bridge->busnr + 1)
6666
desc0 |= CDNS_PCIE_AT_OB_REGION_DESC0_TYPE_CONF_TYPE0;
6767
else
6868
desc0 |= CDNS_PCIE_AT_OB_REGION_DESC0_TYPE_CONF_TYPE1;
@@ -321,10 +321,9 @@ static int cdns_pcie_host_map_dma_ranges(struct cdns_pcie_rc *rc)
321321

322322
resource_list_for_each_entry(entry, &bridge->dma_ranges) {
323323
err = cdns_pcie_host_bar_config(rc, entry);
324-
if (err) {
324+
if (err)
325325
dev_err(dev, "Fail to configure IB using dma-ranges\n");
326-
return err;
327-
}
326+
return err;
328327
}
329328

330329
return 0;
@@ -333,23 +332,24 @@ static int cdns_pcie_host_map_dma_ranges(struct cdns_pcie_rc *rc)
333332
static int cdns_pcie_host_init_address_translation(struct cdns_pcie_rc *rc)
334333
{
335334
struct cdns_pcie *pcie = &rc->pcie;
336-
struct resource *bus_range = rc->bus_range;
335+
struct pci_host_bridge *bridge = pci_host_bridge_from_priv(rc);
337336
struct resource *cfg_res = rc->cfg_res;
338-
struct device *dev = pcie->dev;
339-
struct device_node *np = dev->of_node;
340-
struct of_pci_range_parser parser;
337+
struct resource_entry *entry;
341338
u64 cpu_addr = cfg_res->start;
342-
struct of_pci_range range;
343339
u32 addr0, addr1, desc1;
344-
int r, err;
340+
int r, err, busnr = 0;
341+
342+
entry = resource_list_first_type(&bridge->windows, IORESOURCE_BUS);
343+
if (entry)
344+
busnr = entry->res->start;
345345

346346
/*
347347
* Reserve region 0 for PCI configure space accesses:
348348
* OB_REGION_PCI_ADDR0 and OB_REGION_DESC0 are updated dynamically by
349349
* cdns_pci_map_bus(), other region registers are set here once for all.
350350
*/
351351
addr1 = 0; /* Should be programmed to zero. */
352-
desc1 = CDNS_PCIE_AT_OB_REGION_DESC1_BUS(bus_range->start);
352+
desc1 = CDNS_PCIE_AT_OB_REGION_DESC1_BUS(busnr);
353353
cdns_pcie_writel(pcie, CDNS_PCIE_AT_OB_REGION_PCI_ADDR1(0), addr1);
354354
cdns_pcie_writel(pcie, CDNS_PCIE_AT_OB_REGION_DESC1(0), desc1);
355355

@@ -362,25 +362,24 @@ static int cdns_pcie_host_init_address_translation(struct cdns_pcie_rc *rc)
362362
cdns_pcie_writel(pcie, CDNS_PCIE_AT_OB_REGION_CPU_ADDR0(0), addr0);
363363
cdns_pcie_writel(pcie, CDNS_PCIE_AT_OB_REGION_CPU_ADDR1(0), addr1);
364364

365-
err = of_pci_range_parser_init(&parser, np);
366-
if (err)
367-
return err;
368-
369365
r = 1;
370-
for_each_of_pci_range(&parser, &range) {
371-
bool is_io;
372-
373-
if ((range.flags & IORESOURCE_TYPE_BITS) == IORESOURCE_MEM)
374-
is_io = false;
375-
else if ((range.flags & IORESOURCE_TYPE_BITS) == IORESOURCE_IO)
376-
is_io = true;
366+
resource_list_for_each_entry(entry, &bridge->windows) {
367+
struct resource *res = entry->res;
368+
u64 pci_addr = res->start - entry->offset;
369+
370+
if (resource_type(res) == IORESOURCE_IO)
371+
cdns_pcie_set_outbound_region(pcie, busnr, 0, r,
372+
true,
373+
pci_pio_to_address(res->start),
374+
pci_addr,
375+
resource_size(res));
377376
else
378-
continue;
377+
cdns_pcie_set_outbound_region(pcie, busnr, 0, r,
378+
false,
379+
res->start,
380+
pci_addr,
381+
resource_size(res));
379382

380-
cdns_pcie_set_outbound_region(pcie, 0, r, is_io,
381-
range.cpu_addr,
382-
range.pci_addr,
383-
range.size);
384383
r++;
385384
}
386385

@@ -392,39 +391,15 @@ static int cdns_pcie_host_init_address_translation(struct cdns_pcie_rc *rc)
392391
}
393392

394393
static int cdns_pcie_host_init(struct device *dev,
395-
struct list_head *resources,
396394
struct cdns_pcie_rc *rc)
397395
{
398-
struct resource *bus_range = NULL;
399-
struct pci_host_bridge *bridge;
400396
int err;
401397

402-
bridge = pci_host_bridge_from_priv(rc);
403-
if (!bridge)
404-
return -ENOMEM;
405-
406-
/* Parse our PCI ranges and request their resources */
407-
err = pci_parse_request_of_pci_ranges(dev, resources,
408-
&bridge->dma_ranges, &bus_range);
409-
if (err)
410-
return err;
411-
412-
rc->bus_range = bus_range;
413-
rc->pcie.bus = bus_range->start;
414-
415398
err = cdns_pcie_host_init_root_port(rc);
416399
if (err)
417-
goto err_out;
418-
419-
err = cdns_pcie_host_init_address_translation(rc);
420-
if (err)
421-
goto err_out;
422-
423-
return 0;
400+
return err;
424401

425-
err_out:
426-
pci_free_resource_list(resources);
427-
return err;
402+
return cdns_pcie_host_init_address_translation(rc);
428403
}
429404

430405
static int cdns_pcie_host_wait_for_link(struct cdns_pcie *pcie)
@@ -450,7 +425,6 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)
450425
struct platform_device *pdev = to_platform_device(dev);
451426
struct device_node *np = dev->of_node;
452427
struct pci_host_bridge *bridge;
453-
struct list_head resources;
454428
enum cdns_pcie_rp_bar bar;
455429
struct cdns_pcie *pcie;
456430
struct resource *res;
@@ -469,19 +443,16 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)
469443
rc->device_id = 0xffff;
470444
of_property_read_u32(np, "device-id", &rc->device_id);
471445

472-
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "reg");
473-
pcie->reg_base = devm_ioremap_resource(dev, res);
446+
pcie->reg_base = devm_platform_ioremap_resource_byname(pdev, "reg");
474447
if (IS_ERR(pcie->reg_base)) {
475448
dev_err(dev, "missing \"reg\"\n");
476449
return PTR_ERR(pcie->reg_base);
477450
}
478451

479452
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg");
480453
rc->cfg_base = devm_pci_remap_cfg_resource(dev, res);
481-
if (IS_ERR(rc->cfg_base)) {
482-
dev_err(dev, "missing \"cfg\"\n");
454+
if (IS_ERR(rc->cfg_base))
483455
return PTR_ERR(rc->cfg_base);
484-
}
485456
rc->cfg_res = res;
486457

487458
ret = cdns_pcie_start_link(pcie);
@@ -497,26 +468,21 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)
497468
for (bar = RP_BAR0; bar <= RP_NO_BAR; bar++)
498469
rc->avail_ib_bar[bar] = true;
499470

500-
ret = cdns_pcie_host_init(dev, &resources, rc);
471+
ret = cdns_pcie_host_init(dev, rc);
501472
if (ret)
502473
return ret;
503474

504-
list_splice_init(&resources, &bridge->windows);
505-
bridge->dev.parent = dev;
506-
bridge->busnr = pcie->bus;
507475
if (!bridge->ops)
508476
bridge->ops = &cdns_pcie_host_ops;
509-
bridge->map_irq = of_irq_parse_and_map_pci;
510-
bridge->swizzle_irq = pci_common_swizzle;
511477

512478
ret = pci_host_probe(bridge);
513479
if (ret < 0)
514-
goto err_host_probe;
480+
goto err_init;
515481

516482
return 0;
517483

518-
err_host_probe:
519-
pci_free_resource_list(&resources);
484+
err_init:
485+
pm_runtime_put_sync(dev);
520486

521487
return ret;
522488
}

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#include "pcie-cadence.h"
99

10-
void cdns_pcie_set_outbound_region(struct cdns_pcie *pcie, u8 fn,
10+
void cdns_pcie_set_outbound_region(struct cdns_pcie *pcie, u8 busnr, u8 fn,
1111
u32 r, bool is_io,
1212
u64 cpu_addr, u64 pci_addr, size_t size)
1313
{
@@ -60,7 +60,7 @@ void cdns_pcie_set_outbound_region(struct cdns_pcie *pcie, u8 fn,
6060
/* The device and function numbers are always 0. */
6161
desc0 |= CDNS_PCIE_AT_OB_REGION_DESC0_HARDCODED_RID |
6262
CDNS_PCIE_AT_OB_REGION_DESC0_DEVFN(0);
63-
desc1 |= CDNS_PCIE_AT_OB_REGION_DESC1_BUS(pcie->bus);
63+
desc1 |= CDNS_PCIE_AT_OB_REGION_DESC1_BUS(busnr);
6464
} else {
6565
/*
6666
* Use captured values for bus and device numbers but still
@@ -84,7 +84,8 @@ void cdns_pcie_set_outbound_region(struct cdns_pcie *pcie, u8 fn,
8484
cdns_pcie_writel(pcie, CDNS_PCIE_AT_OB_REGION_CPU_ADDR1(r), addr1);
8585
}
8686

87-
void cdns_pcie_set_outbound_region_for_normal_msg(struct cdns_pcie *pcie, u8 fn,
87+
void cdns_pcie_set_outbound_region_for_normal_msg(struct cdns_pcie *pcie,
88+
u8 busnr, u8 fn,
8889
u32 r, u64 cpu_addr)
8990
{
9091
u32 addr0, addr1, desc0, desc1;
@@ -96,7 +97,7 @@ void cdns_pcie_set_outbound_region_for_normal_msg(struct cdns_pcie *pcie, u8 fn,
9697
if (pcie->is_rc) {
9798
desc0 |= CDNS_PCIE_AT_OB_REGION_DESC0_HARDCODED_RID |
9899
CDNS_PCIE_AT_OB_REGION_DESC0_DEVFN(0);
99-
desc1 |= CDNS_PCIE_AT_OB_REGION_DESC1_BUS(pcie->bus);
100+
desc1 |= CDNS_PCIE_AT_OB_REGION_DESC1_BUS(busnr);
100101
} else {
101102
desc0 |= CDNS_PCIE_AT_OB_REGION_DESC0_DEVFN(fn);
102103
}

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ struct cdns_pcie {
272272
struct resource *mem_res;
273273
struct device *dev;
274274
bool is_rc;
275-
u8 bus;
276275
int phy_count;
277276
struct phy **phy;
278277
struct device_link **link;
@@ -285,7 +284,6 @@ struct cdns_pcie {
285284
* @dev: pointer to PCIe device
286285
* @cfg_res: start/end offsets in the physical system memory to map PCI
287286
* configuration space accesses
288-
* @bus_range: first/last buses behind the PCIe host controller
289287
* @cfg_base: IO mapped window to access the PCI configuration space of a
290288
* single function at a time
291289
* @vendor_id: PCI vendor ID
@@ -296,7 +294,6 @@ struct cdns_pcie {
296294
struct cdns_pcie_rc {
297295
struct cdns_pcie pcie;
298296
struct resource *cfg_res;
299-
struct resource *bus_range;
300297
void __iomem *cfg_base;
301298
u32 vendor_id;
302299
u32 device_id;
@@ -498,11 +495,12 @@ static inline int cdns_pcie_ep_setup(struct cdns_pcie_ep *ep)
498495
return 0;
499496
}
500497
#endif
501-
void cdns_pcie_set_outbound_region(struct cdns_pcie *pcie, u8 fn,
498+
void cdns_pcie_set_outbound_region(struct cdns_pcie *pcie, u8 busnr, u8 fn,
502499
u32 r, bool is_io,
503500
u64 cpu_addr, u64 pci_addr, size_t size);
504501

505-
void cdns_pcie_set_outbound_region_for_normal_msg(struct cdns_pcie *pcie, u8 fn,
502+
void cdns_pcie_set_outbound_region_for_normal_msg(struct cdns_pcie *pcie,
503+
u8 busnr, u8 fn,
506504
u32 r, u64 cpu_addr);
507505

508506
void cdns_pcie_reset_outbound_region(struct cdns_pcie *pcie, u32 r);

drivers/pci/controller/dwc/pci-exynos.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,12 @@ static int exynos5440_pcie_get_mem_resources(struct platform_device *pdev,
8484
{
8585
struct dw_pcie *pci = ep->pci;
8686
struct device *dev = pci->dev;
87-
struct resource *res;
8887

8988
ep->mem_res = devm_kzalloc(dev, sizeof(*ep->mem_res), GFP_KERNEL);
9089
if (!ep->mem_res)
9190
return -ENOMEM;
9291

93-
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
94-
ep->mem_res->elbi_base = devm_ioremap_resource(dev, res);
92+
ep->mem_res->elbi_base = devm_platform_ioremap_resource(pdev, 0);
9593
if (IS_ERR(ep->mem_res->elbi_base))
9694
return PTR_ERR(ep->mem_res->elbi_base);
9795

drivers/pci/controller/dwc/pci-imx6.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1269,7 +1269,7 @@ static void imx6_pcie_quirk(struct pci_dev *dev)
12691269
if (bus->dev.parent->parent->driver != &imx6_pcie_driver.driver)
12701270
return;
12711271

1272-
if (bus->number == pp->root_bus_nr) {
1272+
if (pci_is_root_bus(bus)) {
12731273
struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
12741274
struct imx6_pcie *imx6_pcie = to_imx6_pcie(pci);
12751275

drivers/pci/controller/dwc/pci-keystone.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ static int ks_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus,
440440

441441
reg = CFG_BUS(bus->number) | CFG_DEVICE(PCI_SLOT(devfn)) |
442442
CFG_FUNC(PCI_FUNC(devfn));
443-
if (bus->parent->number != pp->root_bus_nr)
443+
if (!pci_is_root_bus(bus->parent))
444444
reg |= CFG_TYPE1;
445445
ks_pcie_app_writel(ks_pcie, CFG_SETUP, reg);
446446

@@ -457,7 +457,7 @@ static int ks_pcie_wr_other_conf(struct pcie_port *pp, struct pci_bus *bus,
457457

458458
reg = CFG_BUS(bus->number) | CFG_DEVICE(PCI_SLOT(devfn)) |
459459
CFG_FUNC(PCI_FUNC(devfn));
460-
if (bus->parent->number != pp->root_bus_nr)
460+
if (!pci_is_root_bus(bus->parent))
461461
reg |= CFG_TYPE1;
462462
ks_pcie_app_writel(ks_pcie, CFG_SETUP, reg);
463463

0 commit comments

Comments
 (0)