Renesas driver updates for v5.18

- Initial support for the new RZ/V2L SoC,
   - RZ/G2L product revision support.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQQ9qaHoIs/1I4cXmEiKwlD9ZEnxcAUCYgZkdgAKCRCKwlD9ZEnx
 cATlAQC3oVCC+xvW+DYQagLO9ADPd8MNe889+p8Kw77xtGi2aQD9Ev9M0QgSzpBY
 /pXngnUMmHnAWfzzqRKZAUKWW4K17Ao=
 =85Jz
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmIY/gkACgkQmmx57+YA
 GNkB6xAAv08XmMxg7bnN0H5cQp2tkn3LNlyWEVSZuu/x+XNc1RRG8oNnZZiS9Voe
 ZTh5EsFxoseeHkNIQxS+WVxrd2jN30Tz7gGTp2/xnbxas+aVomDzo+H4qtgSWK3N
 P0P1PSXHxwUApszPCPuyyXqNoxUmJjn+6OqqPkxpkqwspQYXc7HgWuB5Syk3JUF4
 ZvOTCCgnKKaFJ2Dp5VzwnSYJd2eeHCV6lk96BkO1WsUdEfYO9dm+e/Ig/utU3yhm
 3QDGGrRADYoKx+TM/c+oNJoNcQ4R7JbzzUtY48MQEvx0IDE0e5Q4ocAbf1N7YjRs
 zFR4+E2c/4L5vnUcY4mig/8MWL1tvEVrVqJIAquIzUU04JOr+hjQxw124raJMWdA
 yX58/gv1UoCAcBr2vLln5gX0gILpJCM+obh1ft4f1/Zlqwuv+6CFpNdpWWGgwSFU
 V4GX1WHUE7EJ2PW0t6292vcHZmHrVZBTzEzNh5v0kT6A5jPsV5/fE1Si/uWPnegF
 CTWuunghFczDGLQ6LXEfGg3omN+7MNl7g3xFxWxyYEHh5ED9qQYbp4w/ivJk5mG/
 hClbef+EOyi96yDIxeC1Oy579SPLrV59YLbz0yrqiMN2ADPOxumJPOSHBmqWe7TL
 Jad92hd1bUfejeqoQKQHprPVC2arcitukCXiqIDr/QbyLG4no50=
 =OgHF
 -----END PGP SIGNATURE-----

Merge tag 'renesas-drivers-for-v5.18-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel into arm/drivers

Renesas driver updates for v5.18

  - Initial support for the new RZ/V2L SoC,
  - RZ/G2L product revision support.

* tag 'renesas-drivers-for-v5.18-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel:
  soc: renesas: Add support for reading product revision for RZ/G2L family
  soc: renesas: Identify RZ/V2L SoC

Link: https://lore.kernel.org/r/cover.1644587208.git.geert+renesas@glider.be
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
Arnd Bergmann 2022-02-25 17:04:24 +01:00
commit 15cc8d030c
2 changed files with 51 additions and 22 deletions

View File

@ -296,6 +296,11 @@ config ARCH_R9A07G044
help
This enables support for the Renesas RZ/G2L SoC variants.
config ARCH_R9A07G054
bool "ARM64 Platform support for RZ/V2L"
help
This enables support for the Renesas RZ/V2L SoC variants.
endif # ARM64
config RST_RCAR

View File

