blob: 94174a7482bad93c4c6ad03fbcf30d2139ffb656 [file] [log] [blame]
Mark Kettenisfb574622021-10-23 16:58:02 +02001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (C) 2021 Mark Kettenis <kettenis@openbsd.org>
4 */
5
6#include <common.h>
7#include <dm.h>
8#include <dm/test.h>
9#include <dm/uclass-internal.h>
10#include <iommu.h>
11#include <test/test.h>
12#include <test/ut.h>
13
14static int dm_test_iommu(struct unit_test_state *uts)
15{
16 struct udevice *dev;
17
18 ut_assertok(uclass_find_device(UCLASS_IOMMU, 0, &dev));
19 ut_assert(!(dev_get_flags(dev) & DM_FLAG_ACTIVATED));
20
21 /* Probing USB probes the IOMMU through the "iommus" property */
22 ut_assertok(uclass_probe_all(UCLASS_USB));
23 ut_assert(dev_get_flags(dev) & DM_FLAG_ACTIVATED);
24
25 return 0;
26}
27
28DM_TEST(dm_test_iommu, UT_TESTF_SCAN_FDT);