|
57 | 57 | #define CMN_INFO_REQ_VC_NUM GENMASK_ULL(1, 0)
|
58 | 58 |
|
59 | 59 | /* XPs also have some local topology info which has uses too */
|
60 |
| -#define CMN_MXP__CONNECT_INFO_P0 0x0008 |
61 |
| -#define CMN_MXP__CONNECT_INFO_P1 0x0010 |
62 |
| -#define CMN_MXP__CONNECT_INFO_P2 0x0028 |
63 |
| -#define CMN_MXP__CONNECT_INFO_P3 0x0030 |
64 |
| -#define CMN_MXP__CONNECT_INFO_P4 0x0038 |
65 |
| -#define CMN_MXP__CONNECT_INFO_P5 0x0040 |
| 60 | +#define CMN_MXP__CONNECT_INFO(p) (0x0008 + 8 * (p)) |
66 | 61 | #define CMN__CONNECT_INFO_DEVICE_TYPE GENMASK_ULL(4, 0)
|
67 | 62 |
|
| 63 | +#define CMN_MAX_PORTS 6 |
| 64 | +#define CI700_CONNECT_INFO_P2_5_OFFSET 0x10 |
| 65 | + |
68 | 66 | /* PMU registers occupy the 3rd 4KB page of each node's region */
|
69 | 67 | #define CMN_PMU_OFFSET 0x2000
|
70 | 68 |
|
@@ -396,6 +394,25 @@ static struct arm_cmn_node *arm_cmn_node(const struct arm_cmn *cmn,
|
396 | 394 | return NULL;
|
397 | 395 | }
|
398 | 396 |
|
| 397 | +static u32 arm_cmn_device_connect_info(const struct arm_cmn *cmn, |
| 398 | + const struct arm_cmn_node *xp, int port) |
| 399 | +{ |
| 400 | + int offset = CMN_MXP__CONNECT_INFO(port); |
| 401 | + |
| 402 | + if (port >= 2) { |
| 403 | + if (cmn->model & (CMN600 | CMN650)) |
| 404 | + return 0; |
| 405 | + /* |
| 406 | + * CI-700 may have extra ports, but still has the |
| 407 | + * mesh_port_connect_info registers in the way. |
| 408 | + */ |
| 409 | + if (cmn->model == CI700) |
| 410 | + offset += CI700_CONNECT_INFO_P2_5_OFFSET; |
| 411 | + } |
| 412 | + |
| 413 | + return readl_relaxed(xp->pmu_base - CMN_PMU_OFFSET + offset); |
| 414 | +} |
| 415 | + |
399 | 416 | static struct dentry *arm_cmn_debugfs;
|
400 | 417 |
|
401 | 418 | #ifdef CONFIG_DEBUG_FS
|
@@ -469,22 +486,17 @@ static int arm_cmn_map_show(struct seq_file *s, void *data)
|
469 | 486 | y = cmn->mesh_y;
|
470 | 487 | while (y--) {
|
471 | 488 | int xp_base = cmn->mesh_x * y;
|
472 |
| - u8 port[6][CMN_MAX_DIMENSION]; |
| 489 | + u8 port[CMN_MAX_PORTS][CMN_MAX_DIMENSION]; |
473 | 490 |
|
474 | 491 | for (x = 0; x < cmn->mesh_x; x++)
|
475 | 492 | seq_puts(s, "--------+");
|
476 | 493 |
|
477 | 494 | seq_printf(s, "\n%d |", y);
|
478 | 495 | for (x = 0; x < cmn->mesh_x; x++) {
|
479 | 496 | struct arm_cmn_node *xp = cmn->xps + xp_base + x;
|
480 |
| - void __iomem *base = xp->pmu_base - CMN_PMU_OFFSET; |
481 |
| - |
482 |
| - port[0][x] = readl_relaxed(base + CMN_MXP__CONNECT_INFO_P0); |
483 |
| - port[1][x] = readl_relaxed(base + CMN_MXP__CONNECT_INFO_P1); |
484 |
| - port[2][x] = readl_relaxed(base + CMN_MXP__CONNECT_INFO_P2); |
485 |
| - port[3][x] = readl_relaxed(base + CMN_MXP__CONNECT_INFO_P3); |
486 |
| - port[4][x] = readl_relaxed(base + CMN_MXP__CONNECT_INFO_P4); |
487 |
| - port[5][x] = readl_relaxed(base + CMN_MXP__CONNECT_INFO_P5); |
| 497 | + |
| 498 | + for (p = 0; p < CMN_MAX_PORTS; p++) |
| 499 | + port[p][x] = arm_cmn_device_connect_info(cmn, xp, p); |
488 | 500 | seq_printf(s, " XP #%-2d |", xp_base + x);
|
489 | 501 | }
|
490 | 502 |
|
@@ -2083,18 +2095,9 @@ static int arm_cmn_discover(struct arm_cmn *cmn, unsigned int rgn_offset)
|
2083 | 2095 | * from this, since in that case we will see at least one XP
|
2084 | 2096 | * with port 2 connected, for the HN-D.
|
2085 | 2097 | */
|
2086 |
| - if (readq_relaxed(xp_region + CMN_MXP__CONNECT_INFO_P0)) |
2087 |
| - xp_ports |= BIT(0); |
2088 |
| - if (readq_relaxed(xp_region + CMN_MXP__CONNECT_INFO_P1)) |
2089 |
| - xp_ports |= BIT(1); |
2090 |
| - if (readq_relaxed(xp_region + CMN_MXP__CONNECT_INFO_P2)) |
2091 |
| - xp_ports |= BIT(2); |
2092 |
| - if (readq_relaxed(xp_region + CMN_MXP__CONNECT_INFO_P3)) |
2093 |
| - xp_ports |= BIT(3); |
2094 |
| - if (readq_relaxed(xp_region + CMN_MXP__CONNECT_INFO_P4)) |
2095 |
| - xp_ports |= BIT(4); |
2096 |
| - if (readq_relaxed(xp_region + CMN_MXP__CONNECT_INFO_P5)) |
2097 |
| - xp_ports |= BIT(5); |
| 2098 | + for (int p = 0; p < CMN_MAX_PORTS; p++) |
| 2099 | + if (arm_cmn_device_connect_info(cmn, xp, p)) |
| 2100 | + xp_ports |= BIT(p); |
2098 | 2101 |
|
2099 | 2102 | if (cmn->multi_dtm && (xp_ports & 0xc))
|
2100 | 2103 | arm_cmn_init_dtm(dtm++, xp, 1);
|
|
0 commit comments