rk: move sram_* functions from pm.c to sram.c
author黄涛 <huangtao@rock-chips.com>
Fri, 2 Mar 2012 07:53:03 +0000 (15:53 +0800)
committer黄涛 <huangtao@rock-chips.com>
Fri, 2 Mar 2012 08:01:20 +0000 (16:01 +0800)
arch/arm/mach-rk29/pm.c
arch/arm/plat-rk/include/plat/sram.h
arch/arm/plat-rk/sram.c

index 5d1a510ed56616ed37483dadf06788a719bfa55c..656c6d99173fe2cc27630e629921e97d8ed151af 100755 (executable)
@@ -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)
 
index 198780cea592c0796fa9ca4027b92f3e1b643821..c86b80a065b47af9710b9ea87d8de4f9db136593 100644 (file)
@@ -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
 
index 9a91843f40ea7af9e9fa665d2d1d61c154fa0461..8d8fb062f1486ff4536f5add30414c6cdad1eb58 100644 (file)
@@ -14,6 +14,7 @@
 #include <asm/tlbflush.h>
 #include <asm/cacheflush.h>
 #include <mach/memory.h>
+#include <plat/sram.h>
 
 
 /* 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;
+       }
+}