summaryrefslogtreecommitdiffstats
path: root/recipes-bsp/u-boot/u-boot-am37x-2012.04.01/0001-omap3_evm-Added-function-calls-to-set-volts-speed-on.patch
blob: 4fc6e98aed239b8e24eabb88998f5f3e978e76bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
From eff8924b57d21eadfe749e500617340b1a730c17 Mon Sep 17 00:00:00 2001
From: Schuyler Patton <spatton@ti.com>
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 <spatton@ti.com>
---
 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 <command.h>
 
 /******************************************************************************
+ * 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 <asm/mach-types.h>
 #include <linux/mtd/nand.h>
 #include "evm.h"
+#include <twl4030.h>
 
 #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