@@ -950,14 +950,10 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
950
950
struct device * dev = & pdev -> dev ;
951
951
struct pci_bus * bus , * child ;
952
952
struct pci_host_bridge * bridge ;
953
+ struct resource * bus_res ;
953
954
struct resource_entry * win ;
954
- resource_size_t io_base ;
955
- struct resource * mem ;
956
- struct resource * io ;
957
955
int err ;
958
956
959
- LIST_HEAD (res );
960
-
961
957
if (!dev -> of_node )
962
958
return - ENODEV ;
963
959
@@ -995,29 +991,20 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
995
991
if (err < 0 )
996
992
goto err_deinit_port ;
997
993
998
- err = devm_of_pci_get_host_bridge_resources (dev , 0 , 0xff ,
999
- & res , & io_base );
994
+ err = pci_parse_request_of_pci_ranges (dev , & bridge -> windows , & bus_res );
1000
995
if (err )
1001
996
goto err_remove_irq_domain ;
1002
997
1003
- err = devm_request_pci_bus_resources (dev , & res );
1004
- if (err )
1005
- goto err_free_res ;
998
+ rockchip -> root_bus_nr = bus_res -> start ;
1006
999
1007
1000
/* Get the I/O and memory ranges from DT */
1008
- resource_list_for_each_entry (win , & res ) {
1001
+ resource_list_for_each_entry (win , & bridge -> windows ) {
1009
1002
switch (resource_type (win -> res )) {
1010
1003
case IORESOURCE_IO :
1011
1004
io = win -> res ;
1012
1005
io -> name = "I/O" ;
1013
1006
rockchip -> io_size = resource_size (io );
1014
1007
rockchip -> io_bus_addr = io -> start - win -> offset ;
1015
- err = pci_remap_iospace (io , io_base );
1016
- if (err ) {
1017
- dev_warn (dev , "error %d: failed to map resource %pR\n" ,
1018
- err , io );
1019
- continue ;
1020
- }
1021
1008
rockchip -> io = io ;
1022
1009
break ;
1023
1010
case IORESOURCE_MEM :
@@ -1026,25 +1013,21 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
1026
1013
rockchip -> mem_size = resource_size (mem );
1027
1014
rockchip -> mem_bus_addr = mem -> start - win -> offset ;
1028
1015
break ;
1029
- case IORESOURCE_BUS :
1030
- rockchip -> root_bus_nr = win -> res -> start ;
1031
- break ;
1032
1016
default :
1033
1017
continue ;
1034
1018
}
1035
1019
}
1036
1020
1037
1021
err = rockchip_pcie_cfg_atu (rockchip );
1038
1022
if (err )
1039
- goto err_unmap_iospace ;
1023
+ goto err_remove_irq_domain ;
1040
1024
1041
1025
rockchip -> msg_region = devm_ioremap (dev , rockchip -> msg_bus_addr , SZ_1M );
1042
1026
if (!rockchip -> msg_region ) {
1043
1027
err = - ENOMEM ;
1044
- goto err_unmap_iospace ;
1028
+ goto err_remove_irq_domain ;
1045
1029
}
1046
1030
1047
- list_splice_init (& res , & bridge -> windows );
1048
1031
bridge -> dev .parent = dev ;
1049
1032
bridge -> sysdata = rockchip ;
1050
1033
bridge -> busnr = 0 ;
@@ -1054,7 +1037,7 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
1054
1037
1055
1038
err = pci_scan_root_bus_bridge (bridge );
1056
1039
if (err < 0 )
1057
- goto err_unmap_iospace ;
1040
+ goto err_remove_irq_domain ;
1058
1041
1059
1042
bus = bridge -> bus ;
1060
1043
@@ -1068,10 +1051,6 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
1068
1051
pci_bus_add_devices (bus );
1069
1052
return 0 ;
1070
1053
1071
- err_unmap_iospace :
1072
- pci_unmap_iospace (rockchip -> io );
1073
- err_free_res :
1074
- pci_free_resource_list (& res );
1075
1054
err_remove_irq_domain :
1076
1055
irq_domain_remove (rockchip -> irq_domain );
1077
1056
err_deinit_port :
@@ -1097,7 +1076,6 @@ static int rockchip_pcie_remove(struct platform_device *pdev)
1097
1076
1098
1077
pci_stop_root_bus (rockchip -> root_bus );
1099
1078
pci_remove_root_bus (rockchip -> root_bus );
1100
- pci_unmap_iospace (rockchip -> io );
1101
1079
irq_domain_remove (rockchip -> irq_domain );
1102
1080
1103
1081
rockchip_pcie_deinit_phys (rockchip );
0 commit comments