From patchwork Fri Sep 15 10:22:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minda Chen X-Patchwork-Id: 140335 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp941533vqi; Fri, 15 Sep 2023 03:28:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFqfVceUjw7dvY4T7VCcz0SZhJmH59mjIuQVbu3cm8iOMaFsVErHdDlhemtBfxGWh7xzXri X-Received: by 2002:a9d:7443:0:b0:6bc:6389:b07 with SMTP id p3-20020a9d7443000000b006bc63890b07mr1139590otk.23.1694773734659; Fri, 15 Sep 2023 03:28:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694773734; cv=none; d=google.com; s=arc-20160816; b=DjbRR8avzz20VFQYpJ3IKwzX+VPNxSEFGiuQgSm3jJZnpfdFfToxto3mXAcEwjoM4N cAXwNP9yaup4drkCZvXpdA0S3y1Qdq3ASSQWJm9A1Z5arZ9AYMeHfW4wrGJbqyxRBPwM ra5iX1Xyn/9f5PzLMhAFl8oy/SXPeRO36FDrQjvdv9jv4qXtveWcdt/wlxPo4xr/VhHR hPqJF1AxaOcuidNrTbV42bobAF7efnyqjy3qz+benM4/FcMbBcX7ZqQeOWp24795Vihj JHAQtBBqPamxMoabuDaWWI5MnfUl8lZDb10ACAb4JLfPFeLvuqmOpQvd+o/IQJK/9h+U d3AA== 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=A+0CG0NViVAZJb38wdV7aUuMLy5RSbIlzYpb3Mb0WCo=; fh=y8d0C5dLtGb8zs8KQUIJy2R9+5DBPV29N8a8eZxYvuU=; b=k1IsZZ4NBNiS+JA2Lxo/RQ1M4swSoMCUZnlrmpZ7417K9YKaEuYx2nrMmovDknQLhZ Pw4fvKOnqGUg+ioEqUIXYLgeEj9Mbd5nW92BrfV6I0byRxCsUUDYAnHZOHGUNjeBJuys DMQsNZHSL6jd6EWNoxMpgrVk+dVzy/FqLjzKlNPLKZ7vSAXr/ivcBC82pTbQAYYCiW72 N7BNrcC2XPf163ReW9Xp6K91P/FQE5vRslyL1lODvvriyEt1nLCFrOF54/4T6L6p1mqz tLyJw6OIARGwu2/INy5lPr/eMaBjbsNj7Ox3DF5kgWEZbn3YMjl8QBvdsE5DM3rsMrmS ApSg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id k26-20020a6568da000000b0057744d09d22si3084123pgt.85.2023.09.15.03.28.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 03:28:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id 6E9318297C51; Fri, 15 Sep 2023 03:23:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234500AbjIOKXk (ORCPT + 32 others); Fri, 15 Sep 2023 06:23:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234325AbjIOKXE (ORCPT ); Fri, 15 Sep 2023 06:23:04 -0400 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F2A61FE1; Fri, 15 Sep 2023 03:22:59 -0700 (PDT) Received: from EXMBX166.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX166", Issuer "EXMBX166" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id ADAFA24E1E1; Fri, 15 Sep 2023 18:22:55 +0800 (CST) Received: from EXMBX171.cuchost.com (172.16.6.91) by EXMBX166.cuchost.com (172.16.6.76) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 15 Sep 2023 18:22:55 +0800 Received: from ubuntu.localdomain (113.72.144.67) by EXMBX171.cuchost.com (172.16.6.91) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 15 Sep 2023 18:22:54 +0800 From: Minda Chen To: Daire McNamara , Conor Dooley , Rob Herring , Krzysztof Kozlowski , Bjorn Helgaas , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Emil Renner Berthing CC: , , , , =?utf-8?q?P?= =?utf-8?q?ali_Roh=C3=A1r?= , Paul Walmsley , Palmer Dabbelt , Albert Ou , Philipp Zabel , Mason Huo , Leyfoon Tan , Kevin Xie , Minda Chen Subject: [PATCH v6 11/19] PCI: microchip: Add request_event_irq() callback function Date: Fri, 15 Sep 2023 18:22:35 +0800 Message-ID: <20230915102243.59775-12-minda.chen@starfivetech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230915102243.59775-1-minda.chen@starfivetech.com> References: <20230915102243.59775-1-minda.chen@starfivetech.com> MIME-Version: 1.0 X-Originating-IP: [113.72.144.67] 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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.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 (morse.vger.email [0.0.0.0]); Fri, 15 Sep 2023 03:23:50 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777099063475180459 X-GMAIL-MSGID: 1777099063475180459 PolarFire register 28 interrupts symbols name. PLDA just reguster 13 interrupts, it is not require to register symbol name. So add a callback functions to support StarFive and Microchip platforms. Signed-off-by: Minda Chen --- .../pci/controller/plda/pcie-microchip-host.c | 25 ++++++++++++++++--- drivers/pci/controller/plda/pcie-plda.h | 5 ++++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/plda/pcie-microchip-host.c b/drivers/pci/controller/plda/pcie-microchip-host.c index d9dd63084e2b..e3c7d5e66150 100644 --- a/drivers/pci/controller/plda/pcie-microchip-host.c +++ b/drivers/pci/controller/plda/pcie-microchip-host.c @@ -798,6 +798,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; @@ -897,7 +908,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; @@ -921,8 +934,12 @@ 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; @@ -976,7 +993,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 5b09ffed623c..4e0712c9365e 100644 --- a/drivers/pci/controller/plda/pcie-plda.h +++ b/drivers/pci/controller/plda/pcie-plda.h @@ -153,6 +153,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); +}; + irqreturn_t plda_event_handler(int irq, void *dev_id); void plda_pcie_setup_window(void __iomem *bridge_base_addr, u32 index, phys_addr_t axi_addr, phys_addr_t pci_addr,