blob: 25bd5c9a7ff2725a705783e203f877f6d3fa6646 [file] [log] [blame]
Weijie Gaocaf70922020-04-21 09:28:29 +02001// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2020 MediaTek Inc.
4 *
5 * Author: Weijie Gao <weijie.gao@mediatek.com>
6 */
7
8#include <common.h>
9#include <dm.h>
10#include <errno.h>
11#include <sysreset.h>
12#include <reset.h>
13
14struct resetctl_reboot_priv {
15 struct reset_ctl_bulk resets;
16};
17
18static int resetctl_reboot_request(struct udevice *dev, enum sysreset_t type)
19{
20 struct resetctl_reboot_priv *priv = dev_get_priv(dev);
21
22 return reset_assert_bulk(&priv->resets);
23}
24
25static struct sysreset_ops resetctl_reboot_ops = {
26 .request = resetctl_reboot_request,
27};
28
Samuel Holland30ba45d2021-11-03 22:55:12 -050029static int resetctl_reboot_probe(struct udevice *dev)
Weijie Gaocaf70922020-04-21 09:28:29 +020030{
31 struct resetctl_reboot_priv *priv = dev_get_priv(dev);
32
33 return reset_get_bulk(dev, &priv->resets);
34}
35
36static const struct udevice_id resetctl_reboot_ids[] = {
37 { .compatible = "resetctl-reboot" },
38 { }
39};
40
41U_BOOT_DRIVER(resetctl_reboot) = {
42 .id = UCLASS_SYSRESET,
43 .name = "resetctl_reboot",
44 .of_match = resetctl_reboot_ids,
45 .ops = &resetctl_reboot_ops,
Simon Glass41575d82020-12-03 16:55:17 -070046 .priv_auto = sizeof(struct resetctl_reboot_priv),
Weijie Gaocaf70922020-04-21 09:28:29 +020047 .probe = resetctl_reboot_probe,
48};