]> 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 9967d5e855c76c810e3190fd93f81742993230d3..a60f643560a48cc595a8989f39a00abcf9d039fd 100644 (file)
 #define __ARCH_ARM_OMAP_SRAM_H
 
 #ifndef __ASSEMBLY__
-extern void * omap_sram_push(void * start, unsigned long size);
+#include <linux/slab.h>
+#include <linux/genalloc.h>
+#include <asm/fncpy.h>
+
+extern struct gen_pool *omap_gen_pool;
+
+/*
+ * 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);
 
 extern void omap2_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl,
@@ -83,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