From c5079b6af350c7e5366afee0e4fc959619ffd23f Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E9=BB=84=E6=B6=9B?= Date: Fri, 2 Mar 2012 15:53:03 +0800 Subject: [PATCH] rk: move sram_* functions from pm.c to sram.c --- arch/arm/mach-rk29/pm.c | 34 +++++----------------------- arch/arm/plat-rk/include/plat/sram.h | 6 ++++- arch/arm/plat-rk/sram.c | 21 +++++++++++++++++ 3 files changed, 32 insertions(+), 29 deletions(-) diff --git a/arch/arm/mach-rk29/pm.c b/arch/arm/mach-rk29/pm.c index 5d1a510ed566..656c6d99173f 100755 --- a/arch/arm/mach-rk29/pm.c +++ b/arch/arm/mach-rk29/pm.c @@ -69,17 +69,6 @@ static inline void delay_300us(void) sram_printch('\r'); } - void __sramfunc sram_printascii(const char *s) -{ - while (*s) { - if (*s == '\n') - { - sram_printch('\r'); - } - sram_printch(*s); - s++; - } -} void print(const char *s) { sram_printascii(s); @@ -123,17 +112,6 @@ void print_Dec_3(uint32_t value) print_Dec(value); } -static void /* inline*/ __sramfunc printhex(unsigned int hex) -{ - int i = 8; - sram_printch('0'); - sram_printch('x'); - while (i--) { - unsigned char c = (hex & 0xF0000000) >> 28; - sram_printch(c < 0xa ? c + '0' : c - 0xa + 'a'); - hex <<= 4; - } -} #else static void inline sram_printch(char byte) {} static void inline sram_printascii(const char *s) {} @@ -164,9 +142,9 @@ void __sramfunc ddr_testmode(void) if(nMHz < 100) nMHz = 100; nMHz = ddr_change_freq(nMHz); - printhex(nMHz); + sram_printhex(nMHz); sram_printch(' '); - printhex(n++); + sram_printhex(n++); sram_printch(' '); g_crc2 = calc_crc32((u32)_stext, (size_t)(_etext-_stext)); if (g_crc1!=g_crc2) @@ -191,9 +169,9 @@ void __sramfunc ddr_testmode(void) ddr_suspend(); delayus(nMHz); ddr_resume(); - printhex(nMHz); + sram_printhex(nMHz); sram_printch(' '); - printhex(n++); + sram_printhex(n++); g_crc2 = calc_crc32((u32)_stext, (size_t)(_etext-_stext)); if (g_crc1!=g_crc2) { @@ -301,7 +279,7 @@ do { \ u32 en = readl(RK29_GPIO##ID##_BASE + GPIO_INTEN); \ if (en) { \ sram_printascii("GPIO" #ID "_INTEN: "); \ - printhex(en); \ + sram_printhex(en); \ sram_printch('\n'); \ } \ } while (0) @@ -323,7 +301,7 @@ static void dump_inten(void) do { \ u32 state = readl(RK29_GRF_BASE + GRF_GPIO0_PULL + (ID<<2)); \ sram_printascii("GPIO" #ID "_PULL: "); \ - printhex(state); \ + sram_printhex(state); \ sram_printch('\n'); \ } while (0) diff --git a/arch/arm/plat-rk/include/plat/sram.h b/arch/arm/plat-rk/include/plat/sram.h index 198780cea592..c86b80a065b4 100644 --- a/arch/arm/plat-rk/include/plat/sram.h +++ b/arch/arm/plat-rk/include/plat/sram.h @@ -12,7 +12,7 @@ /* Tag function inside SRAM called from inside SRAM with this */ #define __sramlocalfunc __section(.sram.text) -void __init rk29_sram_init(void); +int __init rk29_sram_init(void); static inline unsigned long ddr_save_sp(unsigned long new_sp) { @@ -27,6 +27,10 @@ static inline unsigned long ddr_save_sp(unsigned long new_sp) #define DDR_SAVE_SP(save_sp) do { save_sp = ddr_save_sp((SRAM_DATA_END&(~7))); } while (0) #define DDR_RESTORE_SP(save_sp) do { ddr_save_sp(save_sp); } while (0) +extern void __sramfunc sram_printch(char byte); +extern void __sramfunc sram_printascii(const char *s); +extern void __sramfunc sram_printhex(unsigned int hex); + #endif /* CONFIG_PLAT_RK */ #endif diff --git a/arch/arm/plat-rk/sram.c b/arch/arm/plat-rk/sram.c index 9a91843f40ea..8d8fb062f148 100644 --- a/arch/arm/plat-rk/sram.c +++ b/arch/arm/plat-rk/sram.c @@ -14,6 +14,7 @@ #include #include #include +#include /* SRAM section definitions from the linker */ @@ -67,3 +68,23 @@ int __init rk29_sram_init(void) return 0; } + +void __sramfunc sram_printascii(const char *s) +{ + while (*s) { + sram_printch(*s); + s++; + } +} + +void __sramfunc sram_printhex(unsigned int hex) +{ + int i = 8; + sram_printch('0'); + sram_printch('x'); + while (i--) { + unsigned char c = (hex & 0xF0000000) >> 28; + sram_printch(c < 0xa ? c + '0' : c - 0xa + 'a'); + hex <<= 4; + } +} -- 2.34.1