From: Minkyu Kang Date: Fri, 31 Jul 2009 06:04:25 +0000 (+0900) Subject: s5pc110: enable l2 cache X-Git-Tag: 20091016~154^2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c7a60cda6e68066b644fa15993c927f2b762e9ed;p=kernel%2Fu-boot.git s5pc110: enable l2 cache Signed-off-by: Minkyu Kang --- diff --git a/cpu/arm_cortexa8/cpu.c b/cpu/arm_cortexa8/cpu.c index 5a5981e..728112a 100644 --- a/cpu/arm_cortexa8/cpu.c +++ b/cpu/arm_cortexa8/cpu.c @@ -35,9 +35,6 @@ #include #include #include -#ifndef CONFIG_L2_OFF -#include -#endif static void cache_flush(void); @@ -60,19 +57,19 @@ int cleanup_before_linux(void) /* invalidate I-cache */ cache_flush(); -#ifndef CONFIG_L2_OFF - /* turn off L2 cache */ - l2_cache_disable(); - /* invalidate L2 cache also */ - v7_flush_dcache_all(get_device_type()); -#endif + if (get_device_type() != 0x10) { + /* turn off L2 cache */ + l2_cache_disable(); + /* invalidate L2 cache also */ + v7_flush_dcache_all(get_device_type()); + } + i = 0; /* mem barrier to sync up things */ asm("mcr p15, 0, %0, c7, c10, 4": :"r"(i)); -#ifndef CONFIG_L2_OFF - l2_cache_enable(); -#endif + if (get_device_type() != 0x10) + l2_cache_enable(); return 0; } diff --git a/cpu/arm_cortexa8/s5pc1xx/Makefile b/cpu/arm_cortexa8/s5pc1xx/Makefile index d3720bd..11ffff7 100644 --- a/cpu/arm_cortexa8/s5pc1xx/Makefile +++ b/cpu/arm_cortexa8/s5pc1xx/Makefile @@ -33,6 +33,7 @@ SOBJS = reset.o COBJS-y = timer.o COBJS-$(CONFIG_S5PC100) += clock.o COBJS-$(CONFIG_S5PC100) += cpu_info.o +COBJS-$(CONFIG_S5PC100) += cache.o COBJS-$(CONFIG_CMD_USBDOWN) += usb-hs-otg.o usb_downloader.o OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS-y)) diff --git a/cpu/arm_cortexa8/s5pc1xx/cache.c b/cpu/arm_cortexa8/s5pc1xx/cache.c new file mode 100644 index 0000000..8396ba3 --- /dev/null +++ b/cpu/arm_cortexa8/s5pc1xx/cache.c @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2009 Samsung Electronics + * Minkyu Kang + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include +#include + +void l2_cache_enable(void) +{ + unsigned long i; + + if (cpu_is_s5pc110()) { + __asm__ __volatile__("mrc p15, 0, %0, c1, c0, 1":"=r"(i)); + __asm__ __volatile__("orr %0, %0, #0x2":"=r"(i)); + __asm__ __volatile__("mcr p15, 0, %0, c1, c0, 1":"=r"(i)); + } +} + +void l2_cache_disable(void) +{ + unsigned long i; + + if (cpu_is_s5pc110()) { + __asm__ __volatile__("mrc p15, 0, %0, c1, c0, 1":"=r"(i)); + __asm__ __volatile__("bic %0, %0, #0x2":"=r"(i)); + __asm__ __volatile__("mcr p15, 0, %0, c1, c0, 1":"=r"(i)); + } +} diff --git a/cpu/arm_cortexa8/s5pc1xx/cpu_info.c b/cpu/arm_cortexa8/s5pc1xx/cpu_info.c index 1fac4b9..237547a 100644 --- a/cpu/arm_cortexa8/s5pc1xx/cpu_info.c +++ b/cpu/arm_cortexa8/s5pc1xx/cpu_info.c @@ -39,6 +39,14 @@ int arch_cpu_init(void) } #endif +u32 get_device_type(void) +{ + if (cpu_is_s5pc110()) + return 0x11; + else + return 0x10; +} + #ifdef CONFIG_DISPLAY_CPUINFO int print_cpuinfo(void) { diff --git a/include/configs/s5pc100_universal.h b/include/configs/s5pc100_universal.h index a4911ce..853a061 100644 --- a/include/configs/s5pc100_universal.h +++ b/include/configs/s5pc100_universal.h @@ -90,7 +90,6 @@ #define CONFIG_ENV_OVERWRITE #define CONFIG_BAUDRATE 115200 -#define CONFIG_L2_OFF /* It should define before config_cmd_default.h */ #define CONFIG_SYS_NO_FLASH 1