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 EXPORT_SYMBOL(__mxc_cpu_type);
15 static unsigned int imx_soc_revision;
17 void mxc_set_cpu_type(unsigned int type)
19 __mxc_cpu_type = type;
22 void imx_set_soc_revision(unsigned int rev)
24 imx_soc_revision = rev;
27 unsigned int imx_get_soc_revision(void)
29 return imx_soc_revision;
32 void imx_print_silicon_rev(const char *cpu, int srev)
34 if (srev == IMX_CHIP_REVISION_UNKNOWN)
35 pr_info("CPU identified as %s, unknown revision\n", cpu);
37 pr_info("CPU identified as %s, silicon rev %d.%d\n",
38 cpu, (srev >> 4) & 0xf, srev & 0xf);
41 void __init imx_set_aips(void __iomem *base)
45 * Set all MPROTx to be non-bufferable, trusted for R/W,
46 * not forced to user-mode.
48 __raw_writel(0x77777777, base + 0x0);
49 __raw_writel(0x77777777, base + 0x4);
52 * Set all OPACRx to be non-bufferable, to not require
53 * supervisor privilege level for access, allow for
54 * write access and untrusted master access.
56 __raw_writel(0x0, base + 0x40);
57 __raw_writel(0x0, base + 0x44);
58 __raw_writel(0x0, base + 0x48);
59 __raw_writel(0x0, base + 0x4C);
60 reg = __raw_readl(base + 0x50) & 0x00FFFFFF;
61 __raw_writel(reg, base + 0x50);
64 void __init imx_aips_allow_unprivileged_access(
67 void __iomem *aips_base_addr;
68 struct device_node *np;
70 for_each_compatible_node(np, NULL, compat) {
71 aips_base_addr = of_iomap(np, 0);
72 imx_set_aips(aips_base_addr);
76 struct device * __init imx_soc_device_init(void)
78 struct soc_device_attribute *soc_dev_attr;
79 struct soc_device *soc_dev;
80 struct device_node *root;
84 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
88 soc_dev_attr->family = "Freescale i.MX";
90 root = of_find_node_by_path("/");
91 ret = of_property_read_string(root, "model", &soc_dev_attr->machine);
96 switch (__mxc_cpu_type) {
136 soc_dev_attr->soc_id = soc_id;
138 soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%d.%d",
139 (imx_soc_revision >> 4) & 0xf,
140 imx_soc_revision & 0xf);
141 if (!soc_dev_attr->revision)
144 soc_dev = soc_device_register(soc_dev_attr);
148 return soc_device_to_device(soc_dev);
151 kfree(soc_dev_attr->revision);