@@ -1031,32 +1031,21 @@ static int tegra_pcie_get_resources(struct tegra_pcie *pcie)
return err;
}
- /* request and remap controller registers */
pads = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pads");
- if (!pads) {
- err = -EADDRNOTAVAIL;
+ pcie->pads = devm_ioremap_resource(&pdev->dev, pads);
+ if (IS_ERR(pcie->pads)) {
+ err = PTR_ERR(pcie->pads);
goto poweroff;
}
afi = platform_get_resource_byname(pdev, IORESOURCE_MEM, "afi");
- if (!afi) {
- err = -EADDRNOTAVAIL;
- goto poweroff;
- }
-
- pcie->pads = devm_request_and_ioremap(&pdev->dev, pads);
- if (!pcie->pads) {
- err = -EADDRNOTAVAIL;
- goto poweroff;
- }
-
- pcie->afi = devm_request_and_ioremap(&pdev->dev, afi);
- if (!pcie->afi) {
- err = -EADDRNOTAVAIL;
+ pcie->afi = devm_ioremap_resource(&pdev->dev, afi);
+ if (IS_ERR(pcie->afi)) {
+ err = PTR_ERR(pcie->afi);
goto poweroff;
}
- /* request and remap configuration space */
+ /* request configuration space, but remap later, on demand */
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cs");
if (!res) {
err = -EADDRNOTAVAIL;
@@ -1492,9 +1481,9 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie)
rp->lanes = value;
rp->pcie = pcie;
- rp->base = devm_request_and_ioremap(pcie->dev, &rp->regs);
- if (!rp->base)
- return -EADDRNOTAVAIL;
+ rp->base = devm_ioremap_resource(pcie->dev, &rp->regs);
+ if (IS_ERR(rp->base))
+ return PTR_ERR(rp->base);
list_add_tail(&rp->list, &pcie->ports);
}