blob: e37d6c91ef404a21bf789eecd0dd81b79537ee0a [file] [log] [blame]
Stephen Warren6488e642016-06-17 09:43:59 -06001/*
2 * Copyright (c) 2016, NVIDIA CORPORATION.
3 *
4 * SPDX-License-Identifier: GPL-2.0
5 */
6
7#include <common.h>
8#include <dm.h>
9#include <reset.h>
10#include <asm/io.h>
11#include <asm/reset.h>
12
13struct sandbox_reset_test {
14 struct reset_ctl ctl;
15};
16
17int sandbox_reset_test_get(struct udevice *dev)
18{
19 struct sandbox_reset_test *sbrt = dev_get_priv(dev);
20
21 return reset_get_by_name(dev, "test", &sbrt->ctl);
22}
23
24int sandbox_reset_test_assert(struct udevice *dev)
25{
26 struct sandbox_reset_test *sbrt = dev_get_priv(dev);
27
28 return reset_assert(&sbrt->ctl);
29}
30
31int sandbox_reset_test_deassert(struct udevice *dev)
32{
33 struct sandbox_reset_test *sbrt = dev_get_priv(dev);
34
35 return reset_deassert(&sbrt->ctl);
36}
37
38int sandbox_reset_test_free(struct udevice *dev)
39{
40 struct sandbox_reset_test *sbrt = dev_get_priv(dev);
41
42 return reset_free(&sbrt->ctl);
43}
44
45static const struct udevice_id sandbox_reset_test_ids[] = {
46 { .compatible = "sandbox,reset-ctl-test" },
47 { }
48};
49
50U_BOOT_DRIVER(sandbox_reset_test) = {
51 .name = "sandbox_reset_test",
52 .id = UCLASS_MISC,
53 .of_match = sandbox_reset_test_ids,
54 .priv_auto_alloc_size = sizeof(struct sandbox_reset_test),
55};