aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-imx/mach-imx6q.c
diff options
context:
space:
mode:
authorAnson Huang <b20788@freescale.com>2014-02-12 04:57:03 -0500
committerShawn Guo <shawn.guo@linaro.org>2014-03-04 21:35:22 -0500
commitc962a0996335fae7f79e64677f47d4784b86f692 (patch)
tree350dd1ec2dd2322b22b08a348d07700c36168bf4 /arch/arm/mach-imx/mach-imx6q.c
parent6e6cdf66563086cb0d2071a4c8ecad7b236ce3ec (diff)
ARM: imx: add speed grading check for i.mx6 soc
The fuse map of speed_grading[1:0] defines the max speed of ARM, see below the definition: 2b'11: 1200000000Hz; 2b'10: 996000000Hz; 2b'01: 852000000Hz; -- i.MX6Q Only, exclusive with 996MHz. 2b'00: 792000000Hz; Need to remove all illegal setpoints according to fuse map. Signed-off-by: Anson Huang <b20788@freescale.com> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Diffstat (limited to 'arch/arm/mach-imx/mach-imx6q.c')
-rw-r--r--arch/arm/mach-imx/mach-imx6q.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index d131499be5d3..1e126853847c 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -253,8 +253,10 @@ static void __init imx6q_init_machine(void)
253#define OCOTP_CFG3 0x440 253#define OCOTP_CFG3 0x440
254#define OCOTP_CFG3_SPEED_SHIFT 16 254#define OCOTP_CFG3_SPEED_SHIFT 16
255#define OCOTP_CFG3_SPEED_1P2GHZ 0x3 255#define OCOTP_CFG3_SPEED_1P2GHZ 0x3
256#define OCOTP_CFG3_SPEED_996MHZ 0x2
257#define OCOTP_CFG3_SPEED_852MHZ 0x1
256 258
257static void __init imx6q_opp_check_1p2ghz(struct device *cpu_dev) 259static void __init imx6q_opp_check_speed_grading(struct device *cpu_dev)
258{ 260{
259 struct device_node *np; 261 struct device_node *np;
260 void __iomem *base; 262 void __iomem *base;
@@ -272,11 +274,29 @@ static void __init imx6q_opp_check_1p2ghz(struct device *cpu_dev)
272 goto put_node; 274 goto put_node;
273 } 275 }
274 276
277 /*
278 * SPEED_GRADING[1:0] defines the max speed of ARM:
279 * 2b'11: 1200000000Hz;
280 * 2b'10: 996000000Hz;
281 * 2b'01: 852000000Hz; -- i.MX6Q Only, exclusive with 996MHz.
282 * 2b'00: 792000000Hz;
283 * We need to set the max speed of ARM according to fuse map.
284 */
275 val = readl_relaxed(base + OCOTP_CFG3); 285 val = readl_relaxed(base + OCOTP_CFG3);
276 val >>= OCOTP_CFG3_SPEED_SHIFT; 286 val >>= OCOTP_CFG3_SPEED_SHIFT;
277 if ((val & 0x3) != OCOTP_CFG3_SPEED_1P2GHZ) 287 val &= 0x3;
288
289 if (val != OCOTP_CFG3_SPEED_1P2GHZ)
278 if (dev_pm_opp_disable(cpu_dev, 1200000000)) 290 if (dev_pm_opp_disable(cpu_dev, 1200000000))
279 pr_warn("failed to disable 1.2 GHz OPP\n"); 291 pr_warn("failed to disable 1.2 GHz OPP\n");
292 if (val < OCOTP_CFG3_SPEED_996MHZ)
293 if (dev_pm_opp_disable(cpu_dev, 996000000))
294 pr_warn("failed to disable 996 MHz OPP\n");
295 if (cpu_is_imx6q()) {
296 if (val != OCOTP_CFG3_SPEED_852MHZ)
297 if (dev_pm_opp_disable(cpu_dev, 852000000))
298 pr_warn("failed to disable 852 MHz OPP\n");
299 }
280 300
281put_node: 301put_node:
282 of_node_put(np); 302 of_node_put(np);
@@ -302,7 +322,7 @@ static void __init imx6q_opp_init(void)
302 goto put_node; 322 goto put_node;
303 } 323 }
304 324
305 imx6q_opp_check_1p2ghz(cpu_dev); 325 imx6q_opp_check_speed_grading(cpu_dev);
306 326
307put_node: 327put_node:
308 of_node_put(np); 328 of_node_put(np);