Skip to content

Commit 79dd993

Browse files
committed
Merge branches 'pci/demodularize-hosts' and 'pci/host-request-windows' into next
* pci/demodularize-hosts: PCI: xgene: Make explicitly non-modular PCI: thunder-pem: Make explicitly non-modular PCI: thunder-ecam: Make explicitly non-modular PCI: tegra: Make explicitly non-modular PCI: rcar-gen2: Make explicitly non-modular PCI: rcar: Make explicitly non-modular PCI: mvebu: Make explicitly non-modular PCI: layerscape: Make explicitly non-modular PCI: keystone: Make explicitly non-modular PCI: hisi: Make explicitly non-modular PCI: generic: Make explicitly non-modular PCI: designware-plat: Make it explicitly non-modular PCI: artpec6: Make explicitly non-modular PCI: armada8k: Make explicitly non-modular PCI: artpec: Add PCI_MSI_IRQ_DOMAIN dependency PCI: artpec: Add Axis ARTPEC-6 PCIe controller driver PCI: Add DT binding for Axis ARTPEC-6 PCIe controller PCI: generic: Select IRQ_DOMAIN * pci/host-request-windows: PCI: versatile: Simplify host bridge window iteration PCI: versatile: Request host bridge window resources with core function PCI: tegra: Request host bridge window resources with core function PCI: tegra: Remove top-level resource from hierarchy PCI: rcar: Simplify host bridge window iteration PCI: rcar: Request host bridge window resources with core function PCI: rcar Gen2: Request host bridge window resources PCI: rcar: Drop gen2 dummy I/O port region ARM: Make PCI I/O space optional PCI: mvebu: Request host bridge window resources with core function PCI: generic: Simplify host bridge window iteration PCI: generic: Request host bridge window resources with core function PCI: altera: Simplify host bridge window iteration PCI: altera: Request host bridge window resources with core function PCI: xilinx-nwl: Use dev_printk() when possible PCI: xilinx-nwl: Request host bridge window resources PCI: xilinx-nwl: Free bridge resource list on failure PCI: xilinx: Request host bridge window resources PCI: xilinx: Free bridge resource list on failure PCI: xgene: Request host bridge window resources PCI: xgene: Free bridge resource list on failure PCI: iproc: Request host bridge window resources PCI: designware: Simplify host bridge window iteration PCI: designware: Request host bridge window resources PCI: designware: Free bridge resource list on failure PCI: Add devm_request_pci_bus_resources()
3 parents 3efc702 + 50dcd29 + da6163a commit 79dd993

29 files changed

Lines changed: 552 additions & 266 deletions
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
* Axis ARTPEC-6 PCIe interface
2+
3+
This PCIe host controller is based on the Synopsys DesignWare PCIe IP
4+
and thus inherits all the common properties defined in designware-pcie.txt.
5+
6+
Required properties:
7+
- compatible: "axis,artpec6-pcie", "snps,dw-pcie"
8+
- reg: base addresses and lengths of the PCIe controller (DBI),
9+
the phy controller, and configuration address space.
10+
- reg-names: Must include the following entries:
11+
- "dbi"
12+
- "phy"
13+
- "config"
14+
- interrupts: A list of interrupt outputs of the controller. Must contain an
15+
entry for each entry in the interrupt-names property.
16+
- interrupt-names: Must include the following entries:
17+
- "msi": The interrupt that is asserted when an MSI is received
18+
- axis,syscon-pcie: A phandle pointing to the ARTPEC-6 system controller,
19+
used to enable and control the Synopsys IP.
20+
21+
Example:
22+
23+
pcie@f8050000 {
24+
compatible = "axis,artpec6-pcie", "snps,dw-pcie";
25+
reg = <0xf8050000 0x2000
26+
0xf8040000 0x1000
27+
0xc0000000 0x1000>;
28+
reg-names = "dbi", "phy", "config";
29+
#address-cells = <3>;
30+
#size-cells = <2>;
31+
device_type = "pci";
32+
/* downstream I/O */
33+
ranges = <0x81000000 0 0x00010000 0xc0010000 0 0x00010000
34+
/* non-prefetchable memory */
35+
0x82000000 0 0xc0020000 0xc0020000 0 0x1ffe0000>;
36+
num-lanes = <2>;
37+
interrupts = <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>;
38+
interrupt-names = "msi";
39+
#interrupt-cells = <1>;
40+
interrupt-map-mask = <0 0 0 0x7>;
41+
interrupt-map = <0 0 0 1 &intc GIC_SPI 144 IRQ_TYPE_LEVEL_HIGH>,
42+
<0 0 0 2 &intc GIC_SPI 145 IRQ_TYPE_LEVEL_HIGH>,
43+
<0 0 0 3 &intc GIC_SPI 146 IRQ_TYPE_LEVEL_HIGH>,
44+
<0 0 0 4 &intc GIC_SPI 147 IRQ_TYPE_LEVEL_HIGH>;
45+
axis,syscon-pcie = <&syscon>;
46+
};

