Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Stephen Warren | 4581b71 | 2016-06-17 09:43:59 -0600 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2016, NVIDIA CORPORATION. |
Stephen Warren | 4581b71 | 2016-06-17 09:43:59 -0600 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #include <common.h> |
| 7 | #include <dm.h> |
| 8 | #include <reset.h> |
| 9 | #include <asm/io.h> |
| 10 | #include <asm/reset.h> |
| 11 | |
| 12 | struct sandbox_reset_test { |
| 13 | struct reset_ctl ctl; |
Neil Armstrong | 91f5f8b | 2018-04-03 11:40:51 +0200 | [diff] [blame] | 14 | struct reset_ctl_bulk bulk; |
Stephen Warren | 4581b71 | 2016-06-17 09:43:59 -0600 | [diff] [blame] | 15 | }; |
| 16 | |
| 17 | int 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 Armstrong | 91f5f8b | 2018-04-03 11:40:51 +0200 | [diff] [blame] | 24 | int 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 Warren | 4581b71 | 2016-06-17 09:43:59 -0600 | [diff] [blame] | 31 | int 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 Armstrong | 91f5f8b | 2018-04-03 11:40:51 +0200 | [diff] [blame] | 38 | int 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 Warren | 4581b71 | 2016-06-17 09:43:59 -0600 | [diff] [blame] | 45 | int 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 Armstrong | 91f5f8b | 2018-04-03 11:40:51 +0200 | [diff] [blame] | 52 | int 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 Warren | 4581b71 | 2016-06-17 09:43:59 -0600 | [diff] [blame] | 59 | int 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 Armstrong | 91f5f8b | 2018-04-03 11:40:51 +0200 | [diff] [blame] | 66 | int 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 Warren | 4581b71 | 2016-06-17 09:43:59 -0600 | [diff] [blame] | 73 | static const struct udevice_id sandbox_reset_test_ids[] = { |
| 74 | { .compatible = "sandbox,reset-ctl-test" }, |
| 75 | { } |
| 76 | }; |
| 77 | |
| 78 | U_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 | }; |