Home | History | Annotate | Download | only in reset
      1 // SPDX-License-Identifier: GPL-2.0
      2 /*
      3  * Copyright (c) 2016, NVIDIA CORPORATION.
      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;
     14 	struct reset_ctl_bulk bulk;
     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 
     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 
     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 
     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 
     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 
     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 
     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 
     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 
     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 };
     84