mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Juergen Kilb <J.Kilb@phytec.de>
To: barebox@lists.infradead.org
Cc: Juergen Kilb <J.Kilb@phytec.de>
Subject: [PATCH] Added helper function to get CS1 base address.
Date: Fri, 9 Sep 2011 14:10:55 +0200	[thread overview]
Message-ID: <1315570256-28614-3-git-send-email-J.Kilb@phytec.de> (raw)
In-Reply-To: <1315570256-28614-1-git-send-email-J.Kilb@phytec.de>

This helper function can be used for automatic
SDDR configuration based on register settings
made by a previously first stage bootloader
i.e. x-loader.

Signed-off-by: Juergen Kilb <J.Kilb@phytec.de>
---
 arch/arm/mach-omap/include/mach/sys_info.h |    1 +
 arch/arm/mach-omap/omap3_generic.c         |   19 +++++++++++++++++++
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap/include/mach/sys_info.h b/arch/arm/mach-omap/include/mach/sys_info.h
index f557068..f0594bf 100644
--- a/arch/arm/mach-omap/include/mach/sys_info.h
+++ b/arch/arm/mach-omap/include/mach/sys_info.h
@@ -91,6 +91,7 @@
 u32 get_cpu_type(void);
 u32 get_cpu_rev(void);
 u32 get_sdr_cs_size(u32 offset);
+u32 get_sdr_cs1_base(void);
 inline u32 get_sysboot_value(void);
 u32 get_gpmc0_base(void);
 u32 get_base(void);
diff --git a/arch/arm/mach-omap/omap3_generic.c b/arch/arm/mach-omap/omap3_generic.c
index 9627a6b..7468441 100644
--- a/arch/arm/mach-omap/omap3_generic.c
+++ b/arch/arm/mach-omap/omap3_generic.c
@@ -178,7 +178,26 @@ u32 get_sdr_cs_size(u32 offset)
 	size *= 2 * (1024 * 1024);	/* find size in MB */
 	return size;
 }
+EXPORT_SYMBOL(get_sdr_cs_size);
+/**
+ * @brief base address of chip select 1 (cs0 is defined at 0x80000000)
+ *
+ * @return return the CS1 base address.
+ */
+u32 get_sdr_cs1_base(void)
+{
+	u32 base;
+	u32 cs_cfg;
 
+	cs_cfg = readl(SDRC_REG(CS_CFG));
+	/* get ram size field */
+	base = (cs_cfg & 0x0000000F) << 2; /* get CS1STARTHIGH */
+	base = base | ((cs_cfg & 0x00000300) >> 8); /* get CS1STARTLOW */
+	base = base << 25;
+	base += 0x80000000;
+	return base;
+}
+EXPORT_SYMBOL(get_sdr_cs1_base);
 /**
  * @brief Get the initial SYSBOOT value
  *
-- 
1.7.0.4


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

  parent reply	other threads:[~2011-09-09 12:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-09 12:10 [PATCH] Add Reset Support for omap3 Juergen Kilb
2011-09-09 12:10 ` [PATCH] Add omap_hsmmc platform data Juergen Kilb
2011-09-09 12:10 ` Juergen Kilb [this message]
2011-09-09 12:10 ` [PATCH] Corrected ns16550 access at all omap based boards Juergen Kilb
2011-09-12 10:32 ` [PATCH] Add Reset Support for omap3 Sascha Hauer

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=1315570256-28614-3-git-send-email-J.Kilb@phytec.de \
    --to=j.kilb@phytec.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