Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PCI: dwc: Drop support for config space in 'ranges'

Since commit a0fd361db8e5 ("PCI: dwc: Move "dbi", "dbi2", and
"addr_space" resource setup into common code"), the code
setting dbi_base when the config space is defined in 'ranges' property
instead of 'reg' is dead code as dbi_base is never NULL.

Rather than fix this, let's just drop the code. Using ranges has been
deprecated since 2014. The only platforms using this were exynos5440,
i.MX6 and Spear13xx. Exynos5440 is dead and has been removed. i.MX6 and
Spear13xx had PCIe support added just before this was deprecated and
were fixed within a kernel release or 2.

Link: https://lore.kernel.org/r/20201215194149.86831-1-robh@kernel.org
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

authored by

Rob Herring and committed by
Bjorn Helgaas
2f5ab5af 6104033b

+12 -33
+12 -33
drivers/pci/controller/dwc/pcie-designware-host.c
··· 305 305 if (cfg_res) { 306 306 pp->cfg0_size = resource_size(cfg_res); 307 307 pp->cfg0_base = cfg_res->start; 308 - } else if (!pp->va_cfg0_base) { 308 + 309 + pp->va_cfg0_base = devm_pci_remap_cfg_resource(dev, cfg_res); 310 + if (IS_ERR(pp->va_cfg0_base)) 311 + return PTR_ERR(pp->va_cfg0_base); 312 + } else { 309 313 dev_err(dev, "Missing *config* reg space\n"); 314 + return -ENODEV; 310 315 } 311 316 312 317 if (!pci->dbi_base) { ··· 327 322 328 323 pp->bridge = bridge; 329 324 330 - /* Get the I/O and memory ranges from DT */ 331 - resource_list_for_each_entry(win, &bridge->windows) { 332 - switch (resource_type(win->res)) { 333 - case IORESOURCE_IO: 334 - pp->io_size = resource_size(win->res); 335 - pp->io_bus_addr = win->res->start - win->offset; 336 - pp->io_base = pci_pio_to_address(win->res->start); 337 - break; 338 - case 0: 339 - dev_err(dev, "Missing *config* reg space\n"); 340 - pp->cfg0_size = resource_size(win->res); 341 - pp->cfg0_base = win->res->start; 342 - if (!pci->dbi_base) { 343 - pci->dbi_base = devm_pci_remap_cfgspace(dev, 344 - pp->cfg0_base, 345 - pp->cfg0_size); 346 - if (!pci->dbi_base) { 347 - dev_err(dev, "Error with ioremap\n"); 348 - return -ENOMEM; 349 - } 350 - } 351 - break; 352 - } 353 - } 354 - 355 - if (!pp->va_cfg0_base) { 356 - pp->va_cfg0_base = devm_pci_remap_cfgspace(dev, 357 - pp->cfg0_base, pp->cfg0_size); 358 - if (!pp->va_cfg0_base) { 359 - dev_err(dev, "Error with ioremap in function\n"); 360 - return -ENOMEM; 361 - } 325 + /* Get the I/O range from DT */ 326 + win = resource_list_first_type(&bridge->windows, IORESOURCE_IO); 327 + if (win) { 328 + pp->io_size = resource_size(win->res); 329 + pp->io_bus_addr = win->res->start - win->offset; 330 + pp->io_base = pci_pio_to_address(win->res->start); 362 331 } 363 332 364 333 if (pci->link_gen < 1)