diff options
-rw-r--r-- | drivers/pci/controller/pci-mvebu.c | 52 |
1 files changed, 48 insertions, 4 deletions
diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c index 50eb0729385b..a41d79b8d46a 100644 --- a/drivers/pci/controller/pci-mvebu.c +++ b/drivers/pci/controller/pci-mvebu.c | |||
@@ -1145,7 +1145,6 @@ static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie) | |||
1145 | { | 1145 | { |
1146 | struct device *dev = &pcie->pdev->dev; | 1146 | struct device *dev = &pcie->pdev->dev; |
1147 | struct device_node *np = dev->of_node; | 1147 | struct device_node *np = dev->of_node; |
1148 | unsigned int i; | ||
1149 | int ret; | 1148 | int ret; |
1150 | 1149 | ||
1151 | INIT_LIST_HEAD(&pcie->resources); | 1150 | INIT_LIST_HEAD(&pcie->resources); |
@@ -1179,13 +1178,58 @@ static int mvebu_pcie_parse_request_resources(struct mvebu_pcie *pcie) | |||
1179 | resource_size(&pcie->io) - 1); | 1178 | resource_size(&pcie->io) - 1); |
1180 | pcie->realio.name = "PCI I/O"; | 1179 | pcie->realio.name = "PCI I/O"; |
1181 | 1180 | ||
1181 | pci_add_resource(&pcie->resources, &pcie->realio); | ||
1182 | } | ||
1183 | |||
1184 | return devm_request_pci_bus_resources(dev, &pcie->resources); | ||
1185 | } | ||
1186 | |||
1187 | /* | ||
1188 | * This is a copy of pci_host_probe(), except that it does the I/O | ||
1189 | * remap as the last step, once we are sure we won't fail. | ||
1190 | * | ||
1191 | * It should be removed once the I/O remap error handling issue has | ||
1192 | * been sorted out. | ||
1193 | */ | ||
1194 | static int mvebu_pci_host_probe(struct pci_host_bridge *bridge) | ||
1195 | { | ||
1196 | struct mvebu_pcie *pcie; | ||
1197 | struct pci_bus *bus, *child; | ||
1198 | int ret; | ||
1199 | |||
1200 | ret = pci_scan_root_bus_bridge(bridge); | ||
1201 | if (ret < 0) { | ||
1202 | dev_err(bridge->dev.parent, "Scanning root bridge failed"); | ||
1203 | return ret; | ||
1204 | } | ||
1205 | |||
1206 | pcie = pci_host_bridge_priv(bridge); | ||
1207 | if (resource_size(&pcie->io) != 0) { | ||
1208 | unsigned int i; | ||
1209 | |||
1182 | for (i = 0; i < resource_size(&pcie->realio); i += SZ_64K) | 1210 | for (i = 0; i < resource_size(&pcie->realio); i += SZ_64K) |
1183 | pci_ioremap_io(i, pcie->io.start + i); | 1211 | pci_ioremap_io(i, pcie->io.start + i); |
1212 | } | ||
1184 | 1213 | ||
1185 | pci_add_resource(&pcie->resources, &pcie->realio); | 1214 | bus = bridge->bus; |
1215 | |||
1216 | /* | ||
1217 | * We insert PCI resources into the iomem_resource and | ||
1218 | * ioport_resource trees in either pci_bus_claim_resources() | ||
1219 | * or pci_bus_assign_resources(). | ||
1220 | */ | ||
1221 | if (pci_has_flag(PCI_PROBE_ONLY)) { | ||
1222 | pci_bus_claim_resources(bus); | ||
1223 | } else { | ||
1224 | pci_bus_size_bridges(bus); | ||
1225 | pci_bus_assign_resources(bus); | ||
1226 | |||
1227 | list_for_each_entry(child, &bus->children, node) | ||
1228 | pcie_bus_configure_settings(child); | ||
1186 | } | 1229 | } |
1187 | 1230 | ||
1188 | return devm_request_pci_bus_resources(dev, &pcie->resources); | 1231 | pci_bus_add_devices(bus); |
1232 | return 0; | ||
1189 | } | 1233 | } |
1190 | 1234 | ||
1191 | static int mvebu_pcie_probe(struct platform_device *pdev) | 1235 | static int mvebu_pcie_probe(struct platform_device *pdev) |
@@ -1268,7 +1312,7 @@ static int mvebu_pcie_probe(struct platform_device *pdev) | |||
1268 | bridge->align_resource = mvebu_pcie_align_resource; | 1312 | bridge->align_resource = mvebu_pcie_align_resource; |
1269 | bridge->msi = pcie->msi; | 1313 | bridge->msi = pcie->msi; |
1270 | 1314 | ||
1271 | return pci_host_probe(bridge); | 1315 | return mvebu_pci_host_probe(bridge); |
1272 | } | 1316 | } |
1273 | 1317 | ||
1274 | static const struct of_device_id mvebu_pcie_of_match_table[] = { | 1318 | static const struct of_device_id mvebu_pcie_of_match_table[] = { |