blob: 7c18e5c41190bbf6ba7d01234aaeb3f43b11f1f1 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Simon Glasse821d182014-02-26 15:59:24 -07002/*
3 * Copyright (C) 2013 Google, Inc
Simon Glasse821d182014-02-26 15:59:24 -07004 */
5
6#include <common.h>
7#include <fdtdec.h>
8#include <dm.h>
Simon Glass9bc15642020-02-03 07:36:16 -07009#include <malloc.h>
Simon Glassb4463db2014-10-04 11:29:51 -060010#include <dm/root.h>
Simon Glasse821d182014-02-26 15:59:24 -070011#include <dm/test.h>
12#include <dm/util.h>
13#include <asm/gpio.h>
Joe Hershberger3a77be52015-05-20 14:27:27 -050014#include <test/ut.h>
Simon Glasse821d182014-02-26 15:59:24 -070015
16/* Test that sandbox GPIOs work correctly */
Joe Hershberger3a77be52015-05-20 14:27:27 -050017static int dm_test_gpio(struct unit_test_state *uts)
Simon Glasse821d182014-02-26 15:59:24 -070018{
19 unsigned int offset, gpio;
20 struct dm_gpio_ops *ops;
Heiko Schocherb74fcb42014-05-22 12:43:05 +020021 struct udevice *dev;
Simon Glasse821d182014-02-26 15:59:24 -070022 const char *name;
23 int offset_count;
24 char buf[80];
25
26 /*
Patrick Delaunay28bdaa52020-01-13 11:35:14 +010027 * We expect to get 4 banks. One is anonymous (just numbered) and
28 * comes from platdata. The other are named a (20 gpios),
29 * b (10 gpios) and c (10 gpios) and come from the device tree. See
Simon Glasse821d182014-02-26 15:59:24 -070030 * test/dm/test.dts.
31 */
32 ut_assertok(gpio_lookup_name("b4", &dev, &offset, &gpio));
33 ut_asserteq_str(dev->name, "extra-gpios");
34 ut_asserteq(4, offset);
35 ut_asserteq(CONFIG_SANDBOX_GPIO_COUNT + 20 + 4, gpio);
36
37 name = gpio_get_bank_info(dev, &offset_count);
38 ut_asserteq_str("b", name);
39 ut_asserteq(10, offset_count);
40
41 /* Get the operations for this device */
42 ops = gpio_get_ops(dev);
Simon Glass96f7d602014-10-04 11:29:48 -060043 ut_assert(ops->get_function);
Simon Glasse821d182014-02-26 15:59:24 -070044
45 /* Cannot get a value until it is reserved */
Simon Glass96f7d602014-10-04 11:29:48 -060046 ut_asserteq(-EBUSY, gpio_get_value(gpio + 1));
Simon Glasse821d182014-02-26 15:59:24 -070047 /*
48 * Now some tests that use the 'sandbox' back door. All GPIOs
49 * should default to input, include b4 that we are using here.
50 */
Simon Glass96f7d602014-10-04 11:29:48 -060051 ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf)));
52 ut_asserteq_str("b4: input: 0 [ ]", buf);
Simon Glasse821d182014-02-26 15:59:24 -070053
54 /* Change it to an output */
55 sandbox_gpio_set_direction(dev, offset, 1);
Simon Glass96f7d602014-10-04 11:29:48 -060056 ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf)));
57 ut_asserteq_str("b4: output: 0 [ ]", buf);
Simon Glasse821d182014-02-26 15:59:24 -070058
59 sandbox_gpio_set_value(dev, offset, 1);
Simon Glass96f7d602014-10-04 11:29:48 -060060 ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf)));
61 ut_asserteq_str("b4: output: 1 [ ]", buf);
Simon Glasse821d182014-02-26 15:59:24 -070062
Simon Glass96f7d602014-10-04 11:29:48 -060063 ut_assertok(gpio_request(gpio, "testing"));
64 ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf)));
65 ut_asserteq_str("b4: output: 1 [x] testing", buf);
Simon Glasse821d182014-02-26 15:59:24 -070066
67 /* Change the value a bit */
68 ut_asserteq(1, ops->get_value(dev, offset));
69 ut_assertok(ops->set_value(dev, offset, 0));
70 ut_asserteq(0, ops->get_value(dev, offset));
Simon Glass96f7d602014-10-04 11:29:48 -060071 ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf)));
72 ut_asserteq_str("b4: output: 0 [x] testing", buf);
Simon Glasse821d182014-02-26 15:59:24 -070073 ut_assertok(ops->set_value(dev, offset, 1));
74 ut_asserteq(1, ops->get_value(dev, offset));
75
Patrick Delaunay28bdaa52020-01-13 11:35:14 +010076 /* Make it an open drain output, and reset it */
77 ut_asserteq(GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE,
78 sandbox_gpio_get_dir_flags(dev, offset));
79 ut_assertok(ops->set_dir_flags(dev, offset,
80 GPIOD_IS_OUT | GPIOD_OPEN_DRAIN));
81 ut_asserteq(GPIOD_IS_OUT | GPIOD_OPEN_DRAIN,
82 sandbox_gpio_get_dir_flags(dev, offset));
83 ut_assertok(ops->set_dir_flags(dev, offset,
84 GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE));
85 ut_asserteq(GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE,
86 sandbox_gpio_get_dir_flags(dev, offset));
87
Simon Glasse821d182014-02-26 15:59:24 -070088 /* Make it an input */
89 ut_assertok(ops->direction_input(dev, offset));
Simon Glass96f7d602014-10-04 11:29:48 -060090 ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf)));
91 ut_asserteq_str("b4: input: 1 [x] testing", buf);
Simon Glasse821d182014-02-26 15:59:24 -070092 sandbox_gpio_set_value(dev, offset, 0);
93 ut_asserteq(0, sandbox_gpio_get_value(dev, offset));
Simon Glass96f7d602014-10-04 11:29:48 -060094 ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf)));
95 ut_asserteq_str("b4: input: 0 [x] testing", buf);
Simon Glasse821d182014-02-26 15:59:24 -070096
Simon Glass96f7d602014-10-04 11:29:48 -060097 ut_assertok(gpio_free(gpio));
98 ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf)));
99 ut_asserteq_str("b4: input: 0 [ ]", buf);
Simon Glasse821d182014-02-26 15:59:24 -0700100
101 /* Check the 'a' bank also */
102 ut_assertok(gpio_lookup_name("a15", &dev, &offset, &gpio));
103 ut_asserteq_str(dev->name, "base-gpios");
104 ut_asserteq(15, offset);
105 ut_asserteq(CONFIG_SANDBOX_GPIO_COUNT + 15, gpio);
106
107 name = gpio_get_bank_info(dev, &offset_count);
108 ut_asserteq_str("a", name);
109 ut_asserteq(20, offset_count);
110
Simon Glass96f7d602014-10-04 11:29:48 -0600111 return 0;
112}
113DM_TEST(dm_test_gpio, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
114
Neil Armstrong643778b2020-05-05 10:43:18 +0200115/* Test that GPIO open-drain/open-source emulation works correctly */
116static int dm_test_gpio_opendrain_opensource(struct unit_test_state *uts)
117{
118 struct gpio_desc desc_list[8];
119 struct udevice *dev, *gpio_c;
120 char buf[80];
121
122 ut_assertok(uclass_get_device(UCLASS_TEST_FDT, 0, &dev));
123 ut_asserteq_str("a-test", dev->name);
124
125 ut_assertok(uclass_get_device(UCLASS_GPIO, 3, &gpio_c));
126 ut_asserteq_str("pinmux-gpios", gpio_c->name);
127
128 ut_asserteq(8, gpio_request_list_by_name(dev, "test3-gpios", desc_list,
129 ARRAY_SIZE(desc_list), 0))
130
131 ut_asserteq(true, !!device_active(gpio_c));
132 ut_asserteq_ptr(gpio_c, desc_list[0].dev);
133 ut_asserteq_ptr(gpio_c, desc_list[1].dev);
134 ut_asserteq_ptr(gpio_c, desc_list[2].dev);
135 ut_asserteq_ptr(gpio_c, desc_list[3].dev);
136 ut_asserteq_ptr(gpio_c, desc_list[4].dev);
137 ut_asserteq_ptr(gpio_c, desc_list[5].dev);
138 ut_asserteq_ptr(gpio_c, desc_list[6].dev);
139 ut_asserteq_ptr(gpio_c, desc_list[7].dev);
140
141 /* GPIO 0 is (GPIO_OUT|GPIO_OPEN_DRAIN) */
142 ut_asserteq(GPIOD_IS_OUT | GPIOD_OPEN_DRAIN,
143 sandbox_gpio_get_dir_flags(gpio_c, 0));
144
145 /* Set it as output high, should become an input */
146 ut_assertok(dm_gpio_set_value(&desc_list[0], 1));
147 ut_assertok(gpio_get_status(gpio_c, 0, buf, sizeof(buf)));
148 ut_asserteq_str("c0: input: 0 [x] a-test.test3-gpios0", buf);
149
150 /* Set it as output low, should become output low */
151 ut_assertok(dm_gpio_set_value(&desc_list[0], 0));
152 ut_assertok(gpio_get_status(gpio_c, 0, buf, sizeof(buf)));
153 ut_asserteq_str("c0: output: 0 [x] a-test.test3-gpios0", buf);
154
155 /* GPIO 1 is (GPIO_OUT|GPIO_OPEN_SOURCE) */
156 ut_asserteq(GPIOD_IS_OUT | GPIOD_OPEN_SOURCE,
157 sandbox_gpio_get_dir_flags(gpio_c, 1));
158
159 /* Set it as output high, should become output high */
160 ut_assertok(dm_gpio_set_value(&desc_list[1], 1));
161 ut_assertok(gpio_get_status(gpio_c, 1, buf, sizeof(buf)));
162 ut_asserteq_str("c1: output: 1 [x] a-test.test3-gpios1", buf);
163
164 /* Set it as output low, should become an input */
165 ut_assertok(dm_gpio_set_value(&desc_list[1], 0));
166 ut_assertok(gpio_get_status(gpio_c, 1, buf, sizeof(buf)));
167 ut_asserteq_str("c1: input: 1 [x] a-test.test3-gpios1", buf);
168
169 /* GPIO 6 is (GPIO_ACTIVE_LOW|GPIO_OUT|GPIO_OPEN_DRAIN) */
170 ut_asserteq(GPIOD_ACTIVE_LOW | GPIOD_IS_OUT | GPIOD_OPEN_DRAIN,
171 sandbox_gpio_get_dir_flags(gpio_c, 6));
172
173 /* Set it as output high, should become output low */
174 ut_assertok(dm_gpio_set_value(&desc_list[6], 1));
175 ut_assertok(gpio_get_status(gpio_c, 6, buf, sizeof(buf)));
176 ut_asserteq_str("c6: output: 0 [x] a-test.test3-gpios6", buf);
177
178 /* Set it as output low, should become an input */
179 ut_assertok(dm_gpio_set_value(&desc_list[6], 0));
180 ut_assertok(gpio_get_status(gpio_c, 6, buf, sizeof(buf)));
181 ut_asserteq_str("c6: input: 0 [x] a-test.test3-gpios6", buf);
182
183 /* GPIO 7 is (GPIO_ACTIVE_LOW|GPIO_OUT|GPIO_OPEN_SOURCE) */
184 ut_asserteq(GPIOD_ACTIVE_LOW | GPIOD_IS_OUT | GPIOD_OPEN_SOURCE,
185 sandbox_gpio_get_dir_flags(gpio_c, 7));
186
187 /* Set it as output high, should become an input */
188 ut_assertok(dm_gpio_set_value(&desc_list[7], 1));
189 ut_assertok(gpio_get_status(gpio_c, 7, buf, sizeof(buf)));
190 ut_asserteq_str("c7: input: 0 [x] a-test.test3-gpios7", buf);
191
192 /* Set it as output low, should become output high */
193 ut_assertok(dm_gpio_set_value(&desc_list[7], 0));
194 ut_assertok(gpio_get_status(gpio_c, 7, buf, sizeof(buf)));
195 ut_asserteq_str("c7: output: 1 [x] a-test.test3-gpios7", buf);
196
197 ut_assertok(gpio_free_list(dev, desc_list, 8));
198
199 return 0;
200}
201DM_TEST(dm_test_gpio_opendrain_opensource,
202 DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
203
Simon Glass96f7d602014-10-04 11:29:48 -0600204/* Test that sandbox anonymous GPIOs work correctly */
Joe Hershberger3a77be52015-05-20 14:27:27 -0500205static int dm_test_gpio_anon(struct unit_test_state *uts)
Simon Glass96f7d602014-10-04 11:29:48 -0600206{
207 unsigned int offset, gpio;
208 struct udevice *dev;
209 const char *name;
210 int offset_count;
211
Simon Glasse821d182014-02-26 15:59:24 -0700212 /* And the anonymous bank */
213 ut_assertok(gpio_lookup_name("14", &dev, &offset, &gpio));
214 ut_asserteq_str(dev->name, "gpio_sandbox");
215 ut_asserteq(14, offset);
216 ut_asserteq(14, gpio);
217
218 name = gpio_get_bank_info(dev, &offset_count);
219 ut_asserteq_ptr(NULL, name);
220 ut_asserteq(CONFIG_SANDBOX_GPIO_COUNT, offset_count);
221
222 return 0;
223}
Simon Glass96f7d602014-10-04 11:29:48 -0600224DM_TEST(dm_test_gpio_anon, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
Simon Glass1b27d602014-10-04 11:29:49 -0600225
226/* Test that gpio_requestf() works as expected */
Joe Hershberger3a77be52015-05-20 14:27:27 -0500227static int dm_test_gpio_requestf(struct unit_test_state *uts)
Simon Glass1b27d602014-10-04 11:29:49 -0600228{
229 unsigned int offset, gpio;
230 struct udevice *dev;
231 char buf[80];
232
233 ut_assertok(gpio_lookup_name("b5", &dev, &offset, &gpio));
234 ut_assertok(gpio_requestf(gpio, "testing %d %s", 1, "hi"));
235 sandbox_gpio_set_direction(dev, offset, 1);
236 sandbox_gpio_set_value(dev, offset, 1);
237 ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf)));
238 ut_asserteq_str("b5: output: 1 [x] testing 1 hi", buf);
239
240 return 0;
241}
242DM_TEST(dm_test_gpio_requestf, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
Simon Glassb4463db2014-10-04 11:29:51 -0600243
244/* Test that gpio_request() copies its string */
Joe Hershberger3a77be52015-05-20 14:27:27 -0500245static int dm_test_gpio_copy(struct unit_test_state *uts)
Simon Glassb4463db2014-10-04 11:29:51 -0600246{
247 unsigned int offset, gpio;
248 struct udevice *dev;
249 char buf[80], name[10];
250
251 ut_assertok(gpio_lookup_name("b6", &dev, &offset, &gpio));
252 strcpy(name, "odd_name");
253 ut_assertok(gpio_request(gpio, name));
254 sandbox_gpio_set_direction(dev, offset, 1);
255 sandbox_gpio_set_value(dev, offset, 1);
256 ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf)));
257 ut_asserteq_str("b6: output: 1 [x] odd_name", buf);
258 strcpy(name, "nothing");
259 ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf)));
260 ut_asserteq_str("b6: output: 1 [x] odd_name", buf);
261
262 return 0;
263}
264DM_TEST(dm_test_gpio_copy, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
265
266/* Test that we don't leak memory with GPIOs */
Joe Hershberger3a77be52015-05-20 14:27:27 -0500267static int dm_test_gpio_leak(struct unit_test_state *uts)
Simon Glassb4463db2014-10-04 11:29:51 -0600268{
Joe Hershberger3a77be52015-05-20 14:27:27 -0500269 ut_assertok(dm_test_gpio(uts));
270 ut_assertok(dm_test_gpio_anon(uts));
271 ut_assertok(dm_test_gpio_requestf(uts));
272 ut_assertok(dm_leak_check_end(uts));
Simon Glassb4463db2014-10-04 11:29:51 -0600273
274 return 0;
275}
Simon Glassb4463db2014-10-04 11:29:51 -0600276DM_TEST(dm_test_gpio_leak, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
Simon Glass16e10402015-01-05 20:05:29 -0700277
278/* Test that we can find GPIOs using phandles */
Joe Hershberger3a77be52015-05-20 14:27:27 -0500279static int dm_test_gpio_phandles(struct unit_test_state *uts)
Simon Glass16e10402015-01-05 20:05:29 -0700280{
281 struct gpio_desc desc, desc_list[8], desc_list2[8];
282 struct udevice *dev, *gpio_a, *gpio_b;
283
284 ut_assertok(uclass_get_device(UCLASS_TEST_FDT, 0, &dev));
285 ut_asserteq_str("a-test", dev->name);
286
287 ut_assertok(gpio_request_by_name(dev, "test-gpios", 1, &desc, 0));
288 ut_assertok(uclass_get_device(UCLASS_GPIO, 1, &gpio_a));
289 ut_assertok(uclass_get_device(UCLASS_GPIO, 2, &gpio_b));
290 ut_asserteq_str("base-gpios", gpio_a->name);
291 ut_asserteq(true, !!device_active(gpio_a));
292 ut_asserteq_ptr(gpio_a, desc.dev);
293 ut_asserteq(4, desc.offset);
294 /* GPIOF_INPUT is the sandbox GPIO driver default */
295 ut_asserteq(GPIOF_INPUT, gpio_get_function(gpio_a, 4, NULL));
296 ut_assertok(dm_gpio_free(dev, &desc));
297
298 ut_asserteq(-ENOENT, gpio_request_by_name(dev, "test-gpios", 3, &desc,
299 0));
300 ut_asserteq_ptr(NULL, desc.dev);
301 ut_asserteq(desc.offset, 0);
302 ut_asserteq(-ENOENT, gpio_request_by_name(dev, "test-gpios", 5, &desc,
303 0));
304
305 /* Last GPIO is ignord as it comes after <0> */
306 ut_asserteq(3, gpio_request_list_by_name(dev, "test-gpios", desc_list,
307 ARRAY_SIZE(desc_list), 0));
308 ut_asserteq(-EBUSY, gpio_request_list_by_name(dev, "test-gpios",
309 desc_list2,
310 ARRAY_SIZE(desc_list2),
311 0));
Patrick Delaunay28bdaa52020-01-13 11:35:14 +0100312 ut_asserteq(GPIOF_INPUT, gpio_get_function(gpio_a, 4, NULL));
Simon Glass16e10402015-01-05 20:05:29 -0700313 ut_assertok(gpio_free_list(dev, desc_list, 3));
Patrick Delaunay28bdaa52020-01-13 11:35:14 +0100314 ut_asserteq(GPIOF_UNUSED, gpio_get_function(gpio_a, 4, NULL));
Simon Glass16e10402015-01-05 20:05:29 -0700315 ut_asserteq(3, gpio_request_list_by_name(dev, "test-gpios", desc_list,
316 ARRAY_SIZE(desc_list),
317 GPIOD_IS_OUT |
318 GPIOD_IS_OUT_ACTIVE));
Patrick Delaunay28bdaa52020-01-13 11:35:14 +0100319 ut_asserteq(GPIOF_OUTPUT, gpio_get_function(gpio_a, 4, NULL));
Simon Glass16e10402015-01-05 20:05:29 -0700320 ut_asserteq_ptr(gpio_a, desc_list[0].dev);
321 ut_asserteq(1, desc_list[0].offset);
322 ut_asserteq_ptr(gpio_a, desc_list[1].dev);
323 ut_asserteq(4, desc_list[1].offset);
324 ut_asserteq_ptr(gpio_b, desc_list[2].dev);
325 ut_asserteq(5, desc_list[2].offset);
326 ut_asserteq(1, dm_gpio_get_value(desc_list));
327 ut_assertok(gpio_free_list(dev, desc_list, 3));
328
Patrick Delaunay28bdaa52020-01-13 11:35:14 +0100329 ut_asserteq(GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE,
330 sandbox_gpio_get_dir_flags(gpio_a, 1));
Simon Glass16e10402015-01-05 20:05:29 -0700331 ut_asserteq(6, gpio_request_list_by_name(dev, "test2-gpios", desc_list,
332 ARRAY_SIZE(desc_list), 0));
Patrick Delaunay28bdaa52020-01-13 11:35:14 +0100333
334 /* This was set to output previously but flags resetted to 0 = INPUT */
335 ut_asserteq(0, sandbox_gpio_get_dir_flags(gpio_a, 1));
336 ut_asserteq(GPIOF_INPUT, gpio_get_function(gpio_a, 1, NULL));
Simon Glass16e10402015-01-05 20:05:29 -0700337
338 /* Active low should invert the input value */
339 ut_asserteq(GPIOF_INPUT, gpio_get_function(gpio_b, 6, NULL));
340 ut_asserteq(1, dm_gpio_get_value(&desc_list[2]));
341
342 ut_asserteq(GPIOF_INPUT, gpio_get_function(gpio_b, 7, NULL));
343 ut_asserteq(GPIOF_OUTPUT, gpio_get_function(gpio_b, 8, NULL));
344 ut_asserteq(0, dm_gpio_get_value(&desc_list[4]));
345 ut_asserteq(GPIOF_OUTPUT, gpio_get_function(gpio_b, 9, NULL));
346 ut_asserteq(1, dm_gpio_get_value(&desc_list[5]));
347
Simon Glass16e10402015-01-05 20:05:29 -0700348 return 0;
349}
350DM_TEST(dm_test_gpio_phandles, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
Patrick Delaunay28bdaa52020-01-13 11:35:14 +0100351
352/* Check the gpio pin configuration get from device tree information */
353static int dm_test_gpio_get_dir_flags(struct unit_test_state *uts)
354{
355 struct gpio_desc desc_list[6];
356 struct udevice *dev;
357 ulong flags;
358
359 ut_assertok(uclass_get_device(UCLASS_TEST_FDT, 0, &dev));
360
361 ut_asserteq(6, gpio_request_list_by_name(dev, "test3-gpios", desc_list,
362 ARRAY_SIZE(desc_list), 0));
363
364 ut_assertok(dm_gpio_get_dir_flags(&desc_list[0], &flags));
365 ut_asserteq(GPIOD_IS_OUT | GPIOD_OPEN_DRAIN, flags);
366
367 ut_assertok(dm_gpio_get_dir_flags(&desc_list[1], &flags));
368 ut_asserteq(GPIOD_IS_OUT | GPIOD_OPEN_SOURCE, flags);
369
370 ut_assertok(dm_gpio_get_dir_flags(&desc_list[2], &flags));
371 ut_asserteq(GPIOD_IS_OUT, flags);
372
373 ut_assertok(dm_gpio_get_dir_flags(&desc_list[3], &flags));
374 ut_asserteq(GPIOD_IS_IN | GPIOD_PULL_UP, flags);
375
376 ut_assertok(dm_gpio_get_dir_flags(&desc_list[4], &flags));
377 ut_asserteq(GPIOD_IS_IN | GPIOD_PULL_DOWN, flags);
378
379 ut_assertok(dm_gpio_get_dir_flags(&desc_list[5], &flags));
380 ut_asserteq(GPIOD_IS_IN, flags);
381
382 ut_assertok(gpio_free_list(dev, desc_list, 6));
383
384 return 0;
385}
386DM_TEST(dm_test_gpio_get_dir_flags, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);