mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
rk: move sram.c from mach-rk29 to plat-rk
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 <20><><EFBFBD>붨<EFBFBD><EBB6A8>Ϊȫ<CEAA>ֱ<EFBFBD><D6B1><EFBFBD>
|
||||
#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>
|
||||
|
||||
@@ -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
|
||||
|
||||
40
arch/arm/plat-rk/include/plat/sram.h
Normal file
40
arch/arm/plat-rk/include/plat/sram.h
Normal file
@@ -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 <20><><EFBFBD>붨<EFBFBD><EBB6A8>Ϊȫ<CEAA>ֱ<EFBFBD><D6B1><EFBFBD>
|
||||
#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
|
||||
|
||||
Reference in New Issue
Block a user