@ -64,6 +64,10 @@ static const struct renesas_family fam_rzg2l __initconst __maybe_unused = {
.name = "RZ/G2L",
};
static const struct renesas_family fam_rzv2l __initconst __maybe_unused = {
.name = "RZ/V2L",
};
static const struct renesas_family fam_shmobile __initconst __maybe_unused = {
.name = "SH-Mobile",
.reg = 0xe600101c, /* CCCR (Common Chip Code Register) */
@ -144,6 +148,11 @@ static const struct renesas_soc soc_rz_g2l __initconst __maybe_unused = {
.id = 0x841c447,
};
static const struct renesas_soc soc_rz_v2l __initconst __maybe_unused = {
.family = &fam_rzv2l,
.id = 0x8447447,
};
static const struct renesas_soc soc_rcar_m1a __initconst __maybe_unused = {
.family = &fam_rcar_gen1,
};
@ -334,6 +343,9 @@ static const struct of_device_id renesas_socs[] __initconst = {
#if defined(CONFIG_ARCH_R9A07G044)
{ .compatible = "renesas,r9a07g044", .data = &soc_rz_g2l },
#endif
#if defined(CONFIG_ARCH_R9A07G054)
{ .compatible = "renesas,r9a07g054", .data = &soc_rz_v2l },
#endif
#ifdef CONFIG_ARCH_SH73A0
{ .compatible = "renesas,sh73a0", .data = &soc_shmobile_ag5 },
#endif
@ -367,6 +379,7 @@ static const struct renesas_id id_prr __initconst = {
static const struct of_device_id renesas_ids[] __initconst = {
{ .compatible = "renesas,bsid", .data = &id_bsid },
{ .compatible = "renesas,r9a07g044-sysc", .data = &id_rzg2l },
{ .compatible = "renesas,r9a07g054-sysc", .data = &id_rzg2l },
{ .compatible = "renesas,prr", .data = &id_prr },
{ /* sentinel */ }
};
@ -380,9 +393,11 @@ static int __init renesas_soc_init(void)
const struct renesas_soc *soc;
const struct renesas_id *id;
void __iomem *chipid = NULL;
const char *rev_prefix = "";
struct soc_device *soc_dev;
struct device_node *np;
const char *soc_id;
int ret;
match = of_match_node(renesas_socs, of_root);
if (!match)
@ -403,6 +418,17 @@ static int __init renesas_soc_init(void)
chipid = ioremap(family->reg, 4);
}
soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
if (!soc_dev_attr)
return -ENOMEM;
np = of_find_node_by_path("/");
of_property_read_string(np, "model", &soc_dev_attr->machine);
of_node_put(np);
soc_dev_attr->family = kstrdup_const(family->name, GFP_KERNEL);
soc_dev_attr->soc_id = kstrdup_const(soc_id, GFP_KERNEL);
if (chipid) {
product = readl(chipid + id->offset);
iounmap(chipid);
@ -417,41 +443,39 @@ static int __init renesas_soc_init(void)
eshi = ((product >> 4) & 0x0f) + 1;
eslo = product & 0xf;
soc_dev_attr->revision = kasprintf(GFP_KERNEL, "ES%u.%u",
eshi, eslo);
} else if (id == &id_rzg2l) {
eshi = ((product >> 28) & 0x0f);
soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%u",
eshi);
rev_prefix = "Rev ";
}
if (soc->id &&
((product & id->mask) >> __ffs(id->mask)) != soc->id) {
pr_warn("SoC mismatch (product = 0x%x)\n", product);
return -ENODEV;
ret = -ENODEV;
goto free_soc_dev_attr;
}
}
soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
if (!soc_dev_attr)
return -ENOMEM;
np = of_find_node_by_path("/");
of_property_read_string(np, "model", &soc_dev_attr->machine);
of_node_put(np);
soc_dev_attr->family = kstrdup_const(family->name, GFP_KERNEL);
soc_dev_attr->soc_id = kstrdup_const(soc_id, GFP_KERNEL);
if (eshi)
soc_dev_attr->revision = kasprintf(GFP_KERNEL, "ES%u.%u", eshi,
eslo);
pr_info("Detected Renesas %s %s %s\n", soc_dev_attr->family,
soc_dev_attr->soc_id, soc_dev_attr->revision ?: "");
pr_info("Detected Renesas %s %s %s%s\n", soc_dev_attr->family,
soc_dev_attr->soc_id, rev_prefix, soc_dev_attr->revision ?: "");
soc_dev = soc_device_register(soc_dev_attr);
if (IS_ERR(soc_dev)) {
kfree(soc_dev_attr->revision);
kfree_const(soc_dev_attr->soc_id);
kfree_const(soc_dev_attr->family);
kfree(soc_dev_attr);
return PTR_ERR(soc_dev);
ret = PTR_ERR(soc_dev);
goto free_soc_dev_attr;
}
return 0;
free_soc_dev_attr:
kfree(soc_dev_attr->revision);
kfree_const(soc_dev_attr->soc_id);
kfree_const(soc_dev_attr->family);
kfree(soc_dev_attr);
return ret;
}
early_initcall(renesas_soc_init);