From patchwork Thu Feb 18 14:12:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 62190 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp610886lbl; Thu, 18 Feb 2016 06:14:02 -0800 (PST) X-Received: by 10.98.14.149 with SMTP id 21mr10333407pfo.79.1455804814998; Thu, 18 Feb 2016 06:13:34 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f63si9683783pfj.137.2016.02.18.06.13.34; Thu, 18 Feb 2016 06:13:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1425456AbcBRONe (ORCPT + 4 others); Thu, 18 Feb 2016 09:13:34 -0500 Received: from mailout4.w1.samsung.com ([210.118.77.14]:37168 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751308AbcBRONc (ORCPT ); Thu, 18 Feb 2016 09:13:32 -0500 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O2Q00JKHY6CP1A0@mailout4.w1.samsung.com> for linux-samsung-soc@vger.kernel.org; Thu, 18 Feb 2016 14:13:24 +0000 (GMT) X-AuditID: cbfec7f5-f79b16d000005389-5c-56c5d183e0a8 Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 90.20.21385.481D5C65; Thu, 18 Feb 2016 14:13:24 +0000 (GMT) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O2Q00576Y5X95B0@eusync4.samsung.com>; Thu, 18 Feb 2016 14:13:23 +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 , Joerg Roedel , Inki Dae , Kukjin Kim , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH v2 07/13] iommu: exynos: refactor init config code Date: Thu, 18 Feb 2016 15:12:54 +0100 Message-id: <1455804780-9616-8-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1455804780-9616-1-git-send-email-m.szyprowski@samsung.com> References: <1455804780-9616-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprPLMWRmVeSWpSXmKPExsVy+t/xa7otF4+GGTT4W2ycsZ7VYtL9CSwW C/ZbW3TO3sBu8fqFoUX/49fMFpseX2O1mHF+H5PF2iN32R04PZ4cnMfksWlVJ5vH5iX1HpNv LGf06NuyitHj8ya5ALYoLpuU1JzMstQifbsEroydzaeYCq5zVzya+JWpgfEYZxcjJ4eEgInE lMvH2SFsMYkL99azgdhCAksZJdoaFLoYuYDsJiaJ6wvWMoIk2AQMJbredoEViQjkS7zY+5cF pIhZ4BejxLnOdiaQhLCAk8TJi6/BbBYBVYmTZ/aDNfAKuEtc2rGNEWKbnMT/lyvAajgFPCQ2 n9rACLHZXeLPw5lMExh5FzAyrGIUTS1NLihOSs810itOzC0uzUvXS87P3cQICbavOxiXHrM6 xCjAwajEw7vhxZEwIdbEsuLK3EOMEhzMSiK8u/ceDRPiTUmsrEotyo8vKs1JLT7EKM3BoiTO O3PX+xAhgfTEktTs1NSC1CKYLBMHp1QDY6PptxuFayKWvuQ7mGQaxMfyV8Fy93cPn0QVu+8H AnWfNj7x5p+4pWjtrNOrKm8pJWf3TY2yex/C3hRtp7dE4uC6/tUFa9vuNuv+u/b45o1q+/M/ O4O3nFu0TdiO6d2i9ddEs42PiYi8eSmziel+2VvZp+c2nDXb65f5aVHu0h8/zvYc0gz0VlVi Kc5INNRiLipOBADoOPmHMgIAAA== Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org This patch rewrites sysmmu_init_config function to make it easier to read and understand. Signed-off-by: Marek Szyprowski --- drivers/iommu/exynos-iommu.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) -- 1.9.2 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 3a577a473f3c..15787a177a16 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -383,24 +383,17 @@ 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); - unsigned int ver; - - ver = MMU_RAW_VER(__raw_readl(data->sfrbase + REG_MMU_VERSION)); - if (MMU_MAJ_VER(ver) == 3) { - if (MMU_MIN_VER(ver) >= 2) { - cfg |= CFG_FLPDCACHE; - if (MMU_MIN_VER(ver) == 3) { - cfg |= CFG_ACGEN; - cfg &= ~CFG_LRU; - } else { - cfg |= CFG_SYSSEL; - } - } - } + unsigned int cfg; + + data->version = MMU_RAW_VER(__raw_readl(data->sfrbase + REG_MMU_VERSION)); + if (data->version <= MAKE_MMU_VER(3, 1)) + cfg = CFG_LRU | CFG_QOS(15); + else if (data->version <= MAKE_MMU_VER(3, 2)) + cfg = CFG_LRU | CFG_QOS(15) | CFG_FLPDCACHE | CFG_SYSSEL; + else + cfg = CFG_QOS(15) | CFG_FLPDCACHE | CFG_ACGEN; __raw_writel(cfg, data->sfrbase + REG_MMU_CFG); - data->version = ver; } static void __sysmmu_enable_nocount(struct sysmmu_drvdata *data)