mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-28 21:45:01 +08:00
aeaea8969b
In commit7ef1c871da
("PCI: iproc: Use pci_parse_request_of_pci_ranges()"), calling devm_request_pci_bus_resources() was dropped from the common iProc probe code, but is still needed for BCMA bus probing. Without it, there will be lots of warnings like this: pci 0000:00:00.0: BAR 8: no space for [mem size 0x00c00000] pci 0000:00:00.0: BAR 8: failed to assign [mem size 0x00c00000] Add back calling devm_request_pci_bus_resources() and adding the resources to pci_host_bridge.windows for BCMA bus probe. Link: https://lore.kernel.org/r/20210803215656.3803204-2-robh@kernel.org Fixes:7ef1c871da
("PCI: iproc: Use pci_parse_request_of_pci_ranges()") Reported-by: Rafał Miłecki <zajec5@gmail.com> Tested-by: Rafał Miłecki <rafal@milecki.pl> Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: Srinath Mannam <srinath.mannam@broadcom.com> Cc: Roman Bacik <roman.bacik@broadcom.com> Cc: Bharat Gooty <bharat.gooty@broadcom.com> Cc: Abhishek Shah <abhishek.shah@broadcom.com> Cc: Jitendra Bhivare <jitendra.bhivare@broadcom.com> Cc: Ray Jui <ray.jui@broadcom.com> Cc: Florian Fainelli <f.fainelli@gmail.com> Cc: BCM Kernel Feedback <bcm-kernel-feedback-list@broadcom.com> Cc: Scott Branden <sbranden@broadcom.com> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: "Krzysztof Wilczyński" <kw@linux.com> Cc: Bjorn Helgaas <bhelgaas@google.com>
98 lines
2.5 KiB
C
98 lines
2.5 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Copyright (C) 2015 Broadcom Corporation
|
|
* Copyright (C) 2015 Hauke Mehrtens <hauke@hauke-m.de>
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/pci.h>
|
|
#include <linux/module.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/phy/phy.h>
|
|
#include <linux/bcma/bcma.h>
|
|
#include <linux/ioport.h>
|
|
|
|
#include "pcie-iproc.h"
|
|
|
|
|
|
/* NS: CLASS field is R/O, and set to wrong 0x200 value */
|
|
static void bcma_pcie2_fixup_class(struct pci_dev *dev)
|
|
{
|
|
dev->class = PCI_CLASS_BRIDGE_PCI << 8;
|
|
}
|
|
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM, 0x8011, bcma_pcie2_fixup_class);
|
|
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM, 0x8012, bcma_pcie2_fixup_class);
|
|
|
|
static int iproc_pcie_bcma_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
|
|
{
|
|
struct iproc_pcie *pcie = dev->sysdata;
|
|
struct bcma_device *bdev = container_of(pcie->dev, struct bcma_device, dev);
|
|
|
|
return bcma_core_irq(bdev, 5);
|
|
}
|
|
|
|
static int iproc_pcie_bcma_probe(struct bcma_device *bdev)
|
|
{
|
|
struct device *dev = &bdev->dev;
|
|
struct iproc_pcie *pcie;
|
|
struct pci_host_bridge *bridge;
|
|
int ret;
|
|
|
|
bridge = devm_pci_alloc_host_bridge(dev, sizeof(*pcie));
|
|
if (!bridge)
|
|
return -ENOMEM;
|
|
|
|
pcie = pci_host_bridge_priv(bridge);
|
|
|
|
pcie->dev = dev;
|
|
|
|
pcie->type = IPROC_PCIE_PAXB_BCMA;
|
|
pcie->base = bdev->io_addr;
|
|
if (!pcie->base) {
|
|
dev_err(dev, "no controller registers\n");
|
|
return -ENOMEM;
|
|
}
|
|
|
|
pcie->base_addr = bdev->addr;
|
|
|
|
pcie->mem.start = bdev->addr_s[0];
|
|
pcie->mem.end = bdev->addr_s[0] + SZ_128M - 1;
|
|
pcie->mem.name = "PCIe MEM space";
|
|
pcie->mem.flags = IORESOURCE_MEM;
|
|
pci_add_resource(&bridge->windows, &pcie->mem);
|
|
ret = devm_request_pci_bus_resources(dev, &bridge->windows);
|
|
if (ret)
|
|
return ret;
|
|
|
|
pcie->map_irq = iproc_pcie_bcma_map_irq;
|
|
|
|
bcma_set_drvdata(bdev, pcie);
|
|
|
|
return iproc_pcie_setup(pcie, &bridge->windows);
|
|
}
|
|
|
|
static void iproc_pcie_bcma_remove(struct bcma_device *bdev)
|
|
{
|
|
struct iproc_pcie *pcie = bcma_get_drvdata(bdev);
|
|
|
|
iproc_pcie_remove(pcie);
|
|
}
|
|
|
|
static const struct bcma_device_id iproc_pcie_bcma_table[] = {
|
|
BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_NS_PCIEG2, BCMA_ANY_REV, BCMA_ANY_CLASS),
|
|
{},
|
|
};
|
|
MODULE_DEVICE_TABLE(bcma, iproc_pcie_bcma_table);
|
|
|
|
static struct bcma_driver iproc_pcie_bcma_driver = {
|
|
.name = KBUILD_MODNAME,
|
|
.id_table = iproc_pcie_bcma_table,
|
|
.probe = iproc_pcie_bcma_probe,
|
|
.remove = iproc_pcie_bcma_remove,
|
|
};
|
|
module_bcma_driver(iproc_pcie_bcma_driver);
|
|
|
|
MODULE_AUTHOR("Hauke Mehrtens");
|
|
MODULE_DESCRIPTION("Broadcom iProc PCIe BCMA driver");
|
|
MODULE_LICENSE("GPL v2");
|