Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2457645rdh; Wed, 27 Sep 2023 03:20:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFRp3YXOFAlKZuocQt/Aan/3d4ZHtUzjt9gWz55Q5kGFTikrTX90Hg3WbO98ot6Oo/4tBbg X-Received: by 2002:a67:eb0f:0:b0:450:f9eb:f412 with SMTP id a15-20020a67eb0f000000b00450f9ebf412mr1639342vso.5.1695810048003; Wed, 27 Sep 2023 03:20:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695810047; cv=none; d=google.com; s=arc-20160816; b=WO18kZ8lGv8gnEvdtXz1hqPgUyqM31xYxXJSBWaWm070VZJ9SogeOC7L2hjQAYNbfz pxpXxnY1m9pXrBHSDJZWr3uv+QfyS1PiNObWfFpQHyT3DRGSe4AMPpnlhyQLX2YEaaDu 2A4H+gPP26qYemSNk1Y/miZzcd8y7WPdeClqDIf61wXLWXz4gwHB0Dg21dp0UcTKf+Cz IlPq5qGDmWFJncU71IE3LZSrAFeuHLAqy/+VJ8EjbvJbhIZzzvpcw9sDQCIphsOK4/Vh 5nWJcJEs7PA6ciC5meK36rClfbwJdvqr0E12Ek7Yq7lyRTSxBXpTdvbvRGb5hQK2X1HH LOhQ== 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=KH/9o+8UBz/NoIGu0llUr0msPOhSsaa+/ATeWBANkvM=; b=M7uHQJ0VIpR+vwd5d7vApLhVEyH4RB8oDtJkxFKPaYpVU0y5g4xfP8VAbs8MyJUhCN roFGhXnnT/OSGR5o88YwrEEPDMdsZNwRo1UZ/3AABvTfUa5fQFg/2FEfdJAXEQ4VhVLQ I9RkyYfEq/5Zwzt6nsalP8bwq5lyNBiWCyefxtx5T7w1wDTRnaz77X6tYRk7Gs8wtSon SRn8MS0KznLWpqnzZSwop/DdbZ1zeySHzHhXWkwtKFW+TFBhvPe0faorZNIeE23nBnnC wwqRprxIvo3hGeRNIcmfzUivHuVdor9T1ledXZYRINXCeS4WZApP2tTdZowBBfr6olec qrNA== 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:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id u11-20020a6540cb000000b005855f67e490si691065pgp.690.2023.09.27.03.20.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 03:20:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 7F4BF828E86B; Wed, 27 Sep 2023 03:09:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231349AbjI0KI4 (ORCPT + 99 others); Wed, 27 Sep 2023 06:08:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231184AbjI0KIT (ORCPT ); Wed, 27 Sep 2023 06:08:19 -0400 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 878F719A; Wed, 27 Sep 2023 03:08:17 -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 5ADD324E2FD; Wed, 27 Sep 2023 18:08:16 +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, 27 Sep 2023 18:08:16 +0800 Received: from ubuntu.localdomain (113.72.144.128) by EXMBX171.cuchost.com (172.16.6.91) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Wed, 27 Sep 2023 18:08:14 +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: , , , , Paul Walmsley , Palmer Dabbelt , Albert Ou , Philipp Zabel , Mason Huo , Leyfoon Tan , Kevin Xie , Minda Chen Subject: [PATCH v7 11/19] PCI: microchip: Add request_event_irq() callback function Date: Wed, 27 Sep 2023 18:07:54 +0800 Message-ID: <20230927100802.46620-12-minda.chen@starfivetech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230927100802.46620-1-minda.chen@starfivetech.com> References: <20230927100802.46620-1-minda.chen@starfivetech.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [113.72.144.128] X-ClientProxiedBy: EXCAS066.cuchost.com (172.16.6.26) To EXMBX171.cuchost.com (172.16.6.91) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (howler.vger.email [0.0.0.0]); Wed, 27 Sep 2023 03:09:01 -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