Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1356378imm; Tue, 22 May 2018 02:45:31 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoPxAPtC/ji2cVNDUgsETDFQwMHvdUFxPPZY1BkH98y14oz1+RqzfgW4wFcKooClWWNPdyv X-Received: by 2002:a63:375d:: with SMTP id g29-v6mr8274558pgn.413.1526982331654; Tue, 22 May 2018 02:45:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526982331; cv=none; d=google.com; s=arc-20160816; b=ZutsEHyJf5Ctbbatnz7E8d6tOVCdlkm8NSFR+gOVLqlloeJLVAhQ7LgGPCv/Xuwwki JXuDg1HR/TI3MFmjkENqHSnjjmxLotfNP5pSna5JuhVlx9RqALEeOUm+ryF7vUHIKXNQ HZFNlwaUoY0ySZqdWwP73sIzB8MwNXHwEt5dulxUUG8qPT0tu1Y9QLPeCdJH75mGlImO /TNARslu6+peAHM88/5kGaR2uyj6qGMFc9gJa/hh0yMgZxOn/raEtFjJKXMPkEt8DPV7 X0U+gtS1jMyhWUtd/+lyRh9qOE1BdSrkHikf0XsHyYNuUxDfIWHmQim1v+6p05OVSOGD N3xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=fNrL6HOsvhGi1ZZfrVfBmX2dgR0XnePDmgfvjCxnH3Y=; b=aj/Gg+uFH0pC9JmVIUhB8HauSvbfC2443Y1klPnJG2yNxftihnRn3z3itSbRS9XKnh KtqUigvo69UwSYwJ6+qu8YDAu0RmgJ4VbqDwg6k67AdBmbc3RusOzPwRDSFipG1i+6wr H5p3GMWQJPUnT1lSPVNLYJOq12O3MyXcK7+VAKGk4T+Q3bcLLcPDh6CjCN5x/0ofwrgM HRNoPhfKdwKJt8MyTuXeEU5CecApH1AMDLsjHZRz5+hKfCiPbi6hpFls8mhrdlPs51k9 BJjswWVgnaCCtcphRIegEcGOxGHmuwoBpI5zGnHcNm3fX1BMT0nBZGY64V6umJ9j6DJu 3i0g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a5-v6si5477025plp.178.2018.05.22.02.45.16; Tue, 22 May 2018 02:45:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751652AbeEVJoU (ORCPT + 99 others); Tue, 22 May 2018 05:44:20 -0400 Received: from mail.bootlin.com ([62.4.15.54]:49700 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751391AbeEVJk6 (ORCPT ); Tue, 22 May 2018 05:40:58 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 7A42A207AC; Tue, 22 May 2018 11:40:56 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost.localdomain (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.bootlin.com (Postfix) with ESMTPSA id F1D4820828; Tue, 22 May 2018 11:40:45 +0200 (CEST) From: Miquel Raynal To: Thomas Gleixner , Jason Cooper , Marc Zyngier , Catalin Marinas , Will Deacon , Andrew Lunn , Gregory Clement , Sebastian Hesselbarth Cc: Rob Herring , Mark Rutland , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Thomas Petazzoni , Antoine Tenart , Maxime Chevallier , Nadav Haklai , Haim Boot , Hanna Hawa , linux-kernel@vger.kernel.org, Miquel Raynal Subject: [PATCH v2 07/16] irqchip/irq-mvebu-icu: disociate ICU and NSR Date: Tue, 22 May 2018 11:40:33 +0200 Message-Id: <20180522094042.24770-8-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180522094042.24770-1-miquel.raynal@bootlin.com> References: <20180522094042.24770-1-miquel.raynal@bootlin.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org NSR (non-secure interrupts) are handled in the ICU driver like if there was only this type of interrupt in the ICU. Change this behavior to prepare the introduction of SEI (System Error Interrupts) support by moving the NSR code in a separate function. This is done under the form of a 'probe' function to ease future migration to NSR/SEI being platform devices part of the ICU. Signed-off-by: Miquel Raynal Reviewed-by: Thomas Petazzoni --- drivers/irqchip/irq-mvebu-icu.c | 58 +++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/drivers/irqchip/irq-mvebu-icu.c b/drivers/irqchip/irq-mvebu-icu.c index 607948870a14..24d45186eb6b 100644 --- a/drivers/irqchip/irq-mvebu-icu.c +++ b/drivers/irqchip/irq-mvebu-icu.c @@ -205,6 +205,37 @@ static const struct irq_domain_ops mvebu_icu_domain_ops = { .free = mvebu_icu_irq_domain_free, }; +static int mvebu_icu_subset_probe(struct platform_device *pdev) +{ + struct device_node *msi_parent_dn; + struct irq_domain *irq_domain; + struct mvebu_icu *icu; + + icu = dev_get_drvdata(&pdev->dev); + if (!icu) + return -ENODEV; + + pdev->dev.msi_domain = of_msi_get_domain(&pdev->dev, pdev->dev.of_node, + DOMAIN_BUS_PLATFORM_MSI); + if (!pdev->dev.msi_domain) + return -EPROBE_DEFER; + + msi_parent_dn = irq_domain_get_of_node(pdev->dev.msi_domain); + if (!msi_parent_dn) + return -ENODEV; + + irq_domain = platform_msi_create_device_domain(&pdev->dev, ICU_MAX_IRQS, + mvebu_icu_write_msg, + &mvebu_icu_domain_ops, + icu); + if (!irq_domain) { + dev_err(&pdev->dev, "Failed to create ICU MSI domain\n"); + return -ENOMEM; + } + + return 0; +} + static struct regmap_config mvebu_icu_regmap_config = { .reg_bits = 32, .val_bits = 32, @@ -215,9 +246,6 @@ static struct regmap_config mvebu_icu_regmap_config = { static int mvebu_icu_probe(struct platform_device *pdev) { struct mvebu_icu *icu; - struct device_node *node = pdev->dev.of_node; - struct device_node *gicp_dn; - struct irq_domain *irq_domain; struct resource *res; void __iomem *regs; int i; @@ -255,19 +283,6 @@ static int mvebu_icu_probe(struct platform_device *pdev) icu->irq_chip.irq_set_affinity = irq_chip_set_affinity_parent; #endif - /* - * We're probed after MSI domains have been resolved, so force - * resolution here. - */ - pdev->dev.msi_domain = of_msi_get_domain(&pdev->dev, node, - DOMAIN_BUS_PLATFORM_MSI); - if (!pdev->dev.msi_domain) - return -EPROBE_DEFER; - - gicp_dn = irq_domain_get_of_node(pdev->dev.msi_domain); - if (!gicp_dn) - return -ENODEV; - /* * Clean all ICU interrupts with type SPI_NSR, required to * avoid unpredictable SPI assignments done by firmware. @@ -282,16 +297,9 @@ static int mvebu_icu_probe(struct platform_device *pdev) regmap_write(icu->regmap, ICU_INT_CFG(i), 0); } - irq_domain = - platform_msi_create_device_domain(&pdev->dev, ICU_MAX_IRQS, - mvebu_icu_write_msg, - &mvebu_icu_domain_ops, icu); - if (!irq_domain) { - dev_err(&pdev->dev, "Failed to create ICU domain\n"); - return -ENOMEM; - } + platform_set_drvdata(pdev, icu); - return 0; + return mvebu_icu_subset_probe(pdev); } static const struct of_device_id mvebu_icu_of_match[] = { -- 2.14.1