From 28c3526ad483bb02ee2146676e1f0c272ae50e10 Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Tue, 17 Aug 2010 17:56:30 +0900 Subject: [PATCH] s5p: make s5p common feature Signed-off-by: Minkyu Kang --- Makefile | 7 ++++ arch/arm/cpu/armv7/s5p-common/Makefile | 49 ++++++++++++++++++++++ .../cpu/armv7/{s5pc1xx => s5p-common}/cpu_info.c | 13 +++--- arch/arm/cpu/armv7/{s5pc1xx => s5p-common}/timer.c | 0 arch/arm/cpu/armv7/s5pc1xx/Makefile | 2 - arch/arm/cpu/armv7/s5pc1xx/clock.c | 2 +- arch/arm/include/asm/arch-s5pc1xx/clk.h | 2 +- arch/arm/include/asm/arch-s5pc1xx/cpu.h | 15 ++++--- recovery/board/samsung/universal/Makefile | 2 +- 9 files changed, 75 insertions(+), 17 deletions(-) create mode 100644 arch/arm/cpu/armv7/s5p-common/Makefile rename arch/arm/cpu/armv7/{s5pc1xx => s5p-common}/cpu_info.c (82%) rename arch/arm/cpu/armv7/{s5pc1xx => s5p-common}/timer.c (100%) diff --git a/Makefile b/Makefile index d31e03e..cb6d783 100644 --- a/Makefile +++ b/Makefile @@ -253,6 +253,13 @@ ifeq ($(SOC),omap4) LIBS += $(CPUDIR)/omap-common/libomap-common.a endif +ifeq ($(SOC),s5pc1xx) +LIBS += $(CPUDIR)/s5p-common/libs5p-common.a +endif +ifeq ($(SOC),s5pc2xx) +LIBS += $(CPUDIR)/s5p-common/libs5p-common.a +endif + LIBS := $(addprefix $(obj),$(LIBS)) .PHONY : $(LIBS) $(TIMESTAMP_FILE) $(VERSION_FILE) diff --git a/arch/arm/cpu/armv7/s5p-common/Makefile b/arch/arm/cpu/armv7/s5p-common/Makefile new file mode 100644 index 0000000..5d2fbd6 --- /dev/null +++ b/arch/arm/cpu/armv7/s5p-common/Makefile @@ -0,0 +1,49 @@ +# +# (C) Copyright 2000-2003 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# +# (C) Copyright 2008 +# Guennadi Liakhovetki, DENX Software Engineering, +# +# 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 $(TOPDIR)/config.mk + +LIB = $(obj)libs5p-common.a + +COBJS-y += cpu_info.o +COBJS-y += timer.o + +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS-y) $(SOBJS)) + +all: $(obj).depend $(LIB) + +$(LIB): $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/arch/arm/cpu/armv7/s5pc1xx/cpu_info.c b/arch/arm/cpu/armv7/s5p-common/cpu_info.c similarity index 82% rename from arch/arm/cpu/armv7/s5pc1xx/cpu_info.c rename to arch/arm/cpu/armv7/s5p-common/cpu_info.c index c3c46fa..b2e7e82 100644 --- a/arch/arm/cpu/armv7/s5pc1xx/cpu_info.c +++ b/arch/arm/cpu/armv7/s5p-common/cpu_info.c @@ -25,17 +25,16 @@ #include /* Default is s5pc100 */ -unsigned int s5pc1xx_cpu_id = 0xC100; +unsigned int s5p_cpu_id = 0xC100; /* Default is EVT1 */ -unsigned int s5pc1xx_cpu_rev = 1; +unsigned int s5p_cpu_rev = 1; #ifdef CONFIG_ARCH_CPU_INIT int arch_cpu_init(void) { - s5pc1xx_cpu_id = readl(samsung_get_base_pro_id()); - s5pc1xx_cpu_id = 0xC000 | ((s5pc1xx_cpu_id & 0x00FFF000) >> 12); + s5p_set_cpu_id(readl(samsung_get_base_pro_id())); #ifndef CONFIG_RECOVERY_BLOCK - s5pc1xx_clock_init(); + s5p_clock_init(); #endif return 0; } @@ -43,7 +42,7 @@ int arch_cpu_init(void) u32 get_device_type(void) { - return s5pc1xx_cpu_id; + return s5p_cpu_id; } #ifdef CONFIG_DISPLAY_CPUINFO @@ -53,7 +52,7 @@ int print_cpuinfo(void) char buf[32]; printf("CPU:\tS5P%X@%sMHz\n", - s5pc1xx_cpu_id, strmhz(buf, get_arm_clk())); + s5p_cpu_id, strmhz(buf, get_arm_clk())); #endif return 0; } diff --git a/arch/arm/cpu/armv7/s5pc1xx/timer.c b/arch/arm/cpu/armv7/s5p-common/timer.c similarity index 100% rename from arch/arm/cpu/armv7/s5pc1xx/timer.c rename to arch/arm/cpu/armv7/s5p-common/timer.c diff --git a/arch/arm/cpu/armv7/s5pc1xx/Makefile b/arch/arm/cpu/armv7/s5pc1xx/Makefile index 20cff4e..0e37ad8 100644 --- a/arch/arm/cpu/armv7/s5pc1xx/Makefile +++ b/arch/arm/cpu/armv7/s5pc1xx/Makefile @@ -32,9 +32,7 @@ SOBJS = cache.o SOBJS += reset.o COBJS-y += clock.o -COBJS-y += cpu_info.o COBJS-y += sromc.o -COBJS-y += timer.o COBJS-$(CONFIG_CMD_SLEEP) += sleep.o COBJS-$(CONFIG_CMD_SLEEP) += sleep_asm.o COBJS-$(CONFIG_CMD_USBDOWN) += usb-hs-otg.o usb_downloader.o diff --git a/arch/arm/cpu/armv7/s5pc1xx/clock.c b/arch/arm/cpu/armv7/s5pc1xx/clock.c index 67af84a..c9b5485 100644 --- a/arch/arm/cpu/armv7/s5pc1xx/clock.c +++ b/arch/arm/cpu/armv7/s5pc1xx/clock.c @@ -297,7 +297,7 @@ static unsigned long s5pc100_get_pclk(void) return get_pclkd1(); } -void s5pc1xx_clock_init(void) +void s5p_clock_init(void) { if (cpu_is_s5pc110()) { get_pll_clk = s5pc110_get_pll_clk; diff --git a/arch/arm/include/asm/arch-s5pc1xx/clk.h b/arch/arm/include/asm/arch-s5pc1xx/clk.h index 3e59abe..c25e17a 100644 --- a/arch/arm/include/asm/arch-s5pc1xx/clk.h +++ b/arch/arm/include/asm/arch-s5pc1xx/clk.h @@ -29,7 +29,7 @@ #define HPLL 3 #define VPLL 4 -void s5pc1xx_clock_init(void); +void s5p_clock_init(void); extern unsigned long (*get_pll_clk)(int pllreg); extern unsigned long (*get_arm_clk)(void); diff --git a/arch/arm/include/asm/arch-s5pc1xx/cpu.h b/arch/arm/include/asm/arch-s5pc1xx/cpu.h index 6f462a3..8e70cae 100644 --- a/arch/arm/include/asm/arch-s5pc1xx/cpu.h +++ b/arch/arm/include/asm/arch-s5pc1xx/cpu.h @@ -62,12 +62,17 @@ #ifndef __ASSEMBLY__ /* CPU detection macros */ -extern unsigned int s5pc1xx_cpu_id; +extern unsigned int s5p_cpu_id; + +static inline void s5p_set_cpu_id(unsigned int id) +{ + s5p_cpu_id = 0xC000 | ((id & 0x00FFF000) >> 12); +} #define IS_SAMSUNG_TYPE(type, id) \ static inline int cpu_is_##type(void) \ { \ - return s5pc1xx_cpu_id == id ? 1 : 0; \ + return s5p_cpu_id == id ? 1 : 0; \ } IS_SAMSUNG_TYPE(s5pc100, 0xc100) @@ -92,16 +97,16 @@ SAMSUNG_BASE(sromc, SROMC_BASE) SAMSUNG_BASE(timer, PWMTIMER_BASE) SAMSUNG_BASE(uart, UART_BASE) -extern unsigned int s5pc1xx_cpu_rev; +extern unsigned int s5p_cpu_rev; static inline int s5pc1xx_get_cpu_rev(void) { - return s5pc1xx_cpu_rev; + return s5p_cpu_rev; } static inline void s5pc1xx_set_cpu_rev(unsigned int rev) { - s5pc1xx_cpu_rev = rev; + s5p_cpu_rev = rev; } #endif diff --git a/recovery/board/samsung/universal/Makefile b/recovery/board/samsung/universal/Makefile index 06aa7b9..65842af 100644 --- a/recovery/board/samsung/universal/Makefile +++ b/recovery/board/samsung/universal/Makefile @@ -35,7 +35,7 @@ $(obj)reset.S: $(obj)cpu_info.c: @rm -f $@ - ln -s $(SRCTREE)/$(CPUDIR)/$(SOC)/$@ $@ + ln -s $(SRCTREE)/$(CPUDIR)/s5p-common/$@ $@ $(obj)_memcpy32.S: ln -sf $(SRCTREE)/arch/$(ARCH)/lib/$@ $@ -- 2.7.4