Lines Matching +full:tegra20 +full:- +full:isp
1 // SPDX-License-Identifier: GPL-2.0-only
14 #include <dt-bindings/memory/tegra20-mc.h>
268 TEGRA20_MC_RESET(ISP, 0x100, 0x158, 0x104, 6),
285 spin_lock_irqsave(&mc->lock, flags); in tegra20_mc_hotreset_assert()
287 value = mc_readl(mc, rst->reset); in tegra20_mc_hotreset_assert()
288 mc_writel(mc, value & ~BIT(rst->bit), rst->reset); in tegra20_mc_hotreset_assert()
290 spin_unlock_irqrestore(&mc->lock, flags); in tegra20_mc_hotreset_assert()
301 spin_lock_irqsave(&mc->lock, flags); in tegra20_mc_hotreset_deassert()
303 value = mc_readl(mc, rst->reset); in tegra20_mc_hotreset_deassert()
304 mc_writel(mc, value | BIT(rst->bit), rst->reset); in tegra20_mc_hotreset_deassert()
306 spin_unlock_irqrestore(&mc->lock, flags); in tegra20_mc_hotreset_deassert()
317 spin_lock_irqsave(&mc->lock, flags); in tegra20_mc_block_dma()
319 value = mc_readl(mc, rst->control) & ~BIT(rst->bit); in tegra20_mc_block_dma()
320 mc_writel(mc, value, rst->control); in tegra20_mc_block_dma()
322 spin_unlock_irqrestore(&mc->lock, flags); in tegra20_mc_block_dma()
330 return mc_readl(mc, rst->status) == 0; in tegra20_mc_dma_idling()
336 return (mc_readl(mc, rst->reset) & BIT(rst->bit)) == 0; in tegra20_mc_reset_status()
345 spin_lock_irqsave(&mc->lock, flags); in tegra20_mc_unblock_dma()
347 value = mc_readl(mc, rst->control) | BIT(rst->bit); in tegra20_mc_unblock_dma()
348 mc_writel(mc, value, rst->control); in tegra20_mc_unblock_dma()
350 spin_unlock_irqrestore(&mc->lock, flags); in tegra20_mc_unblock_dma()
378 * ISO clients need to reserve extra bandwidth up-front because in tegra20_mc_icc_aggreate()
396 unsigned int i, idx = spec->args[0]; in tegra20_mc_of_icc_xlate_extended()
400 list_for_each_entry(node, &mc->provider.nodes, node_list) { in tegra20_mc_of_icc_xlate_extended()
401 if (node->id != idx) in tegra20_mc_of_icc_xlate_extended()
406 return ERR_PTR(-ENOMEM); in tegra20_mc_of_icc_xlate_extended()
408 ndata->node = node; in tegra20_mc_of_icc_xlate_extended()
411 if (strstarts(node->name, "display") || in tegra20_mc_of_icc_xlate_extended()
412 strstarts(node->name, "vi")) in tegra20_mc_of_icc_xlate_extended()
413 ndata->tag = TEGRA_MC_ICC_TAG_ISO; in tegra20_mc_of_icc_xlate_extended()
415 ndata->tag = TEGRA_MC_ICC_TAG_DEFAULT; in tegra20_mc_of_icc_xlate_extended()
420 for (i = 0; i < mc->soc->num_clients; i++) { in tegra20_mc_of_icc_xlate_extended()
421 if (mc->soc->clients[i].id == idx) in tegra20_mc_of_icc_xlate_extended()
422 return ERR_PTR(-EPROBE_DEFER); in tegra20_mc_of_icc_xlate_extended()
425 dev_err(mc->dev, "invalid ICC client ID %u\n", idx); in tegra20_mc_of_icc_xlate_extended()
427 return ERR_PTR(-EINVAL); in tegra20_mc_of_icc_xlate_extended()
440 control = FIELD_PREP(MC_STAT_CONTROL_EVENT, g->event); in tegra20_mc_stat_gather_control()
441 control |= FIELD_PREP(MC_STAT_CONTROL_CLIENT_ID, g->client); in tegra20_mc_stat_gather_control()
442 control |= FIELD_PREP(MC_STAT_CONTROL_PRI_EVENT, g->pri_event); in tegra20_mc_stat_gather_control()
443 control |= FIELD_PREP(MC_STAT_CONTROL_FILTER_PRI, g->pri_filter); in tegra20_mc_stat_gather_control()
444 control |= FIELD_PREP(MC_STAT_CONTROL_FILTER_CLIENT_ENABLE, g->client_enb); in tegra20_mc_stat_gather_control()
452 const struct tegra_mc *mc = stat->mc; in tegra20_mc_stat_gather()
454 control_0 = tegra20_mc_stat_gather_control(&stat->gather0); in tegra20_mc_stat_gather()
455 control_1 = tegra20_mc_stat_gather_control(&stat->gather1); in tegra20_mc_stat_gather()
467 fsleep(stat->sample_time_usec); in tegra20_mc_stat_gather()
475 stat->gather0.result = DIV_ROUND_UP(count0, clocks); in tegra20_mc_stat_gather()
476 stat->gather1.result = DIV_ROUND_UP(count1, clocks); in tegra20_mc_stat_gather()
490 stat.gather0.client = client0 ? client0->id : 0; in tegra20_mc_stat_events()
496 stat.gather1.client = client1 ? client1->id : 0; in tegra20_mc_stat_events()
518 for (i = 0; i < mc->soc->num_clients; i += 2) { in tegra20_mc_collect_stats()
519 client0 = &mc->soc->clients[i]; in tegra20_mc_collect_stats()
520 client1 = &mc->soc->clients[i + 1]; in tegra20_mc_collect_stats()
522 if (i + 1 == mc->soc->num_clients) in tegra20_mc_collect_stats()
534 for (i = 0; i < mc->soc->num_clients; i++) { in tegra20_mc_collect_stats()
535 unsigned int clienta, clientb = mc->soc->num_clients; in tegra20_mc_collect_stats()
537 for (client0 = NULL; i < mc->soc->num_clients; i++) { in tegra20_mc_collect_stats()
539 client0 = &mc->soc->clients[i]; in tegra20_mc_collect_stats()
545 for (client1 = NULL; i < mc->soc->num_clients; i++) { in tegra20_mc_collect_stats()
547 client1 = &mc->soc->clients[i]; in tegra20_mc_collect_stats()
614 const struct tegra_mc *mc = dev_get_drvdata(s->private); in tegra20_mc_stats_show()
618 stats = kcalloc(mc->soc->num_clients + 1, sizeof(*stats), GFP_KERNEL); in tegra20_mc_stats_show()
620 return -ENOMEM; in tegra20_mc_stats_show()
629 …seq_puts(s, "-------------------------------------------------------------------------------------… in tegra20_mc_stats_show()
631 for (i = 0; i < mc->soc->num_clients; i++) { in tegra20_mc_stats_show()
632 seq_printf(s, "%-14s ", mc->soc->clients[i].name); in tegra20_mc_stats_show()
635 tegra20_mc_printf_percents(s, "%-9s", stats[i].events); in tegra20_mc_stats_show()
641 tegra20_mc_printf_percents(s, "%-10s", stats[i].arb_timeout); in tegra20_mc_stats_show()
644 * An event is generated based on the high-priority (HP) signal in tegra20_mc_stats_show()
647 tegra20_mc_printf_percents(s, "%-16s", stats[i].arb_high_prio); in tegra20_mc_stats_show()
653 tegra20_mc_printf_percents(s, "%-16s", stats[i].arb_bandwidth); in tegra20_mc_stats_show()
659 tegra20_mc_printf_percents(s, "%-12s", stats[i].rd_wr_change); in tegra20_mc_stats_show()
665 * will be counted (N-1) times. Large values for this event in tegra20_mc_stats_show()
669 tegra20_mc_printf_percents(s, "%-13s", stats[i].successive); in tegra20_mc_stats_show()
675 tegra20_mc_printf_percents(s, "%-12s\n", stats[i].page_miss); in tegra20_mc_stats_show()
685 debugfs_create_devm_seqfile(mc->dev, "stats", mc->debugfs.root, in tegra20_mc_probe()
698 status = mc_readl(mc, MC_INTSTATUS) & mc->soc->intmask; in tegra20_mc_handle_irq()
715 id = value & mc->soc->client_id_mask; in tegra20_mc_handle_irq()
726 id = (value >> 1) & mc->soc->client_id_mask; in tegra20_mc_handle_irq()
737 id = value & mc->soc->client_id_mask; in tegra20_mc_handle_irq()
750 client = mc->soc->clients[id].name; in tegra20_mc_handle_irq()
753 dev_err_ratelimited(mc->dev, "%s: %s%s @%pa: %s (%s)\n", in tegra20_mc_handle_irq()