Lines Matching +full:tegra186 +full:- +full:mc
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2017-2021 NVIDIA CORPORATION. All rights reserved.
14 #include <soc/tegra/mc.h>
17 #include <dt-bindings/memory/tegra186-mc.h>
20 #include "mc.h"
26 static int tegra186_mc_probe(struct tegra_mc *mc) in tegra186_mc_probe() argument
28 struct platform_device *pdev = to_platform_device(mc->dev); in tegra186_mc_probe()
33 mc->bcast_ch_regs = devm_platform_ioremap_resource_byname(pdev, "broadcast"); in tegra186_mc_probe()
34 if (IS_ERR(mc->bcast_ch_regs)) { in tegra186_mc_probe()
35 if (PTR_ERR(mc->bcast_ch_regs) == -EINVAL) { in tegra186_mc_probe()
36 dev_warn(&pdev->dev, in tegra186_mc_probe()
37 "Broadcast channel is missing, please update your device-tree\n"); in tegra186_mc_probe()
38 mc->bcast_ch_regs = NULL; in tegra186_mc_probe()
42 return PTR_ERR(mc->bcast_ch_regs); in tegra186_mc_probe()
45 mc->ch_regs = devm_kcalloc(mc->dev, mc->soc->num_channels, sizeof(*mc->ch_regs), in tegra186_mc_probe()
47 if (!mc->ch_regs) in tegra186_mc_probe()
48 return -ENOMEM; in tegra186_mc_probe()
50 for (i = 0; i < mc->soc->num_channels; i++) { in tegra186_mc_probe()
53 mc->ch_regs[i] = devm_platform_ioremap_resource_byname(pdev, name); in tegra186_mc_probe()
54 if (IS_ERR(mc->ch_regs[i])) in tegra186_mc_probe()
55 return PTR_ERR(mc->ch_regs[i]); in tegra186_mc_probe()
59 err = of_platform_populate(mc->dev->of_node, NULL, NULL, mc->dev); in tegra186_mc_probe()
66 static void tegra186_mc_remove(struct tegra_mc *mc) in tegra186_mc_remove() argument
68 of_platform_depopulate(mc->dev); in tegra186_mc_remove()
72 static void tegra186_mc_client_sid_override(struct tegra_mc *mc, in tegra186_mc_client_sid_override() argument
78 if (client->regs.sid.security == 0 && client->regs.sid.override == 0) in tegra186_mc_client_sid_override()
81 value = readl(mc->regs + client->regs.sid.security); in tegra186_mc_client_sid_override()
100 writel(value, mc->regs + client->regs.sid.security); in tegra186_mc_client_sid_override()
103 value = readl(mc->regs + client->regs.sid.override); in tegra186_mc_client_sid_override()
107 dev_dbg(mc->dev, "overriding SID %x for %s with %x\n", old, in tegra186_mc_client_sid_override()
108 client->name, sid); in tegra186_mc_client_sid_override()
109 writel(sid, mc->regs + client->regs.sid.override); in tegra186_mc_client_sid_override()
114 static int tegra186_mc_probe_device(struct tegra_mc *mc, struct device *dev) in tegra186_mc_probe_device() argument
124 while (!of_parse_phandle_with_args(dev->of_node, "interconnects", "#interconnect-cells", in tegra186_mc_probe_device()
126 if (args.np == mc->dev->of_node && args.args_count != 0) { in tegra186_mc_probe_device()
127 for (i = 0; i < mc->soc->num_clients; i++) { in tegra186_mc_probe_device()
128 const struct tegra_mc_client *client = &mc->soc->clients[i]; in tegra186_mc_probe_device()
130 if (client->id == args.args[0]) in tegra186_mc_probe_device()
132 mc, client, in tegra186_mc_probe_device()
144 static int tegra186_mc_resume(struct tegra_mc *mc) in tegra186_mc_resume() argument
149 for (i = 0; i < mc->soc->num_clients; i++) { in tegra186_mc_resume()
150 const struct tegra_mc_client *client = &mc->soc->clients[i]; in tegra186_mc_resume()
152 tegra186_mc_client_sid_override(mc, client, client->sid); in tegra186_mc_resume()