Lines Matching +full:stm +full:- +full:base
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved
25 #include <soc/tegra/tegra-cbb.h>
108 struct tegra_cbb base; member
130 return container_of(cbb, struct tegra234_cbb, base); in to_tegra234_cbb()
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()
144 dev_info(&pdev->dev, "SoC data missing for firewall\n"); 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()
150 dev_err(&pdev->dev, "wrong firewall offset value\n"); 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()
179 addr = priv->regs + priv->fabric->notifier_offset; in tegra234_cbb_fault_enable()
188 writel(0x3f, priv->mon + FABRIC_MN_MASTER_ERR_STATUS_0); in tegra234_cbb_error_clear()
198 addr = priv->regs + priv->fabric->notifier_offset; in tegra234_cbb_get_status()
207 writel(0x1, cbb->regs + cbb->fabric->off_mask_erd); in tegra234_cbb_mask_serror()
226 void __iomem *base) in tegra234_cbb_lookup_apbslv() argument
233 status = tegra234_cbb_get_tmo_slv(base); in tegra234_cbb_lookup_apbslv()
241 addr = base + APB_BLOCK_NUM_TMO_OFFSET + (block * 4); in tegra234_cbb_lookup_apbslv()
268 const struct tegra234_slave_lookup *map = cbb->fabric->slave_map; in tegra234_lookup_slave_timeout()
281 * <FABRIC>_SN_AXI2APB_<>_BLOCK<index-set-bit>_TMO_0. in tegra234_lookup_slave_timeout()
285 * e) Goto step-a till all bits are set. in tegra234_lookup_slave_timeout()
288 addr = cbb->regs + map[slave_id].offset; in tegra234_lookup_slave_timeout()
313 if (status & (status - 1)) in tegra234_cbb_print_error()
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()
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()
408 strcpy(fabric_name, "psc-fabric"); in print_errlog_err()
410 strcpy(fabric_name, "fsi-fabric"); 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()
445 tegra_cbb_print_err(file, "\t Slave\t\t\t: %s\n", cbb->fabric->slave_map[slave_id].name); in print_errlog_err()
452 status = readl(cbb->mon + FABRIC_MN_MASTER_ERR_STATUS_0); in print_errmonX_info()
455 return -ENODATA; in print_errmonX_info()
460 return -EINVAL; in print_errmonX_info()
463 overflow = readl(cbb->mon + FABRIC_MN_MASTER_ERR_OVERFLOW_STATUS_0); in print_errmonX_info()
467 error = readl(cbb->mon + FABRIC_MN_MASTER_LOG_ERR_STATUS_0); in print_errmonX_info()
470 return -EINVAL; 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()
492 cbb->type++; in print_errmonX_info()
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()
526 tegra234_cbb_error_clear(&cbb->base); in print_err_notifier()
552 status = tegra_cbb_get_status(&priv->base); in tegra234_cbb_debugfs_show()
582 if (status && (irq == priv->sec_irq)) { in tegra234_cbb_isr()
584 smp_processor_id(), priv->fabric->name, in tegra234_cbb_isr()
585 priv->res->start, irq); in tegra234_cbb_isr()
594 if (priv->fabric->off_mask_erd) { in tegra234_cbb_isr()
595 mstr_id = FIELD_GET(USRBITS_MSTR_ID, priv->mn_user_bits); in tegra234_cbb_isr()
615 if (priv->sec_irq) { 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()
703 .name = "aon-fabric",
724 .name = "bpmp-fabric",
741 { "STM", 0x44000 },
801 .name = "cbb-fabric",
824 .name = "dce-fabric",
837 .name = "rce-fabric",
850 .name = "sce-fabric",
988 { "STM", 0x5e000 },
1034 .name = "cbb-fabric",
1059 .name = "bpmp-fabric",
1072 { .compatible = "nvidia,tegra234-cbb-fabric", .data = &tegra234_cbb_fabric },
1073 { .compatible = "nvidia,tegra234-aon-fabric", .data = &tegra234_aon_fabric },
1074 { .compatible = "nvidia,tegra234-bpmp-fabric", .data = &tegra234_bpmp_fabric },
1075 { .compatible = "nvidia,tegra234-dce-fabric", .data = &tegra234_dce_fabric },
1076 { .compatible = "nvidia,tegra234-rce-fabric", .data = &tegra234_rce_fabric },
1077 { .compatible = "nvidia,tegra234-sce-fabric", .data = &tegra234_sce_fabric },
1099 for (entry = tegra234_cbb_acpi_uids; entry->hid; entry++) { in tegra234_cbb_acpi_get_fabric()
1100 if (acpi_dev_hid_uid_match(adev, entry->hid, entry->uid)) in tegra234_cbb_acpi_get_fabric()
1101 return entry->fabric; in tegra234_cbb_acpi_get_fabric()
1120 if (pdev->dev.of_node) { in tegra234_cbb_probe()
1121 fabric = of_device_get_match_data(&pdev->dev); in tegra234_cbb_probe()
1123 struct acpi_device *device = ACPI_COMPANION(&pdev->dev); in tegra234_cbb_probe()
1125 return -ENODEV; in tegra234_cbb_probe()
1129 dev_err(&pdev->dev, "no device match found\n"); in tegra234_cbb_probe()
1130 return -ENODEV; in tegra234_cbb_probe()
1134 cbb = devm_kzalloc(&pdev->dev, sizeof(*cbb), GFP_KERNEL); in tegra234_cbb_probe()
1136 return -ENOMEM; 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()
1158 dev_info(&pdev->dev, "error reporting not enabled due to firewall\n"); 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()
1170 return tegra_cbb_register(&cbb->base); in tegra234_cbb_probe()
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",