From patchwork Mon Oct 7 01:58:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cho KyongHo X-Patchwork-Id: 2994101 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 63C37BF924 for ; Mon, 7 Oct 2013 02:18:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8616E201DE for ; Mon, 7 Oct 2013 02:18:05 +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 80B52201C8 for ; Mon, 7 Oct 2013 02:18:04 +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 1VT06b-0005lt-1b; Mon, 07 Oct 2013 01:59:30 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VT05r-00076A-7U; Mon, 07 Oct 2013 01:58:43 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VT05T-000707-Al for linux-arm-kernel@lists.infradead.org; Mon, 07 Oct 2013 01:58:25 +0000 Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MUA00MOX01D82G0@mailout2.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 07 Oct 2013 10:58:00 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.51]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id 53.7A.20109.82512525; Mon, 07 Oct 2013 10:58:00 +0900 (KST) X-AuditID: cbfee68f-b7f1e6d000004e8d-c5-5252152847a4 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 78.B6.09055.82512525; Mon, 07 Oct 2013 10:58:00 +0900 (KST) Received: from DO-PULLIP-CHO07.dsn.sec.samsung.com ([12.23.118.94]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MUA00F4Q04OYC40@mmp2.samsung.com>; Mon, 07 Oct 2013 10:58:00 +0900 (KST) Date: Mon, 07 Oct 2013 10:58:00 +0900 From: Cho KyongHo To: Linux ARM Kernel , Linux DeviceTree , Linux IOMMU , Linux Kernel , Linux Samsung SOC Subject: [PATCH v10 16/20] iommu/exynos: turn on useful configuration options Message-id: <20131007105800.ab2c86aa52528614188e0719@samsung.com> X-Mailer: Sylpheed 3.3.0 (GTK+ 2.10.14; i686-pc-mingw32) MIME-version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrOIsWRmVeSWpSXmKPExsVy+t8zY10N0aAggz8fDSzu3D3HajH/CJB4 deQHk8WC/dYWnbM3sFv0LrjKZrHp8TVWi8u75rBZzDi/j8niwoqN7BZTFh1mtTj8pp3V4uSf XkaLluu9TBbrZ7xmsZh5aw2Lg4DHk4PzmDxmN1xk8fh3uJ/J4861PWwem5fUe0y+sZzRo2/L KkaPz5vkPK4cPcMUwBnFZZOSmpNZllqkb5fAlTGv/yBLwUOhiu3zDzI1MH7g62Lk5JAQMJHo 3zSRFcIWk7hwbz1bFyMXh5DAMkaJwxfPs8MU7TzwEyoxnVFiwrNN7BDOJCaJCccOATkcHCwC qhIfrsSANLAJaEmsnnucEaRGRKCNSeJr4yEWEIdZ4DSzxKrdK5hBqoQFfCW2vXzLCG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nquoV5xYm5xaV66XnJ+7iZGcJp4JrWDcWWDxSFGAQ5GJR7eHfcD g4RYE8uKK3MPMUpwMCuJ8F6qAwrxpiRWVqUW5ccXleakFh9iTAZ6eyKzlGhyPjCF5ZXEGxqb mBlZGplZGJmYm5MmrCTOe6DVOlBIID2xJDU7NbUgtQhmCxMHp1QDYwBnxPd9S48LyS68arfm dvILv5w9vIwuq64o1x7jcbc91l10j+19lPc9t7MdH6o2ZNvtrJvEszjwunNDTOmBaac3WNw4 ejv39JdA+9C1cz7E7Xz4XTBg2Txz7sr/3Gke0wVajoTGx+14K9qYyiPOMkdvseT+BZc/53E8 4vC4kmjtW1N4ZsqqPCWW4oxEQy3mouJEAOrOmllXAwAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131006_215819_702630_F1C41CA1 X-CRM114-Status: GOOD ( 11.97 ) X-Spam-Score: -6.9 (------) Cc: Kukjin Kim , Prathyush , Grant Grundler , Joerg Roedel , Subash Patel , Sachin Kamat , Sylwester Nawrocki , Varun Sethi , Antonios Motakis , Tomasz Figa , Rahul Sharma 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=-4.2 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 This turns on ACGEN and SYSSEL. ACGEN is architectural clock gating that gates clocks by System MMU itself if it is not active. Note that ACGEN is different from clock gating by the CPU. ACGEN just gates clocks to the internal logic of System MMU while clock gating by the CPU gates clocks to the System MMU. SYSSEL selects System MMU version in some Exynos SoCs. Some Exynos SoCs have an option to select System MMU versions exclusively because the SoCs adopts new System MMU version experimentally. This also always selects LRU as TLB replacement policy. Selecting TLB replacement policy is deprecated from System MMU 3.2. TLB in System MMU 3.3 has single TLB replacement policy, LRU. The bit of MMU_CFG selecting TLB replacement policy is remained as reserved. QoS value of page table walking is set to 15 (highst value). System MMU 3.3 can inherit QoS value of page table walking from its master H/W's transaction. This new feature is enabled by default and QoS value written to MMU_CFG is ignored. Signed-off-by: Cho KyongHo --- drivers/iommu/exynos-iommu.c | 20 +++++++++++++++++--- 1 files changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index d9c5416..03031dc 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -82,6 +82,11 @@ #define CTRL_BLOCK 0x7 #define CTRL_DISABLE 0x0 +#define CFG_LRU 0x1 +#define CFG_QOS(n) ((n & 0xF) << 7) +#define CFG_MASK 0x0150FFFF /* Selecting bit 0-15, 20, 22 and 24 */ +#define CFG_ACGEN (1 << 24) /* System MMU 3.3 only */ +#define CFG_SYSSEL (1 << 22) /* System MMU 3.2 only */ #define CFG_FLPDCACHE (1 << 20) /* System MMU 3.2+ only */ #define REG_MMU_CTRL 0x000 @@ -372,12 +377,21 @@ static bool __sysmmu_disable(struct sysmmu_drvdata *data) static void __sysmmu_init_config(struct sysmmu_drvdata *data) { - unsigned long cfg = 0; + unsigned long cfg = CFG_LRU | CFG_QOS(15); int maj, min = 0; maj = __sysmmu_version(data, &min); - if ((maj == 3) && (min > 1)) - cfg |= CFG_FLPDCACHE; + if (maj == 3) { + if (min >= 2) { + cfg |= CFG_FLPDCACHE; + if (min == 3) { + cfg |= CFG_ACGEN; + cfg &= ~CFG_LRU; + } else { + cfg |= CFG_SYSSEL; + } + } + } __raw_writel(cfg, data->sfrbase + REG_MMU_CFG); }