blob: 62540ffc581a4a602724e36b60848ce40f906227 [file] [log] [blame]
Kuninori Morimoto41c45672018-09-07 02:04:19 +00001// SPDX-License-Identifier: GPL-2.0
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +01002/*
3 * Renesas SoC Identification
4 *
5 * Copyright (C) 2014-2016 Glider bvba
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +01006 */
7
8#include <linux/io.h>
9#include <linux/of.h>
10#include <linux/of_address.h>
11#include <linux/slab.h>
12#include <linux/string.h>
13#include <linux/sys_soc.h>
14
15
16struct renesas_family {
17 const char name[16];
18 u32 reg; /* CCCR or PRR, if not in DT */
19};
20
21static const struct renesas_family fam_rcar_gen1 __initconst __maybe_unused = {
22 .name = "R-Car Gen1",
23 .reg = 0xff000044, /* PRR (Product Register) */
24};
25
26static const struct renesas_family fam_rcar_gen2 __initconst __maybe_unused = {
27 .name = "R-Car Gen2",
28 .reg = 0xff000044, /* PRR (Product Register) */
29};
30
31static const struct renesas_family fam_rcar_gen3 __initconst __maybe_unused = {
32 .name = "R-Car Gen3",
33 .reg = 0xfff00044, /* PRR (Product Register) */
34};
35
Yoshihiro Shimoda97116332021-12-01 16:33:01 +090036static const struct renesas_family fam_rcar_gen4 __initconst __maybe_unused = {
37 .name = "R-Car Gen4",
38};
39
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +010040static const struct renesas_family fam_rmobile __initconst __maybe_unused = {
41 .name = "R-Mobile",
42 .reg = 0xe600101c, /* CCCR (Common Chip Code Register) */
43};
44
Chris Brandt175f4352018-07-27 11:53:32 -050045static const struct renesas_family fam_rza1 __initconst __maybe_unused = {
46 .name = "RZ/A1",
47};
48
49static const struct renesas_family fam_rza2 __initconst __maybe_unused = {
50 .name = "RZ/A2",
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +010051};
52
Biju Das2a4056a72018-07-24 16:47:18 +010053static const struct renesas_family fam_rzg1 __initconst __maybe_unused = {
54 .name = "RZ/G1",
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +010055 .reg = 0xff000044, /* PRR (Product Register) */
56};
57
Biju Das2a4056a72018-07-24 16:47:18 +010058static const struct renesas_family fam_rzg2 __initconst __maybe_unused = {
59 .name = "RZ/G2",
60 .reg = 0xfff00044, /* PRR (Product Register) */
61};
62
Lad Prabhakar187cd572021-06-09 17:37:16 +010063static const struct renesas_family fam_rzg2l __initconst __maybe_unused = {
64 .name = "RZ/G2L",
65};
66
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +010067static const struct renesas_family fam_shmobile __initconst __maybe_unused = {
68 .name = "SH-Mobile",
69 .reg = 0xe600101c, /* CCCR (Common Chip Code Register) */
70};
71
72
73struct renesas_soc {
74 const struct renesas_family *family;
Lad Prabhakar187cd572021-06-09 17:37:16 +010075 u32 id;
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +010076};
77
78static const struct renesas_soc soc_rz_a1h __initconst __maybe_unused = {
Chris Brandt175f4352018-07-27 11:53:32 -050079 .family = &fam_rza1,
80};
81
82static const struct renesas_soc soc_rz_a2m __initconst __maybe_unused = {
83 .family = &fam_rza2,
84 .id = 0x3b,
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +010085};
86
87static const struct renesas_soc soc_rmobile_ape6 __initconst __maybe_unused = {
88 .family = &fam_rmobile,
89 .id = 0x3f,
90};
91
92static const struct renesas_soc soc_rmobile_a1 __initconst __maybe_unused = {
93 .family = &fam_rmobile,
94 .id = 0x40,
95};
96
Geert Uytterhoeven8848e1b2017-03-10 14:48:29 +010097static const struct renesas_soc soc_rz_g1h __initconst __maybe_unused = {
Biju Das2a4056a72018-07-24 16:47:18 +010098 .family = &fam_rzg1,
Geert Uytterhoeven8848e1b2017-03-10 14:48:29 +010099 .id = 0x45,
100};
101
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +0100102static const struct renesas_soc soc_rz_g1m __initconst __maybe_unused = {
Biju Das2a4056a72018-07-24 16:47:18 +0100103 .family = &fam_rzg1,
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +0100104 .id = 0x47,
105};
106
Geert Uytterhoevencd59de82017-03-10 14:48:30 +0100107static const struct renesas_soc soc_rz_g1n __initconst __maybe_unused = {
Biju Das2a4056a72018-07-24 16:47:18 +0100108 .family = &fam_rzg1,
Geert Uytterhoevencd59de82017-03-10 14:48:30 +0100109 .id = 0x4b,
110};
111
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +0100112static const struct renesas_soc soc_rz_g1e __initconst __maybe_unused = {
Biju Das2a4056a72018-07-24 16:47:18 +0100113 .family = &fam_rzg1,
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +0100114 .id = 0x4c,
115};
116
Biju Das1daf13b2018-03-27 15:37:13 +0100117static const struct renesas_soc soc_rz_g1c __initconst __maybe_unused = {
Biju Das2a4056a72018-07-24 16:47:18 +0100118 .family = &fam_rzg1,
Biju Das1daf13b2018-03-27 15:37:13 +0100119 .id = 0x53,
120};
121
Biju Das2a4056a72018-07-24 16:47:18 +0100122static const struct renesas_soc soc_rz_g2m __initconst __maybe_unused = {
123 .family = &fam_rzg2,
124 .id = 0x52,
125};
126
Biju Das574cb722019-09-05 10:30:42 +0100127static const struct renesas_soc soc_rz_g2n __initconst __maybe_unused = {
128 .family = &fam_rzg2,
129 .id = 0x55,
130};
131
Fabrizio Castro2bab3d82018-09-10 12:53:50 +0100132static const struct renesas_soc soc_rz_g2e __initconst __maybe_unused = {
133 .family = &fam_rzg2,
134 .id = 0x57,
135};
136
Marian-Cristian Rotariu5b83cc42020-07-07 17:18:01 +0100137static const struct renesas_soc soc_rz_g2h __initconst __maybe_unused = {
138 .family = &fam_rzg2,
139 .id = 0x4f,
140};
141
Lad Prabhakar187cd572021-06-09 17:37:16 +0100142static const struct renesas_soc soc_rz_g2l __initconst __maybe_unused = {
143 .family = &fam_rzg2l,
144 .id = 0x841c447,
145};
146
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +0100147static const struct renesas_soc soc_rcar_m1a __initconst __maybe_unused = {
148 .family = &fam_rcar_gen1,
149};
150
151static const struct renesas_soc soc_rcar_h1 __initconst __maybe_unused = {
152 .family = &fam_rcar_gen1,
153 .id = 0x3b,
154};
155
156static const struct renesas_soc soc_rcar_h2 __initconst __maybe_unused = {
157 .family = &fam_rcar_gen2,
158 .id = 0x45,
159};
160
161static const struct renesas_soc soc_rcar_m2_w __initconst __maybe_unused = {
162 .family = &fam_rcar_gen2,
163 .id = 0x47,
164};
165
166static const struct renesas_soc soc_rcar_v2h __initconst __maybe_unused = {
167 .family = &fam_rcar_gen2,
168 .id = 0x4a,
169};
170
171static const struct renesas_soc soc_rcar_m2_n __initconst __maybe_unused = {
172 .family = &fam_rcar_gen2,
173 .id = 0x4b,
174};
175
176static const struct renesas_soc soc_rcar_e2 __initconst __maybe_unused = {
177 .family = &fam_rcar_gen2,
178 .id = 0x4c,
179};
180
181static const struct renesas_soc soc_rcar_h3 __initconst __maybe_unused = {
182 .family = &fam_rcar_gen3,
183 .id = 0x4f,
184};
185
186static const struct renesas_soc soc_rcar_m3_w __initconst __maybe_unused = {
187 .family = &fam_rcar_gen3,
188 .id = 0x52,
189};
190
Jacopo Mondibfd83982018-02-20 16:12:05 +0100191static const struct renesas_soc soc_rcar_m3_n __initconst __maybe_unused = {
192 .family = &fam_rcar_gen3,
193 .id = 0x55,
194};
195
Sergei Shtylyovbb0030752017-09-12 23:37:17 +0300196static const struct renesas_soc soc_rcar_v3m __initconst __maybe_unused = {
197 .family = &fam_rcar_gen3,
198 .id = 0x54,
199};
200
Sergei Shtylyov84477562018-02-02 21:22:14 +0300201static const struct renesas_soc soc_rcar_v3h __initconst __maybe_unused = {
202 .family = &fam_rcar_gen3,
203 .id = 0x56,
204};
205
Takeshi Kihara44842d42018-04-11 18:36:23 +0900206static const struct renesas_soc soc_rcar_e3 __initconst __maybe_unused = {
207 .family = &fam_rcar_gen3,
208 .id = 0x57,
209};
210
Geert Uytterhoeven1b954782017-07-20 14:34:51 +0200211static const struct renesas_soc soc_rcar_d3 __initconst __maybe_unused = {
212 .family = &fam_rcar_gen3,
213 .id = 0x58,
214};
215
Yoshihiro Shimoda090e87e2020-09-07 18:19:45 +0900216static const struct renesas_soc soc_rcar_v3u __initconst __maybe_unused = {
217 .family = &fam_rcar_gen3,
218 .id = 0x59,
219};
220
Yoshihiro Shimoda97116332021-12-01 16:33:01 +0900221static const struct renesas_soc soc_rcar_s4 __initconst __maybe_unused = {
222 .family = &fam_rcar_gen4,
223 .id = 0x5a,
224};
225
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +0100226static const struct renesas_soc soc_shmobile_ag5 __initconst __maybe_unused = {
227 .family = &fam_shmobile,
228 .id = 0x37,
229};
230
231
232static const struct of_device_id renesas_socs[] __initconst = {
233#ifdef CONFIG_ARCH_R7S72100
234 { .compatible = "renesas,r7s72100", .data = &soc_rz_a1h },
235#endif
Chris Brandt175f4352018-07-27 11:53:32 -0500236#ifdef CONFIG_ARCH_R7S9210
237 { .compatible = "renesas,r7s9210", .data = &soc_rz_a2m },
238#endif
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +0100239#ifdef CONFIG_ARCH_R8A73A4
240 { .compatible = "renesas,r8a73a4", .data = &soc_rmobile_ape6 },
241#endif
242#ifdef CONFIG_ARCH_R8A7740
243 { .compatible = "renesas,r8a7740", .data = &soc_rmobile_a1 },
244#endif
Geert Uytterhoeven8848e1b2017-03-10 14:48:29 +0100245#ifdef CONFIG_ARCH_R8A7742
246 { .compatible = "renesas,r8a7742", .data = &soc_rz_g1h },
247#endif
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +0100248#ifdef CONFIG_ARCH_R8A7743
249 { .compatible = "renesas,r8a7743", .data = &soc_rz_g1m },
250#endif
Geert Uytterhoevencd59de82017-03-10 14:48:30 +0100251#ifdef CONFIG_ARCH_R8A7744
252 { .compatible = "renesas,r8a7744", .data = &soc_rz_g1n },
253#endif
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +0100254#ifdef CONFIG_ARCH_R8A7745
255 { .compatible = "renesas,r8a7745", .data = &soc_rz_g1e },
256#endif
Biju Das1daf13b2018-03-27 15:37:13 +0100257#ifdef CONFIG_ARCH_R8A77470
258 { .compatible = "renesas,r8a77470", .data = &soc_rz_g1c },
259#endif
Biju Das2a4056a72018-07-24 16:47:18 +0100260#ifdef CONFIG_ARCH_R8A774A1
261 { .compatible = "renesas,r8a774a1", .data = &soc_rz_g2m },
262#endif
Biju Das574cb722019-09-05 10:30:42 +0100263#ifdef CONFIG_ARCH_R8A774B1
264 { .compatible = "renesas,r8a774b1", .data = &soc_rz_g2n },
265#endif
Fabrizio Castro2bab3d82018-09-10 12:53:50 +0100266#ifdef CONFIG_ARCH_R8A774C0
267 { .compatible = "renesas,r8a774c0", .data = &soc_rz_g2e },
268#endif
Marian-Cristian Rotariu5b83cc42020-07-07 17:18:01 +0100269#ifdef CONFIG_ARCH_R8A774E1
270 { .compatible = "renesas,r8a774e1", .data = &soc_rz_g2h },
271#endif
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +0100272#ifdef CONFIG_ARCH_R8A7778
273 { .compatible = "renesas,r8a7778", .data = &soc_rcar_m1a },
274#endif
275#ifdef CONFIG_ARCH_R8A7779
276 { .compatible = "renesas,r8a7779", .data = &soc_rcar_h1 },
277#endif
278#ifdef CONFIG_ARCH_R8A7790
279 { .compatible = "renesas,r8a7790", .data = &soc_rcar_h2 },
280#endif
281#ifdef CONFIG_ARCH_R8A7791
282 { .compatible = "renesas,r8a7791", .data = &soc_rcar_m2_w },
283#endif
284#ifdef CONFIG_ARCH_R8A7792
285 { .compatible = "renesas,r8a7792", .data = &soc_rcar_v2h },
286#endif
287#ifdef CONFIG_ARCH_R8A7793
288 { .compatible = "renesas,r8a7793", .data = &soc_rcar_m2_n },
289#endif
290#ifdef CONFIG_ARCH_R8A7794
291 { .compatible = "renesas,r8a7794", .data = &soc_rcar_e2 },
292#endif
Geert Uytterhoeven4ff27112020-02-18 12:24:49 +0100293#if defined(CONFIG_ARCH_R8A77950) || defined(CONFIG_ARCH_R8A77951)
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +0100294 { .compatible = "renesas,r8a7795", .data = &soc_rcar_h3 },
295#endif
Geert Uytterhoevenbfe6b552021-07-19 17:38:33 +0200296#ifdef CONFIG_ARCH_R8A77951
Geert Uytterhoeven2ed1e482021-08-12 13:23:52 +0200297 { .compatible = "renesas,r8a779m0", .data = &soc_rcar_h3 },
Geert Uytterhoevenbfe6b552021-07-19 17:38:33 +0200298 { .compatible = "renesas,r8a779m1", .data = &soc_rcar_h3 },
Geert Uytterhoeven2ed1e482021-08-12 13:23:52 +0200299 { .compatible = "renesas,r8a779m8", .data = &soc_rcar_h3 },
Geert Uytterhoevenbfe6b552021-07-19 17:38:33 +0200300#endif
Geert Uytterhoeven39e57e12019-10-23 14:33:33 +0200301#ifdef CONFIG_ARCH_R8A77960
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +0100302 { .compatible = "renesas,r8a7796", .data = &soc_rcar_m3_w },
303#endif
Geert Uytterhoeven9c9f7892019-10-23 14:33:35 +0200304#ifdef CONFIG_ARCH_R8A77961
305 { .compatible = "renesas,r8a77961", .data = &soc_rcar_m3_w },
Geert Uytterhoeven2ed1e482021-08-12 13:23:52 +0200306 { .compatible = "renesas,r8a779m2", .data = &soc_rcar_m3_w },
Geert Uytterhoevenbfe6b552021-07-19 17:38:33 +0200307 { .compatible = "renesas,r8a779m3", .data = &soc_rcar_m3_w },
Geert Uytterhoeven9c9f7892019-10-23 14:33:35 +0200308#endif
Jacopo Mondibfd83982018-02-20 16:12:05 +0100309#ifdef CONFIG_ARCH_R8A77965
310 { .compatible = "renesas,r8a77965", .data = &soc_rcar_m3_n },
Geert Uytterhoeven2ed1e482021-08-12 13:23:52 +0200311 { .compatible = "renesas,r8a779m4", .data = &soc_rcar_m3_n },
312 { .compatible = "renesas,r8a779m5", .data = &soc_rcar_m3_n },
Jacopo Mondibfd83982018-02-20 16:12:05 +0100313#endif
Sergei Shtylyovbb0030752017-09-12 23:37:17 +0300314#ifdef CONFIG_ARCH_R8A77970
315 { .compatible = "renesas,r8a77970", .data = &soc_rcar_v3m },
316#endif
Sergei Shtylyov84477562018-02-02 21:22:14 +0300317#ifdef CONFIG_ARCH_R8A77980
318 { .compatible = "renesas,r8a77980", .data = &soc_rcar_v3h },
319#endif
Takeshi Kihara44842d42018-04-11 18:36:23 +0900320#ifdef CONFIG_ARCH_R8A77990
321 { .compatible = "renesas,r8a77990", .data = &soc_rcar_e3 },
Geert Uytterhoeven2ed1e482021-08-12 13:23:52 +0200322 { .compatible = "renesas,r8a779m6", .data = &soc_rcar_e3 },
Takeshi Kihara44842d42018-04-11 18:36:23 +0900323#endif
Geert Uytterhoeven1b954782017-07-20 14:34:51 +0200324#ifdef CONFIG_ARCH_R8A77995
325 { .compatible = "renesas,r8a77995", .data = &soc_rcar_d3 },
Geert Uytterhoeven2ed1e482021-08-12 13:23:52 +0200326 { .compatible = "renesas,r8a779m7", .data = &soc_rcar_d3 },
Geert Uytterhoeven1b954782017-07-20 14:34:51 +0200327#endif
Yoshihiro Shimoda090e87e2020-09-07 18:19:45 +0900328#ifdef CONFIG_ARCH_R8A779A0
329 { .compatible = "renesas,r8a779a0", .data = &soc_rcar_v3u },
330#endif
Yoshihiro Shimoda97116332021-12-01 16:33:01 +0900331#ifdef CONFIG_ARCH_R8A779F0
332 { .compatible = "renesas,r8a779f0", .data = &soc_rcar_s4 },
333#endif
Lad Prabhakar187cd572021-06-09 17:37:16 +0100334#if defined(CONFIG_ARCH_R9A07G044)
335 { .compatible = "renesas,r9a07g044", .data = &soc_rz_g2l },
336#endif
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +0100337#ifdef CONFIG_ARCH_SH73A0
338 { .compatible = "renesas,sh73a0", .data = &soc_shmobile_ag5 },
339#endif
340 { /* sentinel */ }
341};
342
Geert Uytterhoeven05b22ca2021-11-10 20:00:52 +0100343struct renesas_id {
344 unsigned int offset;
345 u32 mask;
346};
347
348static const struct renesas_id id_bsid __initconst = {
349 .offset = 0,
350 .mask = 0xff0000,
351 /*
352 * TODO: Upper 4 bits of BSID are for chip version, but the format is
353 * not known at this time so we don't know how to specify eshi and eslo
354 */
355};
356
357static const struct renesas_id id_rzg2l __initconst = {
358 .offset = 0xa04,
359 .mask = 0xfffffff,
360};
361
362static const struct renesas_id id_prr __initconst = {
363 .offset = 0,
364 .mask = 0xff00,
365};
366
367static const struct of_device_id renesas_ids[] __initconst = {
368 { .compatible = "renesas,bsid", .data = &id_bsid },
369 { .compatible = "renesas,r9a07g044-sysc", .data = &id_rzg2l },
370 { .compatible = "renesas,prr", .data = &id_prr },
371 { /* sentinel */ }
372};
373
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +0100374static int __init renesas_soc_init(void)
375{
376 struct soc_device_attribute *soc_dev_attr;
Geert Uytterhoeven05b22ca2021-11-10 20:00:52 +0100377 unsigned int product, eshi = 0, eslo;
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +0100378 const struct renesas_family *family;
379 const struct of_device_id *match;
380 const struct renesas_soc *soc;
Geert Uytterhoeven05b22ca2021-11-10 20:00:52 +0100381 const struct renesas_id *id;
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +0100382 void __iomem *chipid = NULL;
383 struct soc_device *soc_dev;
384 struct device_node *np;
Geert Uytterhoeven05b22ca2021-11-10 20:00:52 +0100385 const char *soc_id;
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +0100386
387 match = of_match_node(renesas_socs, of_root);
388 if (!match)
389 return -ENODEV;
390
Geert Uytterhoeven05b22ca2021-11-10 20:00:52 +0100391 soc_id = strchr(match->compatible, ',') + 1;
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +0100392 soc = match->data;
393 family = soc->family;
394
Geert Uytterhoeven05b22ca2021-11-10 20:00:52 +0100395 np = of_find_matching_node_and_match(NULL, renesas_ids, &match);
Chris Brandt175f4352018-07-27 11:53:32 -0500396 if (np) {
Geert Uytterhoeven05b22ca2021-11-10 20:00:52 +0100397 id = match->data;
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +0100398 chipid = of_iomap(np, 0);
399 of_node_put(np);
Geert Uytterhoeven4194b582019-10-16 16:33:06 +0200400 } else if (soc->id && family->reg) {
Geert Uytterhoeven05b22ca2021-11-10 20:00:52 +0100401 /* Try hardcoded CCCR/PRR fallback */
402 id = &id_prr;
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +0100403 chipid = ioremap(family->reg, 4);
404 }
Geert Uytterhoeven05b22ca2021-11-10 20:00:52 +0100405
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +0100406 if (chipid) {
Geert Uytterhoeven05b22ca2021-11-10 20:00:52 +0100407 product = readl(chipid + id->offset);
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +0100408 iounmap(chipid);
Geert Uytterhoeven05b22ca2021-11-10 20:00:52 +0100409
410 if (id == &id_prr) {
411 /* R-Car M3-W ES1.1 incorrectly identifies as ES2.0 */
412 if ((product & 0x7fff) == 0x5210)
413 product ^= 0x11;
414 /* R-Car M3-W ES1.3 incorrectly identifies as ES2.1 */
415 if ((product & 0x7fff) == 0x5211)
416 product ^= 0x12;
417
418 eshi = ((product >> 4) & 0x0f) + 1;
419 eslo = product & 0xf;
420 }
421
422 if (soc->id &&
423 ((product & id->mask) >> __ffs(id->mask)) != soc->id) {
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +0100424 pr_warn("SoC mismatch (product = 0x%x)\n", product);
425 return -ENODEV;
426 }
427 }
428
429 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
430 if (!soc_dev_attr)
431 return -ENOMEM;
432
433 np = of_find_node_by_path("/");
434 of_property_read_string(np, "model", &soc_dev_attr->machine);
435 of_node_put(np);
436
437 soc_dev_attr->family = kstrdup_const(family->name, GFP_KERNEL);
Geert Uytterhoeven05b22ca2021-11-10 20:00:52 +0100438 soc_dev_attr->soc_id = kstrdup_const(soc_id, GFP_KERNEL);
Chris Brandt175f4352018-07-27 11:53:32 -0500439 if (eshi)
440 soc_dev_attr->revision = kasprintf(GFP_KERNEL, "ES%u.%u", eshi,
441 eslo);
Geert Uytterhoeven8d6799a2016-11-14 19:37:08 +0100442
443 pr_info("Detected Renesas %s %s %s\n", soc_dev_attr->family,
444 soc_dev_attr->soc_id, soc_dev_attr->revision ?: "");
445
446 soc_dev = soc_device_register(soc_dev_attr);
447 if (IS_ERR(soc_dev)) {
448 kfree(soc_dev_attr->revision);
449 kfree_const(soc_dev_attr->soc_id);
450 kfree_const(soc_dev_attr->family);
451 kfree(soc_dev_attr);
452 return PTR_ERR(soc_dev);
453 }
454
455 return 0;
456}
Geert Uytterhoevenb1d134b2017-03-31 11:01:54 +0200457early_initcall(renesas_soc_init);