blob: 51f6c51ca8783ed6fbac57cf7ca92723c89b8109 [file] [log] [blame]
Sascha Hauer198016e2009-02-06 15:38:22 +01001
2#include <linux/module.h>
Fabio Estevambb07d752012-02-29 10:28:08 -03003#include <linux/io.h>
Shawn Guo50f2de62012-09-14 14:14:45 +08004
5#include "hardware.h"
Fabio Estevame7feaaa2013-03-25 09:20:28 -03006#include "common.h"
Sascha Hauer198016e2009-02-06 15:38:22 +01007
8unsigned int __mxc_cpu_type;
9EXPORT_SYMBOL(__mxc_cpu_type);
10
Shawn Guobfefdff2013-08-13 13:54:02 +080011static unsigned int imx_soc_revision;
12
Sascha Hauer198016e2009-02-06 15:38:22 +010013void mxc_set_cpu_type(unsigned int type)
14{
15 __mxc_cpu_type = type;
16}
17
Shawn Guobfefdff2013-08-13 13:54:02 +080018void imx_set_soc_revision(unsigned int rev)
19{
20 imx_soc_revision = rev;
21}
22
23unsigned int imx_get_soc_revision(void)
24{
25 return imx_soc_revision;
26}
27
Fabio Estevam059e58f2011-08-26 13:35:18 +080028void imx_print_silicon_rev(const char *cpu, int srev)
29{
30 if (srev == IMX_CHIP_REVISION_UNKNOWN)
31 pr_info("CPU identified as %s, unknown revision\n", cpu);
32 else
33 pr_info("CPU identified as %s, silicon rev %d.%d\n",
34 cpu, (srev >> 4) & 0xf, srev & 0xf);
35}
Fabio Estevambb07d752012-02-29 10:28:08 -030036
37void __init imx_set_aips(void __iomem *base)
38{
39 unsigned int reg;
40/*
41 * Set all MPROTx to be non-bufferable, trusted for R/W,
42 * not forced to user-mode.
43 */
44 __raw_writel(0x77777777, base + 0x0);
45 __raw_writel(0x77777777, base + 0x4);
46
47/*
48 * Set all OPACRx to be non-bufferable, to not require
49 * supervisor privilege level for access, allow for
50 * write access and untrusted master access.
51 */
52 __raw_writel(0x0, base + 0x40);
53 __raw_writel(0x0, base + 0x44);
54 __raw_writel(0x0, base + 0x48);
55 __raw_writel(0x0, base + 0x4C);
56 reg = __raw_readl(base + 0x50) & 0x00FFFFFF;
57 __raw_writel(reg, base + 0x50);
58}