2 * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #include <linux/types.h>
20 #include <linux/kernel.h>
21 #include <linux/init.h>
22 #include <linux/clk.h>
23 #include <linux/module.h>
24 #include <linux/iram_alloc.h>
25 #include <mach/hardware.h>
30 struct cpu_op *(*get_cpu_op)(int *op);
32 int mx6_set_cpu_voltage(u32 cpu_volt)
36 val = (cpu_volt - 725000) / 25000;
38 reg = __raw_readl(ANADIG_REG_CORE);
39 reg &= ~(ANADIG_REG_TARGET_MASK << ANADIG_REG0_CORE_TARGET_OFFSET);
40 reg |= ((val + 1) << ANADIG_REG0_CORE_TARGET_OFFSET);
42 __raw_writel(reg, ANADIG_REG_CORE);
47 static int __init post_cpu_init(void)
52 iram_init(MX6Q_IRAM_BASE_ADDR, MX6Q_IRAM_SIZE);
54 base = ioremap(AIPS1_ON_BASE_ADDR, PAGE_SIZE);
55 __raw_writel(0x0, base + 0x40);
56 __raw_writel(0x0, base + 0x44);
57 __raw_writel(0x0, base + 0x48);
58 __raw_writel(0x0, base + 0x4C);
59 reg = __raw_readl(base + 0x50) & 0x00FFFFFF;
60 __raw_writel(reg, base + 0x50);
63 base = ioremap(AIPS2_ON_BASE_ADDR, PAGE_SIZE);
64 __raw_writel(0x0, base + 0x40);
65 __raw_writel(0x0, base + 0x44);
66 __raw_writel(0x0, base + 0x48);
67 __raw_writel(0x0, base + 0x4C);
68 reg = __raw_readl(base + 0x50) & 0x00FFFFFF;
69 __raw_writel(reg, base + 0x50);
75 postcore_initcall(post_cpu_init);