]> git.sur5r.net Git - u-boot/blobdiff - test/dm/gpio.c
Merge branch 'master' of git://git.denx.de/u-boot-sunxi
[u-boot] / test / dm / gpio.c
index 727db186903b5d4d324c8b7f979aee48d57ab1bf..bb4b20cea938d57463627e697f8bd20cf09db4cd 100644 (file)
@@ -1,7 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2013 Google, Inc
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -13,8 +12,6 @@
 #include <asm/gpio.h>
 #include <test/ut.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 /* Test that sandbox GPIOs work correctly */
 static int dm_test_gpio(struct unit_test_state *uts)
 {
@@ -75,6 +72,13 @@ static int dm_test_gpio(struct unit_test_state *uts)
        ut_assertok(ops->set_value(dev, offset, 1));
        ut_asserteq(1, ops->get_value(dev, offset));
 
+       /* Make it an open drain output, and reset it */
+       ut_asserteq(0, sandbox_gpio_get_open_drain(dev, offset));
+       ut_assertok(ops->set_open_drain(dev, offset, 1));
+       ut_asserteq(1, sandbox_gpio_get_open_drain(dev, offset));
+       ut_assertok(ops->set_open_drain(dev, offset, 0));
+       ut_asserteq(0, sandbox_gpio_get_open_drain(dev, offset));
+
        /* Make it an input */
        ut_assertok(ops->direction_input(dev, offset));
        ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf)));