diff options
author | Simon Glass <sjg@chromium.org> | 2019-12-06 21:41:57 -0700 |
---|---|---|
committer | Bin Meng <bmeng.cn@gmail.com> | 2019-12-15 11:44:11 +0800 |
commit | 3e17ffbb44cd24c53504179ff51a835502b183ed (patch) | |
tree | 5e70600eb19d603a8b795eb0fdb8edc6ac745981 /test/dm/p2sb.c | |
parent | 89694de514387e87385aa0f111ed76ab91ba20a3 (diff) | |
download | u-boot-3e17ffbb44cd24c53504179ff51a835502b183ed.tar.gz |
sandbox: Add PCI driver and test for p2sb
Add a sandbox driver and PCI-device emulator for p2sb. Also add a test
which uses a simple 'adder' driver to test the p2sb functionality.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'test/dm/p2sb.c')
-rw-r--r-- | test/dm/p2sb.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/dm/p2sb.c b/test/dm/p2sb.c new file mode 100644 index 00000000000..ccb75cf3753 --- /dev/null +++ b/test/dm/p2sb.c @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Test for Primary-to-Sideband bus (P2SB) + * + * Copyright 2019 Google LLC + */ + +#include <common.h> +#include <dm.h> +#include <p2sb.h> +#include <asm/test.h> +#include <dm/test.h> +#include <test/ut.h> + +/* Base test of the PMC uclass */ +static int dm_test_p2sb_base(struct unit_test_state *uts) +{ + struct udevice *dev; + + sandbox_set_enable_memio(true); + ut_assertok(uclass_get_device_by_name(UCLASS_AXI, "adder", &dev)); + ut_asserteq(0x03000004, pcr_read32(dev, 4)); + ut_asserteq(0x300, pcr_read16(dev, 6)); + ut_asserteq(4, pcr_read8(dev, 4)); + + return 0; +} +DM_TEST(dm_test_p2sb_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); |