blob: fbe3999b96059120245de3065d88cea5281819e9 [file] [log] [blame]
developer1aa30892020-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
developer1aa30892020-04-21 09:28:29 +02008#include <dm.h>
9#include <errno.h>
10#include <sysreset.h>
11#include <reset.h>
12
13struct resetctl_reboot_priv {
14 struct reset_ctl_bulk resets;
15};
16
17static int resetctl_reboot_request(struct udevice *dev, enum sysreset_t type)
18{
19 struct resetctl_reboot_priv *priv = dev_get_priv(dev);
20
21 return reset_assert_bulk(&priv->resets);
22}
23
24static struct sysreset_ops resetctl_reboot_ops = {
25 .request = resetctl_reboot_request,
26};
27
Samuel Holland83e32fa2021-11-03 22:55:12 -050028static int resetctl_reboot_probe(struct udevice *dev)
developer1aa30892020-04-21 09:28:29 +020029{
30 struct resetctl_reboot_priv *priv = dev_get_priv(dev);
31
32 return reset_get_bulk(dev, &priv->resets);
33}
34
35static const struct udevice_id resetctl_reboot_ids[] = {
36 { .compatible = "resetctl-reboot" },
37 { }
38};
39
40U_BOOT_DRIVER(resetctl_reboot) = {
41 .id = UCLASS_SYSRESET,
42 .name = "resetctl_reboot",
43 .of_match = resetctl_reboot_ids,
44 .ops = &resetctl_reboot_ops,
Simon Glass8a2b47f2020-12-03 16:55:17 -070045 .priv_auto = sizeof(struct resetctl_reboot_priv),
developer1aa30892020-04-21 09:28:29 +020046 .probe = resetctl_reboot_probe,
47};