From eff8924b57d21eadfe749e500617340b1a730c17 Mon Sep 17 00:00:00 2001 From: Schuyler Patton Date: Thu, 30 Jun 2011 13:39:25 -0500 Subject: [PATCH 1/3] omap3_evm: Added function calls to set volts, speed on OMAP36xx parts * evm.c * Added setup calls to set voltage and speed * Added calls in misc_init_r to twl4030_power_mpu_init and set_mpu_clock functions. These set VDD1 to 1.35v and mpu clock to 1GHz respectively. There is a check performed to make sure that this is only called on omap36xx class parts. * twl4030.c * Added twl4030_power_mpu_init function to set VDD1 to 1.35 Volts * This is done to allow omap36xx parts to run at 1GHz. * clock.c * Added set_mpu_clk function to allow u-boot to set the clock rate. * sys_proto.h * Added the function prototype set_mpu_clock * twl4030.h * Added twl4030_power_mpu_init function prototype Upstream-Status: Pending Signed-off-by: Schuyler Patton --- arch/arm/cpu/armv7/omap3/clock.c | 15 +++++++++++++++ arch/arm/include/asm/arch-omap3/sys_proto.h | 2 ++ board/ti/evm/evm.c | 5 +++++ drivers/power/twl4030.c | 12 ++++++++++++ include/twl4030.h | 3 +++ 5 files changed, 37 insertions(+), 0 deletions(-) diff --git a/arch/arm/cpu/armv7/omap3/clock.c b/arch/arm/cpu/armv7/omap3/clock.c index 567817e..46a28a3 100644 --- a/arch/arm/cpu/armv7/omap3/clock.c +++ b/arch/arm/cpu/armv7/omap3/clock.c @@ -35,6 +35,21 @@ #include /****************************************************************************** + * Setting the Clock speed + * + *****************************************************************************/ +void set_mpu_clk(int speed) +{ + struct prcm *prcm_base = (struct prcm *)PRCM_BASE; + + + /* Set M */ + sr32(&prcm_base->clksel1_pll_mpu, 8, 11, speed); + /* lock mode */ + sr32(&prcm_base->clken_pll_mpu, 0, 3, PLL_LOCK); +} + +/****************************************************************************** * get_sys_clk_speed() - determine reference oscillator speed * based on known 32kHz clock and gptimer. *****************************************************************************/ diff --git a/arch/arm/include/asm/arch-omap3/sys_proto.h b/arch/arm/include/asm/arch-omap3/sys_proto.h index 2a89e56..9db13d7 100644 --- a/arch/arm/include/asm/arch-omap3/sys_proto.h +++ b/arch/arm/include/asm/arch-omap3/sys_proto.h @@ -36,6 +36,8 @@ void prcm_init(void); void per_clocks_enable(void); void ehci_clocks_enable(void); +void set_mpu_clk(int speed); + void memif_init(void); void sdrc_init(void); void do_sdrc_init(u32, u32); diff --git a/board/ti/evm/evm.c b/board/ti/evm/evm.c index 8497aee..91eb93d 100644 --- a/board/ti/evm/evm.c +++ b/board/ti/evm/evm.c @@ -39,6 +39,7 @@ #include #include #include "evm.h" +#include #define OMAP3EVM_GPIO_ETH_RST_GEN1 64 #define OMAP3EVM_GPIO_ETH_RST_GEN2 7 @@ -177,6 +178,10 @@ int misc_init_r(void) #endif dieid_num_r(); + if (get_cpu_family() == CPU_OMAP36XX) { + twl4030_power_mpu_init(); + set_mpu_clk(500); + } return 0; } diff --git a/drivers/power/twl4030.c b/drivers/power/twl4030.c index 36b2144..670b4cb 100644 --- a/drivers/power/twl4030.c +++ b/drivers/power/twl4030.c @@ -105,6 +105,18 @@ void twl4030_power_init(void) TWL4030_PM_RECEIVER_DEV_GRP_P1); } +#define VDD1_VSEL_135 0x3C + +void twl4030_power_mpu_init(void) +{ + unsigned char byte; + + /* 1.4 Volts */ + byte = VDD1_VSEL_135; + twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER, byte, + TWL4030_PM_RECEIVER_VDD1_VSEL); +} + void twl4030_power_mmc_init(void) { /* Set VMMC1 to 3.15 Volts */ diff --git a/include/twl4030.h b/include/twl4030.h index 9cd32ab..91d36b8 100644 --- a/include/twl4030.h +++ b/include/twl4030.h @@ -510,6 +510,9 @@ static inline int twl4030_i2c_read_u8(u8 chip_no, u8 *val, u8 reg) * Power */ +/*For setting VDD1 */ +void twl4030_power_mpu_init(void); + /* For hardware resetting */ void twl4030_power_reset_init(void); /* For setting device group and voltage */ -- 1.7.0.4