From 9f3e03376fe86557893e0c45dfa8676b88e92b7e Mon Sep 17 00:00:00 2001 From: Marc Zyngier Date: Mon, 8 Dec 2014 17:52:45 +0000 Subject: device core: Introduce per-device MSI domain pointer As MSI-type features are creeping into non-PCI devices, it is starting to make sense to give our struct device some form of support for this, by allowing a pointer to an MSI irq domain to be set/retrieved. Signed-off-by: Marc Zyngier Signed-off-by: Jon Medhurst --- include/linux/device.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/linux/device.h b/include/linux/device.h index a2b4ea70a946..979182377cf2 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -714,6 +714,7 @@ struct device_dma_parameters { * along with subsystem-level and driver-level callbacks. * @pins: For device pin management. * See Documentation/pinctrl.txt for details. + * @msi_domain: The generic MSI domain this device is using. * @numa_node: NUMA node this device is close to. * @dma_mask: Dma mask (if dma'ble device). * @coherent_dma_mask: Like dma_mask, but for alloc_coherent mapping as not all @@ -774,6 +775,9 @@ struct device { struct dev_pm_info power; struct dev_pm_domain *pm_domain; +#ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN + struct irq_domain *msi_domain; /* MSI domain device uses */ +#endif #ifdef CONFIG_PINCTRL struct dev_pin_info *pins; #endif @@ -861,6 +865,22 @@ static inline void set_dev_node(struct device *dev, int node) } #endif +static inline struct irq_domain *dev_get_msi_domain(const struct device *dev) +{ +#ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN + return dev->msi_domain; +#else + return NULL; +#endif +} + +static inline void dev_set_msi_domain(struct device *dev, struct irq_domain *d) +{ +#ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN + dev->msi_domain = d; +#endif +} + static inline void *dev_get_drvdata(const struct device *dev) { return dev->driver_data; -- cgit v1.2.3 From eb1c6f942d4f11704521fc5e14aa5ed574980b91 Mon Sep 17 00:00:00 2001 From: Marc Zyngier Date: Mon, 8 Dec 2014 18:38:09 +0000 Subject: PCI/MSI: Add hooks to populate the msi_domain field In order to be able to populate the device msi_domain field, add the necesary hooks to propagate the PHB msi_domain across secondary busses to devices. So far, nobody populates the initial msi_domain. Signed-off-by: Marc Zyngier Signed-off-by: Jon Medhurst --- drivers/pci/probe.c | 30 ++++++++++++++++++++++++++++++ include/linux/pci.h | 1 + 2 files changed, 31 insertions(+) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index cefd636681b6..fa0ccca730bb 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -661,6 +661,20 @@ static void pci_set_bus_speed(struct pci_bus *bus) } } +void __weak pcibios_set_phb_msi_domain(struct pci_bus *bus) +{ +} + +static void pci_set_bus_msi_domain(struct pci_bus *bus) +{ + struct pci_dev *bridge = bus->self; + + if (!bridge) + pcibios_set_phb_msi_domain(bus); + else + dev_set_msi_domain(&bus->dev, dev_get_msi_domain(&bridge->dev)); +} + static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent, struct pci_dev *bridge, int busnr) { @@ -714,6 +728,7 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent, bridge->subordinate = child; add_dev: + pci_set_bus_msi_domain(child); ret = device_register(&child->dev); WARN_ON(ret < 0); @@ -1544,6 +1559,17 @@ static void pci_init_capabilities(struct pci_dev *dev) pci_enable_acs(dev); } +static void pci_set_msi_domain(struct pci_dev *dev) +{ + /* + * If no domain has been set through the pcibios callback, + * inherit the default from the bus device. + */ + if (!dev_get_msi_domain(&dev->dev)) + dev_set_msi_domain(&dev->dev, + dev_get_msi_domain(&dev->bus->dev)); +} + void pci_device_add(struct pci_dev *dev, struct pci_bus *bus) { int ret; @@ -1585,6 +1611,9 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus) ret = pcibios_add_device(dev); WARN_ON(ret < 0); + /* Setup MSI irq domain */ + pci_set_msi_domain(dev); + /* Notifier could use PCI capabilities */ dev->match_driver = false; ret = device_add(&dev->dev); @@ -1975,6 +2004,7 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus, b->bridge = get_device(&bridge->dev); device_enable_async_suspend(b->bridge); pci_set_bus_of_node(b); + pci_set_bus_msi_domain(b); if (!parent) set_dev_node(b->bridge, pcibus_to_node(b)); diff --git a/include/linux/pci.h b/include/linux/pci.h index 8a0321a8fb59..b19c2c269546 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1645,6 +1645,7 @@ int pcibios_set_pcie_reset_state(struct pci_dev *dev, int pcibios_add_device(struct pci_dev *dev); void pcibios_release_device(struct pci_dev *dev); void pcibios_penalize_isa_irq(int irq, int active); +void pcibios_set_phb_msi_domain(struct pci_bus *bus); #ifdef CONFIG_HIBERNATE_CALLBACKS extern struct dev_pm_ops pcibios_pm_ops; -- cgit v1.2.3 From 7c24c3f3dcd27149852215770d7f6c2e111d2fd0 Mon Sep 17 00:00:00 2001 From: Marc Zyngier Date: Mon, 8 Dec 2014 18:49:34 +0000 Subject: PCI/MSI: of: Add support for OF-provided msi_domain In order to populate the PHB msi_domain, use the "msi-parent" attribute to lookup a corresponding irq domain. If found, this is our MSI domain. This gets plugged into the core PCI code. Signed-off-by: Marc Zyngier Signed-off-by: Jon Medhurst --- drivers/pci/of.c | 15 +++++++++++++++ drivers/pci/probe.c | 1 + include/linux/pci.h | 2 ++ 3 files changed, 18 insertions(+) diff --git a/drivers/pci/of.c b/drivers/pci/of.c index f0929934bb7a..d8d12742e11e 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -9,6 +9,7 @@ * 2 of the License, or (at your option) any later version. */ +#include #include #include #include @@ -59,3 +60,17 @@ struct device_node * __weak pcibios_get_phb_of_node(struct pci_bus *bus) return of_node_get(bus->bridge->parent->of_node); return NULL; } + +void pci_set_phb_of_msi_domain(struct pci_bus *bus) +{ +#ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN + struct device_node *np; + + if (!bus->dev.of_node) + return; + np = of_parse_phandle(bus->dev.of_node, "msi-parent", 0); + if (!np) + return; + dev_set_msi_domain(&bus->dev, irq_find_host(np)); +#endif +} diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index fa0ccca730bb..90281f5e03ca 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -663,6 +663,7 @@ static void pci_set_bus_speed(struct pci_bus *bus) void __weak pcibios_set_phb_msi_domain(struct pci_bus *bus) { + pci_set_phb_of_msi_domain(bus); } static void pci_set_bus_msi_domain(struct pci_bus *bus) diff --git a/include/linux/pci.h b/include/linux/pci.h index b19c2c269546..1026af534e1a 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1847,6 +1847,7 @@ void pci_set_of_node(struct pci_dev *dev); void pci_release_of_node(struct pci_dev *dev); void pci_set_bus_of_node(struct pci_bus *bus); void pci_release_bus_of_node(struct pci_bus *bus); +void pci_set_phb_of_msi_domain(struct pci_bus *bus); /* Arch may override this (weak) */ struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus); @@ -1869,6 +1870,7 @@ static inline void pci_set_bus_of_node(struct pci_bus *bus) { } static inline void pci_release_bus_of_node(struct pci_bus *bus) { } static inline struct device_node * pci_device_to_OF_node(const struct pci_dev *pdev) { return NULL; } +static inline void pci_set_phb_of_msi_domain(struct pci_bus *bus) {} #endif /* CONFIG_OF */ #ifdef CONFIG_EEH -- cgit v1.2.3 From c16633477d3c0c6698890d4076aef77f97710a5f Mon Sep 17 00:00:00 2001 From: Marc Zyngier Date: Wed, 10 Dec 2014 17:30:59 +0000 Subject: PCI/MSI: of: Allow msi_domain lookup using the PHB node A number of platforms do not need to use the msi-parent property, as the host bridge itself provides the MSI controller. Allow this configuration by performing an irq domain lookup based on the PHB node if it doesn't have a valid msi-parent property. Signed-off-by: Marc Zyngier Signed-off-by: Jon Medhurst --- drivers/pci/of.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/pci/of.c b/drivers/pci/of.c index d8d12742e11e..75bfb854337e 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -68,9 +68,14 @@ void pci_set_phb_of_msi_domain(struct pci_bus *bus) if (!bus->dev.of_node) return; + /* Start looking for a phandle to an MSI controller. */ np = of_parse_phandle(bus->dev.of_node, "msi-parent", 0); + /* + * If we don't have an msi-parent property, look for a domain + * directly attached to the host bridge. + */ if (!np) - return; + np = bus->dev.of_node; dev_set_msi_domain(&bus->dev, irq_find_host(np)); #endif } -- cgit v1.2.3 From fbfb67d00a6ef583dc674fcf13a84b417d185ab4 Mon Sep 17 00:00:00 2001 From: Marc Zyngier Date: Mon, 8 Dec 2014 18:54:14 +0000 Subject: PCI/MSI: Let pci_msi_get_domain use struct device's msi_domain Now that we can easily find which MSI domain a PCI device is using, use dev_get_msi_domain as a way to retrieve the information. The original code is still used as a fallback. Signed-off-by: Marc Zyngier Signed-off-by: Jon Medhurst --- drivers/pci/msi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index f66be868ad21..f27402170b9f 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -41,7 +41,8 @@ static struct irq_domain *pci_msi_get_domain(struct pci_dev *dev) { struct irq_domain *domain = NULL; - if (dev->bus->msi) + domain = dev_get_msi_domain(&dev->dev); + if (!domain && dev->bus->msi) domain = dev->bus->msi->domain; if (!domain) domain = arch_get_pci_msi_domain(dev); -- cgit v1.2.3 From 8993a237058acb2f63c45f768bad068423205cdf Mon Sep 17 00:00:00 2001 From: Marc Zyngier Date: Mon, 8 Dec 2014 18:58:30 +0000 Subject: irqchip: GICv2m: Get rid of struct msi_controller GICv2m only uses the msi_controller structure as a way to match the PHB with its MSI HW, and thus the msi_domain. But now that we can directly associate an msi_domain with a device, there is no use keeping this msi_controller around. Just remove all traces of msi_controller from the driver. Signed-off-by: Marc Zyngier Signed-off-by: Jon Medhurst --- drivers/irqchip/irq-gic-v2m.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/drivers/irqchip/irq-gic-v2m.c b/drivers/irqchip/irq-gic-v2m.c index fdf706555d72..a76b802eb3f8 100644 --- a/drivers/irqchip/irq-gic-v2m.c +++ b/drivers/irqchip/irq-gic-v2m.c @@ -45,7 +45,6 @@ struct v2m_data { spinlock_t msi_cnt_lock; - struct msi_controller mchip; struct resource res; /* GICv2m resource */ void __iomem *base; /* GICv2m virt address */ u32 spi_start; /* The SPI number that MSIs start */ @@ -218,6 +217,7 @@ static int __init gicv2m_init_one(struct device_node *node, { int ret; struct v2m_data *v2m; + struct irq_domain *inner_domain; v2m = kzalloc(sizeof(struct v2m_data), GFP_KERNEL); if (!v2m) { @@ -261,19 +261,17 @@ static int __init gicv2m_init_one(struct device_node *node, goto err_iounmap; } - v2m->domain = irq_domain_add_tree(NULL, &gicv2m_domain_ops, v2m); - if (!v2m->domain) { + inner_domain = irq_domain_add_tree(NULL, &gicv2m_domain_ops, v2m); + if (!inner_domain) { pr_err("Failed to create GICv2m domain\n"); ret = -ENOMEM; goto err_free_bm; } - v2m->domain->parent = parent; - v2m->mchip.of_node = node; - v2m->mchip.domain = pci_msi_create_irq_domain(node, - &gicv2m_msi_domain_info, - v2m->domain); - if (!v2m->mchip.domain) { + inner_domain->parent = parent; + v2m->domain = pci_msi_create_irq_domain(node, &gicv2m_msi_domain_info, + inner_domain); + if (!v2m->domain) { pr_err("Failed to create MSI domain\n"); ret = -ENOMEM; goto err_free_domains; @@ -281,12 +279,6 @@ static int __init gicv2m_init_one(struct device_node *node, spin_lock_init(&v2m->msi_cnt_lock); - ret = of_pci_msi_chip_add(&v2m->mchip); - if (ret) { - pr_err("Failed to add msi_chip.\n"); - goto err_free_domains; - } - pr_info("Node %s: range[%#lx:%#lx], SPI[%d:%d]\n", node->name, (unsigned long)v2m->res.start, (unsigned long)v2m->res.end, v2m->spi_start, (v2m->spi_start + v2m->nr_spis)); @@ -294,10 +286,10 @@ static int __init gicv2m_init_one(struct device_node *node, return 0; err_free_domains: - if (v2m->mchip.domain) - irq_domain_remove(v2m->mchip.domain); if (v2m->domain) irq_domain_remove(v2m->domain); + if (inner_domain) + irq_domain_remove(inner_domain); err_free_bm: kfree(v2m->bm); err_iounmap: -- cgit v1.2.3 From ca6d572279825b6f7692a3708923a17c596b48bb Mon Sep 17 00:00:00 2001 From: Marc Zyngier Date: Mon, 8 Dec 2014 18:58:30 +0000 Subject: irqchip: gicv3-its: Get rid of struct msi_controller The GICv3 ITS only uses the msi_controller structure as a way to match the PHB with its MSI HW, and thus the msi_domain. But now that we can directly associate an msi_domain with a device, there is no use keeping this msi_controller around. Just remove all traces of msi_controller from the driver. Signed-off-by: Marc Zyngier Signed-off-by: Jon Medhurst --- drivers/irqchip/irq-gic-v3-its.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index c00e2db351ba..ed7dfb5320ba 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -54,13 +54,12 @@ struct its_collection { /* * The ITS structure - contains most of the infrastructure, with the - * msi_controller, the command queue, the collections, and the list of - * devices writing to it. + * top-level MSI domain, the command queue, the collections, and the + * list of devices writing to it. */ struct its_node { raw_spinlock_t lock; struct list_head entry; - struct msi_controller msi_chip; struct irq_domain *domain; void __iomem *base; unsigned long phys_base; @@ -874,7 +873,7 @@ static int its_alloc_tables(struct its_node *its) if (order >= MAX_ORDER) { order = MAX_ORDER - 1; pr_warn("%s: Device Table too large, reduce its page order to %u\n", - its->msi_chip.of_node->full_name, order); + its->domain->of_node->full_name, order); } } @@ -944,7 +943,7 @@ retry_baser: if (val != tmp) { pr_err("ITS: %s: GITS_BASER%d doesn't stick: %lx %lx\n", - its->msi_chip.of_node->full_name, i, + its->domain->of_node->full_name, i, (unsigned long) val, (unsigned long) tmp); err = -ENXIO; goto out_free; @@ -1426,6 +1425,7 @@ static int its_probe(struct device_node *node, struct irq_domain *parent) struct resource res; struct its_node *its; void __iomem *its_base; + struct irq_domain *inner_domain = NULL; u32 val; u64 baser, tmp; int err; @@ -1469,7 +1469,6 @@ static int its_probe(struct device_node *node, struct irq_domain *parent) INIT_LIST_HEAD(&its->its_device_list); its->base = its_base; its->phys_base = res.start; - its->msi_chip.of_node = node; its->ite_size = ((readl_relaxed(its_base + GITS_TYPER) >> 4) & 0xf) + 1; its->cmd_base = kzalloc(ITS_CMD_QUEUE_SZ, GFP_KERNEL); @@ -1515,7 +1514,7 @@ static int its_probe(struct device_node *node, struct irq_domain *parent) writeq_relaxed(0, its->base + GITS_CWRITER); writel_relaxed(GITS_CTLR_ENABLE, its->base + GITS_CTLR); - if (of_property_read_bool(its->msi_chip.of_node, "msi-controller")) { + if (of_property_read_bool(its->domain->of_node, "msi-controller")) { its->domain = irq_domain_add_tree(NULL, &its_domain_ops, its); if (!its->domain) { err = -ENOMEM; @@ -1524,17 +1523,13 @@ static int its_probe(struct device_node *node, struct irq_domain *parent) its->domain->parent = parent; - its->msi_chip.domain = pci_msi_create_irq_domain(node, - &its_pci_msi_domain_info, - its->domain); - if (!its->msi_chip.domain) { + its->domain = pci_msi_create_irq_domain(node, + &its_pci_msi_domain_info, + inner_domain); + if (!its->domain) { err = -ENOMEM; goto out_free_domains; } - - err = of_pci_msi_chip_add(&its->msi_chip); - if (err) - goto out_free_domains; } spin_lock(&its_lock); @@ -1544,8 +1539,6 @@ static int its_probe(struct device_node *node, struct irq_domain *parent) return 0; out_free_domains: - if (its->msi_chip.domain) - irq_domain_remove(its->msi_chip.domain); if (its->domain) irq_domain_remove(its->domain); out_free_tables: -- cgit v1.2.3 From 543665c8ee5fdac50a11018d24f331e50fadd7d5 Mon Sep 17 00:00:00 2001 From: Marc Zyngier Date: Wed, 10 Dec 2014 13:38:13 +0000 Subject: PCI/MSI: Drop domain field from msi_controller The only two users of that field are not using the msi_controller structure anymore, so drop it altogether. Signed-off-by: Marc Zyngier Signed-off-by: Jon Medhurst --- drivers/pci/msi.c | 2 -- include/linux/msi.h | 3 --- 2 files changed, 5 deletions(-) diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index f27402170b9f..43bfb3c08092 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -42,8 +42,6 @@ static struct irq_domain *pci_msi_get_domain(struct pci_dev *dev) struct irq_domain *domain = NULL; domain = dev_get_msi_domain(&dev->dev); - if (!domain && dev->bus->msi) - domain = dev->bus->msi->domain; if (!domain) domain = arch_get_pci_msi_domain(dev); diff --git a/include/linux/msi.h b/include/linux/msi.h index 8ac4a68ffae2..692f217ae813 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h @@ -108,9 +108,6 @@ struct msi_controller { struct device *dev; struct device_node *of_node; struct list_head list; -#ifdef CONFIG_GENERIC_MSI_IRQ_DOMAIN - struct irq_domain *domain; -#endif int (*setup_irq)(struct msi_controller *chip, struct pci_dev *dev, struct msi_desc *desc); -- cgit v1.2.3 From 50364379615bef4f6f0f3d74d965e3f1f01285b8 Mon Sep 17 00:00:00 2001 From: Jayachandran C Date: Tue, 19 May 2015 16:11:04 +0100 Subject: PCI: generic: remove dependency on hw_pci The current code in pci-host-generic.c uses pci_common_init_dev() from the arch/arm/ to do a part of the PCI initialization, and this prevents it from being used on arm64. The initialization done by pci_common_init_dev() that is really needed by pci-host-generic.c can be done in the same file without using the hw_pci API of ARM. The ARM platform requires a pci_sys_data as sysdata for the PCI bus, this is be handled by setting up 'struct gen_pci' to embed a pci_sys_data variable as the first element on the ARM platform. Signed-off-by: Jayachandran C Signed-off-by: Jon Medhurst --- drivers/pci/host/pci-host-generic.c | 49 ++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/drivers/pci/host/pci-host-generic.c b/drivers/pci/host/pci-host-generic.c index ba46e581db99..1631d34f500f 100644 --- a/drivers/pci/host/pci-host-generic.c +++ b/drivers/pci/host/pci-host-generic.c @@ -39,6 +39,9 @@ struct gen_pci_cfg_windows { }; struct gen_pci { +#ifdef CONFIG_ARM + struct pci_sys_data sys; +#endif struct pci_host_bridge host; struct gen_pci_cfg_windows cfg; struct list_head resources; @@ -48,8 +51,7 @@ static void __iomem *gen_pci_map_cfg_bus_cam(struct pci_bus *bus, unsigned int devfn, int where) { - struct pci_sys_data *sys = bus->sysdata; - struct gen_pci *pci = sys->private_data; + struct gen_pci *pci = bus->sysdata; resource_size_t idx = bus->number - pci->cfg.bus_range->start; return pci->cfg.win[idx] + ((devfn << 8) | where); @@ -64,8 +66,7 @@ static void __iomem *gen_pci_map_cfg_bus_ecam(struct pci_bus *bus, unsigned int devfn, int where) { - struct pci_sys_data *sys = bus->sysdata; - struct gen_pci *pci = sys->private_data; + struct gen_pci *pci = bus->sysdata; resource_size_t idx = bus->number - pci->cfg.bus_range->start; return pci->cfg.win[idx] + ((devfn << 12) | where); @@ -198,11 +199,33 @@ static int gen_pci_parse_map_cfg_windows(struct gen_pci *pci) return 0; } -static int gen_pci_setup(int nr, struct pci_sys_data *sys) +static int gen_pci_init(struct device *dev, struct gen_pci *pci) { - struct gen_pci *pci = sys->private_data; - list_splice_init(&pci->resources, &sys->resources); - return 1; + struct pci_bus *bus; + + pci_add_flags(PCI_REASSIGN_ALL_RSRC); + + bus = pci_scan_root_bus(dev, 0, &gen_pci_ops, pci, &pci->resources); + if (!bus) { + dev_err(dev, "Scanning rootbus failed"); + return -ENODEV; + } + pci_fixup_irqs(pci_common_swizzle, of_irq_parse_and_map_pci); + + if (!pci_has_flag(PCI_PROBE_ONLY)) { + pci_bus_size_bridges(bus); + pci_bus_assign_resources(bus); + } + pci_bus_add_devices(bus); + + /* Configure PCI Express settings */ + if (pci_has_flag(PCI_PROBE_ONLY)) { + struct pci_bus *child; + + list_for_each_entry(child, &bus->children, node) + pcie_bus_configure_settings(child); + } + return 0; } static int gen_pci_probe(struct platform_device *pdev) @@ -214,13 +237,6 @@ static int gen_pci_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; struct gen_pci *pci = devm_kzalloc(dev, sizeof(*pci), GFP_KERNEL); - struct hw_pci hw = { - .nr_controllers = 1, - .private_data = (void **)&pci, - .setup = gen_pci_setup, - .map_irq = of_irq_parse_and_map_pci, - .ops = &gen_pci_ops, - }; if (!pci) return -ENOMEM; @@ -258,8 +274,7 @@ static int gen_pci_probe(struct platform_device *pdev) return err; } - pci_common_init_dev(dev, &hw); - return 0; + return gen_pci_init(dev, pci); } static struct platform_driver gen_pci_driver = { -- cgit v1.2.3 From f9522d59d15c2e66c269200e794fd15e12cefb14 Mon Sep 17 00:00:00 2001 From: Jayachandran C Date: Tue, 19 May 2015 16:12:21 +0100 Subject: PCI: generic: add arm64 support Make pci-host-generic driver available on arm64. This needs drivers/pci/setup-irq.o to be built for the arm64 as well. Signed-off-by: Jayachandran C Signed-off-by: Jon Medhurst --- drivers/pci/Makefile | 1 + drivers/pci/host/Kconfig | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pci/Makefile b/drivers/pci/Makefile index 73e4af400a5a..be3f631c3f75 100644 --- a/drivers/pci/Makefile +++ b/drivers/pci/Makefile @@ -33,6 +33,7 @@ obj-$(CONFIG_PCI_IOV) += iov.o # obj-$(CONFIG_ALPHA) += setup-irq.o obj-$(CONFIG_ARM) += setup-irq.o +obj-$(CONFIG_ARM64) += setup-irq.o obj-$(CONFIG_UNICORE32) += setup-irq.o obj-$(CONFIG_SUPERH) += setup-irq.o obj-$(CONFIG_MIPS) += setup-irq.o diff --git a/drivers/pci/host/Kconfig b/drivers/pci/host/Kconfig index c132bddc03f3..675c2d1ef887 100644 --- a/drivers/pci/host/Kconfig +++ b/drivers/pci/host/Kconfig @@ -53,7 +53,7 @@ config PCI_RCAR_GEN2_PCIE config PCI_HOST_GENERIC bool "Generic PCI host controller" - depends on ARM && OF + depends on (ARM || ARM64) && OF help Say Y here if you want to support a simple generic PCI host controller, such as the one emulated by kvmtool. -- cgit v1.2.3 From 7d53c0509545fbf18e47f43f2d81e297d36b6702 Mon Sep 17 00:00:00 2001 From: Liviu Dudau Date: Wed, 25 Feb 2015 18:44:02 +0000 Subject: sky2: Add module parameter for passing the MAC address For designs where EEPROMs are not connected to PCI Yukon2 chips we need to get the MAC address from the firmware. Add a module parameter called 'mac_address' for this. It will be used if no DT node can be found and the B2_MAC register holds an invalid value. Signed-off-by: Liviu Dudau Signed-off-by: Jon Medhurst --- drivers/net/ethernet/marvell/sky2.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c index d9f4498832a1..a977d9574623 100644 --- a/drivers/net/ethernet/marvell/sky2.c +++ b/drivers/net/ethernet/marvell/sky2.c @@ -101,6 +101,10 @@ static int legacy_pme = 0; module_param(legacy_pme, int, 0); MODULE_PARM_DESC(legacy_pme, "Legacy power management"); +/* Ugh! Let the firmware tell us the hardware address */ +static int mac_address[ETH_ALEN] = { 0, }; +module_param_array(mac_address, int, NULL, 0); + static const struct pci_device_id sky2_id_table[] = { { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) }, /* SK-9Sxx */ { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) }, /* SK-9Exx */ @@ -4811,13 +4815,21 @@ static struct net_device *sky2_init_netdev(struct sky2_hw *hw, unsigned port, /* try to get mac address in the following order: * 1) from device tree data * 2) from internal registers set by bootloader + * 3) from the command line parameter */ iap = of_get_mac_address(hw->pdev->dev.of_node); if (iap) memcpy(dev->dev_addr, iap, ETH_ALEN); - else + else { memcpy_fromio(dev->dev_addr, hw->regs + B2_MAC_1 + port * 8, ETH_ALEN); + if (!is_valid_ether_addr(&dev->dev_addr[0])) { + int i; + + for (i = 0; i < ETH_ALEN; i++) + dev->dev_addr[i] = mac_address[i]; + } + } return dev; } -- cgit v1.2.3