Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <sumitg@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>

authored by

Sumit Gupta and committed by
Thierry Reding
5f2c2c43 25de5c8f

+36 -5
+36 -5
drivers/soc/tegra/cbb/tegra234-cbb.c
··· 30 30 #define FABRIC_EN_CFG_ADDR_LOW_0 0x80 31 31 #define FABRIC_EN_CFG_ADDR_HI_0 0x84 32 32 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 + 33 37 #define FABRIC_MN_INITIATOR_ERR_EN_0 0x200 34 38 #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 37 41 38 42 #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 40 44 #define FABRIC_MN_INITIATOR_LOG_ADDR_HIGH_0 0x308 41 45 #define FABRIC_MN_INITIATOR_LOG_ATTRIBUTES0_0 0x30c 42 46 #define FABRIC_MN_INITIATOR_LOG_ATTRIBUTES1_0 0x310 ··· 324 320 } 325 321 } 326 322 323 + static void tegra234_hw_lookup_target_timeout(struct seq_file *file, struct tegra234_cbb *cbb, 324 + u8 target_id, u8 fab_id) 325 + { 326 + unsigned int notifier = cbb->fabric->notifier_offset; 327 + u32 hi, lo; 328 + u64 addr; 329 + 330 + writel(target_id, cbb->regs + notifier + FABRIC_EN_CFG_TARGET_NODE_ADDR_INDEX_0_0); 331 + 332 + hi = readl(cbb->regs + notifier + FABRIC_EN_CFG_TARGET_NODE_ADDR_HI_0); 333 + lo = readl(cbb->regs + notifier + FABRIC_EN_CFG_TARGET_NODE_ADDR_LOW_0); 334 + 335 + addr = (u64)hi << 32 | lo; 336 + 337 + tegra_cbb_print_err(file, "\t Target Node Addr : %#llx\n", addr); 338 + } 339 + 327 340 static void tegra234_cbb_print_error(struct seq_file *file, struct tegra234_cbb *cbb, u32 status, 328 341 u32 overflow) 329 342 { ··· 466 445 if (!cbb->fabric->fab_list[fab_id].is_lookup) 467 446 return; 468 447 469 - if (!strcmp(cbb->fabric->errors[cbb->type].code, "TIMEOUT_ERR")) 470 - tegra234_sw_lookup_target_timeout(file, cbb, target_id, fab_id); 448 + /* 449 + * If is_lookup field is set in fabric_lookup table of soc data, it 450 + * means that address lookup of target is supported for Timeout errors. 451 + * If is_lookup is set and the target_map is not populated making 452 + * max_targets as zero, then it means HW lookup is to be performed. 453 + */ 454 + if (!strcmp(cbb->fabric->errors[cbb->type].code, "TIMEOUT_ERR")) { 455 + if (cbb->fabric->fab_list[fab_id].max_targets) 456 + tegra234_sw_lookup_target_timeout(file, cbb, target_id, fab_id); 457 + else 458 + tegra234_hw_lookup_target_timeout(file, cbb, target_id, fab_id); 459 + } 471 460 472 461 return; 473 462 }