aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Brandt <chris.brandt@renesas.com>2018-07-27 12:53:32 -0400
committerSimon Horman <horms+renesas@verge.net.au>2018-08-27 09:06:42 -0400
commit175f435f44b724e389f23c154d94fda45870c1f6 (patch)
tree552efa0c3a5ecd50574d555ffb874be5b2af7a8d
parent332df9828e94d4288825584638b7df6ad4c1ff38 (diff)
soc: renesas: identify RZ/A2
Add support for identifying the RZ/A2M (R7S9210) SoC. Also add support for reading the BSID register which is a different format than the PRR. Signed-off-by: Chris Brandt <chris.brandt@renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-rw-r--r--drivers/soc/renesas/renesas-soc.c55
1 files changed, 47 insertions, 8 deletions
diff --git a/drivers/soc/renesas/renesas-soc.c b/drivers/soc/renesas/renesas-soc.c
index 56916183739b..ce19b2732433 100644
--- a/drivers/soc/renesas/renesas-soc.c
+++ b/drivers/soc/renesas/renesas-soc.c
@@ -46,8 +46,12 @@ static const struct renesas_family fam_rmobile __initconst __maybe_unused = {
46 .reg = 0xe600101c, /* CCCR (Common Chip Code Register) */ 46 .reg = 0xe600101c, /* CCCR (Common Chip Code Register) */
47}; 47};
48 48
49static const struct renesas_family fam_rza __initconst __maybe_unused = { 49static const struct renesas_family fam_rza1 __initconst __maybe_unused = {
50 .name = "RZ/A", 50 .name = "RZ/A1",
51};
52
53static const struct renesas_family fam_rza2 __initconst __maybe_unused = {
54 .name = "RZ/A2",
51}; 55};
52 56
53static const struct renesas_family fam_rzg1 __initconst __maybe_unused = { 57static const struct renesas_family fam_rzg1 __initconst __maybe_unused = {
@@ -72,7 +76,12 @@ struct renesas_soc {
72}; 76};
73 77
74static const struct renesas_soc soc_rz_a1h __initconst __maybe_unused = { 78static const struct renesas_soc soc_rz_a1h __initconst __maybe_unused = {
75 .family = &fam_rza, 79 .family = &fam_rza1,
80};
81
82static const struct renesas_soc soc_rz_a2m __initconst __maybe_unused = {
83 .family = &fam_rza2,
84 .id = 0x3b,
76}; 85};
77 86
78static const struct renesas_soc soc_rmobile_ape6 __initconst __maybe_unused = { 87static const struct renesas_soc soc_rmobile_ape6 __initconst __maybe_unused = {
@@ -194,6 +203,9 @@ static const struct of_device_id renesas_socs[] __initconst = {
194#ifdef CONFIG_ARCH_R7S72100 203#ifdef CONFIG_ARCH_R7S72100
195 { .compatible = "renesas,r7s72100", .data = &soc_rz_a1h }, 204 { .compatible = "renesas,r7s72100", .data = &soc_rz_a1h },
196#endif 205#endif
206#ifdef CONFIG_ARCH_R7S9210
207 { .compatible = "renesas,r7s9210", .data = &soc_rz_a2m },
208#endif
197#ifdef CONFIG_ARCH_R8A73A4 209#ifdef CONFIG_ARCH_R8A73A4
198 { .compatible = "renesas,r8a73a4", .data = &soc_rmobile_ape6 }, 210 { .compatible = "renesas,r8a73a4", .data = &soc_rmobile_ape6 },
199#endif 211#endif
@@ -275,7 +287,7 @@ static int __init renesas_soc_init(void)
275 void __iomem *chipid = NULL; 287 void __iomem *chipid = NULL;
276 struct soc_device *soc_dev; 288 struct soc_device *soc_dev;
277 struct device_node *np; 289 struct device_node *np;
278 unsigned int product; 290 unsigned int product, eshi = 0, eslo;
279 291
280 match = of_match_node(renesas_socs, of_root); 292 match = of_match_node(renesas_socs, of_root);
281 if (!match) 293 if (!match)
@@ -284,6 +296,31 @@ static int __init renesas_soc_init(void)
284 soc = match->data; 296 soc = match->data;
285 family = soc->family; 297 family = soc->family;
286 298
299 np = of_find_compatible_node(NULL, NULL, "renesas,bsid");
300 if (np) {
301 chipid = of_iomap(np, 0);
302 of_node_put(np);
303
304 if (chipid) {
305 product = readl(chipid);
306 iounmap(chipid);
307
308 if (soc->id && ((product >> 16) & 0xff) != soc->id) {
309 pr_warn("SoC mismatch (product = 0x%x)\n",
310 product);
311 return -ENODEV;
312 }
313 }
314
315 /*
316 * TODO: Upper 4 bits of BSID are for chip version, but the
317 * format is not known at this time so we don't know how to
318 * specify eshi and eslo
319 */
320
321 goto done;
322 }
323
287 /* Try PRR first, then hardcoded fallback */ 324 /* Try PRR first, then hardcoded fallback */
288 np = of_find_compatible_node(NULL, NULL, "renesas,prr"); 325 np = of_find_compatible_node(NULL, NULL, "renesas,prr");
289 if (np) { 326 if (np) {
@@ -302,8 +339,11 @@ static int __init renesas_soc_init(void)
302 pr_warn("SoC mismatch (product = 0x%x)\n", product); 339 pr_warn("SoC mismatch (product = 0x%x)\n", product);
303 return -ENODEV; 340 return -ENODEV;
304 } 341 }
342 eshi = ((product >> 4) & 0x0f) + 1;
343 eslo = product & 0xf;
305 } 344 }
306 345
346done:
307 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); 347 soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
308 if (!soc_dev_attr) 348 if (!soc_dev_attr)
309 return -ENOMEM; 349 return -ENOMEM;
@@ -315,10 +355,9 @@ static int __init renesas_soc_init(void)
315 soc_dev_attr->family = kstrdup_const(family->name, GFP_KERNEL); 355 soc_dev_attr->family = kstrdup_const(family->name, GFP_KERNEL);
316 soc_dev_attr->soc_id = kstrdup_const(strchr(match->compatible, ',') + 1, 356 soc_dev_attr->soc_id = kstrdup_const(strchr(match->compatible, ',') + 1,
317 GFP_KERNEL); 357 GFP_KERNEL);
318 if (chipid) 358 if (eshi)
319 soc_dev_attr->revision = kasprintf(GFP_KERNEL, "ES%u.%u", 359 soc_dev_attr->revision = kasprintf(GFP_KERNEL, "ES%u.%u", eshi,
320 ((product >> 4) & 0x0f) + 1, 360 eslo);
321 product & 0xf);
322 361
323 pr_info("Detected Renesas %s %s %s\n", soc_dev_attr->family, 362 pr_info("Detected Renesas %s %s %s\n", soc_dev_attr->family,
324 soc_dev_attr->soc_id, soc_dev_attr->revision ?: ""); 363 soc_dev_attr->soc_id, soc_dev_attr->revision ?: "");