Lines Matching +full:tegra20 +full:- +full:vi
1 // SPDX-License-Identifier: GPL-2.0-only
13 #include <dt-bindings/memory/tegra20-mc.h>
275 TEGRA20_MC_RESET(VI, 0x100, 0x178, 0x104, 14),
284 spin_lock_irqsave(&mc->lock, flags); in tegra20_mc_hotreset_assert()
286 value = mc_readl(mc, rst->reset); in tegra20_mc_hotreset_assert()
287 mc_writel(mc, value & ~BIT(rst->bit), rst->reset); in tegra20_mc_hotreset_assert()
289 spin_unlock_irqrestore(&mc->lock, flags); in tegra20_mc_hotreset_assert()
300 spin_lock_irqsave(&mc->lock, flags); in tegra20_mc_hotreset_deassert()
302 value = mc_readl(mc, rst->reset); in tegra20_mc_hotreset_deassert()
303 mc_writel(mc, value | BIT(rst->bit), rst->reset); in tegra20_mc_hotreset_deassert()
305 spin_unlock_irqrestore(&mc->lock, flags); in tegra20_mc_hotreset_deassert()
316 spin_lock_irqsave(&mc->lock, flags); in tegra20_mc_block_dma()
318 value = mc_readl(mc, rst->control) & ~BIT(rst->bit); in tegra20_mc_block_dma()
319 mc_writel(mc, value, rst->control); in tegra20_mc_block_dma()
321 spin_unlock_irqrestore(&mc->lock, flags); in tegra20_mc_block_dma()
329 return mc_readl(mc, rst->status) == 0; in tegra20_mc_dma_idling()
335 return (mc_readl(mc, rst->reset) & BIT(rst->bit)) == 0; in tegra20_mc_reset_status()
344 spin_lock_irqsave(&mc->lock, flags); in tegra20_mc_unblock_dma()
346 value = mc_readl(mc, rst->control) | BIT(rst->bit); in tegra20_mc_unblock_dma()
347 mc_writel(mc, value, rst->control); in tegra20_mc_unblock_dma()
349 spin_unlock_irqrestore(&mc->lock, flags); in tegra20_mc_unblock_dma()
377 * ISO clients need to reserve extra bandwidth up-front because in tegra20_mc_icc_aggreate()
395 unsigned int i, idx = spec->args[0]; in tegra20_mc_of_icc_xlate_extended()
399 list_for_each_entry(node, &mc->provider.nodes, node_list) { in tegra20_mc_of_icc_xlate_extended()
400 if (node->id != idx) in tegra20_mc_of_icc_xlate_extended()
405 return ERR_PTR(-ENOMEM); in tegra20_mc_of_icc_xlate_extended()
407 ndata->node = node; in tegra20_mc_of_icc_xlate_extended()
410 if (strstarts(node->name, "display") || in tegra20_mc_of_icc_xlate_extended()
411 strstarts(node->name, "vi")) in tegra20_mc_of_icc_xlate_extended()
412 ndata->tag = TEGRA_MC_ICC_TAG_ISO; in tegra20_mc_of_icc_xlate_extended()
414 ndata->tag = TEGRA_MC_ICC_TAG_DEFAULT; in tegra20_mc_of_icc_xlate_extended()
419 for (i = 0; i < mc->soc->num_clients; i++) { in tegra20_mc_of_icc_xlate_extended()
420 if (mc->soc->clients[i].id == idx) in tegra20_mc_of_icc_xlate_extended()
421 return ERR_PTR(-EPROBE_DEFER); in tegra20_mc_of_icc_xlate_extended()
424 dev_err(mc->dev, "invalid ICC client ID %u\n", idx); in tegra20_mc_of_icc_xlate_extended()
426 return ERR_PTR(-EINVAL); in tegra20_mc_of_icc_xlate_extended()
439 control = FIELD_PREP(MC_STAT_CONTROL_EVENT, g->event); in tegra20_mc_stat_gather_control()
440 control |= FIELD_PREP(MC_STAT_CONTROL_CLIENT_ID, g->client); in tegra20_mc_stat_gather_control()
441 control |= FIELD_PREP(MC_STAT_CONTROL_PRI_EVENT, g->pri_event); in tegra20_mc_stat_gather_control()
442 control |= FIELD_PREP(MC_STAT_CONTROL_FILTER_PRI, g->pri_filter); in tegra20_mc_stat_gather_control()
443 control |= FIELD_PREP(MC_STAT_CONTROL_FILTER_CLIENT_ENABLE, g->client_enb); in tegra20_mc_stat_gather_control()
451 const struct tegra_mc *mc = stat->mc; in tegra20_mc_stat_gather()
453 control_0 = tegra20_mc_stat_gather_control(&stat->gather0); in tegra20_mc_stat_gather()
454 control_1 = tegra20_mc_stat_gather_control(&stat->gather1); in tegra20_mc_stat_gather()
466 fsleep(stat->sample_time_usec); in tegra20_mc_stat_gather()
474 stat->gather0.result = DIV_ROUND_UP(count0, clocks); in tegra20_mc_stat_gather()
475 stat->gather1.result = DIV_ROUND_UP(count1, clocks); in tegra20_mc_stat_gather()
489 stat.gather0.client = client0 ? client0->id : 0; in tegra20_mc_stat_events()
495 stat.gather1.client = client1 ? client1->id : 0; in tegra20_mc_stat_events()
517 for (i = 0; i < mc->soc->num_clients; i += 2) { in tegra20_mc_collect_stats()
518 client0 = &mc->soc->clients[i]; in tegra20_mc_collect_stats()
519 client1 = &mc->soc->clients[i + 1]; in tegra20_mc_collect_stats()
521 if (i + 1 == mc->soc->num_clients) in tegra20_mc_collect_stats()
533 for (i = 0; i < mc->soc->num_clients; i++) { in tegra20_mc_collect_stats()
534 unsigned int clienta, clientb = mc->soc->num_clients; in tegra20_mc_collect_stats()
536 for (client0 = NULL; i < mc->soc->num_clients; i++) { in tegra20_mc_collect_stats()
538 client0 = &mc->soc->clients[i]; in tegra20_mc_collect_stats()
544 for (client1 = NULL; i < mc->soc->num_clients; i++) { in tegra20_mc_collect_stats()
546 client1 = &mc->soc->clients[i]; in tegra20_mc_collect_stats()
613 const struct tegra_mc *mc = dev_get_drvdata(s->private); in tegra20_mc_stats_show()
617 stats = kcalloc(mc->soc->num_clients + 1, sizeof(*stats), GFP_KERNEL); in tegra20_mc_stats_show()
619 return -ENOMEM; in tegra20_mc_stats_show()
628 …seq_puts(s, "-------------------------------------------------------------------------------------… in tegra20_mc_stats_show()
630 for (i = 0; i < mc->soc->num_clients; i++) { in tegra20_mc_stats_show()
631 seq_printf(s, "%-14s ", mc->soc->clients[i].name); in tegra20_mc_stats_show()
634 tegra20_mc_printf_percents(s, "%-9s", stats[i].events); in tegra20_mc_stats_show()
640 tegra20_mc_printf_percents(s, "%-10s", stats[i].arb_timeout); in tegra20_mc_stats_show()
643 * An event is generated based on the high-priority (HP) signal in tegra20_mc_stats_show()
646 tegra20_mc_printf_percents(s, "%-16s", stats[i].arb_high_prio); in tegra20_mc_stats_show()
652 tegra20_mc_printf_percents(s, "%-16s", stats[i].arb_bandwidth); in tegra20_mc_stats_show()
658 tegra20_mc_printf_percents(s, "%-12s", stats[i].rd_wr_change); in tegra20_mc_stats_show()
664 * will be counted (N-1) times. Large values for this event in tegra20_mc_stats_show()
668 tegra20_mc_printf_percents(s, "%-13s", stats[i].successive); in tegra20_mc_stats_show()
674 tegra20_mc_printf_percents(s, "%-12s\n", stats[i].page_miss); in tegra20_mc_stats_show()
684 debugfs_create_devm_seqfile(mc->dev, "stats", mc->debugfs.root, in tegra20_mc_probe()
694 if (IS_ENABLED(CONFIG_TEGRA_IOMMU_GART) && mc->gart) { in tegra20_mc_suspend()
695 err = tegra_gart_suspend(mc->gart); in tegra20_mc_suspend()
707 if (IS_ENABLED(CONFIG_TEGRA_IOMMU_GART) && mc->gart) { in tegra20_mc_resume()
708 err = tegra_gart_resume(mc->gart); in tegra20_mc_resume()
723 status = mc_readl(mc, MC_INTSTATUS) & mc->soc->intmask; in tegra20_mc_handle_irq()
740 id = value & mc->soc->client_id_mask; in tegra20_mc_handle_irq()
751 id = (value >> 1) & mc->soc->client_id_mask; in tegra20_mc_handle_irq()
762 id = value & mc->soc->client_id_mask; in tegra20_mc_handle_irq()
775 client = mc->soc->clients[id].name; in tegra20_mc_handle_irq()
778 dev_err_ratelimited(mc->dev, "%s: %s%s @%pa: %s (%s)\n", in tegra20_mc_handle_irq()