blob: 148b6b1707d4696c70495e60a0983e5c6525cda8 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0
Stephen Warren92c67fa2016-07-13 13:45:31 -06002/*
3 * Copyright (c) 2016, NVIDIA CORPORATION.
Stephen Warren92c67fa2016-07-13 13:45:31 -06004 */
5
6#include <common.h>
7#include <dm.h>
8#include <power-domain.h>
9#include <asm/io.h>
10#include <asm/power-domain.h>
11
12struct sandbox_power_domain_test {
13 struct power_domain pd;
14};
15
16int sandbox_power_domain_test_get(struct udevice *dev)
17{
18 struct sandbox_power_domain_test *sbrt = dev_get_priv(dev);
19
20 return power_domain_get(dev, &sbrt->pd);
21}
22
23int sandbox_power_domain_test_on(struct udevice *dev)
24{
25 struct sandbox_power_domain_test *sbrt = dev_get_priv(dev);
26
27 return power_domain_on(&sbrt->pd);
28}
29
30int sandbox_power_domain_test_off(struct udevice *dev)
31{
32 struct sandbox_power_domain_test *sbrt = dev_get_priv(dev);
33
34 return power_domain_off(&sbrt->pd);
35}
36
37int sandbox_power_domain_test_free(struct udevice *dev)
38{
39 struct sandbox_power_domain_test *sbrt = dev_get_priv(dev);
40
41 return power_domain_free(&sbrt->pd);
42}
43
44static const struct udevice_id sandbox_power_domain_test_ids[] = {
45 { .compatible = "sandbox,power-domain-test" },
46 { }
47};
48
49U_BOOT_DRIVER(sandbox_power_domain_test) = {
50 .name = "sandbox_power_domain_test",
51 .id = UCLASS_MISC,
52 .of_match = sandbox_power_domain_test_ids,
53 .priv_auto_alloc_size = sizeof(struct sandbox_power_domain_test),
54};