From patchwork Wed Nov 19 11:15:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 41146 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EED2424542 for ; Wed, 19 Nov 2014 11:16:54 +0000 (UTC) Received: by mail-lb0-f198.google.com with SMTP id 10sf258268lbg.1 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=n+V/AdMDgQ9VYaxmZzlwdyvHglIn4tuy1gfH2rqcNyw=; b=YO8sSH/HwGbkojViG89mF++blDTK1R9rv6XwiAXreo8Oh0ffan87OB8ljvbNUQv2QY 8sukGHrogg2SDAHRx3dqOuV24fwgAuOhbHfJZYSuqFU02j7dpZDTyD7dNQ7wBhcKXMiq +IPMtzu6PGPiD07uoxjuHuK9jVyrN/2do3/DKpFi5xTFUGJeNXUFRvVoLaMrDYjadmTi sDsxWqusmjlxoNgnpongbFZZeNGOAD6ktQYO3qFmxsURry50GGIx+ZWDIf1iOQn1J/Jd m0n9mns6gDUHqrucvjk7U3dCshdiViTWI0desvxu4hwNUpRALf0dwyfZ+cJ6AW8JdxzR LzOg== X-Gm-Message-State: ALoCoQnnEUWbKCjP8JKSXfgY4tb7QjpDkgHDfx72UXPiNbb6Ok+U8sbcWFk9ak6UllSSrnPTpKOq X-Received: by 10.180.106.67 with SMTP id gs3mr7001278wib.3.1416395813951; 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 cb1ls1534645lad.89.gmail; Wed, 19 Nov 2014 03:16:53 -0800 (PST) X-Received: by 10.153.6.9 with SMTP id cq9mr2133372lad.79.1416395813688; Wed, 19 Nov 2014 03:16:53 -0800 (PST) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id po9si1505479lbb.10.2014.11.19.03.16.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Nov 2014 03:16:53 -0800 (PST) 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 gd6so300170lab.33 for ; Wed, 19 Nov 2014 03:16:53 -0800 (PST) X-Received: by 10.112.45.102 with SMTP id l6mr4743529lbm.46.1416395813603; Wed, 19 Nov 2014 03:16:53 -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 ew9csp64331lbc; Wed, 19 Nov 2014 03:16:52 -0800 (PST) X-Received: by 10.66.254.136 with SMTP id ai8mr45073265pad.76.1416395805316; Wed, 19 Nov 2014 03:16:45 -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:45 -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 S1754826AbaKSLQj (ORCPT + 4 others); Wed, 19 Nov 2014 06:16:39 -0500 Received: from mailout4.w1.samsung.com ([210.118.77.14]:61932 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754356AbaKSLQi (ORCPT ); Wed, 19 Nov 2014 06:16:38 -0500 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NFA004RWA49XL40@mailout4.w1.samsung.com> for linux-samsung-soc@vger.kernel.org; Wed, 19 Nov 2014 11:19:22 +0000 (GMT) X-AuditID: cbfec7f5-b7f956d000005ed7-e8-546c7c14e25d Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 8B.B2.24279.41C7C645; Wed, 19 Nov 2014 11:16:36 +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:36 +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 19/19] iommu: exynos: add callback for initializing devices from device tree Date: Wed, 19 Nov 2014 12:15:48 +0100 Message-id: <1416395748-10731-20-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+NgFrrBLMWRmVeSWpSXmKPExsVy+t/xy7oiNTkhBi8vKlv8nXSM3WLiysnM FpPuT2CxWLDf2qJz9gZ2i94FV9kszja9YbfonLiE3eLLlYdMFpseX2O1mHF+H5PF2iN32S1O Xf/MZvGv9yCjxf89O9gtjjzczW6xatcfRovbv/ksXn48weIg7PHk4DwmjzXz1jB6/P41idFj 56y77B6zO2ayemxeoeWxaVUnm8fmJfUet/89ZvaYfGM5o8eVE02sHr3N79g8+rasYvT4vEku gC+KyyYlNSezLLVI3y6BK6Nv6irWgqO8FbMaGpgaGFdxdzFyckgImEhM6zvOAmGLSVy4t56t i5GLQ0hgKaPE8ytToZw+JonbDTPZQKrYBAwlut52gdkiAvkSL/b+BetmFnjDInFvkyGILSyQ KPH12VWwOIuAqkTbztusXYzsHLwCnhLHOCB2yUn8f7mCqYuRg4MTKHr9BVixkICHRNP0dawT GHkXMDKsYhRNLU0uKE5KzzXSK07MLS7NS9dLzs/dxAiJja87GJceszrEKMDBqMTD21CcEyLE mlhWXJl7iFGCg1lJhLe4ECjEm5JYWZValB9fVJqTWnyIkYmDU6qB8faZi3dig8I9Zt574iZY sX+znOubl4mfdO4u/hS3I31uR6vcapnbKXoXynfKFKn/tlreP/lKQJlqQuoHZ23OvEcphhMK j38qm/RyV9R6SefcLa+aX2atnWIaa/Mu8sw887qsFRvyDqncXvj2z9TL9mIbgiR3Ncp2nE73 6HKMebn+/dZ389dc+K7EUpyRaKjFXFScCAA2wDTtawIAAA== 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 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 88f9afe641a0..213db88ca52c 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -1078,6 +1078,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 -ENODEV; + + data = platform_get_drvdata(sysmmu); + if (!data) + return -ENODEV; + + if (!owner) { + owner = kzalloc(sizeof(*owner), GFP_KERNEL); + if (!owner) + return -ENOMEM; + + INIT_LIST_HEAD(&owner->clients); + dev->archdata.iommu = owner; + } + + list_add_tail(&data->owner_node, &owner->clients); + return 0; +} + static const struct iommu_ops exynos_iommu_ops = { .domain_init = exynos_iommu_domain_init, .domain_destroy = exynos_iommu_domain_destroy, @@ -1087,6 +1114,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;