blob: 95ce2ca1171fede219e280a8a4d6d40e40689c84 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0
Stephen Warren4581b712016-06-17 09:43:59 -06002/*
3 * Copyright (c) 2016, NVIDIA CORPORATION.
Stephen Warren4581b712016-06-17 09:43:59 -06004 */
5
6#include <common.h>
7#include <dm.h>
8#include <reset.h>
9#include <asm/io.h>
10#include <asm/reset.h>
11
12struct sandbox_reset_test {
13 struct reset_ctl ctl;
Neil Armstrong91f5f8b2018-04-03 11:40:51 +020014 struct reset_ctl_bulk bulk;
Stephen Warren4581b712016-06-17 09:43:59 -060015};
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
Neil Armstrong91f5f8b2018-04-03 11:40:51 +020024int sandbox_reset_test_get_bulk(struct udevice *dev)
25{
26 struct sandbox_reset_test *sbrt = dev_get_priv(dev);
27
28 return reset_get_bulk(dev, &sbrt->bulk);
29}
30
Stephen Warren4581b712016-06-17 09:43:59 -060031int sandbox_reset_test_assert(struct udevice *dev)
32{
33 struct sandbox_reset_test *sbrt = dev_get_priv(dev);
34
35 return reset_assert(&sbrt->ctl);
36}
37
Neil Armstrong91f5f8b2018-04-03 11:40:51 +020038int sandbox_reset_test_assert_bulk(struct udevice *dev)
39{
40 struct sandbox_reset_test *sbrt = dev_get_priv(dev);
41
42 return reset_assert_bulk(&sbrt->bulk);
43}
44
Stephen Warren4581b712016-06-17 09:43:59 -060045int sandbox_reset_test_deassert(struct udevice *dev)
46{
47 struct sandbox_reset_test *sbrt = dev_get_priv(dev);
48
49 return reset_deassert(&sbrt->ctl);
50}
51
Neil Armstrong91f5f8b2018-04-03 11:40:51 +020052int sandbox_reset_test_deassert_bulk(struct udevice *dev)
53{
54 struct sandbox_reset_test *sbrt = dev_get_priv(dev);
55
56 return reset_deassert_bulk(&sbrt->bulk);
57}
58
Stephen Warren4581b712016-06-17 09:43:59 -060059int sandbox_reset_test_free(struct udevice *dev)
60{
61 struct sandbox_reset_test *sbrt = dev_get_priv(dev);
62
63 return reset_free(&sbrt->ctl);
64}
65
Neil Armstrong91f5f8b2018-04-03 11:40:51 +020066int sandbox_reset_test_release_bulk(struct udevice *dev)
67{
68 struct sandbox_reset_test *sbrt = dev_get_priv(dev);
69
70 return reset_release_bulk(&sbrt->bulk);
71}
72
Stephen Warren4581b712016-06-17 09:43:59 -060073static const struct udevice_id sandbox_reset_test_ids[] = {
74 { .compatible = "sandbox,reset-ctl-test" },
75 { }
76};
77
78U_BOOT_DRIVER(sandbox_reset_test) = {
79 .name = "sandbox_reset_test",
80 .id = UCLASS_MISC,
81 .of_match = sandbox_reset_test_ids,
82 .priv_auto_alloc_size = sizeof(struct sandbox_reset_test),
83};