‎MAINTAINERS‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8824,6 +8824,15 @@ S: Maintained
88248824
F: Documentation/devicetree/bindings/pci/xgene-pci-msi.txt
88258825
F: drivers/pci/host/pci-xgene-msi.c
88268826

8827+
PCIE DRIVER FOR AXIS ARTPEC
8828+
M: Niklas Cassel <niklas.cassel@axis.com>
8829+
M: Jesper Nilsson <jesper.nilsson@axis.com>
8830+
L: linux-arm-kernel@axis.com
8831+
L: linux-pci@vger.kernel.org
8832+
S: Maintained
8833+
F: Documentation/devicetree/bindings/pci/axis,artpec*
8834+
F: drivers/pci/host/*artpec*
8835+
88278836
PCIE DRIVER FOR HISILICON
88288837
M: Zhou Wang <wangzhou1@hisilicon.com>
88298838
M: Gabriele Paoloni <gabriele.paoloni@huawei.com>

‎arch/arm/include/asm/mach/pci.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ struct hw_pci {
2222
struct msi_controller *msi_ctrl;
2323
struct pci_ops *ops;
2424
int nr_controllers;
25+
unsigned int io_optional:1;
2526
void **private_data;
2627
int (*setup)(int nr, struct pci_sys_data *);
2728
struct pci_bus *(*scan)(int nr, struct pci_sys_data *);

‎arch/arm/kernel/bios32.c‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,8 @@ static int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
410410
return irq;
411411
}
412412

413-
static int pcibios_init_resources(int busnr, struct pci_sys_data *sys)
413+
static int pcibios_init_resource(int busnr, struct pci_sys_data *sys,
414+
int io_optional)
414415
{
415416
int ret;
416417
struct resource_entry *window;
@@ -420,6 +421,14 @@ static int pcibios_init_resources(int busnr, struct pci_sys_data *sys)
420421
&iomem_resource, sys->mem_offset);
421422
}
422423

424+
/*
425+
* If a platform says I/O port support is optional, we don't add
426+
* the default I/O space. The platform is responsible for adding
427+
* any I/O space it needs.
428+
*/
429+
if (io_optional)
430+
return 0;
431+
423432
resource_list_for_each_entry(window, &sys->resources)
424433
if (resource_type(window->res) == IORESOURCE_IO)
425434
return 0;
@@ -466,7 +475,7 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw,
466475
if (ret > 0) {
467476
struct pci_host_bridge *host_bridge;
468477

469-
ret = pcibios_init_resources(nr, sys);
478+
ret = pcibios_init_resource(nr, sys, hw->io_optional);
470479
if (ret) {
471480
kfree(sys);
472481
break;

‎drivers/pci/bus.c‎

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,35 @@ void pci_bus_remove_resources(struct pci_bus *bus)
9191
}
9292
}
9393

94+
int devm_request_pci_bus_resources(struct device *dev,
95+
struct list_head *resources)
96+
{
97+
struct resource_entry *win;
98+
struct resource *parent, *res;
99+
int err;
100+
101+
resource_list_for_each_entry(win, resources) {
102+
res = win->res;
103+
switch (resource_type(res)) {
104+
case IORESOURCE_IO:
105+
parent = &ioport_resource;
106+
break;
107+
case IORESOURCE_MEM:
108+
parent = &iomem_resource;
109+
break;
110+
default:
111+
continue;
112+
}
113+
114+
err = devm_request_resource(dev, parent, res);
115+
if (err)
116+
return err;
117+
}
118+
119+
return 0;
120+
}
121+
EXPORT_SYMBOL_GPL(devm_request_pci_bus_resources);
122+
94123
static struct pci_bus_region pci_32_bit = {0, 0xffffffffULL};
95124
#ifdef CONFIG_PCI_BUS_ADDR_T_64BIT
96125
static struct pci_bus_region pci_64_bit = {0,
@@ -398,4 +427,3 @@ void pci_bus_put(struct pci_bus *bus)
398427
put_device(&bus->dev);
399428
}
400429
EXPORT_SYMBOL(pci_bus_put);
401-

‎drivers/pci/host/Kconfig‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ config PCI_HOST_GENERIC
8989
bool "Generic PCI host controller"
9090
depends on (ARM || ARM64) && OF
9191
select PCI_HOST_COMMON
92+
select IRQ_DOMAIN
9293
help
9394
Say Y here if you want to support a simple generic PCI host
9495
controller, such as the one emulated by kvmtool.
@@ -254,4 +255,14 @@ config PCIE_ARMADA_8K
254255
Designware hardware and therefore the driver re-uses the
255256
Designware core functions to implement the driver.
256257

258+
config PCIE_ARTPEC6
259+
bool "Axis ARTPEC-6 PCIe controller"
260+
depends on MACH_ARTPEC6
261+
depends on PCI_MSI_IRQ_DOMAIN
262+
select PCIE_DW
263+
select PCIEPORTBUS
264+
help
265+
Say Y here to enable PCIe controller support on Axis ARTPEC-6
266+
SoCs. This PCIe controller uses the DesignWare core.
267+
257268
endmenu

