| .. | .. |
|---|
| 81 | 81 | |
|---|
| 82 | 82 | kfree(efuse_buf); |
|---|
| 83 | 83 | |
|---|
| 84 | + dev_info(dev, "SoC\t\t: %lx\n", rockchip_soc_id); |
|---|
| 85 | + |
|---|
| 86 | +#ifdef CONFIG_NO_GKI |
|---|
| 84 | 87 | system_serial_low = crc32(0, buf, 8); |
|---|
| 85 | 88 | system_serial_high = crc32(system_serial_low, buf + 8, 8); |
|---|
| 86 | 89 | |
|---|
| 87 | | - dev_info(dev, "SoC\t\t: %lx\n", rockchip_soc_id); |
|---|
| 88 | 90 | dev_info(dev, "Serial\t\t: %08x%08x\n", |
|---|
| 89 | 91 | system_serial_high, system_serial_low); |
|---|
| 92 | +#endif |
|---|
| 90 | 93 | |
|---|
| 91 | 94 | return 0; |
|---|
| 92 | 95 | } |
|---|
| .. | .. |
|---|
| 105 | 108 | }, |
|---|
| 106 | 109 | }; |
|---|
| 107 | 110 | |
|---|
| 111 | +static void rockchip_set_cpu_version_from_os_reg(u32 reg) |
|---|
| 112 | +{ |
|---|
| 113 | + void __iomem *r = ioremap(reg, 0x4); |
|---|
| 114 | + |
|---|
| 115 | + if (r) { |
|---|
| 116 | + rockchip_set_cpu_version(readl_relaxed(r) & GENMASK(2, 0)); |
|---|
| 117 | + iounmap(r); |
|---|
| 118 | + } |
|---|
| 119 | +} |
|---|
| 120 | + |
|---|
| 108 | 121 | static void px30_init(void) |
|---|
| 109 | 122 | { |
|---|
| 110 | 123 | void __iomem *base; |
|---|
| .. | .. |
|---|
| 120 | 133 | rockchip_soc_id = ROCKCHIP_SOC_PX30S; |
|---|
| 121 | 134 | iounmap(base); |
|---|
| 122 | 135 | } |
|---|
| 136 | +} |
|---|
| 137 | + |
|---|
| 138 | +#define RV1106_OS_REG1 0xff020204 |
|---|
| 139 | +static void rv1103_init(void) |
|---|
| 140 | +{ |
|---|
| 141 | + rockchip_soc_id = ROCKCHIP_SOC_RV1103; |
|---|
| 142 | + rockchip_set_cpu_version_from_os_reg(RV1106_OS_REG1); |
|---|
| 143 | +} |
|---|
| 144 | + |
|---|
| 145 | +static void rv1106_init(void) |
|---|
| 146 | +{ |
|---|
| 147 | + rockchip_soc_id = ROCKCHIP_SOC_RV1106; |
|---|
| 148 | + rockchip_set_cpu_version_from_os_reg(RV1106_OS_REG1); |
|---|
| 123 | 149 | } |
|---|
| 124 | 150 | |
|---|
| 125 | 151 | static void rv1109_init(void) |
|---|
| .. | .. |
|---|
| 176 | 202 | #define RK3308_GRF_CHIP_ID 0x800 |
|---|
| 177 | 203 | base = ioremap(RK3308_GRF_PHYS, SZ_4K); |
|---|
| 178 | 204 | if (base) { |
|---|
| 179 | | - if (readl_relaxed(base + RK3308_GRF_CHIP_ID) == 0x3308) |
|---|
| 205 | + u32 v = readl_relaxed(base + RK3308_GRF_CHIP_ID); |
|---|
| 206 | + |
|---|
| 207 | + if (v == 0x3308) |
|---|
| 180 | 208 | rockchip_soc_id = ROCKCHIP_SOC_RK3308B; |
|---|
| 209 | + if (v == 0x3308c) |
|---|
| 210 | + rockchip_soc_id = ROCKCHIP_SOC_RK3308BS; |
|---|
| 181 | 211 | iounmap(base); |
|---|
| 182 | 212 | } |
|---|
| 183 | 213 | } |
|---|
| 184 | 214 | |
|---|
| 185 | 215 | static void rk3528_init(void) |
|---|
| 186 | 216 | { |
|---|
| 187 | | - rockchip_soc_id = ROCKCHIP_SOC_RK3528; |
|---|
| 217 | + if (of_machine_is_compatible("rockchip,rk3528")) |
|---|
| 218 | + rockchip_soc_id = ROCKCHIP_SOC_RK3528; |
|---|
| 219 | + else if (of_machine_is_compatible("rockchip,rk3528a")) |
|---|
| 220 | + rockchip_soc_id = ROCKCHIP_SOC_RK3528A; |
|---|
| 188 | 221 | } |
|---|
| 189 | 222 | |
|---|
| 190 | 223 | #define RK356X_PMU_GRF_PHYS 0xfdc20000 |
|---|
| .. | .. |
|---|
| 208 | 241 | rk356x_set_cpu_version(); |
|---|
| 209 | 242 | } |
|---|
| 210 | 243 | |
|---|
| 244 | +static void rk3567_init(void) |
|---|
| 245 | +{ |
|---|
| 246 | + rockchip_soc_id = ROCKCHIP_SOC_RK3567; |
|---|
| 247 | + rk356x_set_cpu_version(); |
|---|
| 248 | +} |
|---|
| 249 | + |
|---|
| 211 | 250 | static void rk3568_init(void) |
|---|
| 212 | 251 | { |
|---|
| 213 | 252 | rockchip_soc_id = ROCKCHIP_SOC_RK3568; |
|---|
| 214 | 253 | rk356x_set_cpu_version(); |
|---|
| 215 | 254 | } |
|---|
| 216 | 255 | |
|---|
| 217 | | -int __init rockchip_soc_id_init(void) |
|---|
| 256 | +int rockchip_soc_id_init(void) |
|---|
| 218 | 257 | { |
|---|
| 219 | 258 | if (rockchip_soc_id) |
|---|
| 220 | 259 | return 0; |
|---|
| .. | .. |
|---|
| 228 | 267 | rk3126_init(); |
|---|
| 229 | 268 | } else if (cpu_is_rk3308()) { |
|---|
| 230 | 269 | rk3308_init(); |
|---|
| 270 | + } else if (cpu_is_rv1103()) { |
|---|
| 271 | + rv1103_init(); |
|---|
| 272 | + } else if (cpu_is_rv1106()) { |
|---|
| 273 | + rv1106_init(); |
|---|
| 231 | 274 | } else if (cpu_is_rv1109()) { |
|---|
| 232 | 275 | rv1109_init(); |
|---|
| 233 | 276 | } else if (cpu_is_rv1126()) { |
|---|
| .. | .. |
|---|
| 236 | 279 | rk3528_init(); |
|---|
| 237 | 280 | } else if (cpu_is_rk3566()) { |
|---|
| 238 | 281 | rk3566_init(); |
|---|
| 282 | + } else if (cpu_is_rk3567()) { |
|---|
| 283 | + rk3567_init(); |
|---|
| 239 | 284 | } else if (cpu_is_rk3568()) { |
|---|
| 240 | 285 | rk3568_init(); |
|---|
| 241 | 286 | } else if (cpu_is_px30()) { |
|---|
| .. | .. |
|---|
| 244 | 289 | |
|---|
| 245 | 290 | return 0; |
|---|
| 246 | 291 | } |
|---|
| 292 | +EXPORT_SYMBOL(rockchip_soc_id_init); |
|---|
| 247 | 293 | #ifndef MODULE |
|---|
| 248 | 294 | pure_initcall(rockchip_soc_id_init); |
|---|
| 249 | 295 | #endif |
|---|