Lines Matching refs:cbb

132 static inline struct tegra234_cbb *to_tegra234_cbb(struct tegra_cbb *cbb)  in to_tegra234_cbb()  argument
134 return container_of(cbb, struct tegra234_cbb, base); in to_tegra234_cbb()
141 tegra234_cbb_write_access_allowed(struct platform_device *pdev, struct tegra234_cbb *cbb) in tegra234_cbb_write_access_allowed() argument
145 if (!cbb->fabric->firewall_base || in tegra234_cbb_write_access_allowed()
146 !cbb->fabric->firewall_ctl || in tegra234_cbb_write_access_allowed()
147 !cbb->fabric->firewall_wr_ctl) { in tegra234_cbb_write_access_allowed()
152 if ((cbb->fabric->firewall_ctl > FIREWALL_APERTURE_SZ) || in tegra234_cbb_write_access_allowed()
153 (cbb->fabric->firewall_wr_ctl > FIREWALL_APERTURE_SZ)) { in tegra234_cbb_write_access_allowed()
158 val = readl(cbb->regs + cbb->fabric->firewall_base + cbb->fabric->firewall_ctl); in tegra234_cbb_write_access_allowed()
171 val = readl(cbb->regs + cbb->fabric->firewall_base + cbb->fabric->firewall_wr_ctl); in tegra234_cbb_write_access_allowed()
178 static void tegra234_cbb_fault_enable(struct tegra_cbb *cbb) in tegra234_cbb_fault_enable() argument
180 struct tegra234_cbb *priv = to_tegra234_cbb(cbb); in tegra234_cbb_fault_enable()
188 static void tegra234_cbb_error_clear(struct tegra_cbb *cbb) in tegra234_cbb_error_clear() argument
190 struct tegra234_cbb *priv = to_tegra234_cbb(cbb); in tegra234_cbb_error_clear()
196 static u32 tegra234_cbb_get_status(struct tegra_cbb *cbb) in tegra234_cbb_get_status() argument
198 struct tegra234_cbb *priv = to_tegra234_cbb(cbb); in tegra234_cbb_get_status()
209 static void tegra234_cbb_mask_serror(struct tegra234_cbb *cbb) in tegra234_cbb_mask_serror() argument
211 writel(0x1, cbb->regs + cbb->fabric->off_mask_erd); in tegra234_cbb_mask_serror()
269 static void tegra234_lookup_slave_timeout(struct seq_file *file, struct tegra234_cbb *cbb, in tegra234_lookup_slave_timeout() argument
272 const struct tegra234_slave_lookup *map = cbb->fabric->slave_map; in tegra234_lookup_slave_timeout()
292 addr = cbb->regs + map[slave_id].offset; in tegra234_lookup_slave_timeout()
312 static void tegra234_cbb_print_error(struct seq_file *file, struct tegra234_cbb *cbb, u32 status, in tegra234_cbb_print_error() argument
321 if (type >= cbb->fabric->max_errors) { in tegra234_cbb_print_error()
329 cbb->fabric->errors[type].code); in tegra234_cbb_print_error()
338 if (type >= cbb->fabric->max_errors) { in tegra234_cbb_print_error()
346 cbb->fabric->errors[type].code); in tegra234_cbb_print_error()
353 static void print_errlog_err(struct seq_file *file, struct tegra234_cbb *cbb) in print_errlog_err() argument
364 mstr_id = FIELD_GET(FAB_EM_EL_MSTRID, cbb->mn_user_bits); in print_errlog_err()
365 vqc = FIELD_GET(FAB_EM_EL_VQC, cbb->mn_user_bits); in print_errlog_err()
366 grpsec = FIELD_GET(FAB_EM_EL_GRPSEC, cbb->mn_user_bits); in print_errlog_err()
367 falconsec = FIELD_GET(FAB_EM_EL_FALCONSEC, cbb->mn_user_bits); in print_errlog_err()
375 requester_socket_id = FIELD_GET(REQ_SOCKET_ID, cbb->mn_attr2); in print_errlog_err()
383 fab_id = FIELD_GET(FAB_EM_EL_FABID, cbb->mn_attr2); in print_errlog_err()
384 slave_id = FIELD_GET(FAB_EM_EL_SLAVEID, cbb->mn_attr2); in print_errlog_err()
386 access_id = FIELD_GET(FAB_EM_EL_ACCESSID, cbb->mn_attr1); in print_errlog_err()
388 cache_type = FIELD_GET(FAB_EM_EL_AXCACHE, cbb->mn_attr0); in print_errlog_err()
389 prot_type = FIELD_GET(FAB_EM_EL_AXPROT, cbb->mn_attr0); in print_errlog_err()
390 burst_length = FIELD_GET(FAB_EM_EL_BURSTLENGTH, cbb->mn_attr0); in print_errlog_err()
391 burst_type = FIELD_GET(FAB_EM_EL_BURSTTYPE, cbb->mn_attr0); in print_errlog_err()
392 beat_size = FIELD_GET(FAB_EM_EL_BEATSIZE, cbb->mn_attr0); in print_errlog_err()
393 access_type = FIELD_GET(FAB_EM_EL_ACCESSTYPE, cbb->mn_attr0); in print_errlog_err()
396 if (cbb->type < cbb->fabric->max_errors) in print_errlog_err()
398 cbb->fabric->errors[cbb->type].code); in print_errlog_err()
400 tegra_cbb_print_err(file, "\t Wrong type index:%u\n", cbb->type); in print_errlog_err()
402 tegra_cbb_print_err(file, "\t MASTER_ID\t\t: %s\n", cbb->fabric->master_id[mstr_id]); in print_errlog_err()
403 tegra_cbb_print_err(file, "\t Address\t\t: %#llx\n", cbb->access); in print_errlog_err()
416 strcpy(fabric_name, cbb->fabric->name); in print_errlog_err()
439 if (slave_id >= cbb->fabric->max_slaves) { in print_errlog_err()
444 if (!strcmp(cbb->fabric->errors[cbb->type].code, "TIMEOUT_ERR")) { in print_errlog_err()
445 tegra234_lookup_slave_timeout(file, cbb, slave_id, fab_id); in print_errlog_err()
449 tegra_cbb_print_err(file, "\t Slave\t\t\t: %s\n", cbb->fabric->slave_map[slave_id].name); in print_errlog_err()
452 static int print_errmonX_info(struct seq_file *file, struct tegra234_cbb *cbb) in print_errmonX_info() argument
456 status = readl(cbb->mon + FABRIC_MN_MASTER_ERR_STATUS_0); in print_errmonX_info()
467 overflow = readl(cbb->mon + FABRIC_MN_MASTER_ERR_OVERFLOW_STATUS_0); in print_errmonX_info()
469 tegra234_cbb_print_error(file, cbb, status, overflow); in print_errmonX_info()
471 error = readl(cbb->mon + FABRIC_MN_MASTER_LOG_ERR_STATUS_0); in print_errmonX_info()
477 cbb->type = 0; in print_errmonX_info()
483 hi = readl(cbb->mon + FABRIC_MN_MASTER_LOG_ADDR_HIGH_0); in print_errmonX_info()
484 lo = readl(cbb->mon + FABRIC_MN_MASTER_LOG_ADDR_LOW_0); in print_errmonX_info()
486 cbb->access = (u64)hi << 32 | lo; in print_errmonX_info()
488 cbb->mn_attr0 = readl(cbb->mon + FABRIC_MN_MASTER_LOG_ATTRIBUTES0_0); in print_errmonX_info()
489 cbb->mn_attr1 = readl(cbb->mon + FABRIC_MN_MASTER_LOG_ATTRIBUTES1_0); in print_errmonX_info()
490 cbb->mn_attr2 = readl(cbb->mon + FABRIC_MN_MASTER_LOG_ATTRIBUTES2_0); in print_errmonX_info()
491 cbb->mn_user_bits = readl(cbb->mon + FABRIC_MN_MASTER_LOG_USER_BITS0_0); in print_errmonX_info()
493 print_errlog_err(file, cbb); in print_errmonX_info()
496 cbb->type++; in print_errmonX_info()
503 static int print_err_notifier(struct seq_file *file, struct tegra234_cbb *cbb, u32 status) in print_err_notifier() argument
510 cbb->fabric->name, status); in print_err_notifier()
514 unsigned int notifier = cbb->fabric->notifier_offset; in print_err_notifier()
519 writel(mask, cbb->regs + notifier + FABRIC_EN_CFG_ADDR_INDEX_0_0); in print_err_notifier()
520 hi = readl(cbb->regs + notifier + FABRIC_EN_CFG_ADDR_HI_0); in print_err_notifier()
521 lo = readl(cbb->regs + notifier + FABRIC_EN_CFG_ADDR_LOW_0); in print_err_notifier()
525 offset = addr - cbb->res->start; in print_err_notifier()
526 cbb->mon = cbb->regs + offset; in print_err_notifier()
527 cbb->mask = BIT(index); in print_err_notifier()
529 err = print_errmonX_info(file, cbb); in print_err_notifier()
530 tegra234_cbb_error_clear(&cbb->base); in print_err_notifier()
546 static int tegra234_cbb_debugfs_show(struct tegra_cbb *cbb, struct seq_file *file, void *data) in tegra234_cbb_debugfs_show() argument
552 list_for_each_entry(cbb, &cbb_list, node) { in tegra234_cbb_debugfs_show()
553 struct tegra234_cbb *priv = to_tegra234_cbb(cbb); in tegra234_cbb_debugfs_show()
575 struct tegra_cbb *cbb; in tegra234_cbb_isr() local
582 list_for_each_entry(cbb, &cbb_list, node) { in tegra234_cbb_isr()
583 struct tegra234_cbb *priv = to_tegra234_cbb(cbb); in tegra234_cbb_isr()
584 u32 status = tegra_cbb_get_status(cbb); in tegra234_cbb_isr()
615 static int tegra234_cbb_interrupt_enable(struct tegra_cbb *cbb) in tegra234_cbb_interrupt_enable() argument
617 struct tegra234_cbb *priv = to_tegra234_cbb(cbb); in tegra234_cbb_interrupt_enable()
620 int err = devm_request_irq(cbb->dev, priv->sec_irq, tegra234_cbb_isr, 0, in tegra234_cbb_interrupt_enable()
621 dev_name(cbb->dev), priv); in tegra234_cbb_interrupt_enable()
623 dev_err(cbb->dev, "failed to register interrupt %u: %d\n", priv->sec_irq, in tegra234_cbb_interrupt_enable()
632 static void tegra234_cbb_error_enable(struct tegra_cbb *cbb) in tegra234_cbb_error_enable() argument
634 tegra_cbb_fault_enable(cbb); in tegra234_cbb_error_enable()
1120 struct tegra234_cbb *cbb; in tegra234_cbb_probe() local
1138 cbb = devm_kzalloc(&pdev->dev, sizeof(*cbb), GFP_KERNEL); in tegra234_cbb_probe()
1139 if (!cbb) in tegra234_cbb_probe()
1142 INIT_LIST_HEAD(&cbb->base.node); in tegra234_cbb_probe()
1143 cbb->base.ops = &tegra234_cbb_ops; in tegra234_cbb_probe()
1144 cbb->base.dev = &pdev->dev; in tegra234_cbb_probe()
1145 cbb->fabric = fabric; in tegra234_cbb_probe()
1147 cbb->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &cbb->res); in tegra234_cbb_probe()
1148 if (IS_ERR(cbb->regs)) in tegra234_cbb_probe()
1149 return PTR_ERR(cbb->regs); in tegra234_cbb_probe()
1151 err = tegra_cbb_get_irq(pdev, NULL, &cbb->sec_irq); in tegra234_cbb_probe()
1155 platform_set_drvdata(pdev, cbb); in tegra234_cbb_probe()
1161 if (!tegra234_cbb_write_access_allowed(pdev, cbb)) { in tegra234_cbb_probe()
1167 list_add(&cbb->base.node, &cbb_list); in tegra234_cbb_probe()
1171 if (cbb->fabric->off_mask_erd) in tegra234_cbb_probe()
1172 tegra234_cbb_mask_serror(cbb); in tegra234_cbb_probe()
1174 return tegra_cbb_register(&cbb->base); in tegra234_cbb_probe()
1184 struct tegra234_cbb *cbb = dev_get_drvdata(dev); in tegra234_cbb_resume_noirq() local
1186 tegra234_cbb_error_enable(&cbb->base); in tegra234_cbb_resume_noirq()
1188 dev_dbg(dev, "%s resumed\n", cbb->fabric->name); in tegra234_cbb_resume_noirq()