Lines Matching full:cbb
5 * The driver handles Error's from Control Backbone(CBB) version 2.0.
25 #include <soc/tegra/tegra-cbb.h>
128 static inline struct tegra234_cbb *to_tegra234_cbb(struct tegra_cbb *cbb) in to_tegra234_cbb() argument
130 return container_of(cbb, struct tegra234_cbb, base); in to_tegra234_cbb()
137 tegra234_cbb_write_access_allowed(struct platform_device *pdev, struct tegra234_cbb *cbb) in tegra234_cbb_write_access_allowed() argument
141 if (!cbb->fabric->firewall_base || in tegra234_cbb_write_access_allowed()
142 !cbb->fabric->firewall_ctl || in tegra234_cbb_write_access_allowed()
143 !cbb->fabric->firewall_wr_ctl) { in tegra234_cbb_write_access_allowed()
148 if ((cbb->fabric->firewall_ctl > FIREWALL_APERTURE_SZ) || in tegra234_cbb_write_access_allowed()
149 (cbb->fabric->firewall_wr_ctl > FIREWALL_APERTURE_SZ)) { in tegra234_cbb_write_access_allowed()
154 val = readl(cbb->regs + cbb->fabric->firewall_base + cbb->fabric->firewall_ctl); in tegra234_cbb_write_access_allowed()
167 val = readl(cbb->regs + cbb->fabric->firewall_base + cbb->fabric->firewall_wr_ctl); in tegra234_cbb_write_access_allowed()
174 static void tegra234_cbb_fault_enable(struct tegra_cbb *cbb) in tegra234_cbb_fault_enable() argument
176 struct tegra234_cbb *priv = to_tegra234_cbb(cbb); in tegra234_cbb_fault_enable()
184 static void tegra234_cbb_error_clear(struct tegra_cbb *cbb) in tegra234_cbb_error_clear() argument
186 struct tegra234_cbb *priv = to_tegra234_cbb(cbb); in tegra234_cbb_error_clear()
192 static u32 tegra234_cbb_get_status(struct tegra_cbb *cbb) in tegra234_cbb_get_status() argument
194 struct tegra234_cbb *priv = to_tegra234_cbb(cbb); in tegra234_cbb_get_status()
205 static void tegra234_cbb_mask_serror(struct tegra234_cbb *cbb) in tegra234_cbb_mask_serror() argument
207 writel(0x1, cbb->regs + cbb->fabric->off_mask_erd); in tegra234_cbb_mask_serror()
265 static void tegra234_lookup_slave_timeout(struct seq_file *file, struct tegra234_cbb *cbb, in tegra234_lookup_slave_timeout() argument
268 const struct tegra234_slave_lookup *map = cbb->fabric->slave_map; in tegra234_lookup_slave_timeout()
288 addr = cbb->regs + map[slave_id].offset; in tegra234_lookup_slave_timeout()
308 static void tegra234_cbb_print_error(struct seq_file *file, struct tegra234_cbb *cbb, u32 status, in tegra234_cbb_print_error() argument
317 if (type >= cbb->fabric->max_errors) { in tegra234_cbb_print_error()
325 cbb->fabric->errors[type].code); in tegra234_cbb_print_error()
334 if (type >= cbb->fabric->max_errors) { in tegra234_cbb_print_error()
342 cbb->fabric->errors[type].code); in tegra234_cbb_print_error()
349 static void print_errlog_err(struct seq_file *file, struct tegra234_cbb *cbb) in print_errlog_err() argument
360 mstr_id = FIELD_GET(FAB_EM_EL_MSTRID, cbb->mn_user_bits); in print_errlog_err()
361 vqc = FIELD_GET(FAB_EM_EL_VQC, cbb->mn_user_bits); in print_errlog_err()
362 grpsec = FIELD_GET(FAB_EM_EL_GRPSEC, cbb->mn_user_bits); in print_errlog_err()
363 falconsec = FIELD_GET(FAB_EM_EL_FALCONSEC, cbb->mn_user_bits); in print_errlog_err()
371 requester_socket_id = FIELD_GET(REQ_SOCKET_ID, cbb->mn_attr2); in print_errlog_err()
379 fab_id = FIELD_GET(FAB_EM_EL_FABID, cbb->mn_attr2); in print_errlog_err()
380 slave_id = FIELD_GET(FAB_EM_EL_SLAVEID, cbb->mn_attr2); in print_errlog_err()
382 access_id = FIELD_GET(FAB_EM_EL_ACCESSID, cbb->mn_attr1); in print_errlog_err()
384 cache_type = FIELD_GET(FAB_EM_EL_AXCACHE, cbb->mn_attr0); in print_errlog_err()
385 prot_type = FIELD_GET(FAB_EM_EL_AXPROT, cbb->mn_attr0); in print_errlog_err()
386 burst_length = FIELD_GET(FAB_EM_EL_BURSTLENGTH, cbb->mn_attr0); in print_errlog_err()
387 burst_type = FIELD_GET(FAB_EM_EL_BURSTTYPE, cbb->mn_attr0); in print_errlog_err()
388 beat_size = FIELD_GET(FAB_EM_EL_BEATSIZE, cbb->mn_attr0); in print_errlog_err()
389 access_type = FIELD_GET(FAB_EM_EL_ACCESSTYPE, cbb->mn_attr0); in print_errlog_err()
392 if (cbb->type < cbb->fabric->max_errors) in print_errlog_err()
394 cbb->fabric->errors[cbb->type].code); in print_errlog_err()
396 tegra_cbb_print_err(file, "\t Wrong type index:%u\n", cbb->type); in print_errlog_err()
398 tegra_cbb_print_err(file, "\t MASTER_ID\t\t: %s\n", cbb->fabric->master_id[mstr_id]); in print_errlog_err()
399 tegra_cbb_print_err(file, "\t Address\t\t: %#llx\n", cbb->access); in print_errlog_err()
412 strcpy(fabric_name, cbb->fabric->name); in print_errlog_err()
435 if (slave_id >= cbb->fabric->max_slaves) { in print_errlog_err()
440 if (!strcmp(cbb->fabric->errors[cbb->type].code, "TIMEOUT_ERR")) { in print_errlog_err()
441 tegra234_lookup_slave_timeout(file, cbb, slave_id, fab_id); in print_errlog_err()
445 tegra_cbb_print_err(file, "\t Slave\t\t\t: %s\n", cbb->fabric->slave_map[slave_id].name); in print_errlog_err()
448 static int print_errmonX_info(struct seq_file *file, struct tegra234_cbb *cbb) in print_errmonX_info() argument
452 status = readl(cbb->mon + FABRIC_MN_MASTER_ERR_STATUS_0); in print_errmonX_info()
459 pr_err("CBB registers returning all 1's which is invalid\n"); in print_errmonX_info()
463 overflow = readl(cbb->mon + FABRIC_MN_MASTER_ERR_OVERFLOW_STATUS_0); in print_errmonX_info()
465 tegra234_cbb_print_error(file, cbb, status, overflow); in print_errmonX_info()
467 error = readl(cbb->mon + FABRIC_MN_MASTER_LOG_ERR_STATUS_0); in print_errmonX_info()
473 cbb->type = 0; in print_errmonX_info()
479 hi = readl(cbb->mon + FABRIC_MN_MASTER_LOG_ADDR_HIGH_0); in print_errmonX_info()
480 lo = readl(cbb->mon + FABRIC_MN_MASTER_LOG_ADDR_LOW_0); in print_errmonX_info()
482 cbb->access = (u64)hi << 32 | lo; in print_errmonX_info()
484 cbb->mn_attr0 = readl(cbb->mon + FABRIC_MN_MASTER_LOG_ATTRIBUTES0_0); in print_errmonX_info()
485 cbb->mn_attr1 = readl(cbb->mon + FABRIC_MN_MASTER_LOG_ATTRIBUTES1_0); in print_errmonX_info()
486 cbb->mn_attr2 = readl(cbb->mon + FABRIC_MN_MASTER_LOG_ATTRIBUTES2_0); in print_errmonX_info()
487 cbb->mn_user_bits = readl(cbb->mon + FABRIC_MN_MASTER_LOG_USER_BITS0_0); in print_errmonX_info()
489 print_errlog_err(file, cbb); in print_errmonX_info()
492 cbb->type++; in print_errmonX_info()
499 static int print_err_notifier(struct seq_file *file, struct tegra234_cbb *cbb, u32 status) in print_err_notifier() argument
506 cbb->fabric->name, status); in print_err_notifier()
510 unsigned int notifier = cbb->fabric->notifier_offset; in print_err_notifier()
515 writel(mask, cbb->regs + notifier + FABRIC_EN_CFG_ADDR_INDEX_0_0); in print_err_notifier()
516 hi = readl(cbb->regs + notifier + FABRIC_EN_CFG_ADDR_HI_0); in print_err_notifier()
517 lo = readl(cbb->regs + notifier + FABRIC_EN_CFG_ADDR_LOW_0); in print_err_notifier()
521 offset = addr - cbb->res->start; in print_err_notifier()
522 cbb->mon = cbb->regs + offset; in print_err_notifier()
523 cbb->mask = BIT(index); in print_err_notifier()
525 err = print_errmonX_info(file, cbb); in print_err_notifier()
526 tegra234_cbb_error_clear(&cbb->base); in print_err_notifier()
542 static int tegra234_cbb_debugfs_show(struct tegra_cbb *cbb, struct seq_file *file, void *data) in tegra234_cbb_debugfs_show() argument
548 list_for_each_entry(cbb, &cbb_list, node) { in tegra234_cbb_debugfs_show()
549 struct tegra234_cbb *priv = to_tegra234_cbb(cbb); in tegra234_cbb_debugfs_show()
566 * Handler for CBB errors
571 struct tegra_cbb *cbb; in tegra234_cbb_isr() local
578 list_for_each_entry(cbb, &cbb_list, node) { in tegra234_cbb_isr()
579 struct tegra234_cbb *priv = to_tegra234_cbb(cbb); in tegra234_cbb_isr()
580 u32 status = tegra_cbb_get_status(cbb); in tegra234_cbb_isr()
611 static int tegra234_cbb_interrupt_enable(struct tegra_cbb *cbb) in tegra234_cbb_interrupt_enable() argument
613 struct tegra234_cbb *priv = to_tegra234_cbb(cbb); in tegra234_cbb_interrupt_enable()
616 int err = devm_request_irq(cbb->dev, priv->sec_irq, tegra234_cbb_isr, 0, in tegra234_cbb_interrupt_enable()
617 dev_name(cbb->dev), priv); in tegra234_cbb_interrupt_enable()
619 dev_err(cbb->dev, "failed to register interrupt %u: %d\n", priv->sec_irq, in tegra234_cbb_interrupt_enable()
628 static void tegra234_cbb_error_enable(struct tegra_cbb *cbb) in tegra234_cbb_error_enable() argument
630 tegra_cbb_fault_enable(cbb); in tegra234_cbb_error_enable()
698 { "CBB", 0x15000 },
719 { "CBB", 0x17000 },
739 { "CBB", 0x42000 },
801 .name = "cbb-fabric",
818 { "CBB", 0x17000 },
1034 .name = "cbb-fabric",
1051 { "CBB", 0x15000 },
1072 { .compatible = "nvidia,tegra234-cbb-fabric", .data = &tegra234_cbb_fabric },
1116 struct tegra234_cbb *cbb; in tegra234_cbb_probe() local
1134 cbb = devm_kzalloc(&pdev->dev, sizeof(*cbb), GFP_KERNEL); in tegra234_cbb_probe()
1135 if (!cbb) in tegra234_cbb_probe()
1138 INIT_LIST_HEAD(&cbb->base.node); in tegra234_cbb_probe()
1139 cbb->base.ops = &tegra234_cbb_ops; in tegra234_cbb_probe()
1140 cbb->base.dev = &pdev->dev; in tegra234_cbb_probe()
1141 cbb->fabric = fabric; in tegra234_cbb_probe()
1143 cbb->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &cbb->res); in tegra234_cbb_probe()
1144 if (IS_ERR(cbb->regs)) in tegra234_cbb_probe()
1145 return PTR_ERR(cbb->regs); in tegra234_cbb_probe()
1147 err = tegra_cbb_get_irq(pdev, NULL, &cbb->sec_irq); in tegra234_cbb_probe()
1151 platform_set_drvdata(pdev, cbb); in tegra234_cbb_probe()
1155 * is blocked by CBB firewall. in tegra234_cbb_probe()
1157 if (!tegra234_cbb_write_access_allowed(pdev, cbb)) { in tegra234_cbb_probe()
1163 list_add(&cbb->base.node, &cbb_list); in tegra234_cbb_probe()
1167 if (cbb->fabric->off_mask_erd) in tegra234_cbb_probe()
1168 tegra234_cbb_mask_serror(cbb); in tegra234_cbb_probe()
1170 return tegra_cbb_register(&cbb->base); in tegra234_cbb_probe()
1175 struct tegra234_cbb *cbb = dev_get_drvdata(dev); in tegra234_cbb_resume_noirq() local
1177 tegra234_cbb_error_enable(&cbb->base); in tegra234_cbb_resume_noirq()
1179 dev_dbg(dev, "%s resumed\n", cbb->fabric->name); in tegra234_cbb_resume_noirq()
1191 .name = "tegra234-cbb",