On LS1028a the TF-A is placed in DDR, so we have to reserve the region
in order to keep Linux away from it.

Signed-off-by: Sascha Hauer <s.ha...@pengutronix.de>
---
 arch/arm/mach-layerscape/soc.c       | 22 ++++++++++++++++++++++
 drivers/mci/imx-esdhc-pbl.c          |  3 ++-
 include/mach/layerscape/layerscape.h |  8 ++++++++
 3 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-layerscape/soc.c b/arch/arm/mach-layerscape/soc.c
index b4c9dd5828..8507a66ff6 100644
--- a/arch/arm/mach-layerscape/soc.c
+++ b/arch/arm/mach-layerscape/soc.c
@@ -4,6 +4,7 @@
 #include <init.h>
 #include <memory.h>
 #include <linux/bug.h>
+#include <linux/printk.h>
 #include <mach/layerscape/layerscape.h>
 #include <of.h>
 
@@ -96,6 +97,27 @@ static int ls1028a_init(void)
        return 0;
 }
 
+static int ls1028a_reserve_tfa(void)
+{
+       resource_size_t tfa_start = LS1028A_TFA_RESERVED_START;
+       resource_size_t tfa_size = LS1028A_TFA_RESERVED_SIZE;
+       struct resource *res;
+
+       if (!cpu_is_ls1028a())
+               return 0;
+
+       res = reserve_sdram_region("tfa", tfa_start, tfa_size);
+       if (!res) {
+               pr_err("Cannot request SDRAM region %pa - %pa\n", &tfa_start, 
&tfa_size);
+                return -EINVAL;
+       }
+
+       of_register_fixup(of_fixup_reserved_memory, res);
+
+       return 0;
+}
+mmu_initcall(ls1028a_reserve_tfa);
+
 static int ls1046a_init(void)
 {
        if (!cpu_is_ls1046a())
diff --git a/drivers/mci/imx-esdhc-pbl.c b/drivers/mci/imx-esdhc-pbl.c
index 2c74d101e4..2d071eaca8 100644
--- a/drivers/mci/imx-esdhc-pbl.c
+++ b/drivers/mci/imx-esdhc-pbl.c
@@ -21,6 +21,7 @@
 #endif
 #ifdef CONFIG_ARCH_LAYERSCAPE
 #include <mach/layerscape/xload.h>
+#include <mach/layerscape/layerscape.h>
 #endif
 #include "sdhci.h"
 #include "imx-esdhc.h"
@@ -387,7 +388,7 @@ static int ls1028a_esdhc_start_image(void __iomem *base, 
struct dram_regions_inf
                .socdata = &data,
        };
        void *sdram = (void *)0x80000000;
-       void (*bl31)(void) = (void *)0xfbe00000;
+       void (*bl31)(void) = (void *)LS1028A_TFA_RESERVED_START;
        size_t bl31_size;
        void *bl31_image;
        struct bl2_to_bl31_params_mem_v2 *params;
diff --git a/include/mach/layerscape/layerscape.h 
b/include/mach/layerscape/layerscape.h
index ca1710d7bc..3dacfcb29f 100644
--- a/include/mach/layerscape/layerscape.h
+++ b/include/mach/layerscape/layerscape.h
@@ -3,6 +3,8 @@
 #ifndef __MACH_LAYERSCAPE_H
 #define __MACH_LAYERSCAPE_H
 
+#include <linux/sizes.h>
+
 #define LS1046A_DDR_SDRAM_BASE         0x80000000
 #define LS1046A_DDR_FREQ               2100000000
 
@@ -16,6 +18,12 @@
 #define LS1028A_SP_SHARED_DRAM_SIZE    SZ_2M
 #define LS1028A_TZC400_BASE            0x01100000
 
+#define LS1028A_TFA_SIZE               SZ_64M
+#define LS1028A_TFA_SHRD               SZ_2M
+#define LS1028A_TFA_RESERVED_SIZE      (LS1028A_TFA_SIZE + LS1028A_TFA_SHRD)
+#define LS1028A_TFA_RESERVED_START     (0x100000000 - 
LS1028A_TFA_RESERVED_SIZE)
+#define LS1028A_TFA_START              (0x100000000 - LS1028A_TFA_SIZE)
+
 enum bootsource ls1046a_bootsource_get(void);
 enum bootsource ls1021a_bootsource_get(void);
 
-- 
2.39.2


Reply via email to