From patchwork Tue Sep 16 11:54:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 37457 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5FDCE20F2E for ; Tue, 16 Sep 2014 11:55:32 +0000 (UTC) Received: by mail-wg0-f69.google.com with SMTP id y10sf3065702wgg.8 for ; Tue, 16 Sep 2014 04:55:31 -0700 (PDT) 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=lSQPTQDZZ4AxmFDodmjoeuiIi/gjtneh3lMlNAlipwA=; b=TvXlsgXN9y6vHb/ah0+R0bmsWy3e7pwLI2kb98SzThJlZCG57Yb4ppFiXtgepp9KaR JKs8acc29PAHJOqBsBPSrC0aCB0wN0pKuHjla62sew2Yz32RibjparZMqKVNQgWKG62b 9SkZN3hwO22PiVxQbQJ+jxHpmczdk+LGDiEdyg9kp1bQBGAmz284vHlxB5GMvn0WHmFD KpXpMCk6Z3lxdq2DIJr6NKM5vFLaGI2Pg/xA97mA2d82QBpQt5ljzuAa6du/9dEAYuOH Jyq3am4c6cMB3Wmnmm/qnoUnOABpBsD4eHFGQvc8BYOK3VEZ3z+opfzbgWA6qlWPs+Vt A3mw== X-Gm-Message-State: ALoCoQmcVBPwpQpYfT8iAf+o8I8MYzBhsB2xMmxLu7rGaXrt57b45S7dpfch+fwHurXDWN8+nuYN X-Received: by 10.112.146.97 with SMTP id tb1mr265076lbb.20.1410868531296; Tue, 16 Sep 2014 04:55:31 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.201 with SMTP id v9ls495415lag.40.gmail; Tue, 16 Sep 2014 04:55:31 -0700 (PDT) X-Received: by 10.152.43.18 with SMTP id s18mr16634880lal.68.1410868531064; Tue, 16 Sep 2014 04:55:31 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com [209.85.215.46]) by mx.google.com with ESMTPS id h10si23757526lam.113.2014.09.16.04.55.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 16 Sep 2014 04:55:30 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by mail-la0-f46.google.com with SMTP id el20so6510724lab.5 for ; Tue, 16 Sep 2014 04:55:29 -0700 (PDT) X-Received: by 10.112.53.230 with SMTP id e6mr10218298lbp.100.1410868529799; Tue, 16 Sep 2014 04:55:29 -0700 (PDT) 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.130.169 with SMTP id of9csp374330lbb; Tue, 16 Sep 2014 04:55:29 -0700 (PDT) X-Received: by 10.66.151.196 with SMTP id us4mr44287112pab.78.1410868526109; Tue, 16 Sep 2014 04:55:26 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id zp8si29178866pac.130.2014.09.16.04.55.25 for ; Tue, 16 Sep 2014 04:55:25 -0700 (PDT) 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 S1753413AbaIPLzU (ORCPT + 6 others); Tue, 16 Sep 2014 07:55:20 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:58165 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754326AbaIPLzI (ORCPT ); Tue, 16 Sep 2014 07:55:08 -0400 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) 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 <0NBZ00JD9T8MGPB0@mailout2.w1.samsung.com> for linux-samsung-soc@vger.kernel.org; Tue, 16 Sep 2014 12:57:58 +0100 (BST) X-AuditID: cbfec7f5-b7f776d000003e54-10-5418251ab72c Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 9D.9C.15956.A1528145; Tue, 16 Sep 2014 12:55:06 +0100 (BST) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync2.samsung.com (Oracle Communications Messaging Server 7u4-23.01 (7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0NBZ00CMIT3CL960@eusync2.samsung.com>; Tue, 16 Sep 2014 12:55:06 +0100 (BST) 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 v2 17/18] iommu: exynos: init from dt-specific callback instead of initcall Date: Tue, 16 Sep 2014 13:54:44 +0200 Message-id: <1410868485-4143-18-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1410868485-4143-1-git-send-email-m.szyprowski@samsung.com> References: <1410868485-4143-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFLMWRmVeSWpSXmKPExsVy+t/xK7pSqhIhBqeaTCz+TjrGbjFx5WRm i0n3J7BYLNhvbdE5ewO7Re+Cq2wWZ5vesFt0TlzCbvHlykMmi02Pr7FazDi/j8li7ZG77Ban rn9ms/jXe5DR4v+eHewWRx7uZrdYtesPo8Xt33wWLz+eYHEQ9nhycB6Tx5p5axg9fv+axOix c9Zddo/ZHTNZPTav0PLYtKqTzWPzknqP2/8eM3tMvrGc0ePKiSZWj97md2wefVtWMXp83iQX wBfFZZOSmpNZllqkb5fAlfH70Wm2gm2CFYuOeTcw3uDrYuTkkBAwkZg8o50VwhaTuHBvPVsX IxeHkMBSRommqX9YIZw+Jon2583MIFVsAoYSXW+72EBsEYF8iRd7/7KA2MwCb1gk7m0yBLGF BWIlWromgcVZBFQlpjd3MoLYvAIeEh13p7FAbJOT+P9yBROIzQkUn9z2BGy+kIC7xMdvp5gm MPIuYGRYxSiaWppcUJyUnmukV5yYW1yal66XnJ+7iRESH193MC49ZnWIUYCDUYmHN+OfeIgQ a2JZcWXuIUYJDmYlEV4NRYkQId6UxMqq1KL8+KLSnNTiQ4xMHJxSDYy7dmld+vjxr0HxTFu7 pCoF6+VOdtpnZ0rcuqz/tivxhq1d1OlpKZZxycldkRtWnSpmeLpaqujP05lSJ/K2Pd5UJc04 zTi3Xv/v7wd9+f+aHf3Kn9lvPnj/zJNp93c+33XL92WnvYVgqihja6bY1H21X4w+/cgOS9TT 2f6xY3HiNDf+C83mAe+UWIozEg21mIuKEwGOPGJDbQIAAA== 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.46 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 | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 5eb999d7653a..0d304c62956e 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; @@ -1083,6 +1088,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; @@ -1115,6 +1122,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); @@ -1124,4 +1133,25 @@ err_reg_driver: kmem_cache_destroy(lv2table_kmem_cache); return ret; } -subsys_initcall(exynos_iommu_init); + +static struct iommu_data exynos_of_data = { + .ops = &exynos_iommu_ops, +}; + +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_data(np, &exynos_of_data); + return 0; +} + +IOMMU_OF_DECLARE(exynos_iommu_of, "samsung,exynos-sysmmu", + exynos_iommu_of_setup);