|
35 | 35 | #define REG_GEN3_PTAT2 0x60 |
36 | 36 | #define REG_GEN3_PTAT3 0x64 |
37 | 37 | #define REG_GEN3_THSCP 0x68 |
| 38 | +#define REG_GEN4_THSFMON00 0x180 |
| 39 | +#define REG_GEN4_THSFMON01 0x184 |
| 40 | +#define REG_GEN4_THSFMON02 0x188 |
| 41 | +#define REG_GEN4_THSFMON15 0x1BC |
| 42 | +#define REG_GEN4_THSFMON16 0x1C0 |
| 43 | +#define REG_GEN4_THSFMON17 0x1C4 |
38 | 44 |
|
39 | 45 | /* IRQ{STR,MSK,EN} bits */ |
40 | 46 | #define IRQ_TEMP1 BIT(0) |
|
55 | 61 |
|
56 | 62 | #define MCELSIUS(temp) ((temp) * 1000) |
57 | 63 | #define GEN3_FUSE_MASK 0xFFF |
| 64 | +#define GEN4_FUSE_MASK 0xFFF |
58 | 65 |
|
59 | 66 | #define TSC_MAX_NUM 5 |
60 | 67 |
|
@@ -272,6 +279,34 @@ static void rcar_gen3_thermal_read_fuses_gen3(struct rcar_gen3_thermal_priv *pri |
272 | 279 | } |
273 | 280 | } |
274 | 281 |
|
| 282 | +static void rcar_gen3_thermal_read_fuses_gen4(struct rcar_gen3_thermal_priv *priv) |
| 283 | +{ |
| 284 | + unsigned int i; |
| 285 | + |
| 286 | + /* |
| 287 | + * Set the pseudo calibration points with fused values. |
| 288 | + * PTAT is shared between all TSCs but only fused for the first |
| 289 | + * TSC while THCODEs are fused for each TSC. |
| 290 | + */ |
| 291 | + priv->ptat[0] = rcar_gen3_thermal_read(priv->tscs[0], REG_GEN4_THSFMON16) & |
| 292 | + GEN4_FUSE_MASK; |
| 293 | + priv->ptat[1] = rcar_gen3_thermal_read(priv->tscs[0], REG_GEN4_THSFMON17) & |
| 294 | + GEN4_FUSE_MASK; |
| 295 | + priv->ptat[2] = rcar_gen3_thermal_read(priv->tscs[0], REG_GEN4_THSFMON15) & |
| 296 | + GEN4_FUSE_MASK; |
| 297 | + |
| 298 | + for (i = 0; i < priv->num_tscs; i++) { |
| 299 | + struct rcar_gen3_thermal_tsc *tsc = priv->tscs[i]; |
| 300 | + |
| 301 | + tsc->thcode[0] = rcar_gen3_thermal_read(tsc, REG_GEN4_THSFMON01) & |
| 302 | + GEN4_FUSE_MASK; |
| 303 | + tsc->thcode[1] = rcar_gen3_thermal_read(tsc, REG_GEN4_THSFMON02) & |
| 304 | + GEN4_FUSE_MASK; |
| 305 | + tsc->thcode[2] = rcar_gen3_thermal_read(tsc, REG_GEN4_THSFMON00) & |
| 306 | + GEN4_FUSE_MASK; |
| 307 | + } |
| 308 | +} |
| 309 | + |
275 | 310 | static bool rcar_gen3_thermal_read_fuses(struct rcar_gen3_thermal_priv *priv) |
276 | 311 | { |
277 | 312 | unsigned int i; |
@@ -343,6 +378,11 @@ static const struct rcar_thermal_info rcar_gen3_thermal_info = { |
343 | 378 | .read_fuses = rcar_gen3_thermal_read_fuses_gen3, |
344 | 379 | }; |
345 | 380 |
|
| 381 | +static const struct rcar_thermal_info rcar_gen4_thermal_info = { |
| 382 | + .ths_tj_1 = 126, |
| 383 | + .read_fuses = rcar_gen3_thermal_read_fuses_gen4, |
| 384 | +}; |
| 385 | + |
346 | 386 | static const struct of_device_id rcar_gen3_thermal_dt_ids[] = { |
347 | 387 | { |
348 | 388 | .compatible = "renesas,r8a774a1-thermal", |
@@ -382,11 +422,11 @@ static const struct of_device_id rcar_gen3_thermal_dt_ids[] = { |
382 | 422 | }, |
383 | 423 | { |
384 | 424 | .compatible = "renesas,r8a779f0-thermal", |
385 | | - .data = &rcar_gen3_thermal_info, |
| 425 | + .data = &rcar_gen4_thermal_info, |
386 | 426 | }, |
387 | 427 | { |
388 | 428 | .compatible = "renesas,r8a779g0-thermal", |
389 | | - .data = &rcar_gen3_thermal_info, |
| 429 | + .data = &rcar_gen4_thermal_info, |
390 | 430 | }, |
391 | 431 | {}, |
392 | 432 | }; |
|
0 commit comments