From patchwork Thu Jul 6 09:37:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivek Gautam X-Patchwork-Id: 9827843 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BEAAD60317 for ; Thu, 6 Jul 2017 09:39:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7252283C9 for ; Thu, 6 Jul 2017 09:39:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D4BCB2856C; Thu, 6 Jul 2017 09:39:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 229DC283C9 for ; Thu, 6 Jul 2017 09:39:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=SoS8Dvta8/LQrZPekbeNIdvThAldtr3CPyf8vwSamIU=; b=Bls8NZYuy1d/38g/u/9Aux8dS5 qgKD3MKJ4RUBoCVvlhkcPYv2m+MMBhtuFwzyKdobUi6O8wdVeN7VO2KeP9mDFQq6IaFpNb9w/6pSS ABIbnn/yeVZP8hj1lEkJQZLbieOT9SfGp/3m0BQa6vskhVUNM9+1LnI9wQll4uCBnVzXSrIh62/8P TQQjNqkvHwKVio3V/iOwRi8KY1RefsnQ7ZMlpaVO3+CZDG1GLv5oK5vgLR3OWmz5Bo4FMF8kfZx3B Z/jZfViqmng0sFevIQEnDq0nKNd2SgRXQI+NqbFkCFgPkp97znVI6ri+l+XiSWwlyZl61NKfRRMPV 8EZ3yx0w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dT3FQ-0008NI-RU; Thu, 06 Jul 2017 09:38:56 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dT3Eb-0006tG-Kr for linux-arm-kernel@lists.infradead.org; Thu, 06 Jul 2017 09:38:11 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id E57D6611DE; Thu, 6 Jul 2017 09:37:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1499333868; bh=KchG52SeuOq3PPaVTfE3GStkxtCY7KIpm5Zi8SFbAgU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kfJY4G+datC0xb8fA23+p65LLr7tvgTP9IM0iUhQJ3HExsGvmruxP3AaPGHNXoY7J zaWz+4Oxwa3kcFcSdwopIxB7nI3+rbsNIT80WKvGqK+1Bl2F9YefoNKLfod0E838vc V+KQSRrM+h2WFEosXh2vguGEaIleeHPQY5brZ8XU= Received: from blr-ubuntu-41.ap.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.18.19]) (using TLSv1.1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: vivek.gautam@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id BD2F86109C; Thu, 6 Jul 2017 09:37:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1499333865; bh=KchG52SeuOq3PPaVTfE3GStkxtCY7KIpm5Zi8SFbAgU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mei3Xiss/ZNNf8z2oohuzy8iZLlghxUvcvClyrKROPia+BCFuNYYTUiEW/J09MvqB 3LboNBPFTZ5FSRNS6MU/si7/9IfnbaDxcSlJKrobv4osleaMw0Trx3mQaVfKliJjSE cquBAQ7dmOWKouvBxBRGzU7q2BJe8waMhEGhRxNA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org BD2F86109C Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=vivek.gautam@codeaurora.org From: Vivek Gautam To: joro@8bytes.org, robin.murphy@arm.com, robh+dt@kernel.org, mark.rutland@arm.com, will.deacon@arm.com, m.szyprowski@samsung.com, sboyd@codeaurora.org, robdclark@gmail.com, iommu@lists.linux-foundation.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org Subject: [PATCH V4 5/6] iommu/arm-smmu: Add support for MMU40x/500 clocks Date: Thu, 6 Jul 2017 15:07:04 +0530 Message-Id: <1499333825-7658-6-git-send-email-vivek.gautam@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1499333825-7658-1-git-send-email-vivek.gautam@codeaurora.org> References: <1499333825-7658-1-git-send-email-vivek.gautam@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170706_023806_439685_BBEF0232 X-CRM114-Status: GOOD ( 15.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: architt@codeaurora.org, linux-arm-msm@vger.kernel.org, stanimir.varbanov@linaro.org, vivek.gautam@codeaurora.org, sricharan@codeaurora.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sricharan R The MMU400x/500 is the implementation of the SMMUv2 arch specification. It is split in to two blocks TBU, TCU. TBU caches the page table, instantiated for each master locally, clocked by the TBUn_clk. TCU manages the address translation with PTW and has the programming interface as well, clocked using the TCU_CLK. The TBU can also be sharing the same clock domain as TCU, in which case both are clocked using the TCU_CLK. This defines the clock bindings for the same and adds the clock names to compatible data. Signed-off-by: Sricharan R [vivek: clock rework and cleanup] Signed-off-by: Vivek Gautam --- .../devicetree/bindings/iommu/arm,smmu.txt | 24 ++++++++++++++++++++++ drivers/iommu/arm-smmu.c | 12 ++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.txt b/Documentation/devicetree/bindings/iommu/arm,smmu.txt index 8a6ffce12af5..00331752d355 100644 --- a/Documentation/devicetree/bindings/iommu/arm,smmu.txt +++ b/Documentation/devicetree/bindings/iommu/arm,smmu.txt @@ -71,6 +71,26 @@ conditions. or using stream matching with #iommu-cells = <2>, and may be ignored if present in such cases. +- clock-names: Should be "tcu" and "iface" for "arm,mmu-400", + "arm,mmu-401" and "arm,mmu-500" + + "tcu" clock is required for smmu's register access using the + programming interface and ptw for downstream bus access. This + clock is also used for access to the TBU connected to the + master locally. Sometimes however, TBU is clocked along with + the master. + + "iface" clock is required to access the TCU's programming + interface, apart from the "tcu" clock. + +- clocks: Phandles for respective clocks described by clock-names. + +- power-domains: Phandles to SMMU's power domain specifier. This is + required even if SMMU belongs to the master's power + domain, as the SMMU will have to be enabled and + accessed before master gets enabled and linked to its + SMMU. + ** Deprecated properties: - mmu-masters (deprecated in favour of the generic "iommus" binding) : @@ -95,6 +115,10 @@ conditions. <0 36 4>, <0 37 4>; #iommu-cells = <1>; + clocks = <&gcc GCC_SMMU_CFG_CLK>, + <&gcc GCC_APSS_TCU_CLK>; + + clock-names = "iface", "tcu"; }; /* device with two stream IDs, 0 and 7 */ diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 75567d9698ab..7bb09280fa11 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -1947,9 +1947,19 @@ struct arm_smmu_match_data { ARM_SMMU_MATCH_DATA(smmu_generic_v1, ARM_SMMU_V1, GENERIC_SMMU); ARM_SMMU_MATCH_DATA(smmu_generic_v2, ARM_SMMU_V2, GENERIC_SMMU); ARM_SMMU_MATCH_DATA(arm_mmu401, ARM_SMMU_V1_64K, GENERIC_SMMU); -ARM_SMMU_MATCH_DATA(arm_mmu500, ARM_SMMU_V2, ARM_MMU500); ARM_SMMU_MATCH_DATA(cavium_smmuv2, ARM_SMMU_V2, CAVIUM_SMMUV2); +static const char * const arm_mmu500_clks[] = { + "tcu", "iface", +}; + +static const struct arm_smmu_match_data arm_mmu500 = { + .version = ARM_SMMU_V2, + .model = ARM_MMU500, + .clks = arm_mmu500_clks, + .num_clks = ARRAY_SIZE(arm_mmu500_clks), +}; + static const struct of_device_id arm_smmu_of_match[] = { { .compatible = "arm,smmu-v1", .data = &smmu_generic_v1 }, { .compatible = "arm,smmu-v2", .data = &smmu_generic_v2 },