PCI: host-generic: Support building as modules
Enable building host-generic and its host-common dependency as a module. Link: https://lore.kernel.org/r/20200409234923.21598-3-robh@kernel.org Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Acked-by: Will Deacon <will@kernel.org> Acked-by: Bjorn Helgaas <bhelgaas@google.com> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: Andrew Murray <amurray@thegoodpenguin.co.uk> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Will Deacon <will@kernel.org> Cc: linux-pci@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org
This commit is contained in:

committed by
Lorenzo Pieralisi

parent
0b104773b4
commit
0c59c06a7c
@@ -62,11 +62,11 @@ config PCIE_RCAR
|
|||||||
Say Y here if you want PCIe controller support on R-Car SoCs.
|
Say Y here if you want PCIe controller support on R-Car SoCs.
|
||||||
|
|
||||||
config PCI_HOST_COMMON
|
config PCI_HOST_COMMON
|
||||||
bool
|
tristate
|
||||||
select PCI_ECAM
|
select PCI_ECAM
|
||||||
|
|
||||||
config PCI_HOST_GENERIC
|
config PCI_HOST_GENERIC
|
||||||
bool "Generic PCI host controller"
|
tristate "Generic PCI host controller"
|
||||||
depends on OF
|
depends on OF
|
||||||
select PCI_HOST_COMMON
|
select PCI_HOST_COMMON
|
||||||
select IRQ_DOMAIN
|
select IRQ_DOMAIN
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
|
#include <linux/module.h>
|
||||||
#include <linux/of_address.h>
|
#include <linux/of_address.h>
|
||||||
#include <linux/of_pci.h>
|
#include <linux/of_pci.h>
|
||||||
#include <linux/pci-ecam.h>
|
#include <linux/pci-ecam.h>
|
||||||
@@ -95,6 +96,7 @@ int pci_host_common_probe(struct platform_device *pdev,
|
|||||||
platform_set_drvdata(pdev, bridge->bus);
|
platform_set_drvdata(pdev, bridge->bus);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(pci_host_common_probe);
|
||||||
|
|
||||||
int pci_host_common_remove(struct platform_device *pdev)
|
int pci_host_common_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
@@ -107,3 +109,6 @@ int pci_host_common_remove(struct platform_device *pdev)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(pci_host_common_remove);
|
||||||
|
|
||||||
|
MODULE_LICENSE("GPL v2");
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
|
#include <linux/module.h>
|
||||||
#include <linux/of_address.h>
|
#include <linux/of_address.h>
|
||||||
#include <linux/of_pci.h>
|
#include <linux/of_pci.h>
|
||||||
#include <linux/pci-ecam.h>
|
#include <linux/pci-ecam.h>
|
||||||
@@ -76,6 +77,7 @@ static const struct of_device_id gen_pci_of_match[] = {
|
|||||||
|
|
||||||
{ },
|
{ },
|
||||||
};
|
};
|
||||||
|
MODULE_DEVICE_TABLE(of, gen_pci_of_match);
|
||||||
|
|
||||||
static int gen_pci_probe(struct platform_device *pdev)
|
static int gen_pci_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
@@ -92,9 +94,10 @@ static struct platform_driver gen_pci_driver = {
|
|||||||
.driver = {
|
.driver = {
|
||||||
.name = "pci-host-generic",
|
.name = "pci-host-generic",
|
||||||
.of_match_table = gen_pci_of_match,
|
.of_match_table = gen_pci_of_match,
|
||||||
.suppress_bind_attrs = true,
|
|
||||||
},
|
},
|
||||||
.probe = gen_pci_probe,
|
.probe = gen_pci_probe,
|
||||||
.remove = pci_host_common_remove,
|
.remove = pci_host_common_remove,
|
||||||
};
|
};
|
||||||
builtin_platform_driver(gen_pci_driver);
|
module_platform_driver(gen_pci_driver);
|
||||||
|
|
||||||
|
MODULE_LICENSE("GPL v2");
|
||||||
|
@@ -101,6 +101,7 @@ err_exit:
|
|||||||
pci_ecam_free(cfg);
|
pci_ecam_free(cfg);
|
||||||
return ERR_PTR(err);
|
return ERR_PTR(err);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(pci_ecam_create);
|
||||||
|
|
||||||
void pci_ecam_free(struct pci_config_window *cfg)
|
void pci_ecam_free(struct pci_config_window *cfg)
|
||||||
{
|
{
|
||||||
@@ -121,6 +122,7 @@ void pci_ecam_free(struct pci_config_window *cfg)
|
|||||||
release_resource(&cfg->res);
|
release_resource(&cfg->res);
|
||||||
kfree(cfg);
|
kfree(cfg);
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(pci_ecam_free);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Function to implement the pci_ops ->map_bus method
|
* Function to implement the pci_ops ->map_bus method
|
||||||
@@ -143,6 +145,7 @@ void __iomem *pci_ecam_map_bus(struct pci_bus *bus, unsigned int devfn,
|
|||||||
base = cfg->win + (busn << cfg->ops->bus_shift);
|
base = cfg->win + (busn << cfg->ops->bus_shift);
|
||||||
return base + (devfn << devfn_shift) + where;
|
return base + (devfn << devfn_shift) + where;
|
||||||
}
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(pci_ecam_map_bus);
|
||||||
|
|
||||||
/* ECAM ops */
|
/* ECAM ops */
|
||||||
const struct pci_ecam_ops pci_generic_ecam_ops = {
|
const struct pci_ecam_ops pci_generic_ecam_ops = {
|
||||||
@@ -153,6 +156,7 @@ const struct pci_ecam_ops pci_generic_ecam_ops = {
|
|||||||
.write = pci_generic_config_write,
|
.write = pci_generic_config_write,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
EXPORT_SYMBOL_GPL(pci_generic_ecam_ops);
|
||||||
|
|
||||||
#if defined(CONFIG_ACPI) && defined(CONFIG_PCI_QUIRKS)
|
#if defined(CONFIG_ACPI) && defined(CONFIG_PCI_QUIRKS)
|
||||||
/* ECAM ops for 32-bit access only (non-compliant) */
|
/* ECAM ops for 32-bit access only (non-compliant) */
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
#include "pci.h"
|
#include "pci.h"
|
||||||
|
|
||||||
unsigned int pci_flags;
|
unsigned int pci_flags;
|
||||||
|
EXPORT_SYMBOL_GPL(pci_flags);
|
||||||
|
|
||||||
struct pci_dev_resource {
|
struct pci_dev_resource {
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
|
@@ -59,7 +59,7 @@ extern const struct pci_ecam_ops xgene_v2_pcie_ecam_ops; /* APM X-Gene PCIe v2.x
|
|||||||
extern const struct pci_ecam_ops al_pcie_ops; /* Amazon Annapurna Labs PCIe */
|
extern const struct pci_ecam_ops al_pcie_ops; /* Amazon Annapurna Labs PCIe */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_PCI_HOST_COMMON
|
#if IS_ENABLED(CONFIG_PCI_HOST_COMMON)
|
||||||
/* for DT-based PCI controllers that support ECAM */
|
/* for DT-based PCI controllers that support ECAM */
|
||||||
int pci_host_common_probe(struct platform_device *pdev,
|
int pci_host_common_probe(struct platform_device *pdev,
|
||||||
const struct pci_ecam_ops *ops);
|
const struct pci_ecam_ops *ops);
|
||||||
|
Reference in New Issue
Block a user