rk: move sram.c from mach-rk29 to plat-rk
author黄涛 <huangtao@rock-chips.com>
Fri, 10 Feb 2012 08:27:40 +0000 (16:27 +0800)
committer黄涛 <huangtao@rock-chips.com>
Fri, 10 Feb 2012 08:41:10 +0000 (16:41 +0800)
arch/arm/mach-rk29/Makefile
arch/arm/mach-rk29/include/mach/sram.h
arch/arm/mach-rk29/sram.c [deleted file]
arch/arm/plat-rk/Makefile
arch/arm/plat-rk/include/plat/sram.h [new file with mode: 0644]
arch/arm/plat-rk/sram.c [new file with mode: 0644]

index 7385fe3cd18602f0f41f8e93e622da5e0ff73d23..79f18f3c696804408e956a3a11a84fb253588590 100644 (file)
@@ -1,4 +1,4 @@
-obj-y += timer.o io.o devices.o iomux.o clock.o rk29-pl330.o dma.o ddr.o sram.o memcpy_dma.o reset.o
+obj-y += timer.o io.o devices.o iomux.o clock.o rk29-pl330.o dma.o ddr.o memcpy_dma.o reset.o
 obj-y += tests.o memtester.o
 obj-y += early_printk.o
 ifndef CONFIG_DEBUG_LL
index 27d403c62e4397ec416565d3edb980f4e68073d0..8fcb978837985bc16c3dfb176ccd130ed3548cec 100644 (file)
@@ -1,40 +1 @@
-/*
- * Copyright (C) 2008-2009 ST-Ericsson AB
- * License terms: GNU General Public License (GPL) version 2
- * TCM memory handling for ARM systems
- *
- * Author: Linus Walleij <linus.walleij@stericsson.com>
- * Author: Rickard Andersson <rickard.andersson@stericsson.com>
- */
-
-#ifndef __ARCH_ARM_MACH_RK29_SRAM_H
-#define __ARCH_ARM_MACH_RK29_SRAM_H
-#ifdef CONFIG_ARCH_RK29
-
-/* Tag variables with this */
-#define __sramdata __section(.sram.data)
-/* Tag constants with this */
-#define __sramconst __section(.sram.rodata)
-/* Tag functions inside SRAM called from outside SRAM with this */
-#define __sramfunc __attribute__((long_call)) __section(.sram.text) noinline
-/* Tag function inside SRAM called from inside SRAM  with this */
-#define __sramlocalfunc __section(.sram.text)
-
-void __init rk29_sram_init(void);
-
-static inline unsigned long ddr_save_sp(unsigned long new_sp)
-{
-       unsigned long old_sp;
-
-       asm volatile ("mov %0, sp" : "=r" (old_sp));
-       asm volatile ("mov sp, %0" :: "r" (new_sp));
-       return old_sp;
-}
-
-// save_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)
-
-#endif
-#endif
-
+#include <plat/sram.h>
diff --git a/arch/arm/mach-rk29/sram.c b/arch/arm/mach-rk29/sram.c
deleted file mode 100644 (file)
index c278592..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * License terms: GNU General Public License (GPL) version 2
- */
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/stddef.h>
-#include <linux/ioport.h>
-#include <linux/genalloc.h>
-#include <linux/string.h> /* memcpy */
-#include <asm/page.h> /* PAGE_SHIFT */
-#include <asm/cputype.h>
-#include <asm/mach/map.h>
-#include <asm/tlbflush.h>
-#include <asm/cacheflush.h>
-#include <mach/memory.h>
-#include <mach/rk29_iomap.h>
-
-
-/* SRAM section definitions from the linker */
-extern char __sram_code_start, __ssram_code_text, __esram_code_text;
-extern char __sram_data_start, __ssram_data, __esram_data;
-
-static struct map_desc sram_code_iomap[] __initdata = {
-       {
-               .virtual        = SRAM_CODE_OFFSET,
-               .pfn            = __phys_to_pfn(0x0),
-               .length         =  1024*1024,
-               .type           =  MT_MEMORY
-       }
-};
-
-int __init rk29_sram_init(void)
-{
-       char *start;
-       char *end;
-       char *ram;
-
-       iotable_init(sram_code_iomap, 1);
-
-       /*
-        * Normally devicemaps_init() would flush caches and tlb after
-        * mdesc->map_io(), but since we're called from map_io(), we
-        * must do it here.
-        */
-       local_flush_tlb_all();
-       flush_cache_all();
-
-        memset((char *)SRAM_CODE_OFFSET,0x0,(SRAM_CODE_END - SRAM_CODE_OFFSET + 1));
-       memset((char *)SRAM_DATA_OFFSET,0x0,(SRAM_DATA_END - SRAM_DATA_OFFSET + 1));
-
-       /* Copy code from RAM to SRAM CODE */
-       start = &__ssram_code_text;
-       end   = &__esram_code_text;
-       ram   = &__sram_code_start;
-       memcpy(start, ram, (end-start));
-       flush_icache_range((unsigned long) start, (unsigned long) end);
-
-       printk("CPU SRAM: copied sram code from %p to %p - %p\n", ram, start, end);
-
-       /* Copy data from RAM to SRAM DATA */
-       start = &__ssram_data;
-       end   = &__esram_data;
-       ram   = &__sram_data_start;
-       memcpy(start, ram, (end-start));
-
-       printk("CPU SRAM: copied sram data from %p to %p - %p\n", ram,start, end);
-
-       return 0;
-}
index f78a8e5a60cb871df1e054c0fe939bee61976f22..675b57652170bc4a20ce6b16f9dee41118fe8009 100644 (file)
@@ -3,3 +3,4 @@ obj-$(CONFIG_USB_GADGET) += usb_detect.o
 obj-$(CONFIG_RK29_VPU) += vpu_service.o
 obj-$(CONFIG_ARCH_RK30) += dma-pl330.o
 obj-y += mem_reserve.o
