Skip to content

Commit 5f2c2c4

Browse files
Sumit Guptathierryreding
authored andcommitted
soc/tegra: cbb: Support HW lookup to get timed out target address
Add support for hardware based lookup to get the address of the timed out target node. This features is added in upcoming SoCs and avoids the need for creating per fabric target_map tables in the driver. Signed-off-by: Sumit Gupta <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent 25de5c8 commit 5f2c2c4

File tree

1 file changed

+36
-5
lines changed

1 file changed

+36
-5
lines changed

drivers/soc/tegra/cbb/tegra234-cbb.c

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,17 @@
3030
#define FABRIC_EN_CFG_ADDR_LOW_0 0x80
3131
#define FABRIC_EN_CFG_ADDR_HI_0 0x84
3232

33+
#define FABRIC_EN_CFG_TARGET_NODE_ADDR_INDEX_0_0 0x100
34+
#define FABRIC_EN_CFG_TARGET_NODE_ADDR_LOW_0 0x140
35+
#define FABRIC_EN_CFG_TARGET_NODE_ADDR_HI_0 0x144
36+
3337
#define FABRIC_MN_INITIATOR_ERR_EN_0 0x200
3438
#define FABRIC_MN_INITIATOR_ERR_FORCE_0 0x204
35-
#define FABRIC_MN_INITIATOR_ERR_STATUS_0 0x208
36-
#define FABRIC_MN_INITIATOR_ERR_OVERFLOW_STATUS_0 0x20c
39+
#define FABRIC_MN_INITIATOR_ERR_STATUS_0 0x208
40+
#define FABRIC_MN_INITIATOR_ERR_OVERFLOW_STATUS_0 0x20c
3741

3842
#define FABRIC_MN_INITIATOR_LOG_ERR_STATUS_0 0x300
39-
#define FABRIC_MN_INITIATOR_LOG_ADDR_LOW_0 0x304
43+
#define FABRIC_MN_INITIATOR_LOG_ADDR_LOW_0 0x304
4044
#define FABRIC_MN_INITIATOR_LOG_ADDR_HIGH_0 0x308
4145
#define FABRIC_MN_INITIATOR_LOG_ATTRIBUTES0_0 0x30c
4246
#define FABRIC_MN_INITIATOR_LOG_ATTRIBUTES1_0 0x310
@@ -320,6 +324,23 @@ static void tegra234_sw_lookup_target_timeout(struct seq_file *file, struct tegr
320324
}
321325
}
322326

327+
static void tegra234_hw_lookup_target_timeout(struct seq_file *file, struct tegra234_cbb *cbb,
328+
u8 target_id, u8 fab_id)
329+
{
330+
unsigned int notifier = cbb->fabric->notifier_offset;
331+
u32 hi, lo;
332+
u64 addr;
333+
334+
writel(target_id, cbb->regs + notifier + FABRIC_EN_CFG_TARGET_NODE_ADDR_INDEX_0_0);
335+
336+
hi = readl(cbb->regs + notifier + FABRIC_EN_CFG_TARGET_NODE_ADDR_HI_0);
337+
lo = readl(cbb->regs + notifier + FABRIC_EN_CFG_TARGET_NODE_ADDR_LOW_0);
338+
339+
addr = (u64)hi << 32 | lo;
340+
341+
tegra_cbb_print_err(file, "\t Target Node Addr : %#llx\n", addr);
342+
}
343+
323344
static void tegra234_cbb_print_error(struct seq_file *file, struct tegra234_cbb *cbb, u32 status,
324345
u32 overflow)
325346
{
@@ -445,8 +466,18 @@ static void print_errlog_err(struct seq_file *file, struct tegra234_cbb *cbb)
445466
if (!cbb->fabric->fab_list[fab_id].is_lookup)
446467
return;
447468

448-
if (!strcmp(cbb->fabric->errors[cbb->type].code, "TIMEOUT_ERR"))
449-
tegra234_sw_lookup_target_timeout(file, cbb, target_id, fab_id);
469+
/*
470+
* If is_lookup field is set in fabric_lookup table of soc data, it
471+
* means that address lookup of target is supported for Timeout errors.
472+
* If is_lookup is set and the target_map is not populated making
473+
* max_targets as zero, then it means HW lookup is to be performed.
474+
*/
475+
if (!strcmp(cbb->fabric->errors[cbb->type].code, "TIMEOUT_ERR")) {
476+
if (cbb->fabric->fab_list[fab_id].max_targets)
477+
tegra234_sw_lookup_target_timeout(file, cbb, target_id, fab_id);
478+
else
479+
tegra234_hw_lookup_target_timeout(file, cbb, target_id, fab_id);
480+
}
450481

451482
return;
452483
}

0 commit comments

Comments
 (0)