Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp730269rdg; Wed, 11 Oct 2023 04:07:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGpcUDGw/GqbDesmJbPgywY5/BEIeBnp/kl/C6CUkc99VzdkjqJyRdmD97Eo30wGZ1Vfrua X-Received: by 2002:a05:6a21:47c8:b0:172:15c8:1fa2 with SMTP id as8-20020a056a2147c800b0017215c81fa2mr4324118pzc.53.1697022425474; Wed, 11 Oct 2023 04:07:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697022425; cv=none; d=google.com; s=arc-20160816; b=Ljg8npRrokIK1pWA+ECEYj9f3QbU+UGklwM+kJ7zItAgNSM2S+nYZsIhOH0FeHQ5UL /zWYH4bkMeJ71p9iIVHZ8BLJknu9mgfp4Z/7iQK54LBar35KrQ5n/HNAijXtwdSBTYP6 EMWZzoRjVmC7QTsnY9L+aes+bxLizFfTOJ72TcD+QIg6FVd+BSxVmhaZbBu4P21wlnT8 ccx6LeqthnbkGaXUUOoFerFmYciYE25ocyRdOa4F+t7LbB2gdFu/CYpi1uaI7yHNaXx9 OfSOq2qbFRCdECaNcdusupdzGtgX8iRpgamVdIUOvaKuBG6R488eGESyiFVZfOTpUWhQ 3TZA== 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=1J1rzjUULAQBkwaGSRujCfp1CYNIqOk0+RP+08qckhM=; fh=ld3UXb1S5Y4IkunPfuj6e9Ppmc+fy6ncC+eQtrVLfK8=; b=0rT7lgxMIXpHdheTkMN4kCi4FVbgfjG75XuvqTLECcNbMgJhcY/+c3RhF+DxPYV2YY Oz8XwvDvrIEo6TTg8xqPSbqmPiAMv4X1RanjPEZqeXBV21nctSy1TdRVgv3WVHmvLVc+ LSlKX5fepMyPLGpLHyrqCHdo+tr3Qku3tlkKNfDmDYqe3D3bxLmYtI3kRu91vcQPyKg3 xOdozgbTFd7UN+JzqgB0jagqsSsA3zwwniLSnrH9lNiQRItLB82Hy3SixWcDy4+N9wBS A/FehNO/w7IxVoPUJ+HwGzyF+CGkEi3Vf2aniTM4q0BFnDhFWHOLXF1x8lX29e18NfQF 8F/w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id u11-20020a6540cb000000b0057795cb4f16si13972905pgp.684.2023.10.11.04.07.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 04:07:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id 85DD480EE788; Wed, 11 Oct 2023 04:07:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234900AbjJKLGj (ORCPT + 99 others); Wed, 11 Oct 2023 07:06:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234881AbjJKLFb (ORCPT ); Wed, 11 Oct 2023 07:05:31 -0400 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DC7E93; Wed, 11 Oct 2023 04:05:29 -0700 (PDT) Received: from fd01.gateway.ufhost.com (fd01.gateway.ufhost.com [61.152.239.71]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ex01.ufhost.com (Postfix) with ESMTP id D49AE24E37B; Wed, 11 Oct 2023 19:05:27 +0800 (CST) 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 fd01.gateway.ufhost.com (Postfix) with ESMTP id B7BEB24DFCE; Wed, 11 Oct 2023 19:05:27 +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; Wed, 11 Oct 2023 19:05:27 +0800 Received: from ubuntu.localdomain (183.27.96.95) by EXMBX171.cuchost.com (172.16.6.91) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Wed, 11 Oct 2023 19:05:26 +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 v8 13/22] PCI: microchip: Add request_event_irq() callback function Date: Wed, 11 Oct 2023 19:05:05 +0800 Message-ID: <20231011110514.107528-14-minda.chen@starfivetech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231011110514.107528-1-minda.chen@starfivetech.com> References: <20231011110514.107528-1-minda.chen@starfivetech.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [183.27.96.95] 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=2.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Wed, 11 Oct 2023 04:07:01 -0700 (PDT) X-Spam-Level: ** PolarFire implements specific interrupts besides PLDA local interrupt and register their interrupt symbol name. (Total 28 interrupts while PLDA contain 13 local interrupts). and interrupt to event mapping is different. So add a callback function to support different IRQ register function. 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 1799455989ac..104332603e25 100644 --- a/drivers/pci/controller/plda/pcie-microchip-host.c +++ b/drivers/pci/controller/plda/pcie-microchip-host.c @@ -799,6 +799,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; @@ -898,7 +909,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; @@ -922,8 +935,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; @@ -977,7 +994,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 b439160448b1..907ad40f3188 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); +}; + 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, -- 2.17.1