From patchwork Wed Nov 19 11:15:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 41145 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8B73020CBB for ; Wed, 19 Nov 2014 11:16:54 +0000 (UTC) Received: by mail-lb0-f200.google.com with SMTP id f15sf253762lbj.11 for ; Wed, 19 Nov 2014 03:16:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=/gHqnYB7MVUAjXDnS26SXPOCd1+LvxaemtGlYAdm89g=; b=W3tTlF6x/yYZ11Nj43Z9dG3yF8uAen9oV57QGR0qhHGL520TdrsZlW5Re4OIU1kSxB vNk9lbVOfaWv+Nb343LrHizsJceQq67eUgsBrS8zNLR0AWnQ42lGyFxsPs6TmbeFqKM+ lzhy9wT6FP/Q98KtVhO9/bj+Z9ZjoDggJ3mps+jpKqIvOfDVUWFX1g9PjbDhHdP7Ltmn pPIBTA3HI/WO2K5GWkzWHUAklQDoPOonN3+nD0WxVyrS0P5YrCBbPP0EnSlMR3UUXgHp pD0oApEqXFb9INpuf/FqW6zZAYbsPKDsU91uqCM/CPJODBPgjHUYkwP/RU0+DF0dtGGb nLHw== X-Gm-Message-State: ALoCoQln+hePbOcjM7nu7tCnrzuSgux683KyH5APlOe8qJvpy5ZRO9eb/DGYHRdC1UbtgWpQb7JH X-Received: by 10.152.26.72 with SMTP id j8mr955383lag.3.1416395813541; Wed, 19 Nov 2014 03:16:53 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.4.33 with SMTP id cb1ls1534641lad.89.gmail; Wed, 19 Nov 2014 03:16:52 -0800 (PST) X-Received: by 10.152.21.135 with SMTP id v7mr4892760lae.65.1416395812948; Wed, 19 Nov 2014 03:16:52 -0800 (PST) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id wh3si1416255lbb.118.2014.11.19.03.16.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Nov 2014 03:16:52 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by mail-la0-f54.google.com with SMTP id gf13so284263lab.41 for ; Wed, 19 Nov 2014 03:16:52 -0800 (PST) X-Received: by 10.112.235.196 with SMTP id uo4mr4678510lbc.66.1416395812439; Wed, 19 Nov 2014 03:16:52 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp64328lbc; Wed, 19 Nov 2014 03:16:51 -0800 (PST) X-Received: by 10.66.65.233 with SMTP id a9mr44689134pat.107.1416395804640; Wed, 19 Nov 2014 03:16:44 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xo9si2087857pbc.210.2014.11.19.03.16.44 for ; Wed, 19 Nov 2014 03:16:44 -0800 (PST) Received-SPF: none (google.com: linux-samsung-soc-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754627AbaKSLQi (ORCPT + 4 others); Wed, 19 Nov 2014 06:16:38 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:39188 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754762AbaKSLQh (ORCPT ); Wed, 19 Nov 2014 06:16:37 -0500 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NFA001O8A4AAR40@mailout2.w1.samsung.com> for linux-samsung-soc@vger.kernel.org; Wed, 19 Nov 2014 11:19:22 +0000 (GMT) X-AuditID: cbfec7f4-b7f6c6d00000120b-b9-546c7c1363e1 Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id D9.F6.04619.31C7C645; Wed, 19 Nov 2014 11:16:35 +0000 (GMT) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync1.samsung.com (Oracle Communications Messaging Server 7u4-23.01 (7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0NFA00GC59YMTL30@eusync1.samsung.com>; Wed, 19 Nov 2014 11:16:35 +0000 (GMT) From: Marek Szyprowski To: iommu@lists.linux-foundation.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Marek Szyprowski , linaro-mm-sig@lists.linaro.org, Arnd Bergmann , Shaik Ameer Basha , Cho KyongHo , Joerg Roedel , Thierry Reding , Olof Johansson , Laurent Pinchart , Rob Herring , Will Deacon , David Wodhouse , Inki Dae , Kukjin Kim , Tomasz Figa , Kyungmin Park Subject: [PATCH v3 18/19] iommu: exynos: init from dt-specific callback instead of initcall Date: Wed, 19 Nov 2014 12:15:47 +0100 Message-id: <1416395748-10731-19-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1416395748-10731-1-git-send-email-m.szyprowski@samsung.com> References: <1416395748-10731-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrJLMWRmVeSWpSXmKPExsVy+t/xy7rCNTkhBivuG1j8nXSM3WLiysnM FpPuT2CxWLDf2qJz9gZ2i94FV9kszja9YbfonLiE3eLLlYdMFpseX2O1mHF+H5PF2iN32S1O Xf/MZvGv9yCjxf89O9gtjjzczW6xatcfRovbv/ksXn48weIg7PHk4DwmjzXz1jB6/P41idFj 56y77B6zO2ayemxeoeWxaVUnm8fmJfUet/89ZvaYfGM5o8eVE02sHr3N79g8+rasYvT4vEku gC+KyyYlNSezLLVI3y6BK2P9l1csBfcFKqY8+c7ewDiJr4uRg0NCwERi6g2lLkZOIFNM4sK9 9WxdjFwcQgJLGSX6tjazQjh9TBL3Z7Uwg1SxCRhKdL3tYgOxRQTyJV7s/csCYjMLvGGRuLfJ EMQWFoiV+PJxF1gNi4CqRFv3OrBeXgFPiU2dK5khtslJ/H+5ggnkCE6g+PUXYGOEBDwkmqav Y53AyLuAkWEVo2hqaXJBcVJ6rqFecWJucWleul5yfu4mRkh0fNnBuPiY1SFGAQ5GJR7ehuKc ECHWxLLiytxDjBIczEoivMWFQCHelMTKqtSi/Pii0pzU4kOMTBycUg2MgYsX5i7KPaW0lduQ ia+Ac/eX3rgWtzT1gpc/61lbo7r41Nhe9itkis+f383E0xfC9Cfm//1J7B4Bi3O3Vxt9n3+1 P2+NRCX3fj1dgcLeVv+ZdUpGX1562NR17rigXTt/yaQ5s4VKlW2Db26cc+QSo5H8bHafZy4H A9z9WzcmtfL/rzGQylJiKc5INNRiLipOBACvYcBlbAIAAA== Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: m.szyprowski@samsung.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This patch introduces IOMMU_OF_DECLARE-based initialization to the driver, which replaces subsys_initcall-based procedure. exynos_iommu_of_setup ensures that each sysmmu controller is probed before its master device. Signed-off-by: Marek Szyprowski --- drivers/iommu/exynos-iommu.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index cd28dc09db39..88f9afe641a0 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -13,16 +13,21 @@ #endif #include +#include #include #include #include #include #include +#include +#include +#include #include #include #include #include +#include #include typedef u32 sysmmu_iova_t; @@ -1084,6 +1089,8 @@ static const struct iommu_ops exynos_iommu_ops = { .pgsize_bitmap = SECT_SIZE | LPAGE_SIZE | SPAGE_SIZE, }; +static int init_done; + static int __init exynos_iommu_init(void) { int ret; @@ -1116,6 +1123,8 @@ static int __init exynos_iommu_init(void) goto err_set_iommu; } + init_done = true; + return 0; err_set_iommu: kmem_cache_free(lv2table_kmem_cache, zero_lv2_table); @@ -1125,4 +1134,21 @@ err_reg_driver: kmem_cache_destroy(lv2table_kmem_cache); return ret; } -subsys_initcall(exynos_iommu_init); + +static int __init exynos_iommu_of_setup(struct device_node *np) +{ + struct platform_device *pdev; + + if (!init_done) + exynos_iommu_init(); + + pdev = of_platform_device_create(np, NULL, platform_bus_type.dev_root); + if (IS_ERR(pdev)) + return PTR_ERR(pdev); + + of_iommu_set_ops(np, &exynos_iommu_ops); + return 0; +} + +IOMMU_OF_DECLARE(exynos_iommu_of, "samsung,exynos-sysmmu", + exynos_iommu_of_setup);