All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: iommu@lists.linux-foundation.org,
	linux-samsung-soc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Cc: Marek Szyprowski <m.szyprowski@samsung.com>,
	Joerg Roedel <joro@8bytes.org>, Inki Dae <inki.dae@samsung.com>,
	Kukjin Kim <kgene@kernel.org>,
	Krzysztof Kozlowski <k.kozlowski@samsung.com>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Subject: [PATCH 07/11] iommu: exynos: refactor init config code
Date: Tue, 16 Feb 2016 15:57:00 +0100	[thread overview]
Message-ID: <1455634624-18130-8-git-send-email-m.szyprowski@samsung.com> (raw)
In-Reply-To: <1455634624-18130-1-git-send-email-m.szyprowski@samsung.com>

This patch rewrites sysmmu_init_config function to make it easier to read
and understand.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/iommu/exynos-iommu.c | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
index 3a577a4..15787a1 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)
-- 
1.9.2

WARNING: multiple messages have this Message-ID (diff)
From: m.szyprowski@samsung.com (Marek Szyprowski)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 07/11] iommu: exynos: refactor init config code
Date: Tue, 16 Feb 2016 15:57:00 +0100	[thread overview]
Message-ID: <1455634624-18130-8-git-send-email-m.szyprowski@samsung.com> (raw)
In-Reply-To: <1455634624-18130-1-git-send-email-m.szyprowski@samsung.com>

This patch rewrites sysmmu_init_config function to make it easier to read
and understand.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/iommu/exynos-iommu.c | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c
index 3a577a4..15787a1 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)
-- 
1.9.2

  parent reply	other threads:[~2016-02-16 14:57 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-16 14:56 [PATCH 00/11] SYSMMU driver update and support for Exynos 5433 Marek Szyprowski
2016-02-16 14:56 ` Marek Szyprowski
2016-02-16 14:56 ` [PATCH 02/11] iommu: exynos: add support for IOMMU_DOMAIN_DMA domain type Marek Szyprowski
2016-02-16 14:56   ` Marek Szyprowski
2016-02-16 14:56 ` [PATCH 05/11] iommu: exynos: refactor code (no direct register access) Marek Szyprowski
2016-02-16 14:56   ` Marek Szyprowski
2016-02-16 14:56 ` [PATCH 06/11] iommu: exynos: refactor fault handling code Marek Szyprowski
2016-02-16 14:56   ` Marek Szyprowski
2016-02-16 14:57 ` Marek Szyprowski [this message]
2016-02-16 14:57   ` [PATCH 07/11] iommu: exynos: refactor init config code Marek Szyprowski
     [not found] ` <1455634624-18130-1-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2016-02-16 14:56   ` [PATCH 01/11] iommu: exynos: rework iommu group initialization Marek Szyprowski
2016-02-16 14:56     ` Marek Szyprowski
2016-02-16 14:56   ` [PATCH 03/11] iommu: exynos: remove ARM-specific cache flush interface Marek Szyprowski
2016-02-16 14:56     ` Marek Szyprowski
2016-02-16 14:56   ` [PATCH 04/11] iommu: exynos: simplify master clock operations Marek Szyprowski
2016-02-16 14:56     ` Marek Szyprowski
2016-02-16 14:57   ` [PATCH 08/11] iommu: exynos: unify code for fldp cache invalidation Marek Szyprowski
2016-02-16 14:57     ` Marek Szyprowski
2016-02-16 14:57   ` [PATCH 09/11] iommu: exynos: update device tree documentation Marek Szyprowski
2016-02-16 14:57     ` Marek Szyprowski
2016-02-16 14:57 ` [PATCH 10/11] iommu: exynos: add support for v5 SYSMMU Marek Szyprowski
2016-02-16 14:57   ` Marek Szyprowski
2016-02-16 14:57 ` [PATCH 11/11] iommu: exynos: add Maintainers entry for Exynos SYSMMU driver Marek Szyprowski
2016-02-16 14:57   ` Marek Szyprowski
2016-02-17  2:02   ` Krzysztof Kozlowski
2016-02-17  2:02     ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1455634624-18130-8-git-send-email-m.szyprowski@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=inki.dae@samsung.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=k.kozlowski@samsung.com \
    --cc=kgene@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.