Lines Matching defs:bpmp

12 #include <soc/tegra/bpmp.h>
13 #include <soc/tegra/bpmp-abi.h>
16 #include "bpmp-private.h"
82 static int tegra186_bpmp_ring_doorbell(struct tegra_bpmp *bpmp)
84 struct tegra186_bpmp *priv = bpmp->priv;
98 struct tegra_bpmp *bpmp = data;
99 struct tegra186_bpmp *priv = bpmp->priv;
104 tegra186_bpmp_ring_doorbell(bpmp);
108 struct tegra_bpmp *bpmp,
111 struct tegra186_bpmp *priv = bpmp->priv;
117 channel->ivc = devm_kzalloc(bpmp->dev, sizeof(*channel->ivc),
136 bpmp);
138 dev_err(bpmp->dev, "failed to setup IVC for channel %u: %d\n",
144 channel->bpmp = bpmp;
166 struct tegra_bpmp *bpmp = mbox_client_to_bpmp(client);
168 tegra_bpmp_handle_rx(bpmp);
171 static void tegra186_bpmp_teardown_channels(struct tegra_bpmp *bpmp)
173 struct tegra186_bpmp *priv = bpmp->priv;
176 for (i = 0; i < bpmp->threaded.count; i++) {
177 if (!bpmp->threaded_channels[i].bpmp)
180 tegra186_bpmp_channel_cleanup(&bpmp->threaded_channels[i]);
183 tegra186_bpmp_channel_cleanup(bpmp->rx_channel);
184 tegra186_bpmp_channel_cleanup(bpmp->tx_channel);
192 static int tegra186_bpmp_dram_init(struct tegra_bpmp *bpmp)
194 struct tegra186_bpmp *priv = bpmp->priv;
200 np = of_parse_phandle(bpmp->dev->of_node, "memory-region", 0);
206 dev_warn(bpmp->dev, "failed to parse memory region: %d\n", err);
213 dev_warn(bpmp->dev, "DRAM region must be larger than 8 KiB\n");
220 priv->tx.dram = devm_memremap(bpmp->dev, priv->tx.phys, size,
224 dev_warn(bpmp->dev, "failed to map DRAM region: %d\n", err);
233 static int tegra186_bpmp_sram_init(struct tegra_bpmp *bpmp)
235 struct tegra186_bpmp *priv = bpmp->priv;
238 priv->tx.pool = of_gen_pool_get(bpmp->dev->of_node, "shmem", 0);
240 dev_err(bpmp->dev, "TX shmem pool not found\n");
247 dev_err(bpmp->dev, "failed to allocate from TX pool\n");
251 priv->rx.pool = of_gen_pool_get(bpmp->dev->of_node, "shmem", 1);
253 dev_err(bpmp->dev, "RX shmem pool not found\n");
261 dev_err(bpmp->dev, "failed to allocate from RX pool\n");
274 static int tegra186_bpmp_setup_channels(struct tegra_bpmp *bpmp)
279 err = tegra186_bpmp_dram_init(bpmp);
281 err = tegra186_bpmp_sram_init(bpmp);
286 err = tegra186_bpmp_channel_init(bpmp->tx_channel, bpmp,
287 bpmp->soc->channels.cpu_tx.offset);
291 err = tegra186_bpmp_channel_init(bpmp->rx_channel, bpmp,
292 bpmp->soc->channels.cpu_rx.offset);
294 tegra186_bpmp_channel_cleanup(bpmp->tx_channel);
298 for (i = 0; i < bpmp->threaded.count; i++) {
299 unsigned int index = bpmp->soc->channels.thread.offset + i;
301 err = tegra186_bpmp_channel_init(&bpmp->threaded_channels[i],
302 bpmp, index);
308 tegra186_bpmp_teardown_channels(bpmp);
313 static void tegra186_bpmp_reset_channels(struct tegra_bpmp *bpmp)
318 tegra186_bpmp_channel_reset(bpmp->tx_channel);
319 tegra186_bpmp_channel_reset(bpmp->rx_channel);
321 for (i = 0; i < bpmp->threaded.count; i++)
322 tegra186_bpmp_channel_reset(&bpmp->threaded_channels[i]);
325 static int tegra186_bpmp_init(struct tegra_bpmp *bpmp)
330 priv = devm_kzalloc(bpmp->dev, sizeof(*priv), GFP_KERNEL);
334 priv->parent = bpmp;
335 bpmp->priv = priv;
337 err = tegra186_bpmp_setup_channels(bpmp);
342 priv->mbox.client.dev = bpmp->dev;
350 dev_err(bpmp->dev, "failed to get HSP mailbox: %d\n", err);
351 tegra186_bpmp_teardown_channels(bpmp);
355 tegra186_bpmp_reset_channels(bpmp);
360 static void tegra186_bpmp_deinit(struct tegra_bpmp *bpmp)
362 struct tegra186_bpmp *priv = bpmp->priv;
366 tegra186_bpmp_teardown_channels(bpmp);
369 static int tegra186_bpmp_resume(struct tegra_bpmp *bpmp)
371 tegra186_bpmp_reset_channels(bpmp);