2 #include <linux/module.h>
5 #include <linux/of_address.h>
6 #include <linux/slab.h>
7 #include <linux/sys_soc.h>
12 unsigned int __mxc_cpu_type
;
13 static unsigned int imx_soc_revision
;
15 void mxc_set_cpu_type(unsigned int type
)
17 __mxc_cpu_type
= type
;
20 void imx_set_soc_revision(unsigned int rev
)
22 imx_soc_revision
= rev
;
25 unsigned int imx_get_soc_revision(void)
27 return imx_soc_revision
;
30 void imx_print_silicon_rev(const char *cpu
, int srev
)
32 if (srev
== IMX_CHIP_REVISION_UNKNOWN
)
33 pr_info("CPU identified as %s, unknown revision\n", cpu
);
35 pr_info("CPU identified as %s, silicon rev %d.%d\n",
36 cpu
, (srev
>> 4) & 0xf, srev
& 0xf);
39 void __init
imx_set_aips(void __iomem
*base
)
43 * Set all MPROTx to be non-bufferable, trusted for R/W,
44 * not forced to user-mode.
46 imx_writel(0x77777777, base
+ 0x0);
47 imx_writel(0x77777777, base
+ 0x4);
50 * Set all OPACRx to be non-bufferable, to not require
51 * supervisor privilege level for access, allow for
52 * write access and untrusted master access.
54 imx_writel(0x0, base
+ 0x40);
55 imx_writel(0x0, base
+ 0x44);
56 imx_writel(0x0, base
+ 0x48);
57 imx_writel(0x0, base
+ 0x4C);
58 reg
= imx_readl(base
+ 0x50) & 0x00FFFFFF;
59 imx_writel(reg
, base
+ 0x50);
62 void __init
imx_aips_allow_unprivileged_access(
65 void __iomem
*aips_base_addr
;
66 struct device_node
*np
;
68 for_each_compatible_node(np
, NULL
, compat
) {
69 aips_base_addr
= of_iomap(np
, 0);
70 imx_set_aips(aips_base_addr
);
74 struct device
* __init
imx_soc_device_init(void)
76 struct soc_device_attribute
*soc_dev_attr
;
77 struct soc_device
*soc_dev
;
78 struct device_node
*root
;
82 soc_dev_attr
= kzalloc(sizeof(*soc_dev_attr
), GFP_KERNEL
);
86 soc_dev_attr
->family
= "Freescale i.MX";
88 root
= of_find_node_by_path("/");
89 ret
= of_property_read_string(root
, "model", &soc_dev_attr
->machine
);
94 switch (__mxc_cpu_type
) {
134 case MXC_CPU_IMX6ULL
:
143 soc_dev_attr
->soc_id
= soc_id
;
145 soc_dev_attr
->revision
= kasprintf(GFP_KERNEL
, "%d.%d",
146 (imx_soc_revision
>> 4) & 0xf,
147 imx_soc_revision
& 0xf);
148 if (!soc_dev_attr
->revision
)
151 soc_dev
= soc_device_register(soc_dev_attr
);
155 return soc_device_to_device(soc_dev
);
158 kfree(soc_dev_attr
->revision
);