From patchwork Tue Sep 16 11:54:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 37459 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 30A872057E for ; Tue, 16 Sep 2014 11:55:36 +0000 (UTC) Received: by mail-lb0-f199.google.com with SMTP id z11sf3105609lbi.6 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=2s4KLKYLrQPmrFi7nNXXYd5TYv4jko/Ll5fWryGPqSE=; b=WW1Tx6ovFSt1vdUgE74pn+i24Rh+XqVOMD7EMuI/piIr1ny2gtyw43CuAAHrNn/L+5 enkCGD/O8HWvwTiQl1P8UzDGI9dsAW2DAWo1KkiUwuRaH7kfxYPk622/8TOSPTaapaL1 N7G3/DD6enMqPrkvJ8wv2xmoxvpw0LKwtDca0GAOyzaWlAoToiKck1gOpIcKVSDjqoIz twR8YW7LvqeVY3sWyRMEBJX1D9M+rwkWDSnpSmGIlGC36+blmZqE+50Dpvf2IDskQFKf Ha9pzT9yhKsFcvC+gPPZXSpYPEXcL9mxMtRHs6QbQQj/UZF6uQWa8hXcHc/8l3tuUeZx Cr0Q== X-Gm-Message-State: ALoCoQkJkgYJVi/7hokQS2UTRa3GJrcGkf2tw26iYVJjWJ1DFyEcyycykK5cmGwsamTpJmsvb+nh X-Received: by 10.180.10.137 with SMTP id i9mr1006395wib.0.1410868528286; Tue, 16 Sep 2014 04:55:28 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.5.12 with SMTP id ci12ls353014lad.48.gmail; Tue, 16 Sep 2014 04:55:28 -0700 (PDT) X-Received: by 10.152.19.66 with SMTP id c2mr36748484lae.64.1410868528068; Tue, 16 Sep 2014 04:55:28 -0700 (PDT) Received: from mail-lb0-f171.google.com (mail-lb0-f171.google.com [209.85.217.171]) by mx.google.com with ESMTPS id jp16si23794117lab.86.2014.09.16.04.55.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 16 Sep 2014 04:55:27 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.171 as permitted sender) client-ip=209.85.217.171; Received: by mail-lb0-f171.google.com with SMTP id 10so6487823lbg.30 for ; Tue, 16 Sep 2014 04:55:27 -0700 (PDT) X-Received: by 10.152.204.231 with SMTP id lb7mr34055641lac.44.1410868526792; Tue, 16 Sep 2014 04:55:26 -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 of9csp374319lbb; Tue, 16 Sep 2014 04:55:26 -0700 (PDT) X-Received: by 10.70.119.97 with SMTP id kt1mr58960921pdb.54.1410868523015; Tue, 16 Sep 2014 04:55:23 -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.22 for ; Tue, 16 Sep 2014 04:55:22 -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 S1753875AbaIPLzR (ORCPT + 6 others); Tue, 16 Sep 2014 07:55:17 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:18289 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754330AbaIPLzJ (ORCPT ); Tue, 16 Sep 2014 07:55:09 -0400 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NBZ00GDQT8MR3B0@mailout3.w1.samsung.com> for linux-samsung-soc@vger.kernel.org; Tue, 16 Sep 2014 12:57:59 +0100 (BST) X-AuditID: cbfec7f4-b7f156d0000063c7-d4-5418251b8a43 Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 1D.38.25543.B1528145; Tue, 16 Sep 2014 12:55:07 +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:07 +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 18/18] iommu: exynos: add callback for initializing devices from device tree Date: Tue, 16 Sep 2014 13:54:45 +0200 Message-id: <1410868485-4143-19-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/xK7rSqhIhBrfmaVn8nXSM3WLiysnM FpPuT2CxWLDf2qJz9gZ2i94FV9kszja9YbfonLiE3eLLlYdMFpseX2O1mHF+H5PF2iN32S1O Xf/MZvGv9yCjxf89O9gtjjzczW6xatcfRovbv/ksXn48weIg7PHk4DwmjzXz1jB6/P41idFj 56y77B6zO2ayemxeoeWxaVUnm8fmJfUet/89ZvaYfGM5o8eVE02sHr3N79g8+rasYvT4vEku gC+KyyYlNSezLLVI3y6BK2Pa9olMBZt5K3a8mcPUwDiDu4uRk0NCwERi5YJ3rBC2mMSFe+vZ QGwhgaWMEofeanUxcgHZfUwSb9/OAUuwCRhKdL3tArNFBPIlXuz9ywJiMwu8YZG4t8kQxBYW SJQ4Mm8rI4jNIqAq0bvjCDuIzSvgIXF6/lcmiGVyEv9frgCzOYHik9ueMEMsdpf4+O0U0wRG 3gWMDKsYRVNLkwuKk9JzDfWKE3OLS/PS9ZLzczcxQuLjyw7GxcesDjEKcDAq8fBm/BMPEWJN LCuuzD3EKMHBrCTCq6EoESLEm5JYWZValB9fVJqTWnyIkYmDU6qBUbFid8Uipc2iL++fEvvW afp2mn9wtMy862d3dCy41bndsLXxrN78jmWn33b1NPycUdM2/eo1liVH9ytc5F3AfOHpOu2t XK+nTb305f66Fat0NUqcby369Sh4m+ocTRv/56XalRvl2puVjlqzbwp24DC8ttuyZkuglOah mzn1y8qnMkrl8XQuWKLEUpyRaKjFXFScCAAQfFXGbQIAAA== 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.217.171 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 adds implementation of of_xlate callback, which prepares masters device for attaching to IOMMU. This callback is called during creating devices from device tree. Signed-off-by: Marek Szyprowski --- drivers/iommu/exynos-iommu.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 0d304c62956e..6b8fe57d17f2 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -1077,6 +1077,33 @@ static phys_addr_t exynos_iommu_iova_to_phys(struct iommu_domain *iommu_domain, return phys; } +static int exynos_iommu_of_xlate(struct device *dev, + struct of_phandle_args *spec) +{ + struct exynos_iommu_owner *owner = dev->archdata.iommu; + struct platform_device *sysmmu = of_find_device_by_node(spec->np); + struct sysmmu_drvdata *data; + + if (!sysmmu) + return 0; + + data = platform_get_drvdata(sysmmu); + if (!data) + return 0; + + if (!owner) { + owner = kzalloc(sizeof(*owner), GFP_KERNEL); + if (!owner) + return 0; + + INIT_LIST_HEAD(&owner->clients); + dev->archdata.iommu = owner; + } + + list_add_tail(&data->owner_node, &owner->clients); + return 1; +} + static const struct iommu_ops exynos_iommu_ops = { .domain_init = exynos_iommu_domain_init, .domain_destroy = exynos_iommu_domain_destroy, @@ -1086,6 +1113,7 @@ static const struct iommu_ops exynos_iommu_ops = { .unmap = exynos_iommu_unmap, .iova_to_phys = exynos_iommu_iova_to_phys, .pgsize_bitmap = SECT_SIZE | LPAGE_SIZE | SPAGE_SIZE, + .of_xlate = exynos_iommu_of_xlate, }; static int init_done;