Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp184431rdb; Tue, 31 Oct 2023 04:56:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFFXjYLaF3MQMXToc9G+7kC8a9nTcHcaRYFfq0V6V7shPddq7nzcQr2NhPygfiCuEU/fNol X-Received: by 2002:a05:6358:cb23:b0:168:eb13:807d with SMTP id gr35-20020a056358cb2300b00168eb13807dmr11121003rwb.14.1698753369005; Tue, 31 Oct 2023 04:56:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698753368; cv=none; d=google.com; s=arc-20160816; b=V247WUhjG1tSJfX4XBIh5SumTU4MmmFcPnoYUkGh9uSto+TrYJRLsh1DDWw+Eyg6N1 fRhIgMWNi8rsFtb8AQC1n2KytxLqZwM7bLHZleLrbXc47x852ylQggVVZkRhhPORM66/ 8RB6K8MCJs/IF2eoc2l2ue4D3kN/XdfM4dg+aNGx7eXFyCltmg3S+VXMfCD05muOFObf pfwI6lzhKNBNkds8MltsIOctca9wPX2p4An1PVMBwxZ/RsaaIZxn6pZLJQ0sHUo9Eqq9 6YKixPJPQZuJAv1taL2pO3i18zApW9HJcK4PxbhL041kpuvZDIZLxoDZC9JvCMrDKIJu ShtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=uICahYagLN9kpABjaSZScj5xb+5FHl10/GY5qE1glXA=; fh=ld3UXb1S5Y4IkunPfuj6e9Ppmc+fy6ncC+eQtrVLfK8=; b=DWduENXS2eo2UCFfngyWGjMY1m8LfqwCRuymLOQOUvLyRCC56FdwOgOmeqvTeNkyH5 opKeK2jAgZlwYaMvymfJaRyEn1jgY6V1aQaeni7SJGKqezgaVkPMQ5X3iKAv4N3NF5D7 f/+T52TofWJFbpIhpjT04pzVpragPXoYPAfWdqcgFA6FUvV9+ILNg4mPoNLiy4iGHLk6 HPKaT+kJrKDlGqTNaV8r5kedG6iLjGOrpmRl/a+mIl+oKtv2/5Pzaymv3LCQugENBVey lVg/yElpSPGzzrynGqfMS100TtXzyZe5awv6AWo6OZH7NvsdK4nRNMKicXKtJNaP66Ce d/Tw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id m11-20020a656a0b000000b005b915369815si951766pgu.155.2023.10.31.04.56.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 04:56:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 47C758068116; Tue, 31 Oct 2023 04:55:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344147AbjJaLzN (ORCPT + 99 others); Tue, 31 Oct 2023 07:55:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344037AbjJaLyr (ORCPT ); Tue, 31 Oct 2023 07:54:47 -0400 Received: from fd01.gateway.ufhost.com (fd01.gateway.ufhost.com [61.152.239.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3A9DF9; Tue, 31 Oct 2023 04:54:44 -0700 (PDT) Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by fd01.gateway.ufhost.com (Postfix) with ESMTP id 64B888138; Tue, 31 Oct 2023 19:54:43 +0800 (CST) Received: from EXMBX171.cuchost.com (172.16.6.91) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Tue, 31 Oct 2023 19:54:43 +0800 Received: from ubuntu.localdomain (113.72.146.247) by EXMBX171.cuchost.com (172.16.6.91) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Tue, 31 Oct 2023 19:54:42 +0800 From: Minda Chen To: Conor Dooley , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Lorenzo Pieralisi , "Daire McNamara" , Emil Renner Berthing , Krzysztof Kozlowski CC: , , , , Paul Walmsley , Palmer Dabbelt , Albert Ou , Philipp Zabel , Mason Huo , Leyfoon Tan , Kevin Xie , Minda Chen Subject: [PATCH v10 12/20] PCI: microchip: Add request_event_irq() callback function Date: Tue, 31 Oct 2023 19:54:22 +0800 Message-ID: <20231031115430.113586-13-minda.chen@starfivetech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231031115430.113586-1-minda.chen@starfivetech.com> References: <20231031115430.113586-1-minda.chen@starfivetech.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [113.72.146.247] X-ClientProxiedBy: EXCAS062.cuchost.com (172.16.6.22) To EXMBX171.cuchost.com (172.16.6.91) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 31 Oct 2023 04:55:29 -0700 (PDT) PolarFire implements specific PCIe interrupts except PLDA local inter- rupt. For lack of MSI controller, these interrupts have to be added to global event field. PolarFire driver also register additional interrupt symbol name. PolarFire PCIe contain total 28 interrupts event while PLDA contain 13 local interrupts event, interrupt to event num mapping is different. So add a callback function to support different IRQ register function. Also Add PLDA default handler function, which will be moved to pcie- plda-host.c in moving codes patch. Signed-off-by: Minda Chen Acked-by: Conor Dooley --- .../pci/controller/plda/pcie-microchip-host.c | 31 ++++++++++++++++--- drivers/pci/controller/plda/pcie-plda.h | 5 +++ 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/plda/pcie-microchip-host.c b/drivers/pci/controller/plda/pcie-microchip-host.c index d42278c006bc..f89d102f4979 100644 --- a/drivers/pci/controller/plda/pcie-microchip-host.c +++ b/drivers/pci/controller/plda/pcie-microchip-host.c @@ -643,6 +643,11 @@ static irqreturn_t mc_event_handler(int irq, void *dev_id) return IRQ_HANDLED; } +static irqreturn_t plda_event_handler(int irq, void *dev_id) +{ + return IRQ_HANDLED; +} + static void plda_handle_event(struct irq_desc *desc) { struct plda_pcie_rp *port = irq_desc_get_handler_data(desc); @@ -804,6 +809,17 @@ static int mc_pcie_init_clks(struct device *dev) return 0; } +static int mc_request_event_irq(struct plda_pcie_rp *plda, int event_irq, + int event) +{ + return devm_request_irq(plda->dev, event_irq, mc_event_handler, + 0, event_cause[event].sym, plda); +} + +static const struct plda_event mc_event = { + .request_event_irq = mc_request_event_irq, +}; + static int plda_pcie_init_irq_domains(struct plda_pcie_rp *port) { struct device *dev = port->dev; @@ -904,7 +920,9 @@ static void mc_disable_interrupts(struct mc_pcie *port) writel_relaxed(GENMASK(31, 0), bridge_base_addr + ISTATUS_HOST); } -static int plda_init_interrupts(struct platform_device *pdev, struct plda_pcie_rp *port) +static int plda_init_interrupts(struct platform_device *pdev, + struct plda_pcie_rp *port, + const struct plda_event *event) { struct device *dev = &pdev->dev; int irq; @@ -928,8 +946,13 @@ static int plda_init_interrupts(struct platform_device *pdev, struct plda_pcie_r return -ENXIO; } - ret = devm_request_irq(dev, event_irq, mc_event_handler, - 0, event_cause[i].sym, port); + if (event->request_event_irq) + ret = event->request_event_irq(port, event_irq, i); + else + ret = devm_request_irq(dev, event_irq, + plda_event_handler, + 0, NULL, port); + if (ret) { dev_err(dev, "failed to request IRQ %d\n", event_irq); return ret; @@ -983,7 +1006,7 @@ static int mc_platform_init(struct pci_config_window *cfg) return ret; /* Address translation is up; safe to enable interrupts */ - ret = plda_init_interrupts(pdev, &port->plda); + ret = plda_init_interrupts(pdev, &port->plda, &mc_event); if (ret) return ret; diff --git a/drivers/pci/controller/plda/pcie-plda.h b/drivers/pci/controller/plda/pcie-plda.h index e3d35cef9894..28ed1374e1de 100644 --- a/drivers/pci/controller/plda/pcie-plda.h +++ b/drivers/pci/controller/plda/pcie-plda.h @@ -121,6 +121,11 @@ struct plda_pcie_rp { int num_events; }; +struct plda_event { + int (*request_event_irq)(struct plda_pcie_rp *pcie, + int event_irq, int event); +}; + void plda_pcie_setup_window(void __iomem *bridge_base_addr, u32 index, phys_addr_t axi_addr, phys_addr_t pci_addr, size_t size); -- 2.17.1