Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4492287rdb; Fri, 15 Sep 2023 04:08:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEdW1FBe30m0HaNVMSoKwfQYC4H8n4NlCLhGKvJlyAGYSsD6jlLmXFpacHNY+aLv3jsTPQe X-Received: by 2002:a17:90a:c24a:b0:26d:17e0:2f3d with SMTP id d10-20020a17090ac24a00b0026d17e02f3dmr1054333pjx.44.1694776088346; Fri, 15 Sep 2023 04:08:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694776088; cv=none; d=google.com; s=arc-20160816; b=unXlKPeT6/oSvAmFybOWoHDwQBUHeyeBbERY95Iz8oGCmE5/X1kYvOMnnmrLFNrTSi glnj6lARPMrlSyhJcbpG/tq8Ed+SRWnFIp1DcaNZ2ET31H45xcp/wDbTONq6g8sAeBZ3 kN+SWTRNXKWiMki6IV7f6RBCyKskxPYWtxS1wOarPHDgI50gD3lmVQwuMjOd+XCkYGtO Lxwf93gywi0gYhu/az5UnsOLH1Agdc/jt1MNZydOLB3NYiDGtx3C+38HigUGSHhMcv+H sCV3WwXCUit/ZQde8d3ERNrcxVi2YwLKHoAMMjuHyoZhdzDoxCusafGVFoiKeefAwcRl vRvg== 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 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id f3-20020a17090ac28300b0026360db339fsi3145880pjt.12.2023.09.15.04.08.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 04:08:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 DCCD483A01B8; Fri, 15 Sep 2023 03:24:23 -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 S234177AbjIOKXk (ORCPT + 99 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=20Wilczy=C5=84ski?= , Emil Renner Berthing CC: , , , , =?UTF-8?q?Pali=20Roh=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 Content-Type: text/plain 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 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]); Fri, 15 Sep 2023 03:24:24 -0700 (PDT) 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, -- 2.17.1