Skip to content

Commit f876904

Browse files
kishonbjorn-helgaas
authored andcommitted
PCI: cadence: Add support to build pcie-cadence library as a kernel module
Currently, the Cadence PCIe controller driver can be built as a built-in module only. Since PCIe functionality is not a necessity for booting, add support to build the Cadence PCIe driver as a loadable module as well. Signed-off-by: Kishon Vijay Abraham I <[email protected]> Signed-off-by: Siddharth Vadapalli <[email protected]> Signed-off-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 16b2da8 commit f876904

File tree

5 files changed

+32
-5
lines changed

5 files changed

+32
-5
lines changed

drivers/pci/controller/cadence/Kconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ menu "Cadence-based PCIe controllers"
44
depends on PCI
55

66
config PCIE_CADENCE
7-
bool
7+
tristate
88

99
config PCIE_CADENCE_HOST
10-
bool
10+
tristate
1111
depends on OF
1212
select IRQ_DOMAIN
1313
select PCIE_CADENCE
1414

1515
config PCIE_CADENCE_EP
16-
bool
16+
tristate
1717
depends on OF
1818
depends on PCI_ENDPOINT
1919
select PCIE_CADENCE

drivers/pci/controller/cadence/pcie-cadence-ep.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <linux/bitfield.h>
77
#include <linux/delay.h>
88
#include <linux/kernel.h>
9+
#include <linux/module.h>
910
#include <linux/of.h>
1011
#include <linux/pci-epc.h>
1112
#include <linux/platform_device.h>
@@ -752,3 +753,8 @@ int cdns_pcie_ep_setup(struct cdns_pcie_ep *ep)
752753

753754
return ret;
754755
}
756+
EXPORT_SYMBOL_GPL(cdns_pcie_ep_setup);
757+
758+
MODULE_LICENSE("GPL");
759+
MODULE_DESCRIPTION("Cadence PCIe endpoint controller driver");
760+
MODULE_AUTHOR("Cyrille Pitchen <[email protected]>");

drivers/pci/controller/cadence/pcie-cadence-host.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include <linux/delay.h>
77
#include <linux/kernel.h>
8+
#include <linux/module.h>
89
#include <linux/list_sort.h>
910
#include <linux/of_address.h>
1011
#include <linux/of_pci.h>
@@ -72,6 +73,7 @@ void __iomem *cdns_pci_map_bus(struct pci_bus *bus, unsigned int devfn,
7273

7374
return rc->cfg_base + (where & 0xfff);
7475
}
76+
EXPORT_SYMBOL_GPL(cdns_pci_map_bus);
7577

7678
static struct pci_ops cdns_pcie_host_ops = {
7779
.map_bus = cdns_pci_map_bus,
@@ -495,6 +497,7 @@ int cdns_pcie_host_init(struct cdns_pcie_rc *rc)
495497

496498
return cdns_pcie_host_init_address_translation(rc);
497499
}
500+
EXPORT_SYMBOL_GPL(cdns_pcie_host_init);
498501

499502
int cdns_pcie_host_link_setup(struct cdns_pcie_rc *rc)
500503
{
@@ -519,6 +522,7 @@ int cdns_pcie_host_link_setup(struct cdns_pcie_rc *rc)
519522

520523
return 0;
521524
}
525+
EXPORT_SYMBOL_GPL(cdns_pcie_host_link_setup);
522526

523527
int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)
524528
{
@@ -572,3 +576,8 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)
572576

573577
return pci_host_probe(bridge);
574578
}
579+
EXPORT_SYMBOL_GPL(cdns_pcie_host_setup);
580+
581+
MODULE_LICENSE("GPL");
582+
MODULE_DESCRIPTION("Cadence PCIe host controller driver");
583+
MODULE_AUTHOR("Cyrille Pitchen <[email protected]>");

drivers/pci/controller/cadence/pcie-cadence.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// Author: Cyrille Pitchen <[email protected]>
55

66
#include <linux/kernel.h>
7+
#include <linux/module.h>
78
#include <linux/of.h>
89

910
#include "pcie-cadence.h"
@@ -23,6 +24,7 @@ void cdns_pcie_detect_quiet_min_delay_set(struct cdns_pcie *pcie)
2324

2425
cdns_pcie_writel(pcie, CDNS_PCIE_LTSSM_CONTROL_CAP, ltssm_control_cap);
2526
}
27+
EXPORT_SYMBOL_GPL(cdns_pcie_detect_quiet_min_delay_set);
2628

