summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/omap-secure.c
diff options
context:
space:
mode:
authorSantosh Shilimkar <santosh.shilimkar@ti.com>2011-06-06 20:28:23 +0530
committerKevin Hilman <khilman@ti.com>2011-12-08 11:29:00 -0800
commit259ee57a8cda5760dd3e803c5271a6327e1f38ac (patch)
tree371adb6d30774b636403279eacaaae4297b31b4f /arch/arm/mach-omap2/omap-secure.c
parentba9456ac9c72a7a5d4d59340aba4259351832521 (diff)
downloadblackbird-obmc-linux-259ee57a8cda5760dd3e803c5271a6327e1f38ac.tar.gz
blackbird-obmc-linux-259ee57a8cda5760dd3e803c5271a6327e1f38ac.zip
ARM: OMAP: PM: Add support to allocate the memory for secure RAM
Allocate the memory to save secure ram context which needs to be done when MPU is hitting OFF mode. The ROM code expects a physical address to this memory and hence use memblock APIs to reserve this memory as part of .reserve() callback. Maximum size as per secure RAM requirements is allocated. To keep omap1 build working, omap-secure.h file is created under plat-omap directory. Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Acked-by: Jean Pihet <j-pihet@ti.com> Reviewed-by: Kevin Hilman <khilman@ti.com> Tested-by: Vishwanath BS <vishwanath.bs@ti.com> Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2/omap-secure.c')
-rw-r--r--arch/arm/mach-omap2/omap-secure.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/omap-secure.c b/arch/arm/mach-omap2/omap-secure.c
index e5a606e59b1e..69f3c72d959b 100644
--- a/arch/arm/mach-omap2/omap-secure.c
+++ b/arch/arm/mach-omap2/omap-secure.c
@@ -13,11 +13,14 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/io.h>
+#include <linux/memblock.h>
#include <asm/cacheflush.h>
#include <mach/omap-secure.h>
+static phys_addr_t omap_secure_memblock_base;
+
/**
* omap_sec_dispatcher: Routine to dispatch low power secure
* service routines
@@ -50,3 +53,29 @@ u32 omap_secure_dispatcher(u32 idx, u32 flag, u32 nargs, u32 arg1, u32 arg2,
return ret;
}
+
+/* Allocate the memory to save secure ram */
+int __init omap_secure_ram_reserve_memblock(void)
+{
+ phys_addr_t paddr;
+ u32 size = OMAP_SECURE_RAM_STORAGE;
+
+ size = ALIGN(size, SZ_1M);
+ paddr = memblock_alloc(size, SZ_1M);
+ if (!paddr) {
+ pr_err("%s: failed to reserve %x bytes\n",
+ __func__, size);
+ return -ENOMEM;
+ }
+ memblock_free(paddr, size);
+ memblock_remove(paddr, size);
+
+ omap_secure_memblock_base = paddr;
+
+ return 0;
+}
+
+phys_addr_t omap_secure_ram_mempool_base(void)
+{
+ return omap_secure_memblock_base;
+}
OpenPOWER on IntegriCloud