[glsdk/meta-ti-glsdk.git] / recipes-bsp / u-boot / u-boot-2012.04.01 / 0001-omap3_evm-Added-function-calls-to-set-volts-speed-on.patch
1 From eff8924b57d21eadfe749e500617340b1a730c17 Mon Sep 17 00:00:00 2001
2 From: Schuyler Patton <spatton@ti.com>
3 Date: Thu, 30 Jun 2011 13:39:25 -0500
4 Subject: [PATCH 1/3] omap3_evm: Added function calls to set volts, speed on OMAP36xx parts
6 * evm.c
8 * Added setup calls to set voltage and speed
10 * Added calls in misc_init_r to twl4030_power_mpu_init and set_mpu_clock
11 functions. These set VDD1 to 1.35v and mpu clock to 1GHz respectively.
12 There is a check performed to make sure that this is only called on
13 omap36xx class parts.
15 * twl4030.c
17 * Added twl4030_power_mpu_init function to set VDD1 to 1.35 Volts
19 * This is done to allow omap36xx parts to run at 1GHz.
21 * clock.c
23 * Added set_mpu_clk function to allow u-boot to set the clock
24 rate.
26 * sys_proto.h
28 * Added the function prototype set_mpu_clock
30 * twl4030.h
32 * Added twl4030_power_mpu_init function prototype
34 Upstream-Status: Pending
36 Signed-off-by: Schuyler Patton <spatton@ti.com>
37 ---
38 arch/arm/cpu/armv7/omap3/clock.c | 15 +++++++++++++++
39 arch/arm/include/asm/arch-omap3/sys_proto.h | 2 ++
40 board/ti/evm/evm.c | 5 +++++
41 drivers/power/twl4030.c | 12 ++++++++++++
42 include/twl4030.h | 3 +++
43 5 files changed, 37 insertions(+), 0 deletions(-)
45 diff --git a/arch/arm/cpu/armv7/omap3/clock.c b/arch/arm/cpu/armv7/omap3/clock.c
46 index 567817e..46a28a3 100644
47 --- a/arch/arm/cpu/armv7/omap3/clock.c
48 +++ b/arch/arm/cpu/armv7/omap3/clock.c
49 @@ -35,6 +35,21 @@
50 #include <command.h>
52 /******************************************************************************
53 + * Setting the Clock speed
54 + *
55 + *****************************************************************************/
56 +void set_mpu_clk(int speed)
57 +{
58 + struct prcm *prcm_base = (struct prcm *)PRCM_BASE;
59 +
60 +
61 + /* Set M */
62 + sr32(&prcm_base->clksel1_pll_mpu, 8, 11, speed);
63 + /* lock mode */
64 + sr32(&prcm_base->clken_pll_mpu, 0, 3, PLL_LOCK);
65 +}
66 +
67 +/******************************************************************************
68 * get_sys_clk_speed() - determine reference oscillator speed
69 * based on known 32kHz clock and gptimer.
70 *****************************************************************************/
71 diff --git a/arch/arm/include/asm/arch-omap3/sys_proto.h b/arch/arm/include/asm/arch-omap3/sys_proto.h
72 index 2a89e56..9db13d7 100644
73 --- a/arch/arm/include/asm/arch-omap3/sys_proto.h
74 +++ b/arch/arm/include/asm/arch-omap3/sys_proto.h
75 @@ -36,6 +36,8 @@ void prcm_init(void);
76 void per_clocks_enable(void);
77 void ehci_clocks_enable(void);
79 +void set_mpu_clk(int speed);
80 +
81 void memif_init(void);
82 void sdrc_init(void);
83 void do_sdrc_init(u32, u32);
84 diff --git a/board/ti/evm/evm.c b/board/ti/evm/evm.c
85 index 8497aee..91eb93d 100644
86 --- a/board/ti/evm/evm.c
87 +++ b/board/ti/evm/evm.c
88 @@ -39,6 +39,7 @@
89 #include <asm/mach-types.h>
90 #include <linux/mtd/nand.h>
91 #include "evm.h"
92 +#include <twl4030.h>
94 #define OMAP3EVM_GPIO_ETH_RST_GEN1 64
95 #define OMAP3EVM_GPIO_ETH_RST_GEN2 7
96 @@ -177,6 +178,10 @@ int misc_init_r(void)
97 #endif
98 dieid_num_r();
100 + if (get_cpu_family() == CPU_OMAP36XX) {
101 + twl4030_power_mpu_init();
102 + set_mpu_clk(500);
103 + }
104 return 0;
105 }
107 diff --git a/drivers/power/twl4030.c b/drivers/power/twl4030.c
108 index 36b2144..670b4cb 100644
109 --- a/drivers/power/twl4030.c
110 +++ b/drivers/power/twl4030.c
111 @@ -105,6 +105,18 @@ void twl4030_power_init(void)
112 TWL4030_PM_RECEIVER_DEV_GRP_P1);
113 }
115 +#define VDD1_VSEL_135 0x3C
116 +
117 +void twl4030_power_mpu_init(void)
118 +{
119 + unsigned char byte;
120 +
121 + /* 1.4 Volts */
122 + byte = VDD1_VSEL_135;
123 + twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER, byte,
124 + TWL4030_PM_RECEIVER_VDD1_VSEL);
125 +}
126 +
127 void twl4030_power_mmc_init(void)
128 {
129 /* Set VMMC1 to 3.15 Volts */
130 diff --git a/include/twl4030.h b/include/twl4030.h
131 index 9cd32ab..91d36b8 100644
132 --- a/include/twl4030.h
133 +++ b/include/twl4030.h
134 @@ -510,6 +510,9 @@ static inline int twl4030_i2c_read_u8(u8 chip_no, u8 *val, u8 reg)
135 * Power
136 */
138 +/*For setting VDD1 */
139 +void twl4030_power_mpu_init(void);
140 +
141 /* For hardware resetting */
142 void twl4030_power_reset_init(void);
143 /* For setting device group and voltage */
144 --
145 1.7.0.4