]> 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: Add SRAM support for AM33xx
[sitara-epos/sitara-epos-kernel.git] / arch / arm / plat-omap / include / plat / sram.h
index f500fc34d06595254fb8688cb7c633a7807c113d..a60f643560a48cc595a8989f39a00abcf9d039fd 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);
@@ -95,6 +102,11 @@ static inline void omap_push_sram_idle(void) {}
  */
 #define OMAP2_SRAM_PA          0x40200000
 #define OMAP3_SRAM_PA           0x40200000
+#ifdef CONFIG_OMAP4_ERRATA_I688
+#define OMAP4_SRAM_PA          0x40304000
+#define OMAP4_SRAM_VA          0xfe404000
+#else
 #define OMAP4_SRAM_PA          0x40300000
-
+#endif
+#define AM33XX_SRAM_PA         0x40300000
 #endif