diff options
Diffstat (limited to 'arch/arm/cpu/armv7')
| -rw-r--r-- | arch/arm/cpu/armv7/am33xx/board.c | 40 | ||||
| -rw-r--r-- | arch/arm/cpu/armv7/am33xx/clock_am33xx.c | 9 | ||||
| -rw-r--r-- | arch/arm/cpu/armv7/exynos/Makefile | 2 | ||||
| -rw-r--r-- | arch/arm/cpu/armv7/exynos/clock.c | 10 | ||||
| -rw-r--r-- | arch/arm/cpu/armv7/exynos/tzpc.c | 57 | ||||
| -rw-r--r-- | arch/arm/cpu/armv7/s5p-common/Makefile | 2 | ||||
| -rw-r--r-- | arch/arm/cpu/armv7/s5p-common/timer.c | 2 | 
7 files changed, 112 insertions, 10 deletions
| diff --git a/arch/arm/cpu/armv7/am33xx/board.c b/arch/arm/cpu/armv7/am33xx/board.c index 885fb2d20e5..b935a29a3ca 100644 --- a/arch/arm/cpu/armv7/am33xx/board.c +++ b/arch/arm/cpu/armv7/am33xx/board.c @@ -149,3 +149,43 @@ int arch_misc_init(void)  #endif  	return 0;  } + +#ifdef CONFIG_SPL_BUILD +void rtc32k_enable(void) +{ +	struct rtc_regs *rtc = (struct rtc_regs *)RTC_BASE; + +	/* +	 * Unlock the RTC's registers.  For more details please see the +	 * RTC_SS section of the TRM.  In order to unlock we need to +	 * write these specific values (keys) in this order. +	 */ +	writel(0x83e70b13, &rtc->kick0r); +	writel(0x95a4f1e0, &rtc->kick1r); + +	/* Enable the RTC 32K OSC by setting bits 3 and 6. */ +	writel((1 << 3) | (1 << 6), &rtc->osc); +} + +#define UART_RESET		(0x1 << 1) +#define UART_CLK_RUNNING_MASK	0x1 +#define UART_SMART_IDLE_EN	(0x1 << 0x3) + +void uart_soft_reset(void) +{ +	struct uart_sys *uart_base = (struct uart_sys *)DEFAULT_UART_BASE; +	u32 regval; + +	regval = readl(&uart_base->uartsyscfg); +	regval |= UART_RESET; +	writel(regval, &uart_base->uartsyscfg); +	while ((readl(&uart_base->uartsyssts) & +		UART_CLK_RUNNING_MASK) != UART_CLK_RUNNING_MASK) +		; + +	/* Disable smart idle */ +	regval = readl(&uart_base->uartsyscfg); +	regval |= UART_SMART_IDLE_EN; +	writel(regval, &uart_base->uartsyscfg); +} +#endif diff --git a/arch/arm/cpu/armv7/am33xx/clock_am33xx.c b/arch/arm/cpu/armv7/am33xx/clock_am33xx.c index a1efc7520a7..9c4d0b43931 100644 --- a/arch/arm/cpu/armv7/am33xx/clock_am33xx.c +++ b/arch/arm/cpu/armv7/am33xx/clock_am33xx.c @@ -246,7 +246,7 @@ static void enable_per_clocks(void)  		;  } -static void mpu_pll_config(void) +void mpu_pll_config_val(int mpull_m)  {  	u32 clkmode, clksel, div_m2; @@ -260,7 +260,7 @@ static void mpu_pll_config(void)  		;  	clksel = clksel & (~CLK_SEL_MASK); -	clksel = clksel | ((MPUPLL_M << CLK_SEL_SHIFT) | MPUPLL_N); +	clksel = clksel | ((mpull_m << CLK_SEL_SHIFT) | MPUPLL_N);  	writel(clksel, &cmwkup->clkseldpllmpu);  	div_m2 = div_m2 & ~CLK_DIV_MASK; @@ -274,6 +274,11 @@ static void mpu_pll_config(void)  		;  } +static void mpu_pll_config(void) +{ +	mpu_pll_config_val(CONFIG_SYS_MPUCLK); +} +  static void core_pll_config(void)  {  	u32 clkmode, clksel, div_m4, div_m5, div_m6; diff --git a/arch/arm/cpu/armv7/exynos/Makefile b/arch/arm/cpu/armv7/exynos/Makefile index 9119961d95d..b2f9152e1bf 100644 --- a/arch/arm/cpu/armv7/exynos/Makefile +++ b/arch/arm/cpu/armv7/exynos/Makefile @@ -22,7 +22,7 @@ include $(TOPDIR)/config.mk  LIB	= $(obj)lib$(SOC).o -COBJS	+= clock.o power.o soc.o system.o pinmux.o +COBJS	+= clock.o power.o soc.o system.o pinmux.o tzpc.o  SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)  OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS)) diff --git a/arch/arm/cpu/armv7/exynos/clock.c b/arch/arm/cpu/armv7/exynos/clock.c index 223660aab6d..e1c42462e18 100644 --- a/arch/arm/cpu/armv7/exynos/clock.c +++ b/arch/arm/cpu/armv7/exynos/clock.c @@ -116,10 +116,8 @@ static int exynos_get_pll_clk(int pllreg, unsigned int r, unsigned int k)  		/* FOUT = (MDIV + K / 1024) * FIN / (PDIV * 2^SDIV) */  		fout = (m + k / 1024) * (freq / (p * (1 << s)));  	} else { -		if (s < 1) -			s = 1; -		/* FOUT = MDIV * FIN / (PDIV * 2^(SDIV - 1)) */ -		fout = m * (freq / (p * (1 << (s - 1)))); +		/* FOUT = MDIV * FIN / (PDIV * 2^SDIV) */ +		fout = m * (freq / (p * (1 << s)));  	}  	return fout; @@ -613,7 +611,7 @@ static unsigned long exynos4_get_mmc_clk(int dev_index)  		(struct exynos4_clock *)samsung_get_base_clock();  	unsigned long uclk, sclk;  	unsigned int sel, ratio, pre_ratio; -	int shift; +	int shift = 0;  	sel = readl(&clk->src_fsys);  	sel = (sel >> (dev_index << 2)) & 0xf; @@ -662,7 +660,7 @@ static unsigned long exynos5_get_mmc_clk(int dev_index)  		(struct exynos5_clock *)samsung_get_base_clock();  	unsigned long uclk, sclk;  	unsigned int sel, ratio, pre_ratio; -	int shift; +	int shift = 0;  	sel = readl(&clk->src_fsys);  	sel = (sel >> (dev_index << 2)) & 0xf; diff --git a/arch/arm/cpu/armv7/exynos/tzpc.c b/arch/arm/cpu/armv7/exynos/tzpc.c new file mode 100644 index 00000000000..f5e8e9c4740 --- /dev/null +++ b/arch/arm/cpu/armv7/exynos/tzpc.c @@ -0,0 +1,57 @@ +/* + * Lowlevel setup for SMDK5250 board based on S5PC520 + * + * Copyright (C) 2012 Samsung Electronics + * + * 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 <common.h> +#include <asm/arch/tzpc.h> +#include <asm/io.h> + +/* Setting TZPC[TrustZone Protection Controller] */ +void tzpc_init(void) +{ +	struct exynos_tzpc *tzpc; +	unsigned int addr, start = 0, end = 0; + +	start = samsung_get_base_tzpc(); + +	if (cpu_is_exynos5()) +		end = start + ((EXYNOS5_NR_TZPC_BANKS - 1) * TZPC_BASE_OFFSET); +	else if (cpu_is_exynos4()) +		end = start + ((EXYNOS4_NR_TZPC_BANKS - 1) * TZPC_BASE_OFFSET); + +	for (addr = start; addr <= end; addr += TZPC_BASE_OFFSET) { +		tzpc = (struct exynos_tzpc *)addr; + +		if (addr == start) +			writel(R0SIZE, &tzpc->r0size); + +		writel(DECPROTXSET, &tzpc->decprot0set); +		writel(DECPROTXSET, &tzpc->decprot1set); + +		if (cpu_is_exynos5() && (addr == end)) +			break; + +		writel(DECPROTXSET, &tzpc->decprot2set); +		writel(DECPROTXSET, &tzpc->decprot3set); +	} +} diff --git a/arch/arm/cpu/armv7/s5p-common/Makefile b/arch/arm/cpu/armv7/s5p-common/Makefile index 17053995bd6..0c38bd0d2f1 100644 --- a/arch/arm/cpu/armv7/s5p-common/Makefile +++ b/arch/arm/cpu/armv7/s5p-common/Makefile @@ -26,9 +26,11 @@ include $(TOPDIR)/config.mk  LIB	= $(obj)libs5p-common.o  COBJS-y		+= cpu_info.o +ifndef CONFIG_SPL_BUILD  COBJS-y		+= timer.o  COBJS-y		+= sromc.o  COBJS-$(CONFIG_PWM)	+= pwm.o +endif  SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)  OBJS	:= $(addprefix $(obj),$(COBJS-y) $(SOBJS)) diff --git a/arch/arm/cpu/armv7/s5p-common/timer.c b/arch/arm/cpu/armv7/s5p-common/timer.c index 4adfaae656d..637593c3397 100644 --- a/arch/arm/cpu/armv7/s5p-common/timer.c +++ b/arch/arm/cpu/armv7/s5p-common/timer.c @@ -95,7 +95,7 @@ unsigned long get_timer(unsigned long base)  	return time_ms - base;  } -unsigned long timer_get_us(void) +unsigned long __attribute__((no_instrument_function)) timer_get_us(void)  {  	static unsigned long base_time_us; | 
