diff options
-rw-r--r-- | arch/arm/Kconfig | 3 | ||||
-rw-r--r-- | arch/arm/include/asm/mach/pci.h | 6 | ||||
-rw-r--r-- | arch/arm/include/asm/pci.h | 7 | ||||
-rw-r--r-- | arch/arm/kernel/bios32.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-cns3xxx/pcie.c | 40 | ||||
-rw-r--r-- | arch/arm64/kernel/pci.c | 22 | ||||
-rw-r--r-- | drivers/pci/host/pci-mvebu.c | 15 | ||||
-rw-r--r-- | drivers/pci/host/pcie-designware.c | 3 | ||||
-rw-r--r-- | drivers/pci/host/pcie-rcar.c | 3 | ||||
-rw-r--r-- | drivers/pci/pci.c | 49 |
10 files changed, 71 insertions, 80 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 97d07ed60a0b..dcb2e0c55be4 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -1279,6 +1279,9 @@ config PCI_DOMAINS | |||
1279 | bool | 1279 | bool |
1280 | depends on PCI | 1280 | depends on PCI |
1281 | 1281 | ||
1282 | config PCI_DOMAINS_GENERIC | ||
1283 | def_bool PCI_DOMAINS | ||
1284 | |||
1282 | config PCI_NANOENGINE | 1285 | config PCI_NANOENGINE |
1283 | bool "BSE nanoEngine PCI support" | 1286 | bool "BSE nanoEngine PCI support" |
1284 | depends on SA1100_NANOENGINE | 1287 | depends on SA1100_NANOENGINE |
diff --git a/arch/arm/include/asm/mach/pci.h b/arch/arm/include/asm/mach/pci.h index 8292b5f81e23..28b9bb35949e 100644 --- a/arch/arm/include/asm/mach/pci.h +++ b/arch/arm/include/asm/mach/pci.h | |||
@@ -19,9 +19,6 @@ struct pci_bus; | |||
19 | struct device; | 19 | struct device; |
20 | 20 | ||
21 | struct hw_pci { | 21 | struct hw_pci { |
22 | #ifdef CONFIG_PCI_DOMAINS | ||
23 | int domain; | ||
24 | #endif | ||
25 | #ifdef CONFIG_PCI_MSI | 22 | #ifdef CONFIG_PCI_MSI |
26 | struct msi_controller *msi_ctrl; | 23 | struct msi_controller *msi_ctrl; |
27 | #endif | 24 | #endif |
@@ -45,9 +42,6 @@ struct hw_pci { | |||
45 | * Per-controller structure | 42 | * Per-controller structure |
46 | */ | 43 | */ |
47 | struct pci_sys_data { | 44 | struct pci_sys_data { |
48 | #ifdef CONFIG_PCI_DOMAINS | ||
49 | int domain; | ||
50 | #endif | ||
51 | #ifdef CONFIG_PCI_MSI | 45 | #ifdef CONFIG_PCI_MSI |
52 | struct msi_controller *msi_ctrl; | 46 | struct msi_controller *msi_ctrl; |
53 | #endif | 47 | #endif |
diff --git a/arch/arm/include/asm/pci.h b/arch/arm/include/asm/pci.h index 7e95d8535e24..585dc33a7a24 100644 --- a/arch/arm/include/asm/pci.h +++ b/arch/arm/include/asm/pci.h | |||
@@ -18,13 +18,6 @@ static inline int pcibios_assign_all_busses(void) | |||
18 | } | 18 | } |
19 | 19 | ||
20 | #ifdef CONFIG_PCI_DOMAINS | 20 | #ifdef CONFIG_PCI_DOMAINS |
21 | static inline int pci_domain_nr(struct pci_bus *bus) | ||
22 | { | ||
23 | struct pci_sys_data *root = bus->sysdata; | ||
24 | |||
25 | return root->domain; | ||
26 | } | ||
27 | |||
28 | static inline int pci_proc_domain(struct pci_bus *bus) | 21 | static inline int pci_proc_domain(struct pci_bus *bus) |
29 | { | 22 | { |
30 | return pci_domain_nr(bus); | 23 | return pci_domain_nr(bus); |
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c index a4effd6d8f2f..ddd75c58b1e8 100644 --- a/arch/arm/kernel/bios32.c +++ b/arch/arm/kernel/bios32.c | |||
@@ -463,9 +463,6 @@ static void pcibios_init_hw(struct device *parent, struct hw_pci *hw, | |||
463 | if (!sys) | 463 | if (!sys) |
464 | panic("PCI: unable to allocate sys data!"); | 464 | panic("PCI: unable to allocate sys data!"); |
465 | 465 | ||
466 | #ifdef CONFIG_PCI_DOMAINS | ||
467 | sys->domain = hw->domain; | ||
468 | #endif | ||
469 | #ifdef CONFIG_PCI_MSI | 466 | #ifdef CONFIG_PCI_MSI |
470 | sys->msi_ctrl = hw->msi_ctrl; | 467 | sys->msi_ctrl = hw->msi_ctrl; |
471 | #endif | 468 | #endif |
diff --git a/arch/arm/mach-cns3xxx/pcie.c b/arch/arm/mach-cns3xxx/pcie.c index 45d6bd09e6ef..f6bf9f623d70 100644 --- a/arch/arm/mach-cns3xxx/pcie.c +++ b/arch/arm/mach-cns3xxx/pcie.c | |||
@@ -30,18 +30,15 @@ struct cns3xxx_pcie { | |||
30 | unsigned int irqs[2]; | 30 | unsigned int irqs[2]; |
31 | struct resource res_io; | 31 | struct resource res_io; |
32 | struct resource res_mem; | 32 | struct resource res_mem; |
33 | struct hw_pci hw_pci; | 33 | int port; |
34 | |||
35 | bool linked; | 34 | bool linked; |
36 | }; | 35 | }; |
37 | 36 | ||
38 | static struct cns3xxx_pcie cns3xxx_pcie[]; /* forward decl. */ | ||
39 | |||
40 | static struct cns3xxx_pcie *sysdata_to_cnspci(void *sysdata) | 37 | static struct cns3xxx_pcie *sysdata_to_cnspci(void *sysdata) |
41 | { | 38 | { |
42 | struct pci_sys_data *root = sysdata; | 39 | struct pci_sys_data *root = sysdata; |
43 | 40 | ||
44 | return &cns3xxx_pcie[root->domain]; | 41 | return root->private_data; |
45 | } | 42 | } |
46 | 43 | ||
47 | static struct cns3xxx_pcie *pdev_to_cnspci(const struct pci_dev *dev) | 44 | static struct cns3xxx_pcie *pdev_to_cnspci(const struct pci_dev *dev) |
@@ -192,13 +189,7 @@ static struct cns3xxx_pcie cns3xxx_pcie[] = { | |||
192 | .flags = IORESOURCE_MEM, | 189 | .flags = IORESOURCE_MEM, |
193 | }, | 190 | }, |
194 | .irqs = { IRQ_CNS3XXX_PCIE0_RC, IRQ_CNS3XXX_PCIE0_DEVICE, }, | 191 | .irqs = { IRQ_CNS3XXX_PCIE0_RC, IRQ_CNS3XXX_PCIE0_DEVICE, }, |
195 | .hw_pci = { | 192 | .port = 0, |
196 | .domain = 0, | ||
197 | .nr_controllers = 1, | ||
198 | .ops = &cns3xxx_pcie_ops, | ||
199 | .setup = cns3xxx_pci_setup, | ||
200 | .map_irq = cns3xxx_pcie_map_irq, | ||
201 | }, | ||
202 | }, | 193 | }, |
203 | [1] = { | 194 | [1] = { |
204 | .host_regs = (void __iomem *)CNS3XXX_PCIE1_HOST_BASE_VIRT, | 195 | .host_regs = (void __iomem *)CNS3XXX_PCIE1_HOST_BASE_VIRT, |
@@ -217,19 +208,13 @@ static struct cns3xxx_pcie cns3xxx_pcie[] = { | |||
217 | .flags = IORESOURCE_MEM, | 208 | .flags = IORESOURCE_MEM, |
218 | }, | 209 | }, |
219 | .irqs = { IRQ_CNS3XXX_PCIE1_RC, IRQ_CNS3XXX_PCIE1_DEVICE, }, | 210 | .irqs = { IRQ_CNS3XXX_PCIE1_RC, IRQ_CNS3XXX_PCIE1_DEVICE, }, |
220 | .hw_pci = { | 211 | .port = 1, |
221 | .domain = 1, | ||
222 | .nr_controllers = 1, | ||
223 | .ops = &cns3xxx_pcie_ops, | ||
224 | .setup = cns3xxx_pci_setup, | ||
225 | .map_irq = cns3xxx_pcie_map_irq, | ||
226 | }, | ||
227 | }, | 212 | }, |
228 | }; | 213 | }; |
229 | 214 | ||
230 | static void __init cns3xxx_pcie_check_link(struct cns3xxx_pcie *cnspci) | 215 | static void __init cns3xxx_pcie_check_link(struct cns3xxx_pcie *cnspci) |
231 | { | 216 | { |
232 | int port = cnspci->hw_pci.domain; | 217 | int port = cnspci->port; |
233 | u32 reg; | 218 | u32 reg; |
234 | unsigned long time; | 219 | unsigned long time; |
235 | 220 | ||
@@ -260,9 +245,9 @@ static void __init cns3xxx_pcie_check_link(struct cns3xxx_pcie *cnspci) | |||
260 | 245 | ||
261 | static void __init cns3xxx_pcie_hw_init(struct cns3xxx_pcie *cnspci) | 246 | static void __init cns3xxx_pcie_hw_init(struct cns3xxx_pcie *cnspci) |
262 | { | 247 | { |
263 | int port = cnspci->hw_pci.domain; | 248 | int port = cnspci->port; |
264 | struct pci_sys_data sd = { | 249 | struct pci_sys_data sd = { |
265 | .domain = port, | 250 | .private_data = cnspci, |
266 | }; | 251 | }; |
267 | struct pci_bus bus = { | 252 | struct pci_bus bus = { |
268 | .number = 0, | 253 | .number = 0, |
@@ -323,6 +308,14 @@ static int cns3xxx_pcie_abort_handler(unsigned long addr, unsigned int fsr, | |||
323 | void __init cns3xxx_pcie_init_late(void) | 308 | void __init cns3xxx_pcie_init_late(void) |
324 | { | 309 | { |
325 | int i; | 310 | int i; |
311 | void *private_data; | ||
312 | struct hw_pci hw_pci = { | ||
313 | .nr_controllers = 1, | ||
314 | .ops = &cns3xxx_pcie_ops, | ||
315 | .setup = cns3xxx_pci_setup, | ||
316 | .map_irq = cns3xxx_pcie_map_irq, | ||
317 | .private_data = &private_data, | ||
318 | }; | ||
326 | 319 | ||
327 | pcibios_min_io = 0; | 320 | pcibios_min_io = 0; |
328 | pcibios_min_mem = 0; | 321 | pcibios_min_mem = 0; |
@@ -335,7 +328,8 @@ void __init cns3xxx_pcie_init_late(void) | |||
335 | cns3xxx_pwr_soft_rst(0x1 << PM_SOFT_RST_REG_OFFST_PCIE(i)); | 328 | cns3xxx_pwr_soft_rst(0x1 << PM_SOFT_RST_REG_OFFST_PCIE(i)); |
336 | cns3xxx_pcie_check_link(&cns3xxx_pcie[i]); | 329 | cns3xxx_pcie_check_link(&cns3xxx_pcie[i]); |
337 | cns3xxx_pcie_hw_init(&cns3xxx_pcie[i]); | 330 | cns3xxx_pcie_hw_init(&cns3xxx_pcie[i]); |
338 | pci_common_init(&cns3xxx_pcie[i].hw_pci); | 331 | private_data = &cns3xxx_pcie[i]; |
332 | pci_common_init(&hw_pci); | ||
339 | } | 333 | } |
340 | 334 | ||
341 | pci_assign_unassigned_resources(); | 335 | pci_assign_unassigned_resources(); |
diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c index ce5836c14ec1..6f93c24ca801 100644 --- a/arch/arm64/kernel/pci.c +++ b/arch/arm64/kernel/pci.c | |||
@@ -46,25 +46,3 @@ int pcibios_add_device(struct pci_dev *dev) | |||
46 | 46 | ||
47 | return 0; | 47 | return 0; |
48 | } | 48 | } |
49 | |||
50 | |||
51 | #ifdef CONFIG_PCI_DOMAINS_GENERIC | ||
52 | static bool dt_domain_found = false; | ||
53 | |||
54 | void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent) | ||
55 | { | ||
56 | int domain = of_get_pci_domain_nr(parent->of_node); | ||
57 | |||
58 | if (domain >= 0) { | ||
59 | dt_domain_found = true; | ||
60 | } else if (dt_domain_found == true) { | ||
61 | dev_err(parent, "Node %s is missing \"linux,pci-domain\" property in DT\n", | ||
62 | parent->of_node->full_name); | ||
63 | return; | ||
64 | } else { | ||
65 | domain = pci_get_new_domain_nr(); | ||
66 | } | ||
67 | |||
68 | bus->domain_nr = domain; | ||
69 | } | ||
70 | #endif | ||
diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c index 1dd759596b0a..1309cfbaa719 100644 --- a/drivers/pci/host/pci-mvebu.c +++ b/drivers/pci/host/pci-mvebu.c | |||
@@ -101,9 +101,7 @@ struct mvebu_pcie { | |||
101 | struct mvebu_pcie_port *ports; | 101 | struct mvebu_pcie_port *ports; |
102 | struct msi_controller *msi; | 102 | struct msi_controller *msi; |
103 | struct resource io; | 103 | struct resource io; |
104 | char io_name[30]; | ||
105 | struct resource realio; | 104 | struct resource realio; |
106 | char mem_name[30]; | ||
107 | struct resource mem; | 105 | struct resource mem; |
108 | struct resource busn; | 106 | struct resource busn; |
109 | int nports; | 107 | int nports; |
@@ -723,18 +721,9 @@ static int mvebu_pcie_setup(int nr, struct pci_sys_data *sys) | |||
723 | { | 721 | { |
724 | struct mvebu_pcie *pcie = sys_to_pcie(sys); | 722 | struct mvebu_pcie *pcie = sys_to_pcie(sys); |
725 | int i; | 723 | int i; |
726 | int domain = 0; | ||
727 | 724 | ||
728 | #ifdef CONFIG_PCI_DOMAINS | 725 | pcie->mem.name = "PCI MEM"; |
729 | domain = sys->domain; | 726 | pcie->realio.name = "PCI I/O"; |
730 | #endif | ||
731 | |||
732 | snprintf(pcie->mem_name, sizeof(pcie->mem_name), "PCI MEM %04x", | ||
733 | domain); | ||
734 | pcie->mem.name = pcie->mem_name; | ||
735 | |||
736 | snprintf(pcie->io_name, sizeof(pcie->io_name), "PCI I/O %04x", domain); | ||
737 | pcie->realio.name = pcie->io_name; | ||
738 | 727 | ||
739 | if (request_resource(&iomem_resource, &pcie->mem)) | 728 | if (request_resource(&iomem_resource, &pcie->mem)) |
740 | return 0; | 729 | return 0; |
diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c index df781cdf13c1..eef311115899 100644 --- a/drivers/pci/host/pcie-designware.c +++ b/drivers/pci/host/pcie-designware.c | |||
@@ -508,9 +508,6 @@ int __init dw_pcie_host_init(struct pcie_port *pp) | |||
508 | dw_pci.private_data = (void **)&pp; | 508 | dw_pci.private_data = (void **)&pp; |
509 | 509 | ||
510 | pci_common_init_dev(pp->dev, &dw_pci); | 510 | pci_common_init_dev(pp->dev, &dw_pci); |
511 | #ifdef CONFIG_PCI_DOMAINS | ||
512 | dw_pci.domain++; | ||
513 | #endif | ||
514 | 511 | ||
515 | return 0; | 512 | return 0; |
516 | } | 513 | } |
diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c index 748786c402fc..ba28078b70e3 100644 --- a/drivers/pci/host/pcie-rcar.c +++ b/drivers/pci/host/pcie-rcar.c | |||
@@ -397,9 +397,6 @@ static void rcar_pcie_enable(struct rcar_pcie *pcie) | |||
397 | #endif | 397 | #endif |
398 | 398 | ||
399 | pci_common_init_dev(&pdev->dev, &rcar_pci); | 399 | pci_common_init_dev(&pdev->dev, &rcar_pci); |
400 | #ifdef CONFIG_PCI_DOMAINS | ||
401 | rcar_pci.domain++; | ||
402 | #endif | ||
403 | } | 400 | } |
404 | 401 | ||
405 | static int phy_wait_for_ack(struct rcar_pcie *pcie) | 402 | static int phy_wait_for_ack(struct rcar_pcie *pcie) |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index cab05f31223f..c419554d0b4b 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -10,6 +10,8 @@ | |||
10 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
11 | #include <linux/delay.h> | 11 | #include <linux/delay.h> |
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/of.h> | ||
14 | #include <linux/of_pci.h> | ||
13 | #include <linux/pci.h> | 15 | #include <linux/pci.h> |
14 | #include <linux/pm.h> | 16 | #include <linux/pm.h> |
15 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
@@ -4439,6 +4441,53 @@ int pci_get_new_domain_nr(void) | |||
4439 | { | 4441 | { |
4440 | return atomic_inc_return(&__domain_nr); | 4442 | return atomic_inc_return(&__domain_nr); |
4441 | } | 4443 | } |
4444 | |||
4445 | #ifdef CONFIG_PCI_DOMAINS_GENERIC | ||
4446 | void pci_bus_assign_domain_nr(struct pci_bus *bus, struct device *parent) | ||
4447 | { | ||
4448 | static int use_dt_domains = -1; | ||
4449 | int domain = of_get_pci_domain_nr(parent->of_node); | ||
4450 | |||
4451 | /* | ||
4452 | * Check DT domain and use_dt_domains values. | ||
4453 | * | ||
4454 | * If DT domain property is valid (domain >= 0) and | ||
4455 | * use_dt_domains != 0, the DT assignment is valid since this means | ||
4456 | * we have not previously allocated a domain number by using | ||
4457 | * pci_get_new_domain_nr(); we should also update use_dt_domains to | ||
4458 | * 1, to indicate that we have just assigned a domain number from | ||
4459 | * DT. | ||
4460 | * | ||
4461 | * If DT domain property value is not valid (ie domain < 0), and we | ||
4462 | * have not previously assigned a domain number from DT | ||
4463 | * (use_dt_domains != 1) we should assign a domain number by | ||
4464 | * using the: | ||
4465 | * | ||
4466 | * pci_get_new_domain_nr() | ||
4467 | * | ||
4468 | * API and update the use_dt_domains value to keep track of method we | ||
4469 | * are using to assign domain numbers (use_dt_domains = 0). | ||
4470 | * | ||
4471 | * All other combinations imply we have a platform that is trying | ||
4472 | * to mix domain numbers obtained from DT and pci_get_new_domain_nr(), | ||
4473 | * which is a recipe for domain mishandling and it is prevented by | ||
4474 | * invalidating the domain value (domain = -1) and printing a | ||
4475 | * corresponding error. | ||
4476 | */ | ||
4477 | if (domain >= 0 && use_dt_domains) { | ||
4478 | use_dt_domains = 1; | ||
4479 | } else if (domain < 0 && use_dt_domains != 1) { | ||
4480 | use_dt_domains = 0; | ||
4481 | domain = pci_get_new_domain_nr(); | ||
4482 | } else { | ||
4483 | dev_err(parent, "Node %s has inconsistent \"linux,pci-domain\" property in DT\n", | ||
4484 | parent->of_node->full_name); | ||
4485 | domain = -1; | ||
4486 | } | ||
4487 | |||
4488 | bus->domain_nr = domain; | ||
4489 | } | ||
4490 | #endif | ||
4442 | #endif | 4491 | #endif |
4443 | 4492 | ||
4444 | /** | 4493 | /** |