@@ -405,27 +405,23 @@ static void xgene_pcie_setup_cfg_reg(struct xgene_pcie_port *port)
405
405
xgene_pcie_writel (port , CFGCTL , EN_REG );
406
406
}
407
407
408
- static int xgene_pcie_map_ranges (struct xgene_pcie_port * port ,
409
- struct list_head * res ,
410
- resource_size_t io_base )
408
+ static int xgene_pcie_map_ranges (struct xgene_pcie_port * port )
411
409
{
410
+ struct pci_host_bridge * bridge = pci_host_bridge_from_priv (port );
412
411
struct resource_entry * window ;
413
412
struct device * dev = port -> dev ;
414
- int ret ;
415
413
416
- resource_list_for_each_entry (window , res ) {
414
+ resource_list_for_each_entry (window , & bridge -> windows ) {
417
415
struct resource * res = window -> res ;
418
416
u64 restype = resource_type (res );
419
417
420
418
dev_dbg (dev , "%pR\n" , res );
421
419
422
420
switch (restype ) {
423
421
case IORESOURCE_IO :
424
- xgene_pcie_setup_ob_reg (port , res , OMR3BARL , io_base ,
422
+ xgene_pcie_setup_ob_reg (port , res , OMR3BARL ,
423
+ pci_pio_to_address (res -> start ),
425
424
res -> start - window -> offset );
426
- ret = devm_pci_remap_iospace (dev , res , io_base );
427
- if (ret < 0 )
428
- return ret ;
429
425
break ;
430
426
case IORESOURCE_MEM :
431
427
if (res -> flags & IORESOURCE_PREFETCH )
@@ -567,8 +563,7 @@ static void xgene_pcie_clear_config(struct xgene_pcie_port *port)
567
563
xgene_pcie_writel (port , i , 0 );
568
564
}
569
565
570
- static int xgene_pcie_setup (struct xgene_pcie_port * port , struct list_head * res ,
571
- resource_size_t io_base )
566
+ static int xgene_pcie_setup (struct xgene_pcie_port * port )
572
567
{
573
568
struct device * dev = port -> dev ;
574
569
u32 val , lanes = 0 , speed = 0 ;
@@ -580,7 +575,7 @@ static int xgene_pcie_setup(struct xgene_pcie_port *port, struct list_head *res,
580
575
val = (XGENE_PCIE_DEVICEID << 16 ) | XGENE_PCIE_VENDORID ;
581
576
xgene_pcie_writel (port , BRIDGE_CFG_0 , val );
582
577
583
- ret = xgene_pcie_map_ranges (port , res , io_base );
578
+ ret = xgene_pcie_map_ranges (port );
584
579
if (ret )
585
580
return ret ;
586
581
@@ -607,11 +602,9 @@ static int xgene_pcie_probe(struct platform_device *pdev)
607
602
struct device * dev = & pdev -> dev ;
608
603
struct device_node * dn = dev -> of_node ;
609
604
struct xgene_pcie_port * port ;
610
- resource_size_t iobase = 0 ;
611
605
struct pci_bus * bus , * child ;
612
606
struct pci_host_bridge * bridge ;
613
607
int ret ;
614
- LIST_HEAD (res );
615
608
616
609
bridge = devm_pci_alloc_host_bridge (dev , sizeof (* port ));
617
610
if (!bridge )
@@ -634,20 +627,14 @@ static int xgene_pcie_probe(struct platform_device *pdev)
634
627
if (ret )
635
628
return ret ;
636
629
637
- ret = devm_of_pci_get_host_bridge_resources (dev , 0 , 0xff , & res ,
638
- & iobase );
630
+ ret = pci_parse_request_of_pci_ranges (dev , & bridge -> windows , NULL );
639
631
if (ret )
640
632
return ret ;
641
633
642
- ret = devm_request_pci_bus_resources (dev , & res );
643
- if (ret )
644
- goto error ;
645
-
646
- ret = xgene_pcie_setup (port , & res , iobase );
634
+ ret = xgene_pcie_setup (port );
647
635
if (ret )
648
- goto error ;
636
+ return ret ;
649
637
650
- list_splice_init (& res , & bridge -> windows );
651
638
bridge -> dev .parent = dev ;
652
639
bridge -> sysdata = port ;
653
640
bridge -> busnr = 0 ;
@@ -657,7 +644,7 @@ static int xgene_pcie_probe(struct platform_device *pdev)
657
644
658
645
ret = pci_scan_root_bus_bridge (bridge );
659
646
if (ret < 0 )
660
- goto error ;
647
+ return ret ;
661
648
662
649
bus = bridge -> bus ;
663
650
@@ -666,10 +653,6 @@ static int xgene_pcie_probe(struct platform_device *pdev)
666
653
pcie_bus_configure_settings (child );
667
654
pci_bus_add_devices (bus );
668
655
return 0 ;
669
-
670
- error :
671
- pci_free_resource_list (& res );
672
- return ret ;
673
656
}
674
657
675
658
static const struct of_device_id xgene_pcie_match_table [] = {
0 commit comments