Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Renesas SoC Identification
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (C) 2014-2016 Glider bvba
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <linux/of.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/of_address.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/string.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/sys_soc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) struct renesas_family {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 	const char name[16];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 	u32 reg;			/* CCCR or PRR, if not in DT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) static const struct renesas_family fam_rcar_gen1 __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 	.name	= "R-Car Gen1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	.reg	= 0xff000044,		/* PRR (Product Register) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) static const struct renesas_family fam_rcar_gen2 __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 	.name	= "R-Car Gen2",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	.reg	= 0xff000044,		/* PRR (Product Register) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) static const struct renesas_family fam_rcar_gen3 __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	.name	= "R-Car Gen3",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	.reg	= 0xfff00044,		/* PRR (Product Register) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) static const struct renesas_family fam_rmobile __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	.name	= "R-Mobile",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	.reg	= 0xe600101c,		/* CCCR (Common Chip Code Register) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) static const struct renesas_family fam_rza1 __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	.name	= "RZ/A1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) static const struct renesas_family fam_rza2 __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	.name	= "RZ/A2",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) static const struct renesas_family fam_rzg1 __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	.name	= "RZ/G1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	.reg	= 0xff000044,		/* PRR (Product Register) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) static const struct renesas_family fam_rzg2 __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	.name	= "RZ/G2",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	.reg	= 0xfff00044,		/* PRR (Product Register) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) static const struct renesas_family fam_shmobile __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	.name	= "SH-Mobile",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	.reg	= 0xe600101c,		/* CCCR (Common Chip Code Register) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) struct renesas_soc {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	const struct renesas_family *family;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	u8 id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) static const struct renesas_soc soc_rz_a1h __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	.family	= &fam_rza1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) static const struct renesas_soc soc_rz_a2m __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	.family	= &fam_rza2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	.id	= 0x3b,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) static const struct renesas_soc soc_rmobile_ape6 __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	.family	= &fam_rmobile,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	.id	= 0x3f,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) static const struct renesas_soc soc_rmobile_a1 __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	.family	= &fam_rmobile,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	.id	= 0x40,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) static const struct renesas_soc soc_rz_g1h __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	.family	= &fam_rzg1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	.id	= 0x45,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) static const struct renesas_soc soc_rz_g1m __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	.family	= &fam_rzg1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	.id	= 0x47,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) static const struct renesas_soc soc_rz_g1n __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	.family	= &fam_rzg1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	.id	= 0x4b,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) static const struct renesas_soc soc_rz_g1e __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	.family	= &fam_rzg1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	.id	= 0x4c,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) static const struct renesas_soc soc_rz_g1c __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	.family	= &fam_rzg1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	.id	= 0x53,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) static const struct renesas_soc soc_rz_g2m __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	.family	= &fam_rzg2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	.id	= 0x52,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) static const struct renesas_soc soc_rz_g2n __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	.family = &fam_rzg2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	.id     = 0x55,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) static const struct renesas_soc soc_rz_g2e __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	.family	= &fam_rzg2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	.id	= 0x57,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) static const struct renesas_soc soc_rz_g2h __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	.family	= &fam_rzg2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	.id	= 0x4f,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) static const struct renesas_soc soc_rcar_m1a __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	.family	= &fam_rcar_gen1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) static const struct renesas_soc soc_rcar_h1 __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	.family	= &fam_rcar_gen1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	.id	= 0x3b,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) static const struct renesas_soc soc_rcar_h2 __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	.family	= &fam_rcar_gen2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	.id	= 0x45,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) static const struct renesas_soc soc_rcar_m2_w __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	.family	= &fam_rcar_gen2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	.id	= 0x47,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) static const struct renesas_soc soc_rcar_v2h __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	.family	= &fam_rcar_gen2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	.id	= 0x4a,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) static const struct renesas_soc soc_rcar_m2_n __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	.family	= &fam_rcar_gen2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	.id	= 0x4b,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) static const struct renesas_soc soc_rcar_e2 __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	.family	= &fam_rcar_gen2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	.id	= 0x4c,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) static const struct renesas_soc soc_rcar_h3 __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	.family	= &fam_rcar_gen3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	.id	= 0x4f,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) static const struct renesas_soc soc_rcar_m3_w __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	.family	= &fam_rcar_gen3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	.id	= 0x52,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) static const struct renesas_soc soc_rcar_m3_n __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	.family = &fam_rcar_gen3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	.id     = 0x55,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) static const struct renesas_soc soc_rcar_v3m __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	.family	= &fam_rcar_gen3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	.id	= 0x54,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) static const struct renesas_soc soc_rcar_v3h __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	.family	= &fam_rcar_gen3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	.id	= 0x56,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) static const struct renesas_soc soc_rcar_e3 __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	.family	= &fam_rcar_gen3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	.id	= 0x57,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) static const struct renesas_soc soc_rcar_d3 __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	.family	= &fam_rcar_gen3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	.id	= 0x58,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) static const struct renesas_soc soc_rcar_v3u __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	.family	= &fam_rcar_gen3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	.id	= 0x59,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) static const struct renesas_soc soc_shmobile_ag5 __initconst __maybe_unused = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	.family	= &fam_shmobile,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	.id	= 0x37,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) static const struct of_device_id renesas_socs[] __initconst = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) #ifdef CONFIG_ARCH_R7S72100
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	{ .compatible = "renesas,r7s72100",	.data = &soc_rz_a1h },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) #ifdef CONFIG_ARCH_R7S9210
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	{ .compatible = "renesas,r7s9210",	.data = &soc_rz_a2m },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) #ifdef CONFIG_ARCH_R8A73A4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	{ .compatible = "renesas,r8a73a4",	.data = &soc_rmobile_ape6 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) #ifdef CONFIG_ARCH_R8A7740
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	{ .compatible = "renesas,r8a7740",	.data = &soc_rmobile_a1 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) #ifdef CONFIG_ARCH_R8A7742
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	{ .compatible = "renesas,r8a7742",	.data = &soc_rz_g1h },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) #ifdef CONFIG_ARCH_R8A7743
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	{ .compatible = "renesas,r8a7743",	.data = &soc_rz_g1m },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) #ifdef CONFIG_ARCH_R8A7744
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	{ .compatible = "renesas,r8a7744",	.data = &soc_rz_g1n },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) #ifdef CONFIG_ARCH_R8A7745
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 	{ .compatible = "renesas,r8a7745",	.data = &soc_rz_g1e },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) #ifdef CONFIG_ARCH_R8A77470
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 	{ .compatible = "renesas,r8a77470",	.data = &soc_rz_g1c },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) #ifdef CONFIG_ARCH_R8A774A1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	{ .compatible = "renesas,r8a774a1",	.data = &soc_rz_g2m },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) #ifdef CONFIG_ARCH_R8A774B1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	{ .compatible = "renesas,r8a774b1",	.data = &soc_rz_g2n },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) #ifdef CONFIG_ARCH_R8A774C0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 	{ .compatible = "renesas,r8a774c0",	.data = &soc_rz_g2e },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) #ifdef CONFIG_ARCH_R8A774E1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 	{ .compatible = "renesas,r8a774e1",	.data = &soc_rz_g2h },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) #ifdef CONFIG_ARCH_R8A7778
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 	{ .compatible = "renesas,r8a7778",	.data = &soc_rcar_m1a },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) #ifdef CONFIG_ARCH_R8A7779
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 	{ .compatible = "renesas,r8a7779",	.data = &soc_rcar_h1 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) #ifdef CONFIG_ARCH_R8A7790
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	{ .compatible = "renesas,r8a7790",	.data = &soc_rcar_h2 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) #ifdef CONFIG_ARCH_R8A7791
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 	{ .compatible = "renesas,r8a7791",	.data = &soc_rcar_m2_w },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) #ifdef CONFIG_ARCH_R8A7792
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 	{ .compatible = "renesas,r8a7792",	.data = &soc_rcar_v2h },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) #ifdef CONFIG_ARCH_R8A7793
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 	{ .compatible = "renesas,r8a7793",	.data = &soc_rcar_m2_n },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) #ifdef CONFIG_ARCH_R8A7794
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 	{ .compatible = "renesas,r8a7794",	.data = &soc_rcar_e2 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) #if defined(CONFIG_ARCH_R8A77950) || defined(CONFIG_ARCH_R8A77951)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 	{ .compatible = "renesas,r8a7795",	.data = &soc_rcar_h3 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) #ifdef CONFIG_ARCH_R8A77960
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 	{ .compatible = "renesas,r8a7796",	.data = &soc_rcar_m3_w },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) #ifdef CONFIG_ARCH_R8A77961
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 	{ .compatible = "renesas,r8a77961",	.data = &soc_rcar_m3_w },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) #ifdef CONFIG_ARCH_R8A77965
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 	{ .compatible = "renesas,r8a77965",	.data = &soc_rcar_m3_n },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) #ifdef CONFIG_ARCH_R8A77970
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 	{ .compatible = "renesas,r8a77970",	.data = &soc_rcar_v3m },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) #ifdef CONFIG_ARCH_R8A77980
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 	{ .compatible = "renesas,r8a77980",	.data = &soc_rcar_v3h },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) #ifdef CONFIG_ARCH_R8A77990
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 	{ .compatible = "renesas,r8a77990",	.data = &soc_rcar_e3 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) #ifdef CONFIG_ARCH_R8A77995
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 	{ .compatible = "renesas,r8a77995",	.data = &soc_rcar_d3 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) #ifdef CONFIG_ARCH_R8A779A0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 	{ .compatible = "renesas,r8a779a0",	.data = &soc_rcar_v3u },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) #ifdef CONFIG_ARCH_SH73A0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 	{ .compatible = "renesas,sh73a0",	.data = &soc_shmobile_ag5 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 	{ /* sentinel */ }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) static int __init renesas_soc_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 	struct soc_device_attribute *soc_dev_attr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 	const struct renesas_family *family;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 	const struct of_device_id *match;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 	const struct renesas_soc *soc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 	void __iomem *chipid = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 	struct soc_device *soc_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 	struct device_node *np;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 	unsigned int product, eshi = 0, eslo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 	match = of_match_node(renesas_socs, of_root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 	if (!match)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 		return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 	soc = match->data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 	family = soc->family;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 	np = of_find_compatible_node(NULL, NULL, "renesas,bsid");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 	if (np) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 		chipid = of_iomap(np, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) 		of_node_put(np);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 		if (chipid) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 			product = readl(chipid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 			iounmap(chipid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 			if (soc->id && ((product >> 16) & 0xff) != soc->id) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 				pr_warn("SoC mismatch (product = 0x%x)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 					product);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 				return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 		 * TODO: Upper 4 bits of BSID are for chip version, but the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 		 * format is not known at this time so we don't know how to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 		 * specify eshi and eslo
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 		goto done;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 	/* Try PRR first, then hardcoded fallback */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) 	np = of_find_compatible_node(NULL, NULL, "renesas,prr");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 	if (np) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 		chipid = of_iomap(np, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 		of_node_put(np);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 	} else if (soc->id && family->reg) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) 		chipid = ioremap(family->reg, 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) 	if (chipid) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 		product = readl(chipid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) 		iounmap(chipid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 		/* R-Car M3-W ES1.1 incorrectly identifies as ES2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) 		if ((product & 0x7fff) == 0x5210)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) 			product ^= 0x11;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 		/* R-Car M3-W ES1.3 incorrectly identifies as ES2.1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 		if ((product & 0x7fff) == 0x5211)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 			product ^= 0x12;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 		if (soc->id && ((product >> 8) & 0xff) != soc->id) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 			pr_warn("SoC mismatch (product = 0x%x)\n", product);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) 			return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 		eshi = ((product >> 4) & 0x0f) + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 		eslo = product & 0xf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) done:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 	soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) 	if (!soc_dev_attr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 	np = of_find_node_by_path("/");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 	of_property_read_string(np, "model", &soc_dev_attr->machine);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 	of_node_put(np);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 	soc_dev_attr->family = kstrdup_const(family->name, GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) 	soc_dev_attr->soc_id = kstrdup_const(strchr(match->compatible, ',') + 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) 					     GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) 	if (eshi)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) 		soc_dev_attr->revision = kasprintf(GFP_KERNEL, "ES%u.%u", eshi,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) 						   eslo);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 	pr_info("Detected Renesas %s %s %s\n", soc_dev_attr->family,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) 		soc_dev_attr->soc_id, soc_dev_attr->revision ?: "");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 	soc_dev = soc_device_register(soc_dev_attr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 	if (IS_ERR(soc_dev)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 		kfree(soc_dev_attr->revision);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) 		kfree_const(soc_dev_attr->soc_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) 		kfree_const(soc_dev_attr->family);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 		kfree(soc_dev_attr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 		return PTR_ERR(soc_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) early_initcall(renesas_soc_init);