From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 3/4] ARM: at91: fix at91sama5_get_ddram_size for sama5d4
Date: Tue, 19 Feb 2019 13:06:11 +0100 [thread overview]
Message-ID: <20190219120612.728-4-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20190219120612.728-1-a.fatoum@pengutronix.de>
at91sama5_get_ddram_size() is despite the name specific to the
sama5d3 which it was added alongside of. sama5d4 board code continues
to use it, but accessing SAMA5D3_BASE_MPDDRC (0xffffea00) on
a sama5d4 should result in a Data Abort (Datasheet Figure 5-1)..
Fix this by giving at91sama5_get_ddram_size the mpddrc base
address as argument and adjust call sites appropriately.
This change was not tested on a sama5d4.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm/boards/sama5d3_xplained/lowlevel.c | 2 +-
arch/arm/boards/sama5d3xek/lowlevel.c | 2 +-
arch/arm/boards/sama5d4_xplained/lowlevel.c | 2 +-
arch/arm/boards/sama5d4ek/lowlevel.c | 2 +-
arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h | 6 ++----
arch/arm/mach-at91/sama5d3_devices.c | 2 +-
arch/arm/mach-at91/sama5d4_devices.c | 2 +-
7 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/arch/arm/boards/sama5d3_xplained/lowlevel.c b/arch/arm/boards/sama5d3_xplained/lowlevel.c
index b791f2a03cc7..56003c6330ec 100644
--- a/arch/arm/boards/sama5d3_xplained/lowlevel.c
+++ b/arch/arm/boards/sama5d3_xplained/lowlevel.c
@@ -19,5 +19,5 @@ void __naked __bare_init barebox_arm_reset_vector(void)
arm_setup_stack(SAMA5D3_SRAM_BASE + SAMA5D3_SRAM_SIZE - 16);
- barebox_arm_entry(SAMA5_DDRCS, at91sama5_get_ddram_size(), NULL);
+ barebox_arm_entry(SAMA5_DDRCS, at91sama5_get_ddram_size(IOMEM(SAMA5D3_BASE_MPDDRC)), NULL);
}
diff --git a/arch/arm/boards/sama5d3xek/lowlevel.c b/arch/arm/boards/sama5d3xek/lowlevel.c
index b791f2a03cc7..56003c6330ec 100644
--- a/arch/arm/boards/sama5d3xek/lowlevel.c
+++ b/arch/arm/boards/sama5d3xek/lowlevel.c
@@ -19,5 +19,5 @@ void __naked __bare_init barebox_arm_reset_vector(void)
arm_setup_stack(SAMA5D3_SRAM_BASE + SAMA5D3_SRAM_SIZE - 16);
- barebox_arm_entry(SAMA5_DDRCS, at91sama5_get_ddram_size(), NULL);
+ barebox_arm_entry(SAMA5_DDRCS, at91sama5_get_ddram_size(IOMEM(SAMA5D3_BASE_MPDDRC)), NULL);
}
diff --git a/arch/arm/boards/sama5d4_xplained/lowlevel.c b/arch/arm/boards/sama5d4_xplained/lowlevel.c
index b791f2a03cc7..82993c83551b 100644
--- a/arch/arm/boards/sama5d4_xplained/lowlevel.c
+++ b/arch/arm/boards/sama5d4_xplained/lowlevel.c
@@ -19,5 +19,5 @@ void __naked __bare_init barebox_arm_reset_vector(void)
arm_setup_stack(SAMA5D3_SRAM_BASE + SAMA5D3_SRAM_SIZE - 16);
- barebox_arm_entry(SAMA5_DDRCS, at91sama5_get_ddram_size(), NULL);
+ barebox_arm_entry(SAMA5_DDRCS, at91sama5_get_ddram_size(IOMEM(SAMA5D4_BASE_MPDDRC)), NULL);
}
diff --git a/arch/arm/boards/sama5d4ek/lowlevel.c b/arch/arm/boards/sama5d4ek/lowlevel.c
index b791f2a03cc7..82993c83551b 100644
--- a/arch/arm/boards/sama5d4ek/lowlevel.c
+++ b/arch/arm/boards/sama5d4ek/lowlevel.c
@@ -19,5 +19,5 @@ void __naked __bare_init barebox_arm_reset_vector(void)
arm_setup_stack(SAMA5D3_SRAM_BASE + SAMA5D3_SRAM_SIZE - 16);
- barebox_arm_entry(SAMA5_DDRCS, at91sama5_get_ddram_size(), NULL);
+ barebox_arm_entry(SAMA5_DDRCS, at91sama5_get_ddram_size(IOMEM(SAMA5D4_BASE_MPDDRC)), NULL);
}
diff --git a/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h b/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h
index b0c003cd1e05..a775d3b19691 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h
@@ -222,13 +222,11 @@ static inline u32 at91sam9n12_get_ddram_size(void)
#endif
#ifdef CONFIG_SOC_SAMA5
-#include <mach/sama5d3.h>
-static inline u32 at91sama5_get_ddram_size(void)
+static inline u32 at91sama5_get_ddram_size(void __iomem *base)
{
u32 cr;
u32 mdr;
u32 size;
- void * __iomem base = IOMEM(SAMA5D3_BASE_MPDDRC);
cr = readl(base + AT91_DDRSDRC_CR);
mdr = readl(base + AT91_DDRSDRC_MDR);
@@ -253,7 +251,7 @@ static inline u32 at91sama5_get_ddram_size(void)
return size;
}
#else
-static inline u32 at91sama5_get_ddram_size(void)
+static inline u32 at91sama5_get_ddram_size(void __iomem *base)
{
return 0;
}
diff --git a/arch/arm/mach-at91/sama5d3_devices.c b/arch/arm/mach-at91/sama5d3_devices.c
index f5075b39374f..b61d2b309ce0 100644
--- a/arch/arm/mach-at91/sama5d3_devices.c
+++ b/arch/arm/mach-at91/sama5d3_devices.c
@@ -28,7 +28,7 @@
void at91_add_device_sdram(u32 size)
{
if (!size)
- size = at91sama5_get_ddram_size();
+ size = at91sama5_get_ddram_size(IOMEM(SAMA5D3_BASE_MPDDRC));
arm_add_mem_device("ram0", SAMA5_DDRCS, size);
add_mem_device("sram0", SAMA5D3_SRAM_BASE,
diff --git a/arch/arm/mach-at91/sama5d4_devices.c b/arch/arm/mach-at91/sama5d4_devices.c
index 4064e4441f9f..546d0888bfd8 100644
--- a/arch/arm/mach-at91/sama5d4_devices.c
+++ b/arch/arm/mach-at91/sama5d4_devices.c
@@ -29,7 +29,7 @@
void at91_add_device_sdram(u32 size)
{
if (!size)
- size = at91sama5_get_ddram_size();
+ size = at91sama5_get_ddram_size(IOMEM(SAMA5D4_BASE_MPDDRC));
arm_add_mem_device("ram0", SAMA5_DDRCS, size);
add_mem_device("sram0", SAMA5D4_SRAM_BASE,
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2019-02-19 12:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-19 12:06 [PATCH 0/4] ARM: at91: misc fixes and cleanup Ahmad Fatoum
2019-02-19 12:06 ` [PATCH 1/4] ARM: at91: replace __raw_{readl, writel} of peripherals with readl, writel Ahmad Fatoum
2019-02-19 12:06 ` [PATCH 2/4] ARM: at91: debug_ll: make UART base address configurable Ahmad Fatoum
2019-02-19 20:42 ` Sam Ravnborg
2019-02-19 21:10 ` Ahmad Fatoum
2019-02-19 21:12 ` Ahmad Fatoum
2019-02-19 21:30 ` Sam Ravnborg
2019-02-20 7:55 ` Sascha Hauer
2019-02-26 9:09 ` Ahmad Fatoum
2019-02-19 12:06 ` Ahmad Fatoum [this message]
2019-02-19 12:06 ` [PATCH 4/4] ARM: at91: remove duplicate get_ddram_size code Ahmad Fatoum
2019-02-24 12:35 ` Sam Ravnborg
2019-02-26 9:10 ` Ahmad Fatoum
2019-02-26 9:56 ` Ahmad Fatoum
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=20190219120612.728-4-a.fatoum@pengutronix.de \
--to=a.fatoum@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