From patchwork Fri Jun 14 15:34:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13698906 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 41C41C27C6E for ; Fri, 14 Jun 2024 15:49:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=AxqLV5NfmG5/gBkPugYJBD8QD7NRVz49OJ+QMwOBjgg=; b=sLk+PVfP3WMa0WVDsqC7yFttqi FFgEkXxa3CytspoextD6t+LexAPZWIQYF7HP88AKgNnPL8PAX7AtTsO2wqjVTHMe/vBdjiaggMPSW CZXnmqhVlhp7OsiQuMibICy6xZXJEBwXav1CS9KRM1LjfU9L3rEen+8xb/2dCmk40WTZ1Cv/GM3kp F4YISavwdWnUyPcinvaqTALpMzpXjpxaIgIWf9/YDAC5vp8Z4gzTvwj9IQPuc7ztk3W6ftVzecz+b aWy2azgykqBFej1pEFx0udIxV2DK22SeXIn5h7R9yOSAanG5s4zDx1o2hw5AHCqTpSpTJkr0f9eX1 SRga+gTw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sI9AT-00000003IRC-0Z2Q; Fri, 14 Jun 2024 15:48:45 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sI9AQ-00000003IQK-2sOy for linux-arm-kernel@lists.infradead.org; Fri, 14 Jun 2024 15:48:43 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id ED2C261F72; Fri, 14 Jun 2024 15:48:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6EF0C2BD10; Fri, 14 Jun 2024 15:48:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718380121; bh=jO7Dzw5P4v+LVE4NQ3h4pjMq0kf48JMKykV7530/mdk=; h=From:To:Cc:Subject:Date:From; b=gErbsjQXHDwJOe8wCzAChDDl0ZuO/k8RfNsD1cODyzEJKV2xE1QFWNBBnKdDlNmSr SiuXFB4w7G0v1KVfZ/yhiXJP+eKTjfR8xqnZJQMZiffWcsepQc6zHdeseXNFDOQlXw qsZvF6iKuWEPWIsXmVW3ANQ/sSllcFRAdY0oudiKu/JDAuHpic1Eil3dmzhRGM0fKw cUPrushCS6DNBd7omHy/d81U0PjLZbeXLw7JEWOcMB7FzB1HYnJkHEUGs8G4Z+bad7 dZ+1TRbBw7OrgKJRJIJc5hkJffYgj3Lit9DczbG3so8hwL/2sZnFwHqtxCLNtWDGe/ V9B0X01H9rHNA== From: Jisheng Zhang To: Thomas Gleixner Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] irqchip/dw-apb-ictl: Support building as module Date: Fri, 14 Jun 2024 23:34:49 +0800 Message-ID: <20240614153449.2083-1-jszhang@kernel.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240614_084842_784456_D1CC46C6 X-CRM114-Status: GOOD ( 14.04 ) X-BeenThere: linux-arm-kernel@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-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Allow the user selection and building of this interrupt controller driver as a module, for example, in some synaptics arm64 SoCs it is used as a second level interrupt controller hanging off the ARM GIC and is therefore loadable during boot. However, this interrupt controller can also be used as the main interrupt controller by other platforms, so we must keep this kind of support by checking whether DW_APB_ICTL is builtin or not. Signed-off-by: Jisheng Zhang --- drivers/irqchip/Kconfig | 2 +- drivers/irqchip/irq-dw-apb-ictl.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index 14464716bacb..cfd1102eb273 100644 --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig @@ -145,7 +145,7 @@ config DAVINCI_CP_INTC select IRQ_DOMAIN config DW_APB_ICTL - bool + tristate "DesignWare APB Interrupt Controller" select GENERIC_IRQ_CHIP select IRQ_DOMAIN_HIERARCHY diff --git a/drivers/irqchip/irq-dw-apb-ictl.c b/drivers/irqchip/irq-dw-apb-ictl.c index d5c1c750c8d2..5eda6c4689cf 100644 --- a/drivers/irqchip/irq-dw-apb-ictl.c +++ b/drivers/irqchip/irq-dw-apb-ictl.c @@ -122,7 +122,7 @@ static int __init dw_apb_ictl_init(struct device_node *np, int ret, nrirqs, parent_irq, i; u32 reg; - if (!parent) { + if (!parent && IS_BUILTIN(CONFIG_DW_APB_ICTL)) { /* Used as the primary interrupt controller */ parent_irq = 0; domain_ops = &dw_apb_ictl_irq_domain_ops; @@ -214,5 +214,12 @@ static int __init dw_apb_ictl_init(struct device_node *np, release_mem_region(r.start, resource_size(&r)); return ret; } -IRQCHIP_DECLARE(dw_apb_ictl, - "snps,dw-apb-ictl", dw_apb_ictl_init); +#if IS_BUILTIN(CONFIG_DW_APB_ICTL) +IRQCHIP_DECLARE(dw_apb_ictl, "snps,dw-apb-ictl", dw_apb_ictl_init); +#else +IRQCHIP_PLATFORM_DRIVER_BEGIN(dw_apb_ictl) +IRQCHIP_MATCH("snps,dw-apb-ictl", dw_apb_ictl_init) +IRQCHIP_PLATFORM_DRIVER_END(dw_apb_ictl) +MODULE_DESCRIPTION("DesignWare APB Interrupt Controller"); +MODULE_LICENSE("GPL v2"); +#endif