]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - sitara-epos/sitara-epos-kernel.git/blobdiff - arch/arm/plat-omap/include/plat/sram.h
ARM: OMAP: AM33XX: Basic suspend resume support
[sitara-epos/sitara-epos-kernel.git] / arch / arm / plat-omap / include / plat / sram.h
index 75aa1b2bef519eaa8958c37a7050df66c022848a..45584162b2fc4224bb168425d5d716c749a6e8ed 100644 (file)
 #define __ARCH_ARM_OMAP_SRAM_H
 
 #ifndef __ASSEMBLY__
+#include <linux/slab.h>
+#include <linux/genalloc.h>
 #include <asm/fncpy.h>
 
-extern void *omap_sram_push_address(unsigned long size);
+extern struct gen_pool *omap_gen_pool;
 
-/* Macro to push a function to the internal SRAM, using the fncpy API */
-#define omap_sram_push(funcp, size) ({                         \
-       typeof(&(funcp)) _res = NULL;                           \
-       void *_sram_address = omap_sram_push_address(size);     \
-       if (_sram_address)                                      \
-               _res = fncpy(_sram_address, &(funcp), size);    \
-       _res;                                                   \
+/*
+ * Note that fncpy requires the SRAM address to be aligned to an 8-byte
+ * boundary, so the min_alloc_order for the pool is set appropriately.
+ */
+#define omap_sram_push(funcp, size) ({                                 \
+       typeof(&(funcp)) _res;                                          \
+       size_t _sz = size;                                              \
+       void *_sram = (void *) gen_pool_alloc(omap_gen_pool, _sz);      \
+       _res = (_sram ? fncpy(_sram, &(funcp), _sz) : NULL);            \
+       if (!_res)                                                      \
+               pr_err("Not enough space in SRAM\n");                   \
+       _res;                                                           \
 })
 
 extern void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl);
@@ -82,8 +89,10 @@ extern u32 omap3_sram_configure_core_dpll(
 extern unsigned long omap3_sram_configure_core_dpll_sz;
 
 #ifdef CONFIG_PM
+extern void am33xx_push_sram_idle(void);
 extern void omap_push_sram_idle(void);
 #else
+static inline void am33xx_push_sram_idle(void) {}
 static inline void omap_push_sram_idle(void) {}
 #endif /* CONFIG_PM */
 
@@ -101,4 +110,5 @@ static inline void omap_push_sram_idle(void) {}
 #else
 #define OMAP4_SRAM_PA          0x40300000
 #endif
+#define AM33XX_SRAM_PA         0x40300000
 #endif