diff options
author | Alexander Shiyan <shc_work@mail.ru> | 2014-08-19 08:31:15 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2014-09-04 15:40:43 -0400 |
commit | e4e3a37d3316332e02e06188dccf4401611e07b9 (patch) | |
tree | fe9093e794ced5ac1c2b853dc8840a1ed04c5584 /arch/arm/mach-clps711x | |
parent | e917ba44f8775e476079f2c163985eb9f49703e8 (diff) |
ARM: clps711x: Add SOC BUS support
Add SOC BUS support with CPU family, machine name and unique ID.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/arm/mach-clps711x')
-rw-r--r-- | arch/arm/mach-clps711x/devices.c | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/arch/arm/mach-clps711x/devices.c b/arch/arm/mach-clps711x/devices.c index 0c689d3a6710..77a9617c216d 100644 --- a/arch/arm/mach-clps711x/devices.c +++ b/arch/arm/mach-clps711x/devices.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * CLPS711X common devices definitions | 2 | * CLPS711X common devices definitions |
3 | * | 3 | * |
4 | * Author: Alexander Shiyan <shc_work@mail.ru>, 2013 | 4 | * Author: Alexander Shiyan <shc_work@mail.ru>, 2013-2014 |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
@@ -9,8 +9,15 @@ | |||
9 | * (at your option) any later version. | 9 | * (at your option) any later version. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/io.h> | ||
13 | #include <linux/of_fdt.h> | ||
12 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
15 | #include <linux/random.h> | ||
13 | #include <linux/sizes.h> | 16 | #include <linux/sizes.h> |
17 | #include <linux/slab.h> | ||
18 | #include <linux/sys_soc.h> | ||
19 | |||
20 | #include <asm/system_info.h> | ||
14 | 21 | ||
15 | #include <mach/hardware.h> | 22 | #include <mach/hardware.h> |
16 | 23 | ||
@@ -90,10 +97,53 @@ static void __init clps711x_add_uart(void) | |||
90 | ARRAY_SIZE(clps711x_uart2_res)); | 97 | ARRAY_SIZE(clps711x_uart2_res)); |
91 | }; | 98 | }; |
92 | 99 | ||
100 | static void __init clps711x_soc_init(void) | ||
101 | { | ||
102 | struct soc_device_attribute *soc_dev_attr; | ||
103 | struct soc_device *soc_dev; | ||
104 | void __iomem *base; | ||
105 | u32 id[5]; | ||
106 | |||
107 | base = ioremap(CLPS711X_PHYS_BASE, SZ_32K); | ||
108 | if (!base) | ||
109 | return; | ||
110 | |||
111 | id[0] = readl(base + UNIQID); | ||
112 | id[1] = readl(base + RANDID0); | ||
113 | id[2] = readl(base + RANDID1); | ||
114 | id[3] = readl(base + RANDID2); | ||
115 | id[4] = readl(base + RANDID3); | ||
116 | system_rev = SYSFLG1_VERID(readl(base + SYSFLG1)); | ||
117 | |||
118 | add_device_randomness(id, sizeof(id)); | ||
119 | |||
120 | system_serial_low = id[0]; | ||
121 | |||
122 | soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); | ||
123 | if (!soc_dev_attr) | ||
124 | goto out_unmap; | ||
125 | |||
126 | soc_dev_attr->machine = of_flat_dt_get_machine_name(); | ||
127 | soc_dev_attr->family = "Cirrus Logic CLPS711X"; | ||
128 | soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%u", system_rev); | ||
129 | soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "%08x", id[0]); | ||
130 | |||
131 | soc_dev = soc_device_register(soc_dev_attr); | ||
132 | if (IS_ERR(soc_dev)) { | ||
133 | kfree(soc_dev_attr->revision); | ||
134 | kfree(soc_dev_attr->soc_id); | ||
135 | kfree(soc_dev_attr); | ||
136 | } | ||
137 | |||
138 | out_unmap: | ||
139 | iounmap(base); | ||
140 | } | ||
141 | |||
93 | void __init clps711x_devices_init(void) | 142 | void __init clps711x_devices_init(void) |
94 | { | 143 | { |
95 | clps711x_add_cpuidle(); | 144 | clps711x_add_cpuidle(); |
96 | clps711x_add_gpio(); | 145 | clps711x_add_gpio(); |
97 | clps711x_add_syscon(); | 146 | clps711x_add_syscon(); |
98 | clps711x_add_uart(); | 147 | clps711x_add_uart(); |
148 | clps711x_soc_init(); | ||
99 | } | 149 | } |