From: Rafał Miłecki Date: Tue, 19 Jan 2016 20:58:48 +0000 (+0000) Subject: bcm53xx: group iProc patches into patchsets they were sent in X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=1dfa369c98075302400f46cd2b410d32a5ef68d6;p=openwrt%2Fstaging%2Fblocktrron.git bcm53xx: group iProc patches into patchsets they were sent in Signed-off-by: Rafał Miłecki SVN-Revision: 48368 --- diff --git a/target/linux/bcm53xx/patches-4.1/030-0001-PCI-iproc-Allow-override-of-device-tree-IRQ-mapping-.patch b/target/linux/bcm53xx/patches-4.1/030-0001-PCI-iproc-Allow-override-of-device-tree-IRQ-mapping-.patch new file mode 100644 index 0000000000..9050f72451 --- /dev/null +++ b/target/linux/bcm53xx/patches-4.1/030-0001-PCI-iproc-Allow-override-of-device-tree-IRQ-mapping-.patch @@ -0,0 +1,53 @@ +From c1e02ceaf5739d32f092ac07bf886a0281ec40b1 Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Tue, 12 May 2015 23:23:00 +0200 +Subject: [PATCH 1/2] PCI: iproc: Allow override of device tree IRQ mapping + function + +The iProc core PCIe driver defaults to using of_irq_parse_and_map_pci() for +IRQ mapping. Add iproc_pcie.map_irq so bus interfaces that don't use +device tree can override this by supplying their own IRQ mapping function. + +[bhelgaas: changelog] +Posting: http://lkml.kernel.org/r/1431465781-10753-1-git-send-email-hauke@hauke-m.de +Signed-off-by: Hauke Mehrtens +Signed-off-by: Bjorn Helgaas +Reviewed-by: Ray Jui +--- + drivers/pci/host/pcie-iproc-platform.c | 2 ++ + drivers/pci/host/pcie-iproc.c | 2 +- + drivers/pci/host/pcie-iproc.h | 1 + + 3 files changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/pci/host/pcie-iproc-platform.c ++++ b/drivers/pci/host/pcie-iproc-platform.c +@@ -71,6 +71,8 @@ static int iproc_pcie_pltfm_probe(struct + + pcie->resources = &res; + ++ pcie->map_irq = of_irq_parse_and_map_pci; ++ + ret = iproc_pcie_setup(pcie); + if (ret) { + dev_err(pcie->dev, "PCIe controller setup failed\n"); +--- a/drivers/pci/host/pcie-iproc.c ++++ b/drivers/pci/host/pcie-iproc.c +@@ -229,7 +229,7 @@ int iproc_pcie_setup(struct iproc_pcie * + + pci_scan_child_bus(bus); + pci_assign_unassigned_bus_resources(bus); +- pci_fixup_irqs(pci_common_swizzle, of_irq_parse_and_map_pci); ++ pci_fixup_irqs(pci_common_swizzle, pcie->map_irq); + pci_bus_add_devices(bus); + + return 0; +--- a/drivers/pci/host/pcie-iproc.h ++++ b/drivers/pci/host/pcie-iproc.h +@@ -34,6 +34,7 @@ struct iproc_pcie { + struct pci_bus *root_bus; + struct phy *phy; + int irqs[IPROC_PCIE_MAX_NUM_IRQS]; ++ int (*map_irq)(const struct pci_dev *, u8, u8); + }; + + int iproc_pcie_setup(struct iproc_pcie *pcie); diff --git a/target/linux/bcm53xx/patches-4.1/030-0002-PCI-iproc-Add-BCMA-PCIe-driver.patch b/target/linux/bcm53xx/patches-4.1/030-0002-PCI-iproc-Add-BCMA-PCIe-driver.patch new file mode 100644 index 0000000000..a850bafd1b --- /dev/null +++ b/target/linux/bcm53xx/patches-4.1/030-0002-PCI-iproc-Add-BCMA-PCIe-driver.patch @@ -0,0 +1,177 @@ +From 4785ffbdc9b52e308e43b9e2dcc1dca44f056d76 Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Tue, 12 May 2015 23:23:01 +0200 +Subject: [PATCH 2/2] PCI: iproc: Add BCMA PCIe driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This driver adds support for the PCIe 2.0 controller found on the BCMA bus. +This controller can be found on (mostly) all Broadcom BCM470X / BCM5301X +ARM SoCs. + +The driver found in the Broadcom SDK does some more stuff, like setting up +some DMA memory areas, chaining MPS and MRRS to 512 and also some PHY +changes like "improving" the PCIe jitter and doing some special +initialization for the 3rd PCIe port. + +This was tested on a bcm4708 board with 2 PCIe ports and wireless cards +connected to them. + +PCI_DOMAINS is needed by this driver, because normally there is more than +one PCIe controller and without PCI_DOMAINS only the first controller gets +registered. This controller gets 6 IRQs; the last one is trigged by all +IRQ events. + +[bhelgaas: fix "GPLv2" MODULE_LICENSE typo] +Signed-off-by: Hauke Mehrtens +Signed-off-by: Bjorn Helgaas +Acked-by: Rafał Miłecki +Acked-by: Ray Jui +--- + drivers/pci/host/Kconfig | 11 ++++ + drivers/pci/host/Makefile | 1 + + drivers/pci/host/pcie-iproc-bcma.c | 112 +++++++++++++++++++++++++++++++++++++ + 3 files changed, 124 insertions(+) + create mode 100644 drivers/pci/host/pcie-iproc-bcma.c + +--- a/drivers/pci/host/Kconfig ++++ b/drivers/pci/host/Kconfig +@@ -125,4 +125,15 @@ config PCIE_IPROC_PLATFORM + Say Y here if you want to use the Broadcom iProc PCIe controller + through the generic platform bus interface + ++config PCIE_IPROC_BCMA ++ bool "Broadcom iProc PCIe BCMA bus driver" ++ depends on ARCH_BCM_IPROC || (ARM && COMPILE_TEST) ++ select PCIE_IPROC ++ select BCMA ++ select PCI_DOMAINS ++ default ARCH_BCM_5301X ++ help ++ Say Y here if you want to use the Broadcom iProc PCIe controller ++ through the BCMA bus interface ++ + endmenu +--- a/drivers/pci/host/Makefile ++++ b/drivers/pci/host/Makefile +@@ -15,3 +15,4 @@ obj-$(CONFIG_PCI_LAYERSCAPE) += pci-laye + obj-$(CONFIG_PCI_VERSATILE) += pci-versatile.o + obj-$(CONFIG_PCIE_IPROC) += pcie-iproc.o + obj-$(CONFIG_PCIE_IPROC_PLATFORM) += pcie-iproc-platform.o ++obj-$(CONFIG_PCIE_IPROC_BCMA) += pcie-iproc-bcma.o +--- /dev/null ++++ b/drivers/pci/host/pcie-iproc-bcma.c +@@ -0,0 +1,112 @@ ++/* ++ * Copyright (C) 2015 Broadcom Corporation ++ * Copyright (C) 2015 Hauke Mehrtens ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License as ++ * published by the Free Software Foundation version 2. ++ * ++ * This program is distributed "as is" WITHOUT ANY WARRANTY of any ++ * kind, whether express or implied; without even the implied warranty ++ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "pcie-iproc.h" ++ ++ ++/* NS: CLASS field is R/O, and set to wrong 0x200 value */ ++static void bcma_pcie2_fixup_class(struct pci_dev *dev) ++{ ++ dev->class = PCI_CLASS_BRIDGE_PCI << 8; ++} ++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM, 0x8011, bcma_pcie2_fixup_class); ++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM, 0x8012, bcma_pcie2_fixup_class); ++ ++static int iproc_pcie_bcma_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) ++{ ++ struct pci_sys_data *sys = dev->sysdata; ++ struct iproc_pcie *pcie = sys->private_data; ++ struct bcma_device *bdev = container_of(pcie->dev, struct bcma_device, dev); ++ ++ return bcma_core_irq(bdev, 5); ++} ++ ++static int iproc_pcie_bcma_probe(struct bcma_device *bdev) ++{ ++ struct iproc_pcie *pcie; ++ LIST_HEAD(res); ++ struct resource res_mem; ++ int ret; ++ ++ pcie = devm_kzalloc(&bdev->dev, sizeof(*pcie), GFP_KERNEL); ++ if (!pcie) ++ return -ENOMEM; ++ ++ pcie->dev = &bdev->dev; ++ bcma_set_drvdata(bdev, pcie); ++ ++ pcie->base = bdev->io_addr; ++ ++ res_mem.start = bdev->addr_s[0]; ++ res_mem.end = bdev->addr_s[0] + SZ_128M - 1; ++ res_mem.name = "PCIe MEM space"; ++ res_mem.flags = IORESOURCE_MEM; ++ pci_add_resource(&res, &res_mem); ++ ++ pcie->resources = &res; ++ ++ pcie->map_irq = iproc_pcie_bcma_map_irq; ++ ++ ret = iproc_pcie_setup(pcie); ++ if (ret) { ++ dev_err(pcie->dev, "PCIe controller setup failed\n"); ++ return ret; ++ } ++ ++ return 0; ++} ++ ++static void iproc_pcie_bcma_remove(struct bcma_device *bdev) ++{ ++ struct iproc_pcie *pcie = bcma_get_drvdata(bdev); ++ ++ iproc_pcie_remove(pcie); ++} ++ ++static const struct bcma_device_id iproc_pcie_bcma_table[] = { ++ BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_NS_PCIEG2, BCMA_ANY_REV, BCMA_ANY_CLASS), ++ {}, ++}; ++MODULE_DEVICE_TABLE(bcma, iproc_pcie_bcma_table); ++ ++static struct bcma_driver iproc_pcie_bcma_driver = { ++ .name = KBUILD_MODNAME, ++ .id_table = iproc_pcie_bcma_table, ++ .probe = iproc_pcie_bcma_probe, ++ .remove = iproc_pcie_bcma_remove, ++}; ++ ++static int __init iproc_pcie_bcma_init(void) ++{ ++ return bcma_driver_register(&iproc_pcie_bcma_driver); ++} ++module_init(iproc_pcie_bcma_init); ++ ++static void __exit iproc_pcie_bcma_exit(void) ++{ ++ bcma_driver_unregister(&iproc_pcie_bcma_driver); ++} ++module_exit(iproc_pcie_bcma_exit); ++ ++MODULE_AUTHOR("Hauke Mehrtens"); ++MODULE_DESCRIPTION("Broadcom iProc PCIe BCMA driver"); ++MODULE_LICENSE("GPL v2"); diff --git a/target/linux/bcm53xx/patches-4.1/030-PCI-iproc-Allow-override-of-device-tree-IRQ-mapping-.patch b/target/linux/bcm53xx/patches-4.1/030-PCI-iproc-Allow-override-of-device-tree-IRQ-mapping-.patch deleted file mode 100644 index 9050f72451..0000000000 --- a/target/linux/bcm53xx/patches-4.1/030-PCI-iproc-Allow-override-of-device-tree-IRQ-mapping-.patch +++ /dev/null @@ -1,53 +0,0 @@ -From c1e02ceaf5739d32f092ac07bf886a0281ec40b1 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Tue, 12 May 2015 23:23:00 +0200 -Subject: [PATCH 1/2] PCI: iproc: Allow override of device tree IRQ mapping - function - -The iProc core PCIe driver defaults to using of_irq_parse_and_map_pci() for -IRQ mapping. Add iproc_pcie.map_irq so bus interfaces that don't use -device tree can override this by supplying their own IRQ mapping function. - -[bhelgaas: changelog] -Posting: http://lkml.kernel.org/r/1431465781-10753-1-git-send-email-hauke@hauke-m.de -Signed-off-by: Hauke Mehrtens -Signed-off-by: Bjorn Helgaas -Reviewed-by: Ray Jui ---- - drivers/pci/host/pcie-iproc-platform.c | 2 ++ - drivers/pci/host/pcie-iproc.c | 2 +- - drivers/pci/host/pcie-iproc.h | 1 + - 3 files changed, 4 insertions(+), 1 deletion(-) - ---- a/drivers/pci/host/pcie-iproc-platform.c -+++ b/drivers/pci/host/pcie-iproc-platform.c -@@ -71,6 +71,8 @@ static int iproc_pcie_pltfm_probe(struct - - pcie->resources = &res; - -+ pcie->map_irq = of_irq_parse_and_map_pci; -+ - ret = iproc_pcie_setup(pcie); - if (ret) { - dev_err(pcie->dev, "PCIe controller setup failed\n"); ---- a/drivers/pci/host/pcie-iproc.c -+++ b/drivers/pci/host/pcie-iproc.c -@@ -229,7 +229,7 @@ int iproc_pcie_setup(struct iproc_pcie * - - pci_scan_child_bus(bus); - pci_assign_unassigned_bus_resources(bus); -- pci_fixup_irqs(pci_common_swizzle, of_irq_parse_and_map_pci); -+ pci_fixup_irqs(pci_common_swizzle, pcie->map_irq); - pci_bus_add_devices(bus); - - return 0; ---- a/drivers/pci/host/pcie-iproc.h -+++ b/drivers/pci/host/pcie-iproc.h -@@ -34,6 +34,7 @@ struct iproc_pcie { - struct pci_bus *root_bus; - struct phy *phy; - int irqs[IPROC_PCIE_MAX_NUM_IRQS]; -+ int (*map_irq)(const struct pci_dev *, u8, u8); - }; - - int iproc_pcie_setup(struct iproc_pcie *pcie); diff --git a/target/linux/bcm53xx/patches-4.1/031-0001-PCI-iproc-Directly-add-PCI-resources.patch b/target/linux/bcm53xx/patches-4.1/031-0001-PCI-iproc-Directly-add-PCI-resources.patch new file mode 100644 index 0000000000..09d82263a9 --- /dev/null +++ b/target/linux/bcm53xx/patches-4.1/031-0001-PCI-iproc-Directly-add-PCI-resources.patch @@ -0,0 +1,90 @@ +From 18c4342aa56d70176eea85021e6fe8f6f8f39c7b Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Sun, 24 May 2015 22:37:02 +0200 +Subject: [PATCH 1/2] PCI: iproc: Directly add PCI resources + +The struct iproc_pcie.resources member was pointing to a stack variable and +is invalid after the registration function returned. + +Remove this pointer and add a parameter to the function. + +Tested-by: Ray Jui +Signed-off-by: Hauke Mehrtens +Signed-off-by: Bjorn Helgaas +Reviewed-by: Ray Jui +--- + drivers/pci/host/pcie-iproc-bcma.c | 4 +--- + drivers/pci/host/pcie-iproc-platform.c | 4 +--- + drivers/pci/host/pcie-iproc.c | 4 ++-- + drivers/pci/host/pcie-iproc.h | 3 +-- + 4 files changed, 5 insertions(+), 10 deletions(-) + +--- a/drivers/pci/host/pcie-iproc-bcma.c ++++ b/drivers/pci/host/pcie-iproc-bcma.c +@@ -62,11 +62,9 @@ static int iproc_pcie_bcma_probe(struct + res_mem.flags = IORESOURCE_MEM; + pci_add_resource(&res, &res_mem); + +- pcie->resources = &res; +- + pcie->map_irq = iproc_pcie_bcma_map_irq; + +- ret = iproc_pcie_setup(pcie); ++ ret = iproc_pcie_setup(pcie, &res); + if (ret) { + dev_err(pcie->dev, "PCIe controller setup failed\n"); + return ret; +--- a/drivers/pci/host/pcie-iproc-platform.c ++++ b/drivers/pci/host/pcie-iproc-platform.c +@@ -69,11 +69,9 @@ static int iproc_pcie_pltfm_probe(struct + return ret; + } + +- pcie->resources = &res; +- + pcie->map_irq = of_irq_parse_and_map_pci; + +- ret = iproc_pcie_setup(pcie); ++ ret = iproc_pcie_setup(pcie, &res); + if (ret) { + dev_err(pcie->dev, "PCIe controller setup failed\n"); + return ret; +--- a/drivers/pci/host/pcie-iproc.c ++++ b/drivers/pci/host/pcie-iproc.c +@@ -183,7 +183,7 @@ static void iproc_pcie_enable(struct ipr + writel(SYS_RC_INTX_MASK, pcie->base + SYS_RC_INTX_EN); + } + +-int iproc_pcie_setup(struct iproc_pcie *pcie) ++int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res) + { + int ret; + struct pci_bus *bus; +@@ -211,7 +211,7 @@ int iproc_pcie_setup(struct iproc_pcie * + pcie->sysdata.private_data = pcie; + + bus = pci_create_root_bus(pcie->dev, 0, &iproc_pcie_ops, +- &pcie->sysdata, pcie->resources); ++ &pcie->sysdata, res); + if (!bus) { + dev_err(pcie->dev, "unable to create PCI root bus\n"); + ret = -ENOMEM; +--- a/drivers/pci/host/pcie-iproc.h ++++ b/drivers/pci/host/pcie-iproc.h +@@ -29,7 +29,6 @@ + struct iproc_pcie { + struct device *dev; + void __iomem *base; +- struct list_head *resources; + struct pci_sys_data sysdata; + struct pci_bus *root_bus; + struct phy *phy; +@@ -37,7 +36,7 @@ struct iproc_pcie { + int (*map_irq)(const struct pci_dev *, u8, u8); + }; + +-int iproc_pcie_setup(struct iproc_pcie *pcie); ++int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res); + int iproc_pcie_remove(struct iproc_pcie *pcie); + + #endif /* _PCIE_IPROC_H */ diff --git a/target/linux/bcm53xx/patches-4.1/031-0002-PCI-iproc-Free-resource-list-after-registration.patch b/target/linux/bcm53xx/patches-4.1/031-0002-PCI-iproc-Free-resource-list-after-registration.patch new file mode 100644 index 0000000000..bbd3164eb2 --- /dev/null +++ b/target/linux/bcm53xx/patches-4.1/031-0002-PCI-iproc-Free-resource-list-after-registration.patch @@ -0,0 +1,57 @@ +From ef07991a95de76b07594448c3521361831ec2cfe Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Sun, 24 May 2015 22:37:03 +0200 +Subject: [PATCH 2/2] PCI: iproc: Free resource list after registration + +The resource list is only used in the setup process and was never freed. +pci_add_resource() allocates a memory area to store the list item. + +Fix the memory leak. + +Tested-by: Ray Jui +Signed-off-by: Hauke Mehrtens +Signed-off-by: Bjorn Helgaas +Reviewed-by: Ray Jui +--- + drivers/pci/host/pcie-iproc-bcma.c | 8 ++++---- + drivers/pci/host/pcie-iproc-platform.c | 8 ++++---- + 2 files changed, 8 insertions(+), 8 deletions(-) + +--- a/drivers/pci/host/pcie-iproc-bcma.c ++++ b/drivers/pci/host/pcie-iproc-bcma.c +@@ -65,12 +65,12 @@ static int iproc_pcie_bcma_probe(struct + pcie->map_irq = iproc_pcie_bcma_map_irq; + + ret = iproc_pcie_setup(pcie, &res); +- if (ret) { ++ if (ret) + dev_err(pcie->dev, "PCIe controller setup failed\n"); +- return ret; +- } + +- return 0; ++ pci_free_resource_list(&res); ++ ++ return ret; + } + + static void iproc_pcie_bcma_remove(struct bcma_device *bdev) +--- a/drivers/pci/host/pcie-iproc-platform.c ++++ b/drivers/pci/host/pcie-iproc-platform.c +@@ -72,12 +72,12 @@ static int iproc_pcie_pltfm_probe(struct + pcie->map_irq = of_irq_parse_and_map_pci; + + ret = iproc_pcie_setup(pcie, &res); +- if (ret) { ++ if (ret) + dev_err(pcie->dev, "PCIe controller setup failed\n"); +- return ret; +- } + +- return 0; ++ pci_free_resource_list(&res); ++ ++ return ret; + } + + static int iproc_pcie_pltfm_remove(struct platform_device *pdev) diff --git a/target/linux/bcm53xx/patches-4.1/031-PCI-iproc-Add-BCMA-PCIe-driver.patch b/target/linux/bcm53xx/patches-4.1/031-PCI-iproc-Add-BCMA-PCIe-driver.patch deleted file mode 100644 index a850bafd1b..0000000000 --- a/target/linux/bcm53xx/patches-4.1/031-PCI-iproc-Add-BCMA-PCIe-driver.patch +++ /dev/null @@ -1,177 +0,0 @@ -From 4785ffbdc9b52e308e43b9e2dcc1dca44f056d76 Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Tue, 12 May 2015 23:23:01 +0200 -Subject: [PATCH 2/2] PCI: iproc: Add BCMA PCIe driver -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This driver adds support for the PCIe 2.0 controller found on the BCMA bus. -This controller can be found on (mostly) all Broadcom BCM470X / BCM5301X -ARM SoCs. - -The driver found in the Broadcom SDK does some more stuff, like setting up -some DMA memory areas, chaining MPS and MRRS to 512 and also some PHY -changes like "improving" the PCIe jitter and doing some special -initialization for the 3rd PCIe port. - -This was tested on a bcm4708 board with 2 PCIe ports and wireless cards -connected to them. - -PCI_DOMAINS is needed by this driver, because normally there is more than -one PCIe controller and without PCI_DOMAINS only the first controller gets -registered. This controller gets 6 IRQs; the last one is trigged by all -IRQ events. - -[bhelgaas: fix "GPLv2" MODULE_LICENSE typo] -Signed-off-by: Hauke Mehrtens -Signed-off-by: Bjorn Helgaas -Acked-by: Rafał Miłecki -Acked-by: Ray Jui ---- - drivers/pci/host/Kconfig | 11 ++++ - drivers/pci/host/Makefile | 1 + - drivers/pci/host/pcie-iproc-bcma.c | 112 +++++++++++++++++++++++++++++++++++++ - 3 files changed, 124 insertions(+) - create mode 100644 drivers/pci/host/pcie-iproc-bcma.c - ---- a/drivers/pci/host/Kconfig -+++ b/drivers/pci/host/Kconfig -@@ -125,4 +125,15 @@ config PCIE_IPROC_PLATFORM - Say Y here if you want to use the Broadcom iProc PCIe controller - through the generic platform bus interface - -+config PCIE_IPROC_BCMA -+ bool "Broadcom iProc PCIe BCMA bus driver" -+ depends on ARCH_BCM_IPROC || (ARM && COMPILE_TEST) -+ select PCIE_IPROC -+ select BCMA -+ select PCI_DOMAINS -+ default ARCH_BCM_5301X -+ help -+ Say Y here if you want to use the Broadcom iProc PCIe controller -+ through the BCMA bus interface -+ - endmenu ---- a/drivers/pci/host/Makefile -+++ b/drivers/pci/host/Makefile -@@ -15,3 +15,4 @@ obj-$(CONFIG_PCI_LAYERSCAPE) += pci-laye - obj-$(CONFIG_PCI_VERSATILE) += pci-versatile.o - obj-$(CONFIG_PCIE_IPROC) += pcie-iproc.o - obj-$(CONFIG_PCIE_IPROC_PLATFORM) += pcie-iproc-platform.o -+obj-$(CONFIG_PCIE_IPROC_BCMA) += pcie-iproc-bcma.o ---- /dev/null -+++ b/drivers/pci/host/pcie-iproc-bcma.c -@@ -0,0 +1,112 @@ -+/* -+ * Copyright (C) 2015 Broadcom Corporation -+ * Copyright (C) 2015 Hauke Mehrtens -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation version 2. -+ * -+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any -+ * kind, whether express or implied; without even the implied warranty -+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "pcie-iproc.h" -+ -+ -+/* NS: CLASS field is R/O, and set to wrong 0x200 value */ -+static void bcma_pcie2_fixup_class(struct pci_dev *dev) -+{ -+ dev->class = PCI_CLASS_BRIDGE_PCI << 8; -+} -+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM, 0x8011, bcma_pcie2_fixup_class); -+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_BROADCOM, 0x8012, bcma_pcie2_fixup_class); -+ -+static int iproc_pcie_bcma_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) -+{ -+ struct pci_sys_data *sys = dev->sysdata; -+ struct iproc_pcie *pcie = sys->private_data; -+ struct bcma_device *bdev = container_of(pcie->dev, struct bcma_device, dev); -+ -+ return bcma_core_irq(bdev, 5); -+} -+ -+static int iproc_pcie_bcma_probe(struct bcma_device *bdev) -+{ -+ struct iproc_pcie *pcie; -+ LIST_HEAD(res); -+ struct resource res_mem; -+ int ret; -+ -+ pcie = devm_kzalloc(&bdev->dev, sizeof(*pcie), GFP_KERNEL); -+ if (!pcie) -+ return -ENOMEM; -+ -+ pcie->dev = &bdev->dev; -+ bcma_set_drvdata(bdev, pcie); -+ -+ pcie->base = bdev->io_addr; -+ -+ res_mem.start = bdev->addr_s[0]; -+ res_mem.end = bdev->addr_s[0] + SZ_128M - 1; -+ res_mem.name = "PCIe MEM space"; -+ res_mem.flags = IORESOURCE_MEM; -+ pci_add_resource(&res, &res_mem); -+ -+ pcie->resources = &res; -+ -+ pcie->map_irq = iproc_pcie_bcma_map_irq; -+ -+ ret = iproc_pcie_setup(pcie); -+ if (ret) { -+ dev_err(pcie->dev, "PCIe controller setup failed\n"); -+ return ret; -+ } -+ -+ return 0; -+} -+ -+static void iproc_pcie_bcma_remove(struct bcma_device *bdev) -+{ -+ struct iproc_pcie *pcie = bcma_get_drvdata(bdev); -+ -+ iproc_pcie_remove(pcie); -+} -+ -+static const struct bcma_device_id iproc_pcie_bcma_table[] = { -+ BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_NS_PCIEG2, BCMA_ANY_REV, BCMA_ANY_CLASS), -+ {}, -+}; -+MODULE_DEVICE_TABLE(bcma, iproc_pcie_bcma_table); -+ -+static struct bcma_driver iproc_pcie_bcma_driver = { -+ .name = KBUILD_MODNAME, -+ .id_table = iproc_pcie_bcma_table, -+ .probe = iproc_pcie_bcma_probe, -+ .remove = iproc_pcie_bcma_remove, -+}; -+ -+static int __init iproc_pcie_bcma_init(void) -+{ -+ return bcma_driver_register(&iproc_pcie_bcma_driver); -+} -+module_init(iproc_pcie_bcma_init); -+ -+static void __exit iproc_pcie_bcma_exit(void) -+{ -+ bcma_driver_unregister(&iproc_pcie_bcma_driver); -+} -+module_exit(iproc_pcie_bcma_exit); -+ -+MODULE_AUTHOR("Hauke Mehrtens"); -+MODULE_DESCRIPTION("Broadcom iProc PCIe BCMA driver"); -+MODULE_LICENSE("GPL v2"); diff --git a/target/linux/bcm53xx/patches-4.1/032-PCI-iproc-Delete-unnecessary-checks-before-phy-calls.patch b/target/linux/bcm53xx/patches-4.1/032-PCI-iproc-Delete-unnecessary-checks-before-phy-calls.patch new file mode 100644 index 0000000000..fc83337de7 --- /dev/null +++ b/target/linux/bcm53xx/patches-4.1/032-PCI-iproc-Delete-unnecessary-checks-before-phy-calls.patch @@ -0,0 +1,79 @@ +From 93972d18bbaba6f34e21742400b6e7461edc4837 Mon Sep 17 00:00:00 2001 +From: Markus Elfring +Date: Sun, 28 Jun 2015 16:42:04 +0200 +Subject: [PATCH] PCI: iproc: Delete unnecessary checks before phy calls + +The functions phy_exit() and phy_power_off() test whether their argument is +NULL and then return immediately. Thus the test around the calls is not +needed. + +This issue was detected by using the Coccinelle software. + +[bhelgaas: also phy_init() and phy_power_on(), as Ray Jui suggested] +[bhelgaas: also remove tests in iproc_pcie_remove()] +Signed-off-by: Markus Elfring +Signed-off-by: Bjorn Helgaas +Reviewed-by: Ray Jui +--- + drivers/pci/host/pcie-iproc.c | 34 +++++++++++++--------------------- + 1 file changed, 13 insertions(+), 21 deletions(-) + +--- a/drivers/pci/host/pcie-iproc.c ++++ b/drivers/pci/host/pcie-iproc.c +@@ -191,19 +191,16 @@ int iproc_pcie_setup(struct iproc_pcie * + if (!pcie || !pcie->dev || !pcie->base) + return -EINVAL; + +- if (pcie->phy) { +- ret = phy_init(pcie->phy); +- if (ret) { +- dev_err(pcie->dev, "unable to initialize PCIe PHY\n"); +- return ret; +- } +- +- ret = phy_power_on(pcie->phy); +- if (ret) { +- dev_err(pcie->dev, "unable to power on PCIe PHY\n"); +- goto err_exit_phy; +- } ++ ret = phy_init(pcie->phy); ++ if (ret) { ++ dev_err(pcie->dev, "unable to initialize PCIe PHY\n"); ++ return ret; ++ } + ++ ret = phy_power_on(pcie->phy); ++ if (ret) { ++ dev_err(pcie->dev, "unable to power on PCIe PHY\n"); ++ goto err_exit_phy; + } + + iproc_pcie_reset(pcie); +@@ -239,12 +236,9 @@ err_rm_root_bus: + pci_remove_root_bus(bus); + + err_power_off_phy: +- if (pcie->phy) +- phy_power_off(pcie->phy); ++ phy_power_off(pcie->phy); + err_exit_phy: +- if (pcie->phy) +- phy_exit(pcie->phy); +- ++ phy_exit(pcie->phy); + return ret; + } + EXPORT_SYMBOL(iproc_pcie_setup); +@@ -254,10 +248,8 @@ int iproc_pcie_remove(struct iproc_pcie + pci_stop_root_bus(pcie->root_bus); + pci_remove_root_bus(pcie->root_bus); + +- if (pcie->phy) { +- phy_power_off(pcie->phy); +- phy_exit(pcie->phy); +- } ++ phy_power_off(pcie->phy); ++ phy_exit(pcie->phy); + + return 0; + } diff --git a/target/linux/bcm53xx/patches-4.1/032-PCI-iproc-Directly-add-PCI-resources.patch b/target/linux/bcm53xx/patches-4.1/032-PCI-iproc-Directly-add-PCI-resources.patch deleted file mode 100644 index 09d82263a9..0000000000 --- a/target/linux/bcm53xx/patches-4.1/032-PCI-iproc-Directly-add-PCI-resources.patch +++ /dev/null @@ -1,90 +0,0 @@ -From 18c4342aa56d70176eea85021e6fe8f6f8f39c7b Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Sun, 24 May 2015 22:37:02 +0200 -Subject: [PATCH 1/2] PCI: iproc: Directly add PCI resources - -The struct iproc_pcie.resources member was pointing to a stack variable and -is invalid after the registration function returned. - -Remove this pointer and add a parameter to the function. - -Tested-by: Ray Jui -Signed-off-by: Hauke Mehrtens -Signed-off-by: Bjorn Helgaas -Reviewed-by: Ray Jui ---- - drivers/pci/host/pcie-iproc-bcma.c | 4 +--- - drivers/pci/host/pcie-iproc-platform.c | 4 +--- - drivers/pci/host/pcie-iproc.c | 4 ++-- - drivers/pci/host/pcie-iproc.h | 3 +-- - 4 files changed, 5 insertions(+), 10 deletions(-) - ---- a/drivers/pci/host/pcie-iproc-bcma.c -+++ b/drivers/pci/host/pcie-iproc-bcma.c -@@ -62,11 +62,9 @@ static int iproc_pcie_bcma_probe(struct - res_mem.flags = IORESOURCE_MEM; - pci_add_resource(&res, &res_mem); - -- pcie->resources = &res; -- - pcie->map_irq = iproc_pcie_bcma_map_irq; - -- ret = iproc_pcie_setup(pcie); -+ ret = iproc_pcie_setup(pcie, &res); - if (ret) { - dev_err(pcie->dev, "PCIe controller setup failed\n"); - return ret; ---- a/drivers/pci/host/pcie-iproc-platform.c -+++ b/drivers/pci/host/pcie-iproc-platform.c -@@ -69,11 +69,9 @@ static int iproc_pcie_pltfm_probe(struct - return ret; - } - -- pcie->resources = &res; -- - pcie->map_irq = of_irq_parse_and_map_pci; - -- ret = iproc_pcie_setup(pcie); -+ ret = iproc_pcie_setup(pcie, &res); - if (ret) { - dev_err(pcie->dev, "PCIe controller setup failed\n"); - return ret; ---- a/drivers/pci/host/pcie-iproc.c -+++ b/drivers/pci/host/pcie-iproc.c -@@ -183,7 +183,7 @@ static void iproc_pcie_enable(struct ipr - writel(SYS_RC_INTX_MASK, pcie->base + SYS_RC_INTX_EN); - } - --int iproc_pcie_setup(struct iproc_pcie *pcie) -+int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res) - { - int ret; - struct pci_bus *bus; -@@ -211,7 +211,7 @@ int iproc_pcie_setup(struct iproc_pcie * - pcie->sysdata.private_data = pcie; - - bus = pci_create_root_bus(pcie->dev, 0, &iproc_pcie_ops, -- &pcie->sysdata, pcie->resources); -+ &pcie->sysdata, res); - if (!bus) { - dev_err(pcie->dev, "unable to create PCI root bus\n"); - ret = -ENOMEM; ---- a/drivers/pci/host/pcie-iproc.h -+++ b/drivers/pci/host/pcie-iproc.h -@@ -29,7 +29,6 @@ - struct iproc_pcie { - struct device *dev; - void __iomem *base; -- struct list_head *resources; - struct pci_sys_data sysdata; - struct pci_bus *root_bus; - struct phy *phy; -@@ -37,7 +36,7 @@ struct iproc_pcie { - int (*map_irq)(const struct pci_dev *, u8, u8); - }; - --int iproc_pcie_setup(struct iproc_pcie *pcie); -+int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res); - int iproc_pcie_remove(struct iproc_pcie *pcie); - - #endif /* _PCIE_IPROC_H */ diff --git a/target/linux/bcm53xx/patches-4.1/033-0001-PCI-iproc-enable-arm64-support-for-iProc-PCIe.patch b/target/linux/bcm53xx/patches-4.1/033-0001-PCI-iproc-enable-arm64-support-for-iProc-PCIe.patch new file mode 100644 index 0000000000..78160f0fce --- /dev/null +++ b/target/linux/bcm53xx/patches-4.1/033-0001-PCI-iproc-enable-arm64-support-for-iProc-PCIe.patch @@ -0,0 +1,116 @@ +From db9d6d790968fd6df9faa7fa1f51967e05afd492 Mon Sep 17 00:00:00 2001 +From: Ray Jui +Date: Mon, 27 Jul 2015 15:42:18 -0700 +Subject: [PATCH 1/4] PCI: iproc: enable arm64 support for iProc PCIe + +PCI: iproc: Add arm64 support + +Add arm64 support to the iProc PCIe driver. + +Note that on arm32, bus->sysdata points to the arm32-specific +pci_sys_data struct, and pci_sys_data.private_data contains the +iproc_pcie pointer. For arm64, there's nothing corresponding to +pci_sys_data, so we keep the iproc_pcie pointer directly in +bus->sysdata. + +In addition, arm64 does IRQ mapping in pcibios_add_device(), so it +doesn't need pci_fixup_irqs() as arm32 does. + +Signed-off-by: Ray Jui +Signed-off-by: Bjorn Helgaas +Reviewed-by: Scott Branden +Acked-by: Bjorn Helgaas +Signed-off-by: Olof Johansson +--- + drivers/pci/host/pcie-iproc.c | 27 ++++++++++++++++++++------- + drivers/pci/host/pcie-iproc.h | 4 +++- + 2 files changed, 23 insertions(+), 8 deletions(-) + +--- a/drivers/pci/host/pcie-iproc.c ++++ b/drivers/pci/host/pcie-iproc.c +@@ -58,9 +58,17 @@ + #define SYS_RC_INTX_EN 0x330 + #define SYS_RC_INTX_MASK 0xf + +-static inline struct iproc_pcie *sys_to_pcie(struct pci_sys_data *sys) ++static inline struct iproc_pcie *iproc_data(struct pci_bus *bus) + { +- return sys->private_data; ++ struct iproc_pcie *pcie; ++#ifdef CONFIG_ARM ++ struct pci_sys_data *sys = bus->sysdata; ++ ++ pcie = sys->private_data; ++#else ++ pcie = bus->sysdata; ++#endif ++ return pcie; + } + + /** +@@ -71,8 +79,7 @@ static void __iomem *iproc_pcie_map_cfg_ + unsigned int devfn, + int where) + { +- struct pci_sys_data *sys = bus->sysdata; +- struct iproc_pcie *pcie = sys_to_pcie(sys); ++ struct iproc_pcie *pcie = iproc_data(bus); + unsigned slot = PCI_SLOT(devfn); + unsigned fn = PCI_FUNC(devfn); + unsigned busno = bus->number; +@@ -186,6 +193,7 @@ static void iproc_pcie_enable(struct ipr + int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res) + { + int ret; ++ void *sysdata; + struct pci_bus *bus; + + if (!pcie || !pcie->dev || !pcie->base) +@@ -205,10 +213,13 @@ int iproc_pcie_setup(struct iproc_pcie * + + iproc_pcie_reset(pcie); + ++#ifdef CONFIG_ARM + pcie->sysdata.private_data = pcie; +- +- bus = pci_create_root_bus(pcie->dev, 0, &iproc_pcie_ops, +- &pcie->sysdata, res); ++ sysdata = &pcie->sysdata; ++#else ++ sysdata = pcie; ++#endif ++ bus = pci_create_root_bus(pcie->dev, 0, &iproc_pcie_ops, sysdata, res); + if (!bus) { + dev_err(pcie->dev, "unable to create PCI root bus\n"); + ret = -ENOMEM; +@@ -226,7 +237,9 @@ int iproc_pcie_setup(struct iproc_pcie * + + pci_scan_child_bus(bus); + pci_assign_unassigned_bus_resources(bus); ++#ifdef CONFIG_ARM + pci_fixup_irqs(pci_common_swizzle, pcie->map_irq); ++#endif + pci_bus_add_devices(bus); + + return 0; +--- a/drivers/pci/host/pcie-iproc.h ++++ b/drivers/pci/host/pcie-iproc.h +@@ -21,7 +21,7 @@ + * @dev: pointer to device data structure + * @base: PCIe host controller I/O register base + * @resources: linked list of all PCI resources +- * @sysdata: Per PCI controller data ++ * @sysdata: Per PCI controller data (ARM-specific) + * @root_bus: pointer to root bus + * @phy: optional PHY device that controls the Serdes + * @irqs: interrupt IDs +@@ -29,7 +29,9 @@ + struct iproc_pcie { + struct device *dev; + void __iomem *base; ++#ifdef CONFIG_ARM + struct pci_sys_data sysdata; ++#endif + struct pci_bus *root_bus; + struct phy *phy; + int irqs[IPROC_PCIE_MAX_NUM_IRQS]; diff --git a/target/linux/bcm53xx/patches-4.1/033-0002-PCI-iproc-Fix-ARM64-dependency-in-Kconfig.patch b/target/linux/bcm53xx/patches-4.1/033-0002-PCI-iproc-Fix-ARM64-dependency-in-Kconfig.patch new file mode 100644 index 0000000000..414a83f4ef --- /dev/null +++ b/target/linux/bcm53xx/patches-4.1/033-0002-PCI-iproc-Fix-ARM64-dependency-in-Kconfig.patch @@ -0,0 +1,27 @@ +From b00c4415fb231f276221c634a47ce7328df9aae5 Mon Sep 17 00:00:00 2001 +From: Ray Jui +Date: Mon, 27 Jul 2015 15:42:19 -0700 +Subject: [PATCH 2/4] PCI: iproc: Fix ARM64 dependency in Kconfig + +Allow Broadcom iProc PCIe core driver to be compiled for ARM64 + +Signed-off-by: Ray Jui +Reviewed-by: Vikram Prakash +Reviewed-by: Scott Branden +Acked-by: Bjorn Helgaas +Signed-off-by: Olof Johansson +--- + drivers/pci/host/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/pci/host/Kconfig ++++ b/drivers/pci/host/Kconfig +@@ -108,7 +108,7 @@ config PCI_VERSATILE + + config PCIE_IPROC + tristate "Broadcom iProc PCIe controller" +- depends on OF && ARM ++ depends on OF && (ARM || ARM64) + default n + help + This enables the iProc PCIe core controller support for Broadcom's diff --git a/target/linux/bcm53xx/patches-4.1/033-PCI-iproc-Free-resource-list-after-registration.patch b/target/linux/bcm53xx/patches-4.1/033-PCI-iproc-Free-resource-list-after-registration.patch deleted file mode 100644 index bbd3164eb2..0000000000 --- a/target/linux/bcm53xx/patches-4.1/033-PCI-iproc-Free-resource-list-after-registration.patch +++ /dev/null @@ -1,57 +0,0 @@ -From ef07991a95de76b07594448c3521361831ec2cfe Mon Sep 17 00:00:00 2001 -From: Hauke Mehrtens -Date: Sun, 24 May 2015 22:37:03 +0200 -Subject: [PATCH 2/2] PCI: iproc: Free resource list after registration - -The resource list is only used in the setup process and was never freed. -pci_add_resource() allocates a memory area to store the list item. - -Fix the memory leak. - -Tested-by: Ray Jui -Signed-off-by: Hauke Mehrtens -Signed-off-by: Bjorn Helgaas -Reviewed-by: Ray Jui ---- - drivers/pci/host/pcie-iproc-bcma.c | 8 ++++---- - drivers/pci/host/pcie-iproc-platform.c | 8 ++++---- - 2 files changed, 8 insertions(+), 8 deletions(-) - ---- a/drivers/pci/host/pcie-iproc-bcma.c -+++ b/drivers/pci/host/pcie-iproc-bcma.c -@@ -65,12 +65,12 @@ static int iproc_pcie_bcma_probe(struct - pcie->map_irq = iproc_pcie_bcma_map_irq; - - ret = iproc_pcie_setup(pcie, &res); -- if (ret) { -+ if (ret) - dev_err(pcie->dev, "PCIe controller setup failed\n"); -- return ret; -- } - -- return 0; -+ pci_free_resource_list(&res); -+ -+ return ret; - } - - static void iproc_pcie_bcma_remove(struct bcma_device *bdev) ---- a/drivers/pci/host/pcie-iproc-platform.c -+++ b/drivers/pci/host/pcie-iproc-platform.c -@@ -72,12 +72,12 @@ static int iproc_pcie_pltfm_probe(struct - pcie->map_irq = of_irq_parse_and_map_pci; - - ret = iproc_pcie_setup(pcie, &res); -- if (ret) { -+ if (ret) - dev_err(pcie->dev, "PCIe controller setup failed\n"); -- return ret; -- } - -- return 0; -+ pci_free_resource_list(&res); -+ -+ return ret; - } - - static int iproc_pcie_pltfm_remove(struct platform_device *pdev) diff --git a/target/linux/bcm53xx/patches-4.1/035-PCI-iproc-Delete-unnecessary-checks-before-phy-calls.patch b/target/linux/bcm53xx/patches-4.1/035-PCI-iproc-Delete-unnecessary-checks-before-phy-calls.patch deleted file mode 100644 index fc83337de7..0000000000 --- a/target/linux/bcm53xx/patches-4.1/035-PCI-iproc-Delete-unnecessary-checks-before-phy-calls.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 93972d18bbaba6f34e21742400b6e7461edc4837 Mon Sep 17 00:00:00 2001 -From: Markus Elfring -Date: Sun, 28 Jun 2015 16:42:04 +0200 -Subject: [PATCH] PCI: iproc: Delete unnecessary checks before phy calls - -The functions phy_exit() and phy_power_off() test whether their argument is -NULL and then return immediately. Thus the test around the calls is not -needed. - -This issue was detected by using the Coccinelle software. - -[bhelgaas: also phy_init() and phy_power_on(), as Ray Jui suggested] -[bhelgaas: also remove tests in iproc_pcie_remove()] -Signed-off-by: Markus Elfring -Signed-off-by: Bjorn Helgaas -Reviewed-by: Ray Jui ---- - drivers/pci/host/pcie-iproc.c | 34 +++++++++++++--------------------- - 1 file changed, 13 insertions(+), 21 deletions(-) - ---- a/drivers/pci/host/pcie-iproc.c -+++ b/drivers/pci/host/pcie-iproc.c -@@ -191,19 +191,16 @@ int iproc_pcie_setup(struct iproc_pcie * - if (!pcie || !pcie->dev || !pcie->base) - return -EINVAL; - -- if (pcie->phy) { -- ret = phy_init(pcie->phy); -- if (ret) { -- dev_err(pcie->dev, "unable to initialize PCIe PHY\n"); -- return ret; -- } -- -- ret = phy_power_on(pcie->phy); -- if (ret) { -- dev_err(pcie->dev, "unable to power on PCIe PHY\n"); -- goto err_exit_phy; -- } -+ ret = phy_init(pcie->phy); -+ if (ret) { -+ dev_err(pcie->dev, "unable to initialize PCIe PHY\n"); -+ return ret; -+ } - -+ ret = phy_power_on(pcie->phy); -+ if (ret) { -+ dev_err(pcie->dev, "unable to power on PCIe PHY\n"); -+ goto err_exit_phy; - } - - iproc_pcie_reset(pcie); -@@ -239,12 +236,9 @@ err_rm_root_bus: - pci_remove_root_bus(bus); - - err_power_off_phy: -- if (pcie->phy) -- phy_power_off(pcie->phy); -+ phy_power_off(pcie->phy); - err_exit_phy: -- if (pcie->phy) -- phy_exit(pcie->phy); -- -+ phy_exit(pcie->phy); - return ret; - } - EXPORT_SYMBOL(iproc_pcie_setup); -@@ -254,10 +248,8 @@ int iproc_pcie_remove(struct iproc_pcie - pci_stop_root_bus(pcie->root_bus); - pci_remove_root_bus(pcie->root_bus); - -- if (pcie->phy) { -- phy_power_off(pcie->phy); -- phy_exit(pcie->phy); -- } -+ phy_power_off(pcie->phy); -+ phy_exit(pcie->phy); - - return 0; - } diff --git a/target/linux/bcm53xx/patches-4.1/037-PCI-iproc-enable-arm64-support-for-iProc-PCIe.patch b/target/linux/bcm53xx/patches-4.1/037-PCI-iproc-enable-arm64-support-for-iProc-PCIe.patch deleted file mode 100644 index 641efd87bc..0000000000 --- a/target/linux/bcm53xx/patches-4.1/037-PCI-iproc-enable-arm64-support-for-iProc-PCIe.patch +++ /dev/null @@ -1,116 +0,0 @@ -From db9d6d790968fd6df9faa7fa1f51967e05afd492 Mon Sep 17 00:00:00 2001 -From: Ray Jui -Date: Mon, 27 Jul 2015 15:42:18 -0700 -Subject: [PATCH 37/40] PCI: iproc: enable arm64 support for iProc PCIe - -PCI: iproc: Add arm64 support - -Add arm64 support to the iProc PCIe driver. - -Note that on arm32, bus->sysdata points to the arm32-specific -pci_sys_data struct, and pci_sys_data.private_data contains the -iproc_pcie pointer. For arm64, there's nothing corresponding to -pci_sys_data, so we keep the iproc_pcie pointer directly in -bus->sysdata. - -In addition, arm64 does IRQ mapping in pcibios_add_device(), so it -doesn't need pci_fixup_irqs() as arm32 does. - -Signed-off-by: Ray Jui -Signed-off-by: Bjorn Helgaas -Reviewed-by: Scott Branden -Acked-by: Bjorn Helgaas -Signed-off-by: Olof Johansson ---- - drivers/pci/host/pcie-iproc.c | 27 ++++++++++++++++++++------- - drivers/pci/host/pcie-iproc.h | 4 +++- - 2 files changed, 23 insertions(+), 8 deletions(-) - ---- a/drivers/pci/host/pcie-iproc.c -+++ b/drivers/pci/host/pcie-iproc.c -@@ -58,9 +58,17 @@ - #define SYS_RC_INTX_EN 0x330 - #define SYS_RC_INTX_MASK 0xf - --static inline struct iproc_pcie *sys_to_pcie(struct pci_sys_data *sys) -+static inline struct iproc_pcie *iproc_data(struct pci_bus *bus) - { -- return sys->private_data; -+ struct iproc_pcie *pcie; -+#ifdef CONFIG_ARM -+ struct pci_sys_data *sys = bus->sysdata; -+ -+ pcie = sys->private_data; -+#else -+ pcie = bus->sysdata; -+#endif -+ return pcie; - } - - /** -@@ -71,8 +79,7 @@ static void __iomem *iproc_pcie_map_cfg_ - unsigned int devfn, - int where) - { -- struct pci_sys_data *sys = bus->sysdata; -- struct iproc_pcie *pcie = sys_to_pcie(sys); -+ struct iproc_pcie *pcie = iproc_data(bus); - unsigned slot = PCI_SLOT(devfn); - unsigned fn = PCI_FUNC(devfn); - unsigned busno = bus->number; -@@ -186,6 +193,7 @@ static void iproc_pcie_enable(struct ipr - int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res) - { - int ret; -+ void *sysdata; - struct pci_bus *bus; - - if (!pcie || !pcie->dev || !pcie->base) -@@ -205,10 +213,13 @@ int iproc_pcie_setup(struct iproc_pcie * - - iproc_pcie_reset(pcie); - -+#ifdef CONFIG_ARM - pcie->sysdata.private_data = pcie; -- -- bus = pci_create_root_bus(pcie->dev, 0, &iproc_pcie_ops, -- &pcie->sysdata, res); -+ sysdata = &pcie->sysdata; -+#else -+ sysdata = pcie; -+#endif -+ bus = pci_create_root_bus(pcie->dev, 0, &iproc_pcie_ops, sysdata, res); - if (!bus) { - dev_err(pcie->dev, "unable to create PCI root bus\n"); - ret = -ENOMEM; -@@ -226,7 +237,9 @@ int iproc_pcie_setup(struct iproc_pcie * - - pci_scan_child_bus(bus); - pci_assign_unassigned_bus_resources(bus); -+#ifdef CONFIG_ARM - pci_fixup_irqs(pci_common_swizzle, pcie->map_irq); -+#endif - pci_bus_add_devices(bus); - - return 0; ---- a/drivers/pci/host/pcie-iproc.h -+++ b/drivers/pci/host/pcie-iproc.h -@@ -21,7 +21,7 @@ - * @dev: pointer to device data structure - * @base: PCIe host controller I/O register base - * @resources: linked list of all PCI resources -- * @sysdata: Per PCI controller data -+ * @sysdata: Per PCI controller data (ARM-specific) - * @root_bus: pointer to root bus - * @phy: optional PHY device that controls the Serdes - * @irqs: interrupt IDs -@@ -29,7 +29,9 @@ - struct iproc_pcie { - struct device *dev; - void __iomem *base; -+#ifdef CONFIG_ARM - struct pci_sys_data sysdata; -+#endif - struct pci_bus *root_bus; - struct phy *phy; - int irqs[IPROC_PCIE_MAX_NUM_IRQS]; diff --git a/target/linux/bcm53xx/patches-4.1/038-PCI-iproc-Fix-ARM64-dependency-in-Kconfig.patch b/target/linux/bcm53xx/patches-4.1/038-PCI-iproc-Fix-ARM64-dependency-in-Kconfig.patch deleted file mode 100644 index 75847afc53..0000000000 --- a/target/linux/bcm53xx/patches-4.1/038-PCI-iproc-Fix-ARM64-dependency-in-Kconfig.patch +++ /dev/null @@ -1,27 +0,0 @@ -From b00c4415fb231f276221c634a47ce7328df9aae5 Mon Sep 17 00:00:00 2001 -From: Ray Jui -Date: Mon, 27 Jul 2015 15:42:19 -0700 -Subject: [PATCH 38/40] PCI: iproc: Fix ARM64 dependency in Kconfig - -Allow Broadcom iProc PCIe core driver to be compiled for ARM64 - -Signed-off-by: Ray Jui -Reviewed-by: Vikram Prakash -Reviewed-by: Scott Branden -Acked-by: Bjorn Helgaas -Signed-off-by: Olof Johansson ---- - drivers/pci/host/Kconfig | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/pci/host/Kconfig -+++ b/drivers/pci/host/Kconfig -@@ -108,7 +108,7 @@ config PCI_VERSATILE - - config PCIE_IPROC - tristate "Broadcom iProc PCIe controller" -- depends on OF && ARM -+ depends on OF && (ARM || ARM64) - default n - help - This enables the iProc PCIe core controller support for Broadcom's