summaryrefslogtreecommitdiffstats
path: root/test/dm/p2sb.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2019-12-06 21:41:57 -0700
committerBin Meng <bmeng.cn@gmail.com>2019-12-15 11:44:11 +0800
commit3e17ffbb44cd24c53504179ff51a835502b183ed (patch)
tree5e70600eb19d603a8b795eb0fdb8edc6ac745981 /test/dm/p2sb.c
parent89694de514387e87385aa0f111ed76ab91ba20a3 (diff)
downloadu-boot-3e17ffbb44cd24c53504179ff51a835502b183ed.tar.gz
u-boot-3e17ffbb44cd24c53504179ff51a835502b183ed.tar.xz
u-boot-3e17ffbb44cd24c53504179ff51a835502b183ed.zip
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.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/dm/p2sb.c b/test/dm/p2sb.c
new file mode 100644
index 0000000000..ccb75cf375
--- /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);