From patchwork Wed Feb 17 07:01:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Liao X-Patchwork-Id: 8335081 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 45154C02AA for ; Wed, 17 Feb 2016 07:04:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6527D202E9 for ; Wed, 17 Feb 2016 07:04:58 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8E49420320 for ; Wed, 17 Feb 2016 07:04:57 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aVw9A-0000kO-CC; Wed, 17 Feb 2016 07:03:36 +0000 Received: from [210.61.82.183] (helo=mailgw01.mediatek.com) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aVw7m-0007ot-97; Wed, 17 Feb 2016 07:02:13 +0000 Received: from mtkhts07.mediatek.inc [(172.21.101.69)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 728903364; Wed, 17 Feb 2016 15:01:44 +0800 Received: from mtksdtcf04.mediatek.inc (10.21.12.144) by mtkhts07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 14.3.266.1; Wed, 17 Feb 2016 15:01:43 +0800 From: James Liao To: Matthias Brugger , Sascha Hauer Subject: [PATCH v5 2/4] soc: mediatek: Init MT8173 scpsys driver earlier Date: Wed, 17 Feb 2016 15:01:37 +0800 Message-ID: <1455692499-56828-3-git-send-email-jamesjj.liao@mediatek.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1455692499-56828-1-git-send-email-jamesjj.liao@mediatek.com> References: <1455692499-56828-1-git-send-email-jamesjj.liao@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160216_230210_617209_8E57B4E1 X-CRM114-Status: GOOD ( 14.85 ) X-Spam-Score: -1.1 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: srv_heupstream@mediatek.com, devicetree@vger.kernel.org, Kevin Hilman , linux-kernel@vger.kernel.org, Daniel Kurtz , linux-mediatek@lists.infradead.org, James Liao , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some power domain comsumers may init before module_init. So the power domain provider (scpsys) need to be initialized earlier too. Take an example for our IOMMU (M4U) and SMI. SMI is a bridge between IOMMU and multimedia HW. SMI is responsible to enable/disable iommu and help transfer data for each multimedia HW. Both of them have to wait until the power and clocks are enabled. So scpsys driver should be initialized before SMI, and SMI should be initialized before IOMMU, and then init IOMMU consumers (display/vdec/venc/camera etc.). IOMMU is subsys_init by default. So we need to init scpsys driver before subsys_init. Signed-off-by: James Liao --- drivers/soc/mediatek/mtk-scpsys.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c index 6d2874d..ebfc887 100644 --- a/drivers/soc/mediatek/mtk-scpsys.c +++ b/drivers/soc/mediatek/mtk-scpsys.c @@ -625,4 +625,21 @@ static struct platform_driver scpsys_drv = { .of_match_table = of_match_ptr(of_scpsys_match_tbl), }, }; -builtin_platform_driver_probe(scpsys_drv, scpsys_probe); + +static int __init scpsys_drv_init(void) +{ + return platform_driver_probe(&scpsys_drv, scpsys_probe); +} + +/* + * There are some Mediatek drivers which depend on the power domain driver need + * to probe in earlier initcall levels. So scpsys driver also need to probe + * earlier. + * + * IOMMU(M4U) and SMI drivers for example. SMI is a bridge between IOMMU and + * multimedia HW. IOMMU depends on SMI, and SMI is a power domain consumer, + * so the proper probe sequence should be scpsys -> SMI -> IOMMU driver. + * IOMMU drivers are initialized during subsys_init by default, so we need to + * move SMI and scpsys drivers to subsys_init or earlier init levels. + */ +subsys_initcall(scpsys_drv_init);