mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 3/4] at91sam9g45: add autodetect sd/ddram size
Date: Sun, 27 Jan 2013 17:40:53 +0100	[thread overview]
Message-ID: <1359304854-12641-3-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <1359304854-12641-1-git-send-email-plagnioj@jcrosoft.com>

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/mach-at91/at91sam9g45_devices.c          |    4 ++++
 arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h |   19 +++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index c4ca7c6..a2f26b5 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -15,6 +15,7 @@
 #include <asm/hardware.h>
 #include <mach/at91_pmc.h>
 #include <mach/at91sam9g45_matrix.h>
+#include <mach/at91sam9_ddrsdr.h>
 #include <mach/board.h>
 #include <mach/gpio.h>
 #include <mach/io.h>
@@ -24,6 +25,9 @@
 
 void at91_add_device_sdram(u32 size)
 {
+	if (!size)
+		size = at91sam9g45_get_ddram_size(1);
+
 	arm_add_mem_device("ram0", AT91_CHIPSELECT_6, size);
 	add_mem_device("sram0", AT91SAM9G45_SRAM_BASE,
 			AT91SAM9G45_SRAM_SIZE, IORESOURCE_MEM_WRITEABLE);
diff --git a/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h b/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h
index c90a248..f8699d7 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h
@@ -175,6 +175,25 @@ static inline u32 at91_get_ddram_size(void * __iomem base, bool is_nb)
 	return size;
 }
 
+#ifdef CONFIG_SOC_AT91SAM9G45
+static inline u32 at91sam9g45_get_ddram_size(int bank)
+{
+	switch (bank) {
+	case 0:
+		return at91_get_ddram_size(IOMEM(AT91SAM9G45_BASE_DDRSDRC0), false);
+	case 1:
+		return at91_get_ddram_size(IOMEM(AT91SAM9G45_BASE_DDRSDRC1), false);
+	default:
+		return 0;
+	}
+}
+#else
+static inline u32 at91sam9g45_get_ddram_size(int bank)
+{
+	return 0;
+}
+#endif
+
 #ifdef CONFIG_SOC_AT91SAM9X5
 static inline u32 at91sam9x5_get_ddram_size(void)
 {
-- 
1.7.10.4


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

  parent reply	other threads:[~2013-01-27 16:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-27 16:39 [PATCH 0/4] at91: sam9gx5/9g45/9n12 sd/ddrram autodetect size Jean-Christophe PLAGNIOL-VILLARD
2013-01-27 16:40 ` [PATCH 1/4] at91sam9x5: add autodetect sd/ddram size Jean-Christophe PLAGNIOL-VILLARD
2013-01-27 16:40   ` [PATCH 2/4] at91sam9n12: " Jean-Christophe PLAGNIOL-VILLARD
2013-01-27 16:40   ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2013-01-27 16:40   ` [PATCH 4/4] at91: Atmel ref board sam{9x5/9n12/m109g45} EK and Ronetix pm9g45 autodetect ddr size Jean-Christophe PLAGNIOL-VILLARD
2013-01-28  7:31 ` [PATCH 0/4] at91: sam9gx5/9g45/9n12 sd/ddrram autodetect size 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=1359304854-12641-3-git-send-email-plagnioj@jcrosoft.com \
    --to=plagnioj@jcrosoft.com \
    --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