Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Stephen Warren | 61f5ddc | 2016-07-13 13:45:31 -0600 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2016, NVIDIA CORPORATION. |
Stephen Warren | 61f5ddc | 2016-07-13 13:45:31 -0600 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #include <common.h> |
| 7 | #include <dm.h> |
Simon Glass | 336d461 | 2020-02-03 07:36:16 -0700 | [diff] [blame] | 8 | #include <malloc.h> |
Stephen Warren | 61f5ddc | 2016-07-13 13:45:31 -0600 | [diff] [blame] | 9 | #include <power-domain.h> |
| 10 | #include <asm/io.h> |
| 11 | #include <asm/power-domain.h> |
| 12 | |
| 13 | struct sandbox_power_domain_test { |
| 14 | struct power_domain pd; |
| 15 | }; |
| 16 | |
| 17 | int sandbox_power_domain_test_get(struct udevice *dev) |
| 18 | { |
| 19 | struct sandbox_power_domain_test *sbrt = dev_get_priv(dev); |
| 20 | |
| 21 | return power_domain_get(dev, &sbrt->pd); |
| 22 | } |
| 23 | |
| 24 | int sandbox_power_domain_test_on(struct udevice *dev) |
| 25 | { |
| 26 | struct sandbox_power_domain_test *sbrt = dev_get_priv(dev); |
| 27 | |
| 28 | return power_domain_on(&sbrt->pd); |
| 29 | } |
| 30 | |
| 31 | int sandbox_power_domain_test_off(struct udevice *dev) |
| 32 | { |
| 33 | struct sandbox_power_domain_test *sbrt = dev_get_priv(dev); |
| 34 | |
| 35 | return power_domain_off(&sbrt->pd); |
| 36 | } |
| 37 | |
| 38 | int sandbox_power_domain_test_free(struct udevice *dev) |
| 39 | { |
| 40 | struct sandbox_power_domain_test *sbrt = dev_get_priv(dev); |
| 41 | |
| 42 | return power_domain_free(&sbrt->pd); |
| 43 | } |
| 44 | |
| 45 | static const struct udevice_id sandbox_power_domain_test_ids[] = { |
| 46 | { .compatible = "sandbox,power-domain-test" }, |
| 47 | { } |
| 48 | }; |
| 49 | |
| 50 | U_BOOT_DRIVER(sandbox_power_domain_test) = { |
| 51 | .name = "sandbox_power_domain_test", |
| 52 | .id = UCLASS_MISC, |
| 53 | .of_match = sandbox_power_domain_test_ids, |
Simon Glass | 41575d8 | 2020-12-03 16:55:17 -0700 | [diff] [blame] | 54 | .priv_auto = sizeof(struct sandbox_power_domain_test), |
Stephen Warren | 61f5ddc | 2016-07-13 13:45:31 -0600 | [diff] [blame] | 55 | }; |