1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2016, NVIDIA CORPORATION.
9 #include <reset-uclass.h>
10 #include <asm/arch-tegra/bpmp_abi.h>
12 static int tegra186_reset_request(struct reset_ctl *reset_ctl)
14 debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl,
15 reset_ctl->dev, reset_ctl->id);
20 static int tegra186_reset_free(struct reset_ctl *reset_ctl)
22 debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl,
23 reset_ctl->dev, reset_ctl->id);
28 static int tegra186_reset_common(struct reset_ctl *reset_ctl,
29 enum mrq_reset_commands cmd)
31 struct mrq_reset_request req;
35 req.reset_id = reset_ctl->id;
37 ret = misc_call(reset_ctl->dev->parent, MRQ_RESET, &req, sizeof(req),
45 static int tegra186_reset_assert(struct reset_ctl *reset_ctl)
47 debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl,
48 reset_ctl->dev, reset_ctl->id);
50 return tegra186_reset_common(reset_ctl, CMD_RESET_ASSERT);
53 static int tegra186_reset_deassert(struct reset_ctl *reset_ctl)
55 debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl,
56 reset_ctl->dev, reset_ctl->id);
58 return tegra186_reset_common(reset_ctl, CMD_RESET_DEASSERT);
61 struct reset_ops tegra186_reset_ops = {
62 .request = tegra186_reset_request,
63 .free = tegra186_reset_free,
64 .rst_assert = tegra186_reset_assert,
65 .rst_deassert = tegra186_reset_deassert,
68 static int tegra186_reset_probe(struct udevice *dev)
70 debug("%s(dev=%p)\n", __func__, dev);
75 U_BOOT_DRIVER(tegra186_reset) = {
76 .name = "tegra186_reset",
78 .probe = tegra186_reset_probe,
79 .ops = &tegra186_reset_ops,