From 46f920d8a970cf102e18f25814a4ff4729ad8537 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sun, 20 Mar 2016 20:44:05 +0800 Subject: irqchip/tegra: Switch to use irq_domain_free_irqs_common Current code calls irq_domain_alloc_irqs_parent() in .alloc, so it should call irq_domain_free_irqs_parent() accordingly in .free. Fix it by switching to use irq_domain_free_irqs_common() instead of the open-coded private implementation. Signed-off-by: Axel Lin Cc: Alexandre Courbot Cc: Jason Cooper Cc: Stephen Warren Cc: Marc Zyngier Cc: Thierry Reding Cc: linux-tegra@vger.kernel.org Link: http://lkml.kernel.org/r/1458477845.28679.1.camel@ingics.com Signed-off-by: Thomas Gleixner --- drivers/irqchip/irq-tegra.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/irqchip/irq-tegra.c b/drivers/irqchip/irq-tegra.c index 121ec301372e..50be9639e27e 100644 --- a/drivers/irqchip/irq-tegra.c +++ b/drivers/irqchip/irq-tegra.c @@ -275,22 +275,10 @@ static int tegra_ictlr_domain_alloc(struct irq_domain *domain, &parent_fwspec); } -static void tegra_ictlr_domain_free(struct irq_domain *domain, - unsigned int virq, - unsigned int nr_irqs) -{ - unsigned int i; - - for (i = 0; i < nr_irqs; i++) { - struct irq_data *d = irq_domain_get_irq_data(domain, virq + i); - irq_domain_reset_irq_data(d); - } -} - static const struct irq_domain_ops tegra_ictlr_domain_ops = { .translate = tegra_ictlr_domain_translate, .alloc = tegra_ictlr_domain_alloc, - .free = tegra_ictlr_domain_free, + .free = irq_domain_free_irqs_common, }; static int __init tegra_ictlr_init(struct device_node *node, -- cgit v1.2.3-59-g8ed1b From d0e286415dc1f4fea2971d6186b0775c7062575b Mon Sep 17 00:00:00 2001 From: MaJun Date: Thu, 17 Mar 2016 16:34:00 +0800 Subject: irqchip/mbigen: Adjust DT bindings to handle multiple devices in a module A mbigen hardware module can contain more than one device node. These device nodes contain the same register definition. mbigen_dev1:intc_dev1 { ... reg = <0x0 0xc0080000 0x0 0x10000>; ... }; mbigen_dev2:intc_dev2 { ... reg = <0x0 0xc0080000 0x0 0x10000>; ... }; In this case both devices try to request the same resource resulting in a resource conflict. To address this problem the devices need to be subnodes of the mbigen hardware module, which then contains the unique register space. [ tglx: Massaged changelog ] Suggested-by: Mark Rutland Signed-off-by: Ma Jun Cc: jason@lakedaemon.net Cc: marc.zyngier@arm.com Cc: Catalin.Marinas@arm.com Cc: guohanjun@huawei.com Cc: Will.Deacon@arm.com Cc: huxinwei@huawei.com Cc: lizefan@huawei.com Cc: dingtianhong@huawei.com Cc: zhaojunhua@hisilicon.com Cc: liguozhu@hisilicon.com Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/20160203111602.GA1234@leverpostej Link: http://lkml.kernel.org/r/1458203641-17172-2-git-send-email-majun258@huawei.com Signed-off-by: Thomas Gleixner --- .../interrupt-controller/hisilicon,mbigen-v2.txt | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/interrupt-controller/hisilicon,mbigen-v2.txt b/Documentation/devicetree/bindings/interrupt-controller/hisilicon,mbigen-v2.txt index 720f7c92e9a1..3b2f4c43ad8d 100644 --- a/Documentation/devicetree/bindings/interrupt-controller/hisilicon,mbigen-v2.txt +++ b/Documentation/devicetree/bindings/interrupt-controller/hisilicon,mbigen-v2.txt @@ -21,6 +21,8 @@ Mbigen main node required properties: - reg: Specifies the base physical address and size of the Mbigen registers. +Mbigen sub node required properties: +------------------------------------------ - interrupt controller: Identifies the node as an interrupt controller - msi-parent: Specifies the MSI controller this mbigen use. @@ -45,13 +47,23 @@ Mbigen main node required properties: Examples: - mbigen_device_gmac:intc { + mbigen_chip_dsa { compatible = "hisilicon,mbigen-v2"; reg = <0x0 0xc0080000 0x0 0x10000>; - interrupt-controller; - msi-parent = <&its_dsa 0x40b1c>; - num-pins = <9>; - #interrupt-cells = <2>; + + mbigen_gmac:intc_gmac { + interrupt-controller; + msi-parent = <&its_dsa 0x40b1c>; + num-pins = <9>; + #interrupt-cells = <2>; + }; + + mbigen_i2c:intc_i2c { + interrupt-controller; + msi-parent = <&its_dsa 0x40b0e>; + num-pins = <2>; + #interrupt-cells = <2>; + }; }; Devices connect to mbigen required properties: -- cgit v1.2.3-59-g8ed1b From ed2a1002d25ccdb6606c8ccb608524118bd30614 Mon Sep 17 00:00:00 2001 From: MaJun Date: Thu, 17 Mar 2016 16:34:01 +0800 Subject: irqchip/mbigen: Handle multiple device nodes in a mbigen module Each mbigen device is represented as a independent platform device. If the devices belong to the same mbigen hardware module, then the register space for these devices is the same. That leads to a resource conflict. The solution for this is to represent the mbigen module as a platform device and make the mbigen devices subdevices of that. The register space is associated to the mbigen module and therefor the resource conflict is avoided. [ tglx: Massaged changelog, cleaned up the code and removed the silly printk ] Signed-off-by: Ma Jun Cc: mark.rutland@arm.com Cc: jason@lakedaemon.net Cc: marc.zyngier@arm.com Cc: Catalin.Marinas@arm.com Cc: guohanjun@huawei.com Cc: Will.Deacon@arm.com Cc: huxinwei@huawei.com Cc: lizefan@huawei.com Cc: dingtianhong@huawei.com Cc: zhaojunhua@hisilicon.com Cc: liguozhu@hisilicon.com Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/1458203641-17172-3-git-send-email-majun258@huawei.com Signed-off-by: Thomas Gleixner --- drivers/irqchip/irq-mbigen.c | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c index 4dd3eb8a40b3..d67baa231c13 100644 --- a/drivers/irqchip/irq-mbigen.c +++ b/drivers/irqchip/irq-mbigen.c @@ -239,8 +239,11 @@ static struct irq_domain_ops mbigen_domain_ops = { static int mbigen_device_probe(struct platform_device *pdev) { struct mbigen_device *mgn_chip; - struct resource *res; + struct platform_device *child; struct irq_domain *domain; + struct device_node *np; + struct device *parent; + struct resource *res; u32 num_pins; mgn_chip = devm_kzalloc(&pdev->dev, sizeof(*mgn_chip), GFP_KERNEL); @@ -254,23 +257,30 @@ static int mbigen_device_probe(struct platform_device *pdev) if (IS_ERR(mgn_chip->base)) return PTR_ERR(mgn_chip->base); - if (of_property_read_u32(pdev->dev.of_node, "num-pins", &num_pins) < 0) { - dev_err(&pdev->dev, "No num-pins property\n"); - return -EINVAL; - } + for_each_child_of_node(pdev->dev.of_node, np) { + if (!of_property_read_bool(np, "interrupt-controller")) + continue; - domain = platform_msi_create_device_domain(&pdev->dev, num_pins, - mbigen_write_msg, - &mbigen_domain_ops, - mgn_chip); + parent = platform_bus_type.dev_root; + child = of_platform_device_create(np, NULL, parent); + if (IS_ERR(child)) + return PTR_ERR(child); - if (!domain) - return -ENOMEM; + if (of_property_read_u32(child->dev.of_node, "num-pins", + &num_pins) < 0) { + dev_err(&pdev->dev, "No num-pins property\n"); + return -EINVAL; + } + + domain = platform_msi_create_device_domain(&child->dev, num_pins, + mbigen_write_msg, + &mbigen_domain_ops, + mgn_chip); + if (!domain) + return -ENOMEM; + } platform_set_drvdata(pdev, mgn_chip); - - dev_info(&pdev->dev, "Allocated %d MSIs\n", num_pins); - return 0; } -- cgit v1.2.3-59-g8ed1b From dd17a3c40d46adea7215cad3f8fa0afb7c616290 Mon Sep 17 00:00:00 2001 From: MaJun Date: Wed, 23 Mar 2016 17:06:32 +0800 Subject: ARM64: Kconfig: Select mbigen interrupt controller on Hisilicon platform As a interrupt controller used on some of hisilicon SOCs(660,1610 etc.), mbigen driver should be enabled when CONFIG_ARCH_HISI is enabled. Signed-off-by: Ma Jun Cc: mark.rutland@arm.com Cc: jason@lakedaemon.net Cc: marc.zyngier@arm.com Cc: Catalin.Marinas@arm.com Cc: guohanjun@huawei.com Cc: Will.Deacon@arm.com Cc: huxinwei@huawei.com Cc: lizefan@huawei.com Cc: dingtianhong@huawei.com Cc: zhaojunhua@hisilicon.com Cc: liguozhu@hisilicon.com Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/1458723993-21044-2-git-send-email-majun258@huawei.com Signed-off-by: Thomas Gleixner --- arch/arm64/Kconfig.platforms | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms index 21074f674bde..fdfd526871dc 100644 --- a/arch/arm64/Kconfig.platforms +++ b/arch/arm64/Kconfig.platforms @@ -37,6 +37,7 @@ config ARCH_LAYERSCAPE config ARCH_HISI bool "Hisilicon SoC Family" + select HISILICON_IRQ_MBIGEN help This enables support for Hisilicon ARMv8 SoC family -- cgit v1.2.3-59-g8ed1b From 9a7c4abd41c0d553f4fb9845bdd4328155426ac7 Mon Sep 17 00:00:00 2001 From: MaJun Date: Wed, 23 Mar 2016 17:06:33 +0800 Subject: irqchip/mbigen: Make CONFIG_HISILICON_IRQ_MBIGEN a hidden option This config is selected by CONFIG_ARCH_HISI, so there is no point to have it user configurable. While at it move the config option to the proper place in the alphabetically sorted option list. Requested-by: Thomas Gleixner Signed-off-by: Ma Jun Cc: mark.rutland@arm.com Cc: jason@lakedaemon.net Cc: marc.zyngier@arm.com Cc: Catalin.Marinas@arm.com Cc: guohanjun@huawei.com Cc: Will.Deacon@arm.com Cc: huxinwei@huawei.com Cc: lizefan@huawei.com Cc: dingtianhong@huawei.com Cc: zhaojunhua@hisilicon.com Cc: liguozhu@hisilicon.com Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/1458723993-21044-3-git-send-email-majun258@huawei.com Signed-off-by: Thomas Gleixner --- drivers/irqchip/Kconfig | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index 7e8c441ff2de..3e124793e224 100644 --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig @@ -32,14 +32,6 @@ config ARM_GIC_V3_ITS bool select PCI_MSI_IRQ_DOMAIN -config HISILICON_IRQ_MBIGEN - bool "Support mbigen interrupt controller" - default n - depends on ARM_GIC_V3 && ARM_GIC_V3_ITS && GENERIC_MSI_IRQ_DOMAIN - help - Enable the mbigen interrupt controller used on - Hisilicon platform. - config ARM_NVIC bool select IRQ_DOMAIN @@ -114,6 +106,12 @@ config DW_APB_ICTL select GENERIC_IRQ_CHIP select IRQ_DOMAIN +config HISILICON_IRQ_MBIGEN + bool + select ARM_GIC_V3 + select ARM_GIC_V3_ITS + select GENERIC_MSI_IRQ_DOMAIN + config IMGPDC_IRQ bool select GENERIC_IRQ_CHIP -- cgit v1.2.3-59-g8ed1b