From patchwork Wed Jun 26 09:28:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hiroshi DOYU X-Patchwork-Id: 2787371 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AD3EBC0AB1 for ; Wed, 26 Jun 2013 17:02:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8F818205B7 for ; Wed, 26 Jun 2013 17:02:19 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4363E205B6 for ; Wed, 26 Jun 2013 17:02:18 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Urt4F-0003tY-Po; Wed, 26 Jun 2013 16:59:43 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Urt1m-0000kc-8u; Wed, 26 Jun 2013 16:57:06 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UrsND-00037P-Sc for linux-arm-kernel@merlin.infradead.org; Wed, 26 Jun 2013 16:15:12 +0000 Received: from hqemgate16.nvidia.com ([216.228.121.65]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Urm4I-000430-SB for linux-arm-kernel@lists.infradead.org; Wed, 26 Jun 2013 09:31:16 +0000 Received: from hqnvupgp08.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com id ; Wed, 26 Jun 2013 02:29:06 -0700 Received: from hqemhub03.nvidia.com ([172.20.12.94]) by hqnvupgp08.nvidia.com (PGP Universal service); Wed, 26 Jun 2013 02:29:29 -0700 X-PGP-Universal: processed; by hqnvupgp08.nvidia.com on Wed, 26 Jun 2013 02:29:29 -0700 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQEMHUB03.nvidia.com (172.20.150.15) with Microsoft SMTP Server id 8.3.298.1; Wed, 26 Jun 2013 02:29:30 -0700 Received: from sc-daphne.nvidia.com (Not Verified[172.20.232.60]) by hqnvemgw01.nvidia.com with MailMarshal (v7,1,2,5326) id ; Wed, 26 Jun 2013 02:29:30 -0700 Received: from oreo.Nvidia.com (dhcp-10-21-26-134.nvidia.com [10.21.26.134]) by sc-daphne.nvidia.com (8.13.8+Sun/8.8.8) with ESMTP id r5Q9SmR6017123; Wed, 26 Jun 2013 02:29:29 -0700 (PDT) From: Hiroshi Doyu To: Subject: [PATCH 21/23] iommu/tegra: smmu: Get swgroup ID from DT Date: Wed, 26 Jun 2013 12:28:24 +0300 Message-ID: <1372238906-9346-22-git-send-email-hdoyu@nvidia.com> X-Mailer: git-send-email 1.8.1.5 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130626_103115_251940_B1ACC745 X-CRM114-Status: GOOD ( 15.05 ) X-Spam-Score: -3.2 (---) Cc: linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Hiroshi Doyu X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.5 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 Get swgroup ID from DT. "nvidia,swgroups" indicates which swgroup IDs a device belongs to. Signed-off-by: Hiroshi Doyu --- arch/arm/boot/dts/tegra30.dtsi | 1 - drivers/iommu/tegra-smmu.c | 20 +++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/tegra30.dtsi b/arch/arm/boot/dts/tegra30.dtsi index 7c480f2..a116737 100644 --- a/arch/arm/boot/dts/tegra30.dtsi +++ b/arch/arm/boot/dts/tegra30.dtsi @@ -1,6 +1,5 @@ #include #include -#include #include #include "skeleton.dtsi" diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index 50eb843..96dbef3 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c @@ -314,6 +314,24 @@ static inline void smmu_write(struct smmu_device *smmu, u32 val, size_t offs) #define smmu_client_hwgrp(c) (c->as->smmu->swgroups) +static u64 tegra_smmu_of_get_swgids(struct device *dev) +{ + size_t bytes; + const char *propname = "nvidia,memory-clients"; + const __be32 *prop; + int i; + u64 swgids = 0; + + prop = of_get_property(dev->of_node, propname, &bytes); + if (!prop || !bytes) + return 0; + + for (i = 0; i < bytes / sizeof(u32); i++, prop++) + swgids |= 1ULL << be32_to_cpup(prop); + + return swgids; +} + static int __smmu_client_set_hwgrp(struct smmu_client *c, u64 map, int on) { @@ -725,7 +743,7 @@ static int smmu_iommu_attach_dev(struct iommu_domain *domain, return -ENOMEM; client->dev = dev; client->as = as; - map = smmu->swgroups; + map = tegra_smmu_of_get_swgids(dev); if (!map) return -EINVAL;