blob: f0ceaa048357157f3c7e40626dfb6d9df86e412c [file] [log] [blame]
Stephen Warren4581b712016-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;
Neil Armstrong91f5f8b2018-04-03 11:40:51 +020015 struct reset_ctl_bulk bulk;
Stephen Warren4581b712016-06-17 09:43:59 -060016};
17
18int sandbox_reset_test_get(struct udevice *dev)
19{
20 struct sandbox_reset_test *sbrt = dev_get_priv(dev);
21
22 return reset_get_by_name(dev, "test", &sbrt->ctl);
23}
24
Neil Armstrong91f5f8b2018-04-03 11:40:51 +020025int sandbox_reset_test_get_bulk(struct udevice *dev)
26{
27 struct sandbox_reset_test *sbrt = dev_get_priv(dev);
28
29 return reset_get_bulk(dev, &sbrt->bulk);
30}
31
Stephen Warren4581b712016-06-17 09:43:59 -060032int sandbox_reset_test_assert(struct udevice *dev)
33{
34 struct sandbox_reset_test *sbrt = dev_get_priv(dev);
35
36 return reset_assert(&sbrt->ctl);
37}
38
Neil Armstrong91f5f8b2018-04-03 11:40:51 +020039int sandbox_reset_test_assert_bulk(struct udevice *dev)
40{
41 struct sandbox_reset_test *sbrt = dev_get_priv(dev);
42
43 return reset_assert_bulk(&sbrt->bulk);
44}
45
Stephen Warren4581b712016-06-17 09:43:59 -060046int sandbox_reset_test_deassert(struct udevice *dev)
47{
48 struct sandbox_reset_test *sbrt = dev_get_priv(dev);
49
50 return reset_deassert(&sbrt->ctl);
51}
52
Neil Armstrong91f5f8b2018-04-03 11:40:51 +020053int sandbox_reset_test_deassert_bulk(struct udevice *dev)
54{
55 struct sandbox_reset_test *sbrt = dev_get_priv(dev);
56
57 return reset_deassert_bulk(&sbrt->bulk);
58}
59
Stephen Warren4581b712016-06-17 09:43:59 -060060int sandbox_reset_test_free(struct udevice *dev)
61{
62 struct sandbox_reset_test *sbrt = dev_get_priv(dev);
63
64 return reset_free(&sbrt->ctl);
65}
66
Neil Armstrong91f5f8b2018-04-03 11:40:51 +020067int sandbox_reset_test_release_bulk(struct udevice *dev)
68{
69 struct sandbox_reset_test *sbrt = dev_get_priv(dev);
70
71 return reset_release_bulk(&sbrt->bulk);
72}
73
Stephen Warren4581b712016-06-17 09:43:59 -060074static const struct udevice_id sandbox_reset_test_ids[] = {
75 { .compatible = "sandbox,reset-ctl-test" },
76 { }
77};
78
79U_BOOT_DRIVER(sandbox_reset_test) = {
80 .name = "sandbox_reset_test",
81 .id = UCLASS_MISC,
82 .of_match = sandbox_reset_test_ids,
83 .priv_auto_alloc_size = sizeof(struct sandbox_reset_test),
84};