From 4cdc84b1e7579ee7a5992351804b46453d6ffab2 Mon Sep 17 00:00:00 2001 From: Jean Pihet Date: Wed, 19 Jan 2011 14:03:52 -0800 Subject: omap: use fncpy to copy the PM code functions to SRAM The new fncpy API is better suited for copying some code to SRAM at runtime. This patch changes the ad-hoc code to the more generic fncpy API. Tested OK on OMAP3 in low power modes (RET/OFF) using omap2plus_defconfig with !CONFIG_THUMB2_KERNEL. Compile tested on OMAP1/2 using omap1_defconfig. Signed-off-by: Jean Pihet Acked-by: Kevin Hilman Tested-by: Kevin Hilman --- arch/arm/plat-omap/include/plat/sram.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'arch/arm/plat-omap/include/plat/sram.h') diff --git a/arch/arm/plat-omap/include/plat/sram.h b/arch/arm/plat-omap/include/plat/sram.h index 9967d5e855c..d673f2c55f9 100644 --- a/arch/arm/plat-omap/include/plat/sram.h +++ b/arch/arm/plat-omap/include/plat/sram.h @@ -12,7 +12,19 @@ #define __ARCH_ARM_OMAP_SRAM_H #ifndef __ASSEMBLY__ -extern void * omap_sram_push(void * start, unsigned long size); +#include + +extern void *omap_sram_push_address(unsigned long size); + +/* 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; \ +}) + extern void omap_sram_reprogram_clock(u32 dpllctl, u32 ckctl); extern void omap2_sram_ddr_init(u32 *slow_dll_ctrl, u32 fast_dll_ctrl, -- cgit v1.2.3 From e7e9a3a79201bbe65fe0fad512563fb4c5609294 Mon Sep 17 00:00:00 2001 From: Jean Pihet Date: Tue, 25 Jan 2011 18:48:06 +0100 Subject: OMAP: fix fncpy API call Fix a potential problem with function types when calling the fncpy API to copy the PM code functions to SRAM. Signed-off-by: Jean Pihet --- arch/arm/plat-omap/include/plat/sram.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'arch/arm/plat-omap/include/plat/sram.h') diff --git a/arch/arm/plat-omap/include/plat/sram.h b/arch/arm/plat-omap/include/plat/sram.h index d673f2c55f9..f500fc34d06 100644 --- a/arch/arm/plat-omap/include/plat/sram.h +++ b/arch/arm/plat-omap/include/plat/sram.h @@ -18,10 +18,10 @@ extern void *omap_sram_push_address(unsigned long size); /* Macro to push a function to the internal SRAM, using the fncpy API */ #define omap_sram_push(funcp, size) ({ \ - typeof(&funcp) _res = NULL; \ + typeof(&(funcp)) _res = NULL; \ void *_sram_address = omap_sram_push_address(size); \ if (_sram_address) \ - _res = fncpy(_sram_address, &funcp, size); \ + _res = fncpy(_sram_address, &(funcp), size); \ _res; \ }) -- cgit v1.2.3