2729
void cdns_pcie_set_outbound_region(struct cdns_pcie *pcie, u8 busnr, u8 fn,
2830
u32 r, bool is_io,
@@ -100,6 +102,7 @@ void cdns_pcie_set_outbound_region(struct cdns_pcie *pcie, u8 busnr, u8 fn,
100102
cdns_pcie_writel(pcie, CDNS_PCIE_AT_OB_REGION_CPU_ADDR0(r), addr0);
101103
cdns_pcie_writel(pcie, CDNS_PCIE_AT_OB_REGION_CPU_ADDR1(r), addr1);
102104
}
105+
EXPORT_SYMBOL_GPL(cdns_pcie_set_outbound_region);
103106

104107
void cdns_pcie_set_outbound_region_for_normal_msg(struct cdns_pcie *pcie,
105108
u8 busnr, u8 fn,
@@ -134,6 +137,7 @@ void cdns_pcie_set_outbound_region_for_normal_msg(struct cdns_pcie *pcie,
134137
cdns_pcie_writel(pcie, CDNS_PCIE_AT_OB_REGION_CPU_ADDR0(r), addr0);
135138
cdns_pcie_writel(pcie, CDNS_PCIE_AT_OB_REGION_CPU_ADDR1(r), addr1);
136139
}
140+
EXPORT_SYMBOL_GPL(cdns_pcie_set_outbound_region_for_normal_msg);
137141

138142
void cdns_pcie_reset_outbound_region(struct cdns_pcie *pcie, u32 r)
139143
{
@@ -146,6 +150,7 @@ void cdns_pcie_reset_outbound_region(struct cdns_pcie *pcie, u32 r)
146150
cdns_pcie_writel(pcie, CDNS_PCIE_AT_OB_REGION_CPU_ADDR0(r), 0);
147151
cdns_pcie_writel(pcie, CDNS_PCIE_AT_OB_REGION_CPU_ADDR1(r), 0);
148152
}
153+
EXPORT_SYMBOL_GPL(cdns_pcie_reset_outbound_region);
149154

150155
void cdns_pcie_disable_phy(struct cdns_pcie *pcie)
151156
{
@@ -156,6 +161,7 @@ void cdns_pcie_disable_phy(struct cdns_pcie *pcie)
156161
phy_exit(pcie->phy[i]);
157162
}
158163
}
164+
EXPORT_SYMBOL_GPL(cdns_pcie_disable_phy);
159165

160166
int cdns_pcie_enable_phy(struct cdns_pcie *pcie)
161167
{
@@ -184,6 +190,7 @@ int cdns_pcie_enable_phy(struct cdns_pcie *pcie)
184190

185191
return ret;
186192
}
193+
EXPORT_SYMBOL_GPL(cdns_pcie_enable_phy);
187194

188195
int cdns_pcie_init_phy(struct device *dev, struct cdns_pcie *pcie)
189196
{
@@ -243,6 +250,7 @@ int cdns_pcie_init_phy(struct device *dev, struct cdns_pcie *pcie)
243250

244251
return ret;
245252
}
253+
EXPORT_SYMBOL_GPL(cdns_pcie_init_phy);
246254

247255
static int cdns_pcie_suspend_noirq(struct device *dev)
248256
{
@@ -271,3 +279,7 @@ const struct dev_pm_ops cdns_pcie_pm_ops = {
271279
NOIRQ_SYSTEM_SLEEP_PM_OPS(cdns_pcie_suspend_noirq,
272280
cdns_pcie_resume_noirq)
273281
};
282+
283+
MODULE_LICENSE("GPL");
284+
MODULE_DESCRIPTION("Cadence PCIe controller driver");
285+
MODULE_AUTHOR("Cyrille Pitchen <[email protected]>");

drivers/pci/controller/cadence/pcie-cadence.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ static inline bool cdns_pcie_link_up(struct cdns_pcie *pcie)
508508
return true;
509509
}
510510

511-
#ifdef CONFIG_PCIE_CADENCE_HOST
511+
#if IS_ENABLED(CONFIG_PCIE_CADENCE_HOST)
512512
int cdns_pcie_host_link_setup(struct cdns_pcie_rc *rc);
513513
int cdns_pcie_host_init(struct cdns_pcie_rc *rc);
514514
int cdns_pcie_host_setup(struct cdns_pcie_rc *rc);
@@ -537,7 +537,7 @@ static inline void __iomem *cdns_pci_map_bus(struct pci_bus *bus, unsigned int d
537537
}
538538
#endif
539539

540-
#ifdef CONFIG_PCIE_CADENCE_EP
540+
#if IS_ENABLED(CONFIG_PCIE_CADENCE_EP)
541541
int cdns_pcie_ep_setup(struct cdns_pcie_ep *ep);
542542
#else
543543
static inline int cdns_pcie_ep_setup(struct cdns_pcie_ep *ep)

0 commit comments

Comments
 (0)