[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-3.0 / beagle / 0005-omap3-Add-basic-support-for-720MHz-part.patch
1 From f0a23fe6d3c8fc9bbb60a962114b64b923ca4515 Mon Sep 17 00:00:00 2001
2 From: Sanjeev Premi <premi@ti.com>
3 Date: Tue, 18 Jan 2011 13:19:55 +0530
4 Subject: [PATCH 05/10] omap3: Add basic support for 720MHz part
6 This patch adds support for new speed enhanced parts with ARM
7 and IVA running at 720MHz and 520MHz respectively. These parts
8 can be probed at run-time by reading PRODID.SKUID[3:0] at
9 0x4830A20C [1].
11 This patch specifically does following:
12 * Detect devices capable of 720MHz.
13 * Add new OPP
14 * Ensure that OPP is conditionally enabled.
15 * Check for presence of IVA before attempting to enable
16 the corresponding OPP.
18 [1] http://focus.ti.com/lit/ug/spruff1d/spruff1d.pdf
20 Signed-off-by: Sanjeev Premi <premi@ti.com>
21 ---
22 arch/arm/mach-omap2/control.h | 7 ++++
23 arch/arm/mach-omap2/id.c | 10 +++++
24 arch/arm/mach-omap2/opp3xxx_data.c | 63 ++++++++++++++++++++++++++++++++-
25 arch/arm/plat-omap/include/plat/cpu.h | 2 +
26 4 files changed, 81 insertions(+), 1 deletions(-)
28 diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
29 index a016c8b..69d0b9c 100644
30 --- a/arch/arm/mach-omap2/control.h
31 +++ b/arch/arm/mach-omap2/control.h
32 @@ -371,6 +371,13 @@
33 #define FEAT_NEON 0
34 #define FEAT_NEON_NONE 1
36 +/*
37 + * Product ID register
38 + */
39 +#define OMAP3_PRODID 0x020C
40 +
41 +#define OMAP3_SKUID_MASK 0x0f
42 +#define OMAP3_SKUID_720MHZ 0x08
44 #ifndef __ASSEMBLY__
45 #ifdef CONFIG_ARCH_OMAP2PLUS
46 diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
47 index 2537090..b6ed78a 100644
48 --- a/arch/arm/mach-omap2/id.c
49 +++ b/arch/arm/mach-omap2/id.c
50 @@ -210,6 +210,15 @@ static void __init omap3_check_features(void)
51 * TODO: Get additional info (where applicable)
52 * e.g. Size of L2 cache.
53 */
54 +
55 + /*
56 + * Does it support 720MHz?
57 + */
58 + status = (OMAP3_SKUID_MASK & read_tap_reg(OMAP3_PRODID));
59 +
60 + if (status & OMAP3_SKUID_720MHZ) {
61 + omap3_features |= OMAP3_HAS_720MHZ;
62 + }
63 }
65 static void __init ti816x_check_features(void)
66 @@ -490,6 +499,7 @@ static void __init omap3_cpuinfo(void)
67 OMAP3_SHOW_FEATURE(neon);
68 OMAP3_SHOW_FEATURE(isp);
69 OMAP3_SHOW_FEATURE(192mhz_clk);
70 + OMAP3_SHOW_FEATURE(720mhz);
72 printk(")\n");
73 }
74 diff --git a/arch/arm/mach-omap2/opp3xxx_data.c b/arch/arm/mach-omap2/opp3xxx_data.c
75 index d95f3f9..44fbc84 100644
76 --- a/arch/arm/mach-omap2/opp3xxx_data.c
77 +++ b/arch/arm/mach-omap2/opp3xxx_data.c
78 @@ -18,8 +18,10 @@
79 * GNU General Public License for more details.
80 */
81 #include <linux/module.h>
82 +#include <linux/opp.h>
84 #include <plat/cpu.h>
85 +#include <plat/omap_device.h>
87 #include "control.h"
88 #include "omap_opp_data.h"
89 @@ -98,6 +100,8 @@ static struct omap_opp_def __initdata omap34xx_opp_def_list[] = {
90 OPP_INITIALIZER("mpu", true, 550000000, OMAP3430_VDD_MPU_OPP4_UV),
91 /* MPU OPP5 */
92 OPP_INITIALIZER("mpu", true, 600000000, OMAP3430_VDD_MPU_OPP5_UV),
93 + /* MPU OPP6 */
94 + OPP_INITIALIZER("mpu", false, 720000000, 1350000),
96 /*
97 * L3 OPP1 - 41.5 MHz is disabled because: The voltage for that OPP is
98 @@ -123,6 +127,8 @@ static struct omap_opp_def __initdata omap34xx_opp_def_list[] = {
99 OPP_INITIALIZER("iva", true, 400000000, OMAP3430_VDD_MPU_OPP4_UV),
100 /* DSP OPP5 */
101 OPP_INITIALIZER("iva", true, 430000000, OMAP3430_VDD_MPU_OPP5_UV),
102 + /* DSP OPP6 */
103 + OPP_INITIALIZER("iva", false, 520000000, 1350000),
104 };
106 static struct omap_opp_def __initdata omap36xx_opp_def_list[] = {
107 @@ -150,6 +156,57 @@ static struct omap_opp_def __initdata omap36xx_opp_def_list[] = {
108 OPP_INITIALIZER("iva", false, 800000000, OMAP3630_VDD_MPU_OPP1G_UV),
109 };
111 +
112 +/**
113 + * omap3_opp_enable_720Mhz() - Enable the OPP corresponding to 720MHz
114 + *
115 + * This function would be executed only if the silicon is capable of
116 + * running at the 720MHz.
117 + */
118 +static int __init omap3_opp_enable_720Mhz(void)
119 +{
120 + int r = -ENODEV;
121 + struct omap_hwmod *oh_mpu = omap_hwmod_lookup("mpu");
122 + struct omap_hwmod *oh_iva;
123 + struct platform_device *pdev;
124 +
125 + if (!oh_mpu || !oh_mpu->od) {
126 + goto err;
127 + } else {
128 + pdev = &oh_mpu->od->pdev;
129 +
130 + r = opp_enable(&pdev->dev, 720000000);
131 + if (r < 0) {
132 + dev_err(&pdev->dev,
133 + "opp_enable() failed for mpu@720MHz");
134 + goto err;
135 + }
136 + }
137 +
138 + if (omap3_has_iva()) {
139 + oh_iva = omap_hwmod_lookup("iva");
140 +
141 + if (!oh_iva || !oh_iva->od) {
142 + r = -ENODEV;
143 + goto err;
144 + } else {
145 + pdev = &oh_iva->od->pdev;
146 +
147 + r = opp_enable(&pdev->dev, 520000000);
148 + if (r < 0) {
149 + dev_err(&pdev->dev,
150 + "opp_enable() failed for iva@520MHz");
151 + goto err;
152 + }
153 + }
154 + }
155 +
156 + dev_info(&pdev->dev, "Enabled OPP corresponding to 720MHz\n");
157 +
158 +err:
159 + return r;
160 +}
161 +
162 /**
163 * omap3_opp_init() - initialize omap3 opp table
164 */
165 @@ -163,10 +220,14 @@ int __init omap3_opp_init(void)
166 if (cpu_is_omap3630())
167 r = omap_init_opp_table(omap36xx_opp_def_list,
168 ARRAY_SIZE(omap36xx_opp_def_list));
169 - else
170 + else {
171 r = omap_init_opp_table(omap34xx_opp_def_list,
172 ARRAY_SIZE(omap34xx_opp_def_list));
174 + if (omap3_has_720mhz())
175 + r = omap3_opp_enable_720Mhz();
176 + }
177 +
178 return r;
179 }
180 device_initcall(omap3_opp_init);
181 diff --git a/arch/arm/plat-omap/include/plat/cpu.h b/arch/arm/plat-omap/include/plat/cpu.h
182 index 8198bb6..5204c1e 100644
183 --- a/arch/arm/plat-omap/include/plat/cpu.h
184 +++ b/arch/arm/plat-omap/include/plat/cpu.h
185 @@ -478,6 +478,7 @@ extern u32 omap3_features;
186 #define OMAP3_HAS_192MHZ_CLK BIT(5)
187 #define OMAP3_HAS_IO_WAKEUP BIT(6)
188 #define OMAP3_HAS_SDRC BIT(7)
189 +#define OMAP3_HAS_720MHZ BIT(8)
191 #define OMAP3_HAS_FEATURE(feat,flag) \
192 static inline unsigned int omap3_has_ ##feat(void) \
193 @@ -493,5 +494,6 @@ OMAP3_HAS_FEATURE(isp, ISP)
194 OMAP3_HAS_FEATURE(192mhz_clk, 192MHZ_CLK)
195 OMAP3_HAS_FEATURE(io_wakeup, IO_WAKEUP)
196 OMAP3_HAS_FEATURE(sdrc, SDRC)
197 +OMAP3_HAS_FEATURE(720mhz, 720MHZ)
199 #endif
200 --
201 1.7.2.5