]>
Commit | Line | Data |
---|---|---|
caf70922 WG |
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 | ||
d678a59d | 8 | #include <common.h> |
caf70922 WG |
9 | #include <dm.h> |
10 | #include <errno.h> | |
11 | #include <sysreset.h> | |
12 | #include <reset.h> | |
13 | ||
14 | struct resetctl_reboot_priv { | |
15 | struct reset_ctl_bulk resets; | |
16 | }; | |
17 | ||
18 | static 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 | ||
25 | static struct sysreset_ops resetctl_reboot_ops = { | |
26 | .request = resetctl_reboot_request, | |
27 | }; | |
28 | ||
30ba45db | 29 | static int resetctl_reboot_probe(struct udevice *dev) |
caf70922 WG |
30 | { |
31 | struct resetctl_reboot_priv *priv = dev_get_priv(dev); | |
32 | ||
33 | return reset_get_bulk(dev, &priv->resets); | |
34 | } | |
35 | ||
36 | static const struct udevice_id resetctl_reboot_ids[] = { | |
37 | { .compatible = "resetctl-reboot" }, | |
38 | { } | |
39 | }; | |
40 | ||
41 | U_BOOT_DRIVER(resetctl_reboot) = { | |
42 | .id = UCLASS_SYSRESET, | |
43 | .name = "resetctl_reboot", | |
44 | .of_match = resetctl_reboot_ids, | |
45 | .ops = &resetctl_reboot_ops, | |
41575d8e | 46 | .priv_auto = sizeof(struct resetctl_reboot_priv), |
caf70922 WG |
47 | .probe = resetctl_reboot_probe, |
48 | }; |