mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 4/4] ARM i.MX esdctl: Use defines from exisiting header file
Date: Wed, 28 Nov 2012 10:59:20 +0100	[thread overview]
Message-ID: <1354096760-14409-5-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1354096760-14409-1-git-send-email-s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-imx/esdctl.c |   28 +++++++++-------------------
 1 file changed, 9 insertions(+), 19 deletions(-)

diff --git a/arch/arm/mach-imx/esdctl.c b/arch/arm/mach-imx/esdctl.c
index 567ecd6..4e83c7d 100644
--- a/arch/arm/mach-imx/esdctl.c
+++ b/arch/arm/mach-imx/esdctl.c
@@ -23,6 +23,7 @@
 #include <asm/barebox-arm.h>
 #include <asm/memory.h>
 #include <mach/esdctl.h>
+#include <mach/esdctl-v4.h>
 #include <mach/imx1-regs.h>
 #include <mach/imx21-regs.h>
 #include <mach/imx25-regs.h>
@@ -112,34 +113,23 @@ static inline unsigned long imx_v3_sdram_size(void __iomem *esdctlbase, int num)
 	return size;
 }
 
-#define IMX_ESDCTL_V4_ESDCTL	0x0
-#define IMX_ESDCTL_V4_ESDMISC	0x18
-
-#define ESDCTL_V4_ESDCTL_DSIZ		(1 << 16)
-#define ESDCTL_V4_ESDMISC_DDR_4_BANK	(1 << 5)
-#define ESDCTL_V4_ESDMISC_ONECS		(1 << 20)
-
-#define ESDCTL_V4_ESDCTL_SDE_0		(1 << 31)
-#define ESDCTL_V4_ESDCTL_SDE_1		(1 << 30)
-#define ESDCTL_V4_ESDMISC_BI		(1 << 12)
-
 /*
  * v4 - found on i.MX53
  */
 static inline unsigned long imx_v4_sdram_size(void __iomem *esdctlbase, int cs)
 {
-	u32 ctlval = readl(esdctlbase + IMX_ESDCTL_V4_ESDCTL);
-	u32 esdmisc = readl(esdctlbase + IMX_ESDCTL_V4_ESDMISC);
+	u32 ctlval = readl(esdctlbase + ESDCTL_V4_ESDCTL0);
+	u32 esdmisc = readl(esdctlbase + ESDCTL_V4_ESDMISC);
 	unsigned long size;
 	int rows, cols, width = 2, banks = 8;
 
-	if (cs == 0 && !(ctlval & ESDCTL_V4_ESDCTL_SDE_0))
+	if (cs == 0 && !(ctlval & ESDCTL_V4_ESDCTLx_SDE0))
 		return 0;
-	if (cs == 1 && !(ctlval & ESDCTL_V4_ESDCTL_SDE_1))
+	if (cs == 1 && !(ctlval & ESDCTL_V4_ESDCTLx_SDE1))
 		return 0;
 
 	/* one 2GiB cs, memory is returned for cs0 only */
-	if (cs == 1 && (esdmisc & ESDCTL_V4_ESDMISC_ONECS))
+	if (cs == 1 && (esdmisc & ESDCTL_V4_ESDMISC_ONE_CS))
 		return 9;
 
 	rows = ((ctlval >> 24) & 0x7) + 11;
@@ -164,16 +154,16 @@ static inline unsigned long imx_v4_sdram_size(void __iomem *esdctlbase, int cs)
 		break;
 	}
 
-	if (ctlval & ESDCTL_V4_ESDCTL_DSIZ)
+	if (ctlval & ESDCTL_V4_ESDCTLx_DSIZ_32B)
 		width = 4;
 
-	if (esdmisc & ESDCTL_V4_ESDMISC_DDR_4_BANK)
+	if (esdmisc & ESDCTL_V4_ESDMISC_BANKS_4)
 		banks = 4;
 
 	size = (1 << cols) * (1 << rows) * banks * width;
 
 	/* bank interleaved, double size */
-	if (esdmisc & ESDCTL_V4_ESDMISC_BI)
+	if (esdmisc & ESDCTL_V4_ESDMISC_BI_ON)
 		return size * 2;
 
 	return size;
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      parent reply	other threads:[~2012-11-28  9:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-28  9:59 [PATCH] Add Garz+Fricke Vincell board support Sascha Hauer
2012-11-28  9:59 ` [PATCH 1/4] ARM i.MX5: move pll setup defines to header file Sascha Hauer
2012-11-28  9:59 ` [PATCH 2/4] ARM i.MX: add esdctl-v4 support Sascha Hauer
2012-11-28  9:59 ` [PATCH 3/4] ARM i.MX: Add Garz+Fricke Vincell Board support Sascha Hauer
2012-11-28 10:11   ` Eric Bénard
2012-11-28 10:23     ` Sascha Hauer
2012-11-28  9:59 ` Sascha Hauer [this message]

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=1354096760-14409-5-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox