blob: 08c15ef342b3dd3ce01807ee59b7e97337f7dde5 [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
Stephen Warren92c67fa2016-07-13 13:45:31 -06006#include <dm.h>
Simon Glass9bc15642020-02-03 07:36:16 -07007#include <malloc.h>
Stephen Warren92c67fa2016-07-13 13:45:31 -06008#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,
Simon Glass8a2b47f2020-12-03 16:55:17 -070053 .priv_auto = sizeof(struct sandbox_power_domain_test),
Stephen Warren92c67fa2016-07-13 13:45:31 -060054};