"Das U-Boot" Source Tree
1// 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 <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
28static int resetctl_reboot_probe(struct udevice *dev)
29{
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,
45 .priv_auto = sizeof(struct resetctl_reboot_priv),
46 .probe = resetctl_reboot_probe,
47};