From patchwork Fri Mar 14 05:13:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cho KyongHo X-Patchwork-Id: 3830811 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 6C093BF540 for ; Fri, 14 Mar 2014 05:15:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 99850202F0 for ; Fri, 14 Mar 2014 05:15:29 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A033F202BE for ; Fri, 14 Mar 2014 05:15:28 +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 1WOKSO-0006I8-J3; Fri, 14 Mar 2014 05:14:56 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WOKSH-0000nX-Gs; Fri, 14 Mar 2014 05:14:49 +0000 Received: from mailout3.samsung.com ([203.254.224.33]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WOKS6-0000kB-MN for linux-arm-kernel@lists.infradead.org; Fri, 14 Mar 2014 05:14:41 +0000 Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N2E00E8DUIZ4M40@mailout3.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 14 Mar 2014 14:13:47 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [203.254.230.50]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id 23.24.14803.B0092235; Fri, 14 Mar 2014 14:13:47 +0900 (KST) X-AuditID: cbfee691-b7efc6d0000039d3-56-5322900bed6c Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id CD.D3.28157.B0092235; Fri, 14 Mar 2014 14:13:47 +0900 (KST) Received: from DO-PULLIP-CHO07.dsn.sec.samsung.com ([12.36.165.149]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N2E00C2GUIZK2H1@mmp1.samsung.com>; Fri, 14 Mar 2014 14:13:47 +0900 (KST) Date: Fri, 14 Mar 2014 14:13:46 +0900 From: Cho KyongHo To: Linux ARM Kernel , Linux DeviceTree , Linux IOMMU , Linux Kernel , Linux Samsung SOC Subject: [PATCH v11 25/27] iommu/exynos: use simpler function to get MMU version Message-id: <20140314141346.101ae9148289467808857d13@samsung.com> X-Mailer: Sylpheed 3.3.0 (GTK+ 2.10.14; i686-pc-mingw32) MIME-version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMIsWRmVeSWpSXmKPExsVy+t8zI13uCUrBBtfbNC3u3D3HajH/CJB4 deQHk8WC/dYWnbM3sFv0LrjKZrHp8TVWi8u75rBZzDi/j8niwoqN7BZTFh1mtTj8pp3V4uSf XkaL9TNes1jMvLWGxYHf48nBeUwesxsusnj8O9zP5HHn2h42j81L6j0m31jO6NG3ZRWjx+dN ch5Xjp5hCuCM4rJJSc3JLEst0rdL4Mr4ca2DveA/f8X8BycZGxiv83QxcnJICJhIfH/QxgJh i0lcuLeerYuRi0NIYBmjxLzOTlaYovuzTjJDJBYxSrw72QpVNZlJYu6HBrAqFgFVifNbTrCB 2GwCWhKr5x5nBCkSEWhjkvjaeIgFxGEWmMss8fHbHLAqYYEAiXtnpoHZvA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TYzg9PBMegfjqgaLQ4wCHIxKPLwzjioGC7EmlhVX 5h5ilOBgVhLhrYpQChbiTUmsrEotyo8vKs1JLT7EmAz090RmKdHkfGDqyiuJNzQ2MTOyNDKz MDIxNydNWEmc92CrdaCQQHpiSWp2ampBahHMFiYOTqkGxhl1UcUFawrXNGlf2qHgHTBhsV3s 55OTAtuf+djZKE5jOiSefe525t85fka3Dx56cK52pmVd1BHj59EXA/O9Y7kk9xx98vPnPfMf KlePPmpcKhu5Wyrpf/kKddEbl64925J+6Nr2fhm9LyVCL63evE9eE/nyftkLJqeeqJT9Utz6 SyQ33dJ68EqJpTgj0VCLuag4EQAEQiU+UwMAAA== 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-20140314_011439_035710_E81066DD X-CRM114-Status: GOOD ( 11.87 ) X-Spam-Score: -6.9 (------) Cc: Kukjin Kim , Prathyush , Grant Grundler , Joerg Roedel , 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, T_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 commit changes the function to get MMU version simpler. Signed-off-by: Cho KyongHo --- drivers/iommu/exynos-iommu.c | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 6e716cc..3d4dabb 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -251,24 +251,6 @@ static unsigned int __raw_sysmmu_version(struct sysmmu_drvdata *data) return MMU_RAW_VER(__raw_readl(data->sfrbase + REG_MMU_VERSION)); } -static unsigned int __sysmmu_version(struct sysmmu_drvdata *data, - unsigned int *minor) -{ - unsigned int ver = 0; - - ver = __raw_sysmmu_version(data); - if (ver > MAKE_MMU_VER(3, 3)) { - dev_err(data->sysmmu, "%s: version(%d.%d) is higher than 3.3\n", - __func__, MMU_MAJ_VER(ver), MMU_MIN_VER(ver)); - BUG(); - } - - if (minor) - *minor = MMU_MIN_VER(ver); - - return MMU_MAJ_VER(ver); -} - static bool sysmmu_block(void __iomem *sfrbase) { int i = 120; @@ -422,13 +404,13 @@ static bool __sysmmu_disable(struct sysmmu_drvdata *data) static void __sysmmu_init_config(struct sysmmu_drvdata *data) { unsigned int cfg = CFG_LRU | CFG_QOS(15); - int maj, min = 0; + unsigned int ver; - maj = __sysmmu_version(data, &min); - if (maj == 3) { - if (min >= 2) { + ver = __raw_sysmmu_version(data); + if (MMU_MAJ_VER(ver) == 3) { + if (MMU_MIN_VER(ver) >= 2) { cfg |= CFG_FLPDCACHE; - if (min == 3) { + if (MMU_MIN_VER(ver) == 3) { cfg |= CFG_ACGEN; cfg &= ~CFG_LRU; } else { @@ -583,7 +565,7 @@ static void sysmmu_tlb_invalidate_entry(struct device *dev, sysmmu_iova_t iova, * 1MB page can be cached in one of all sets. * 64KB page can be one of 16 consecutive sets. */ - if (__sysmmu_version(data, NULL) == 2) + if (MMU_MAJ_VER(__raw_sysmmu_version(data)) == 2) num_inv = min_t(unsigned int, size / PAGE_SIZE, 64);