public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [v2 PATCH 04/12] arm, at91: compile mpddrc ram init code also for AT91SAM9M10G45
Date: Thu, 30 Oct 2014 09:14:58 +0100	[thread overview]
Message-ID: <1414656906-16632-5-git-send-email-hs@denx.de> (raw)
In-Reply-To: <1414656906-16632-1-git-send-email-hs@denx.de>

- compile mpddrc ram init code also for AT91SAM9M10G45
  based boards.
- in CONFIG_SAMA5D3 case, look for the ATMEL_MPDDRC_CR_DECOD_INTERLEAVED
  in the cr configuration

Signed-off-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Andreas Bie?mann <andreas.devel@googlemail.com>

---

Changes in v2:
  add Reviewed-by: Andreas Bie?mann <andreas.devel@googlemail.com>

 arch/arm/cpu/at91-common/Makefile |  6 +++++-
 arch/arm/cpu/at91-common/mpddrc.c | 11 ++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/arch/arm/cpu/at91-common/Makefile b/arch/arm/cpu/at91-common/Makefile
index 5b97838..f62863a 100644
--- a/arch/arm/cpu/at91-common/Makefile
+++ b/arch/arm/cpu/at91-common/Makefile
@@ -9,4 +9,8 @@
 #
 
 obj-$(CONFIG_AT91_WANTS_COMMON_PHY) += phy.o
-obj-$(CONFIG_SPL_BUILD) += mpddrc.o spl.o
+ifneq ($(CONFIG_SPL_BUILD),)
+obj-$(CONFIG_AT91SAM9M10G45) += mpddrc.o
+obj-$(CONFIG_SAMA5D3) += mpddrc.o
+obj-y += spl.o
+endif
diff --git a/arch/arm/cpu/at91-common/mpddrc.c b/arch/arm/cpu/at91-common/mpddrc.c
index 76668d2..602e71e 100644
--- a/arch/arm/cpu/at91-common/mpddrc.c
+++ b/arch/arm/cpu/at91-common/mpddrc.c
@@ -17,6 +17,15 @@ static inline void atmel_mpddr_op(int mode, u32 ram_address)
 	writel(0, ram_address);
 }
 
+static int ddr2_decodtype_is_seq(u32 cr)
+{
+#if defined(CONFIG_SAMA5D3)
+	if (cr & ATMEL_MPDDRC_CR_DECOD_INTERLEAVED)
+		return 0;
+#endif
+	return 1;
+}
+
 int ddr2_init(const unsigned int ram_address,
 	      const struct atmel_mpddr *mpddr_value)
 {
@@ -25,7 +34,7 @@ int ddr2_init(const unsigned int ram_address,
 
 	/* Compute bank offset according to NC in configuration register */
 	ba_off = (mpddr_value->cr & ATMEL_MPDDRC_CR_NC_MASK) + 9;
-	if (!(mpddr_value->cr & ATMEL_MPDDRC_CR_DECOD_INTERLEAVED))
+	if (ddr2_decodtype_is_seq(mpddr_value->cr))
 		ba_off += ((mpddr_value->cr & ATMEL_MPDDRC_CR_NR_MASK) >> 2)
 			   + 11;
 
-- 
1.8.3.1

  parent reply	other threads:[~2014-10-30  8:14 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-30  8:14 [U-Boot] [v2 PATCH 0/12] arm, at91, spl: add spl support for the taurus and corvus boards Heiko Schocher
2014-10-30  8:14 ` [U-Boot] [v2 PATCH 01/12] spi, atmel: move CONFIG_SYS_SPI_WRITE_TOUT into common header Heiko Schocher
2014-10-30  8:14 ` [U-Boot] [v2 PATCH 02/12] arm, at91: add spi dataflash support for the taurus board Heiko Schocher
2014-10-30  8:14 ` [U-Boot] [v2 PATCH 03/12] arm, at91, mpddrc: fix typo in ddr2_init() Heiko Schocher
2014-10-31  1:55   ` Bo Shen
2014-10-31  5:33     ` Heiko Schocher
2014-10-30  8:14 ` Heiko Schocher [this message]
2014-10-30  8:14 ` [U-Boot] [v2 PATCH 05/12] arm, at91: add missing ddr2 cr register MPDDRC_CR_EBISHARE define Heiko Schocher
2014-10-30  8:15 ` [U-Boot] [v2 PATCH 06/12] spl, nand: add option to boot raw u-boot.bin image only Heiko Schocher
2014-10-30  8:15 ` [U-Boot] [v2 PATCH 07/12] mtd: atmel_nand: add missign include Heiko Schocher
2014-10-30  8:15 ` [U-Boot] [v2 PATCH 08/12] spl, nand, atmel_nand: add erase one block function Heiko Schocher
2014-10-30 23:16   ` Scott Wood
2014-10-30  8:15 ` [U-Boot] [v2 PATCH 09/12] spl, mtd, nand, atmel_nand: invert device ready pin logic Heiko Schocher
2014-10-30 23:18   ` Scott Wood
2014-10-30  8:15 ` [U-Boot] [v2 PATCH 10/12] arm, spl, at91: add at91sam9260 and at91sam9g45 spl support Heiko Schocher
2014-10-30 10:17   ` Bo Shen
2014-10-30 11:41     ` Heiko Schocher
2014-10-31  1:55       ` Bo Shen
2014-10-31  1:50   ` Bo Shen
2014-10-31  6:03     ` Heiko Schocher
2014-10-31  6:08     ` Wolfgang Denk
2014-10-30  8:15 ` [U-Boot] [v2 PATCH 11/12] arm, at91, spl: add spl support for the taurus board Heiko Schocher
2014-10-30  8:15 ` [U-Boot] [v2 PATCH 12/12] arm, spl, at91: add spl support for the corvus board Heiko Schocher

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=1414656906-16632-5-git-send-email-hs@denx.de \
    --to=hs@denx.de \
    --cc=u-boot@lists.denx.de \
    /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