Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3993143pxf; Mon, 22 Mar 2021 23:01:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBpnOnpZ2C7EK/gJR7o4vWe9xiELvN1aB00yyWDeTvACmPLajFx46I7qFDBgO8WPumZBKk X-Received: by 2002:a17:907:1693:: with SMTP id hc19mr3197350ejc.28.1616479271908; Mon, 22 Mar 2021 23:01:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616479271; cv=none; d=google.com; s=arc-20160816; b=Niz/mNgKVp0abmAoOdxplpUy0ZhGzT4beg+sK7oOjMNeyyvmV/a9kjVwaU+k1YImHw scOTByF4/Tpr8+8tIEZvO1htIM40k3b6VTTvY+gPJjiI4Xsz0peDiY3tcHb+v1EunMPF qhn9S897oxQ3dAqXB2m6xtkIAENGlqicuADBkPSG8K4wZIqDI5IRf76o6OmLrSuC9y68 XG8vAUyej4IPyaK12lbprp2YUpHkrQVoTp4OOeSqCdIUCb6u9Wmbds8IIEN1NFjl4gP+ fK7fEPe10ItQGBq56pnfuM8PIh408HxuqoPu7eYAtq3LnP+W6jhOzhB80v+52I22rjkN XLuQ== 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=tqQKCmHYvIEUNWf7WJ9C216/JP2E36/KTNWdtjBCC1s=; b=0X5NgDj/9fTjGqKHdICZkAV05BcMHYV9glCRLlIFPGs9uvtFFvCPzxxF1gYS5jI4N5 tjugd2huS4d4/H98adDgNNfiVcDk2VT3ooA1r26GS4RcklXgDUEpNTSGJzo/giXmPb9W Q0B7S+YkBXo1L+Kl40c5SEtQxbC2XVKmQUPgsSUmbrfiZzCfSNV8bGd+A/NdCl9UbpTd mEuryFQWnzbi9okqtbTmzJ3+U4iIFb3GvLHzvBHxxSFwMhZycNOCPw8FWyx7sp51PY6L RjjmLs8ETcvGFGuwv5liirl8bS/fJZL3kJQePncYHPLu2ADvu17+r0g9tIAAm8fhBARL rV1A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lr6si13852288ejb.9.2021.03.22.23.00.49; Mon, 22 Mar 2021 23:01:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229500AbhCWF6y (ORCPT + 99 others); Tue, 23 Mar 2021 01:58:54 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:60099 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S229590AbhCWF6Y (ORCPT ); Tue, 23 Mar 2021 01:58:24 -0400 X-UUID: 2a5c4466fbd2468cb1f5fbd24060b900-20210323 X-UUID: 2a5c4466fbd2468cb1f5fbd24060b900-20210323 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 531924362; Tue, 23 Mar 2021 13:58:20 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 23 Mar 2021 13:58:19 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 23 Mar 2021 13:58:18 +0800 From: Yong Wu To: Joerg Roedel , Matthias Brugger , Will Deacon CC: Robin Murphy , Tomasz Figa , , , , , , Krzysztof Kozlowski , , , Nicolas Boichat , , Subject: [PATCH 2/2] iommu/mediatek: Alloc building as module Date: Tue, 23 Mar 2021 13:58:01 +0800 Message-ID: <20210323055801.16885-2-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210323055801.16885-1-yong.wu@mediatek.com> References: <20210323055801.16885-1-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The IOMMU in many SoC depends on the MM clocks and power-domain which are device_initcall normally, thus the subsys_init here is not helpful. This patch switches it to module_platform_driver which allow the driver built as module. Correspondingly switch the config to tristate. Signed-off-by: Yong Wu --- drivers/iommu/Kconfig | 2 +- drivers/iommu/mtk_iommu.c | 16 ++++------------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig index bc93da48bed0..74f3e15edc14 100644 --- a/drivers/iommu/Kconfig +++ b/drivers/iommu/Kconfig @@ -349,7 +349,7 @@ config S390_AP_IOMMU is not implemented as it is not necessary for VFIO. config MTK_IOMMU - bool "MTK IOMMU Support" + tristate "MediaTek IOMMU Support" depends on ARCH_MEDIATEK || COMPILE_TEST select ARM_DMA_USE_IOMMU select IOMMU_API diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 6ecc007f07cd..a73ff3e20480 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -1079,16 +1080,7 @@ static struct platform_driver mtk_iommu_driver = { .pm = &mtk_iommu_pm_ops, } }; +module_platform_driver(mtk_iommu_driver); -static int __init mtk_iommu_init(void) -{ - int ret; - - ret = platform_driver_register(&mtk_iommu_driver); - if (ret != 0) - pr_err("Failed to register MTK IOMMU driver\n"); - - return ret; -} - -subsys_initcall(mtk_iommu_init) +MODULE_DESCRIPTION("IOMMU API for MediaTek M4U implementations"); +MODULE_LICENSE("GPL v2"); -- 2.18.0