‎drivers/pci/host/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ obj-$(CONFIG_PCIE_QCOM) += pcie-qcom.o
2929
obj-$(CONFIG_PCI_HOST_THUNDER_ECAM) += pci-thunder-ecam.o
3030
obj-$(CONFIG_PCI_HOST_THUNDER_PEM) += pci-thunder-pem.o
3131
obj-$(CONFIG_PCIE_ARMADA_8K) += pcie-armada8k.o
32+
obj-$(CONFIG_PCIE_ARTPEC6) += pcie-artpec6.o

‎drivers/pci/host/pci-host-common.c‎

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -35,44 +35,34 @@ static int gen_pci_parse_request_of_pci_ranges(struct device *dev,
3535
if (err)
3636
return err;
3737

38+
err = devm_request_pci_bus_resources(dev, resources);
39+
if (err)
40+
return err;
41+
3842
resource_list_for_each_entry(win, resources) {
39-
struct resource *parent, *res = win->res;
43+
struct resource *res = win->res;
4044

4145
switch (resource_type(res)) {
4246
case IORESOURCE_IO:
43-
parent = &ioport_resource;
4447
err = pci_remap_iospace(res, iobase);
45-
if (err) {
48+
if (err)
4649
dev_warn(dev, "error %d: failed to map resource %pR\n",
4750
err, res);
48-
continue;
49-
}
5051
break;
5152
case IORESOURCE_MEM:
52-
parent = &iomem_resource;
5353
res_valid |= !(res->flags & IORESOURCE_PREFETCH);
5454
break;
5555
case IORESOURCE_BUS:
5656
*bus_range = res;
57-
default:
58-
continue;
57+
break;
5958
}
60-
61-
err = devm_request_resource(dev, parent, res);
62-
if (err)
63-
goto out_release_res;
64-
}
65-
66-
if (!res_valid) {
67-
dev_err(dev, "non-prefetchable memory resource required\n");
68-
err = -EINVAL;
69-
goto out_release_res;
7059
}
7160

72-
return 0;
61+
if (res_valid)
62+
return 0;
7363

74-
out_release_res:
75-
return err;
64+
dev_err(dev, "non-prefetchable memory resource required\n");
65+
return -EINVAL;
7666
}
7767

7868
static void gen_pci_unmap_cfg(void *ptr)

‎drivers/pci/host/pci-host-generic.c‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*/
2121

2222
#include <linux/kernel.h>
23-
#include <linux/module.h>
23+
#include <linux/init.h>
2424
#include <linux/of_address.h>
2525
#include <linux/of_pci.h>
2626
#include <linux/pci-ecam.h>
@@ -45,8 +45,6 @@ static const struct of_device_id gen_pci_of_match[] = {
4545
{ },
4646
};
4747

48-
MODULE_DEVICE_TABLE(of, gen_pci_of_match);
49-
5048
static int gen_pci_probe(struct platform_device *pdev)
5149
{
5250
const struct of_device_id *of_id;
@@ -65,8 +63,4 @@ static struct platform_driver gen_pci_driver = {
6563
},
6664
.probe = gen_pci_probe,
6765
};
68-
module_platform_driver(gen_pci_driver);
69-
70-
MODULE_DESCRIPTION("Generic PCI host driver");
71-
MODULE_AUTHOR("Will Deacon <will.deacon@arm.com>");
72-
MODULE_LICENSE("GPL v2");
66+
builtin_platform_driver(gen_pci_driver);

‎drivers/pci/host/pci-keystone.c‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <linux/delay.h>
1818
#include <linux/interrupt.h>
1919
#include <linux/irqdomain.h>
20-
#include <linux/module.h>
20+
#include <linux/init.h>
2121
#include <linux/msi.h>
2222
#include <linux/of_irq.h>
2323
#include <linux/of.h>
@@ -360,7 +360,6 @@ static const struct of_device_id ks_pcie_of_match[] = {
360360
},
361361
{ },
362362
};
363-
MODULE_DEVICE_TABLE(of, ks_pcie_of_match);
364363

365364
static int __exit ks_pcie_remove(struct platform_device *pdev)
366365
{
@@ -439,9 +438,4 @@ static struct platform_driver ks_pcie_driver __refdata = {
439438
.of_match_table = of_match_ptr(ks_pcie_of_match),
440439
},
441440
};
442-
443-
module_platform_driver(ks_pcie_driver);
444-
445-
MODULE_AUTHOR("Murali Karicheri <m-karicheri2@ti.com>");
446-
MODULE_DESCRIPTION("Keystone PCIe host controller driver");
447-
MODULE_LICENSE("GPL v2");
441+
builtin_platform_driver(ks_pcie_driver);

0 commit comments

Comments
 (0)