2 * Copyright (C) 2015 Google, Inc
4 * SPDX-License-Identifier: GPL-2.0+
14 DECLARE_GLOBAL_DATA_PTR;
16 /* Base test of system controllers */
17 static int dm_test_syscon_base(struct unit_test_state *uts)
21 ut_assertok(uclass_get_device(UCLASS_SYSCON, 0, &dev));
22 ut_asserteq(SYSCON0, dev->driver_data);
24 ut_assertok(uclass_get_device(UCLASS_SYSCON, 1, &dev));
25 ut_asserteq(SYSCON1, dev->driver_data);
27 ut_asserteq(-ENODEV, uclass_get_device(UCLASS_SYSCON, 2, &dev));
31 DM_TEST(dm_test_syscon_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
33 /* Test system controller finding */
34 static int dm_test_syscon_by_driver_data(struct unit_test_state *uts)
38 ut_assertok(syscon_get_by_driver_data(SYSCON0, &dev));
39 ut_asserteq(SYSCON0, dev->driver_data);
41 ut_assertok(syscon_get_by_driver_data(SYSCON1, &dev));
42 ut_asserteq(SYSCON1, dev->driver_data);
44 ut_asserteq(-ENODEV, syscon_get_by_driver_data(2, &dev));
48 DM_TEST(dm_test_syscon_by_driver_data, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);