rk312x, rk3036: add mutex when detach iommu device. rk32 and later, clean vpu cache...
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-rockchip / cpu.c
1 #include <linux/kernel.h>
2 #include <linux/cpu.h>
3 #include <linux/rockchip/cpu.h>
4
5 unsigned long rockchip_soc_id;
6 EXPORT_SYMBOL(rockchip_soc_id);
7
8 static ssize_t type_show(struct device *dev, struct device_attribute *attr, char *buf)
9 {
10         const char *type;
11
12         if (cpu_is_rk3288())
13                 type = "rk3288";
14         else if (cpu_is_rk319x())
15                 type = "rk319x";
16         else if (cpu_is_rk3188())
17                 type = "rk3188";
18         else if (cpu_is_rk3066b())
19                 type = "rk3066b";
20         else if (cpu_is_rk3026())
21                 type = "rk3026";
22         else if (cpu_is_rk30xx())
23                 type = "rk30xx";
24         else if (cpu_is_rk2928())
25                 type = "rk2928";
26         else if (cpu_is_rk312x())
27                 type = "rk312x";
28         else
29                 type = "";
30
31         return sprintf(buf, "%s\n", type);
32 }
33
34 static struct device_attribute type_attr = __ATTR_RO(type);
35
36 static ssize_t soc_show(struct device *dev, struct device_attribute *attr, char *buf)
37 {
38         const char *soc;
39
40         if (soc_is_rk3288())
41                 soc = "rk3288";
42         else if (soc_is_rk3190())
43                 soc = "rk3190";
44         else if (soc_is_rk3188plus())
45                 soc = "rk3188+";
46         else if (soc_is_rk3188())
47                 soc = "rk3188";
48         else if (soc_is_rk3168())
49                 soc = "rk3168";
50         else if (soc_is_rk3028())
51                 soc = "rk3028";
52         else if (soc_is_rk3066b())
53                 soc = "rk3066b";
54         else if (soc_is_rk3028a())
55                 soc = "rk3028a";
56         else if (soc_is_rk3026())
57                 soc = "rk3026";
58         else if (soc_is_rk2928g())
59                 soc = "rk2928g";
60         else if (soc_is_rk2928l())
61                 soc = "rk2928l";
62         else if (soc_is_rk2926())
63                 soc = "rk2926";
64         else if (soc_is_rk3066())
65                 soc = "rk3066";
66         else if (soc_is_rk3068())
67                 soc = "rk3068";
68         else if (soc_is_rk3000())
69                 soc = "rk3000";
70         else if (soc_is_rk3126())
71                 soc = "rk3126";
72         else if (soc_is_rk3128())
73                 soc = "rk3128";
74         else
75                 soc = "";
76
77         return sprintf(buf, "%s\n", soc);
78 }
79
80 static struct device_attribute soc_attr = __ATTR_RO(soc);
81
82 static int __init rockchip_cpu_lateinit(void)
83 {
84         int err;
85
86         err = device_create_file(cpu_subsys.dev_root, &type_attr);
87         err = device_create_file(cpu_subsys.dev_root, &soc_attr);
88
89         return err;
90 }
91 late_initcall(rockchip_cpu_lateinit);