+obj-y += sram.o
diff --git a/arch/arm/plat-rk/include/plat/sram.h b/arch/arm/plat-rk/include/plat/sram.h
new file mode 100644 (file)
index 0000000..27d403c
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2008-2009 ST-Ericsson AB
+ * License terms: GNU General Public License (GPL) version 2
+ * TCM memory handling for ARM systems
+ *
+ * Author: Linus Walleij <linus.walleij@stericsson.com>
+ * Author: Rickard Andersson <rickard.andersson@stericsson.com>
+ */
+
+#ifndef __ARCH_ARM_MACH_RK29_SRAM_H
+#define __ARCH_ARM_MACH_RK29_SRAM_H
+#ifdef CONFIG_ARCH_RK29
+
+/* Tag variables with this */
+#define __sramdata __section(.sram.data)
+/* Tag constants with this */
+#define __sramconst __section(.sram.rodata)
+/* Tag functions inside SRAM called from outside SRAM with this */
+#define __sramfunc __attribute__((long_call)) __section(.sram.text) noinline
+/* Tag function inside SRAM called from inside SRAM  with this */
+#define __sramlocalfunc __section(.sram.text)
+
+void __init rk29_sram_init(void);
+
+static inline unsigned long ddr_save_sp(unsigned long new_sp)
+{
+       unsigned long old_sp;
+
+       asm volatile ("mov %0, sp" : "=r" (old_sp));
+       asm volatile ("mov sp, %0" :: "r" (new_sp));
+       return old_sp;
+}
+
+// save_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)
+
+#endif
+#endif
+
diff --git a/arch/arm/plat-rk/sram.c b/arch/arm/plat-rk/sram.c
new file mode 100644 (file)
index 0000000..c278592
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * License terms: GNU General Public License (GPL) version 2
+ */
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/stddef.h>
+#include <linux/ioport.h>
+#include <linux/genalloc.h>
+#include <linux/string.h> /* memcpy */
+#include <asm/page.h> /* PAGE_SHIFT */
+#include <asm/cputype.h>
+#include <asm/mach/map.h>
+#include <asm/tlbflush.h>
+#include <asm/cacheflush.h>
+#include <mach/memory.h>
+#include <mach/rk29_iomap.h>
+
+
+/* SRAM section definitions from the linker */
+extern char __sram_code_start, __ssram_code_text, __esram_code_text;
+extern char __sram_data_start, __ssram_data, __esram_data;
+
+static struct map_desc sram_code_iomap[] __initdata = {
+       {
+               .virtual        = SRAM_CODE_OFFSET,
+               .pfn            = __phys_to_pfn(0x0),
+               .length         =  1024*1024,
+               .type           =  MT_MEMORY
+       }
+};
+
+int __init rk29_sram_init(void)
+{
+       char *start;
+       char *end;
+       char *ram;
+
+       iotable_init(sram_code_iomap, 1);
+
+       /*
+        * Normally devicemaps_init() would flush caches and tlb after
+        * mdesc->map_io(), but since we're called from map_io(), we
+        * must do it here.
+        */
+       local_flush_tlb_all();
+       flush_cache_all();
+
+        memset((char *)SRAM_CODE_OFFSET,0x0,(SRAM_CODE_END - SRAM_CODE_OFFSET + 1));
+       memset((char *)SRAM_DATA_OFFSET,0x0,(SRAM_DATA_END - SRAM_DATA_OFFSET + 1));
+
+       /* Copy code from RAM to SRAM CODE */
+       start = &__ssram_code_text;
+       end   = &__esram_code_text;
+       ram   = &__sram_code_start;
+       memcpy(start, ram, (end-start));
+       flush_icache_range((unsigned long) start, (unsigned long) end);
+
+       printk("CPU SRAM: copied sram code from %p to %p - %p\n", ram, start, end);
+
+       /* Copy data from RAM to SRAM DATA */
+       start = &__ssram_data;
+       end   = &__esram_data;
+       ram   = &__sram_data_start;
+       memcpy(start, ram, (end-start));
+
+       printk("CPU SRAM: copied sram data from %p to %p - %p\n", ram,start, end);
+
+       return 0;
+}