From patchwork Tue Feb 27 10:35:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minda Chen X-Patchwork-Id: 13573521 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E3882C54798 for ; Tue, 27 Feb 2024 10:36:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vhKWURbFSamYskl0Huq7v6zimBPhbRPOtbewU+iZ1PQ=; b=EkTPD8zNU+I/Mr sn62qc9ZKd8WbC7o70wtsT+bU56dp16tlz6TX6N2bQ9M2ycpnPRln8/zpYIwTtn4TKrHKCieTVRzz fQRh9IPCi6KU8b4jfiyswZYsPiyIABdb3WBaXk+k5cQawrmO1vJQ9zyJngxrmKSD6FMP0FaA/S5A8 yUqrjg8eN/Iu+LS126egZ2K5OGxrE//GMjfVRBpvpl8u0b5HwxYOljvWKso7s1B5HSKRTUahGtqvj 86Wl1s4o9VTFpygmS/FKDOWIj6eRZ8o/w1kK9yJnWB22VFWcgzMhTsZ/te+AZRlmHWmSkFM1EHPnN YBX99p397wRLBur2z5gw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1reuol-00000004lcA-30tJ; Tue, 27 Feb 2024 10:36:11 +0000 Received: from mail-bjschn02on2072b.outbound.protection.partner.outlook.cn ([2406:e500:4440:2::72b] helo=CHN02-BJS-obe.outbound.protection.partner.outlook.cn) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1reuoQ-00000004lIC-1I3T for linux-riscv@lists.infradead.org; Tue, 27 Feb 2024 10:35:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WERWLyAOoUD9L/QzW5G9RB55b2aU2aiigzVPuISEJ/6bSvnw978LAKlyyGxLEkc91raqqbm7HkNWcqHgr/MkqJtagWnEOxOp0SdjKBrcu8ia2sM6M1JP+X90lmG75Rb0ngtpK6K40TV/vHsgvFlPlSAvcpUV9qaoYJH+yrN5qieypPvHgF3J6er1Mqqy43vob5oKx79q69LU6MXEIiDv1ycX7I/FmYRheu06vDwuyAuVEAhNDZYPYpDGQBnpOjk6n6rGQZ68tpZ4NkMdybhw1Nyi/nWOyR1Z8KhEmEeaoHykjLGBVZWVPUN3/3C1uOC3kBbHNFARI0LSSO7J9dD+mQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cbCfwxEQCLcUcJNBQ9JZ4TkiYpLKqulShZ9N39mSbQk=; b=UtES4ko4qfNYO2WcySjGP6twVFZK3zz4p8iqLitckeWNZrNMQB31eJxZ4sIVa47xSsyPaTB1buKZLIPP77v2dMxY17PBOG98VGLXdYi41x1CBQ0Sq/Ww3k/6tePsveRcGpavcz4PTYDNIdfo0hXMJj+SKs13726jD2u64HzT/18hHNrUhynELUnpQhoURIwXbZlX72gyVXGXVwxb7ZLfg3RmocsCzMY+1pCafuE4kXpDvhtBw0VCb5/Hjd9VZfjhSSxtl6B3EAlTUilwJ+eNB93fkvtb2m/VlXDyHlEbyKEYDwKz4vPXhiOXZ2C6Xl6gWaj63iQSr4sPWUXdqc3TVA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=starfivetech.com; dmarc=pass action=none header.from=starfivetech.com; dkim=pass header.d=starfivetech.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=starfivetech.com; Received: from SHXPR01MB0863.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:25::15) by SHXPR01MB0496.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:1f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.47; Tue, 27 Feb 2024 10:35:42 +0000 Received: from SHXPR01MB0863.CHNPR01.prod.partner.outlook.cn ([fe80::5a5a:fa59:15fd:63dc]) by SHXPR01MB0863.CHNPR01.prod.partner.outlook.cn ([fe80::5a5a:fa59:15fd:63dc%3]) with mapi id 15.20.7270.047; Tue, 27 Feb 2024 10:35:42 +0000 From: Minda Chen To: Conor Dooley , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Lorenzo Pieralisi , Thomas Gleixner , Daire McNamara , Emil Renner Berthing , Krzysztof Kozlowski Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-pci@vger.kernel.org, Paul Walmsley , Palmer Dabbelt , Albert Ou , Philipp Zabel , Mason Huo , Leyfoon Tan , Kevin Xie , Minda Chen Subject: [PATCH v15,RESEND 12/23] PCI: microchip: Add request_event_irq() callback function Date: Tue, 27 Feb 2024 18:35:11 +0800 Message-Id: <20240227103522.80915-13-minda.chen@starfivetech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240227103522.80915-1-minda.chen@starfivetech.com> References: <20240227103522.80915-1-minda.chen@starfivetech.com> X-ClientProxiedBy: NT0PR01CA0003.CHNPR01.prod.partner.outlook.cn (2406:e500:c510::15) To SHXPR01MB0863.CHNPR01.prod.partner.outlook.cn (2406:e500:c311:25::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SHXPR01MB0863:EE_|SHXPR01MB0496:EE_ X-MS-Office365-Filtering-Correlation-Id: 259b7f29-f9f1-48b0-77f3-08dc377fd916 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /niWP6ebgDA9VhfHwEM9UzB6Hzx1hDWZ4YvXBnilJAAXVVqonhX9AgiQeam3Pa2pek6/5IgRakUs1Bi0IETtQnpucxlCn4A0xIiREzQQ4zFYlIJcLHC4qWXXWWhx+NRn98JqTzYpEmEOYF76fMtFTZOz9XFGV0WvvjsVNHyERUNUv+yjCFgfe1GejVzPFMS3jHjQoV9DLcYLSrRqTaDyNzc/aW/ipkD+Kn3K7mgH6UWWk8+YwghI7Eb/2+0dGIqkc3LbC+ucAA/tSIUGuO36pe3Ugd1LIEgzVMckRZ8HAEwgJvVXEJT6aiiFruv8fbACmuJolCqtz2KeyUUtG8GHJTxPYOFDNmxBlwwXkDe6qz5uJul0f5wY3KJ3twcNhVRshTjpvmV/9SwqmclLXmh3fttjarHz/DyByjdKrFoO7A5/qfEcxrAQ7SiiULbKq7YILTOCF2Re7mf9vGhblPZ514Av2MUgwhxE2VIrEXne8JB4x1PemqYE7LMmDWCyfaOagzXf2dCnsUpgNiUshg+GxxRHw01PShzywLfPV4L9lzQFPIQwtXgy6w8huXX9kTz6ls+DHPlxPPvisq6vi9blDFWFRirFEGcEyLW6855e/jHvtSPQtQpZsfzNQPdcG0rX X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SHXPR01MB0863.CHNPR01.prod.partner.outlook.cn;PTR:;CAT:NONE;SFS:(13230031)(38350700005);DIR:OUT;SFP:1102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UtMDg5VQAzJMQzsWITs+ANmQ4nDmXqRIE/vozNXGjCa5Utci9O1ZoFwxuHeKeBADP6bwxE7BGZOx8BXc4EbOnmmCGmTrBypkV7xT7yRWafRx2/Vj1mZsOvof+a4o8X1Ccpvju8mxP3geISQ0cxEEc2yAyiSjtBpRculBtgN5I+w8yBJK/DmUeRV8QsJCabdQDrug5h+Y3dHGRf6pJKDdMg7CwUOP17WJrFEGhBFmuaJ5KfEM9f86r6gorxP3ZyrZD+IaW/BPWEux7QmELiCvR/XVa2G8AIcFl9H7aE7TPHkG2n8WYhs6BwIHV0jtPP9KcHtE17G8oKAhGTTsKVUUrAL+gnRM3qEXGeDVEpPT/3Y6Sqbe/YH0oDsv+iHcjR0wAfMaJ0bcbIqYCfy4x+wZTgPbrRPNpP5PwIkxlSWKQjBWN3zTiTmKDoSiXPaL7ZdnkLKgKBeruXvTEAKYjctZRwcdwwpdnuplI4GBRnOr2phgyvzi5Mt9BWiw/4D7urv0wr+Beet7yZfgQ+RGNRyHrJZExhhOBE14jksZ6G1LNNIUt53pr4zSHu0jEQkg8b85Wq2V5iCq1xDjbvXaabL+9FcFg== X-OriginatorOrg: starfivetech.com X-MS-Exchange-CrossTenant-Network-Message-Id: 259b7f29-f9f1-48b0-77f3-08dc377fd916 X-MS-Exchange-CrossTenant-AuthSource: SHXPR01MB0863.CHNPR01.prod.partner.outlook.cn X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2024 10:35:42.3360 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 06fe3fa3-1221-43d3-861b-5a4ee687a85c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: V43vIwjySZu5p0/w9UFlBF/3aaQeng3GfNAkAlTeD7U2tt+akIceNRQFpNg3EO3SJrnmJz/tUeo3eeaSZQwvjEsIVMKm+kmmuHwTnJkWOrI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SHXPR01MB0496 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240227_023550_444863_CC998DF4 X-CRM114-Status: GOOD ( 14.34 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org As PLDA dts binding doc(Documentation/devicetree/bindings/pci/ plda,xpressrich3-axi-common.yaml) showed, PLDA PCIe contains an interrupt controller. Microchip Polarfire PCIe add some PCIe interrupts base on PLDA IP interrupt controller. Microchip Polarfire PCIe additional intrerrupts: (defined in drivers/pci/controller/plda/pcie-microchip-host.c) EVENT_PCIE_L2_EXIT EVENT_PCIE_HOTRST_EXIT EVENT_PCIE_DLUP_EXIT EVENT_SEC_TX_RAM_SEC_ERR EVENT_SEC_RX_RAM_SEC_ERR .... Both codes of request interrupts and mc_event_handler() contain additional interrupts symbol names, these can not be re-used. So add a new plda_event_handler() functions, which implements PLDA interrupt defalt handler, add request_event_irq() callback function to compat Microchip Polorfire PCIe additional interrupts. 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 0a5cd8b214cd..bf5ce33ee275 100644 --- a/drivers/pci/controller/plda/pcie-microchip-host.c +++ b/drivers/pci/controller/plda/pcie-microchip-host.c @@ -642,6 +642,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); @@ -803,6 +808,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 f7e900b395f8..935686bba837 100644 --- a/drivers/pci/controller/plda/pcie-plda.h +++ b/drivers/pci/controller/plda/pcie-plda.h @@ -127,6 +127,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);