1 /* 2 * Copyright (c) 2016, NVIDIA CORPORATION. 3 * 4 * SPDX-License-Identifier: GPL-2.0 5 */ 6 7 #include <common.h> 8 #include <dm.h> 9 #include <reset.h> 10 #include <asm/io.h> 11 #include <asm/reset.h> 12 13 struct sandbox_reset_test { 14 struct reset_ctl ctl; 15 struct reset_ctl_bulk bulk; 16 }; 17 18 int sandbox_reset_test_get(struct udevice *dev) 19 { 20 struct sandbox_reset_test *sbrt = dev_get_priv(dev); 21 22 return reset_get_by_name(dev, "test", &sbrt->ctl); 23 } 24 25 int sandbox_reset_test_get_bulk(struct udevice *dev) 26 { 27 struct sandbox_reset_test *sbrt = dev_get_priv(dev); 28 29 return reset_get_bulk(dev, &sbrt->bulk); 30 } 31 32 int sandbox_reset_test_assert(struct udevice *dev) 33 { 34 struct sandbox_reset_test *sbrt = dev_get_priv(dev); 35 36 return reset_assert(&sbrt->ctl); 37 } 38 39 int sandbox_reset_test_assert_bulk(struct udevice *dev) 40 { 41 struct sandbox_reset_test *sbrt = dev_get_priv(dev); 42 43 return reset_assert_bulk(&sbrt->bulk); 44 } 45 46 int sandbox_reset_test_deassert(struct udevice *dev) 47 { 48 struct sandbox_reset_test *sbrt = dev_get_priv(dev); 49 50 return reset_deassert(&sbrt->ctl); 51 } 52 53 int sandbox_reset_test_deassert_bulk(struct udevice *dev) 54 { 55 struct sandbox_reset_test *sbrt = dev_get_priv(dev); 56 57 return reset_deassert_bulk(&sbrt->bulk); 58 } 59 60 int sandbox_reset_test_free(struct udevice *dev) 61 { 62 struct sandbox_reset_test *sbrt = dev_get_priv(dev); 63 64 return reset_free(&sbrt->ctl); 65 } 66 67 int sandbox_reset_test_release_bulk(struct udevice *dev) 68 { 69 struct sandbox_reset_test *sbrt = dev_get_priv(dev); 70 71 return reset_release_bulk(&sbrt->bulk); 72 } 73 74 static const struct udevice_id sandbox_reset_test_ids[] = { 75 { .compatible = "sandbox,reset-ctl-test" }, 76 { } 77 }; 78 79 U_BOOT_DRIVER(sandbox_reset_test) = { 80 .name = "sandbox_reset_test", 81 .id = UCLASS_MISC, 82 .of_match = sandbox_reset_test_ids, 83 .priv_auto_alloc_size = sizeof(struct sandbox_reset_test), 84 }; 85