From: Bin Meng <bmeng.cn@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH v2 18/21] test: dm: Add a test case for simple-bus <ranges>
Date: Fri, 12 Mar 2021 21:35:59 +0800 [thread overview]
Message-ID: <20210312133602.31105-19-bmeng.cn@gmail.com> (raw)
In-Reply-To: <20210312133602.31105-1-bmeng.cn@gmail.com>
This adds a test case to verify reading <ranges> of a simple-bus is
working as expected.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
Changes in v2:
- default y if SANDBOX for CONFIG_SIMPLE_BUS_CORRECT_RANGE
drivers/core/Kconfig | 1 +
test/dm/Makefile | 1 +
test/dm/simple-bus.c | 33 +++++++++++++++++++++++++++++++++
3 files changed, 35 insertions(+)
create mode 100644 test/dm/simple-bus.c
diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig
index c7504edaf8..a7c3120860 100644
--- a/drivers/core/Kconfig
+++ b/drivers/core/Kconfig
@@ -238,6 +238,7 @@ config SPL_SIMPLE_BUS
config SIMPLE_BUS_CORRECT_RANGE
bool "Decode the 'simple-bus' <range> by honoring the #address-cells and #size-cells"
depends on SIMPLE_BUS
+ default y if SANDBOX
help
Decoding the 'simple-bus' <range> by honoring the #address-cells
and #size-cells of parent/child bus. If unset, #address-cells of
diff --git a/test/dm/Makefile b/test/dm/Makefile
index 1c2fa95f4a..d0d46e7f7e 100644
--- a/test/dm/Makefile
+++ b/test/dm/Makefile
@@ -90,6 +90,7 @@ obj-$(CONFIG_DM_MDIO) += mdio.o
obj-$(CONFIG_DM_MDIO_MUX) += mdio_mux.o
obj-$(CONFIG_DM_RNG) += rng.o
obj-$(CONFIG_CLK_K210_SET_RATE) += k210_pll.o
+obj-$(CONFIG_SIMPLE_BUS) += simple-bus.o
obj-$(CONFIG_SIMPLE_PM_BUS) += simple-pm-bus.o
obj-$(CONFIG_RESET_SYSCON) += syscon-reset.o
obj-$(CONFIG_SCMI_FIRMWARE) += scmi.o
diff --git a/test/dm/simple-bus.c b/test/dm/simple-bus.c
new file mode 100644
index 0000000000..3530b47fac
--- /dev/null
+++ b/test/dm/simple-bus.c
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2021, Bin Meng <bmeng.cn@gmail.com>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <dm/test.h>
+#include <dm/simple_bus.h>
+#include <dm/uclass-internal.h>
+#include <test/ut.h>
+
+static int dm_test_simple_bus(struct unit_test_state *uts)
+{
+ struct udevice *dev;
+ struct simple_bus_plat *plat;
+
+ /* locate the dummy device @ translation-test node */
+ ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, &dev));
+ ut_asserteq_str("dev at 0,0", dev->name);
+
+ /* locate the parent node which is a simple-bus */
+ ut_assertnonnull(dev = dev_get_parent(dev));
+ ut_asserteq_str("translation-test at 8000", dev->name);
+
+ ut_assertnonnull(plat = dev_get_uclass_plat(dev));
+ ut_asserteq(0, plat->base);
+ ut_asserteq(0x8000, plat->target);
+ ut_asserteq(0x1000, plat->size);
+
+ return 0;
+}
+DM_TEST(dm_test_simple_bus, UT_TESTF_SCAN_FDT | UT_TESTF_FLAT_TREE);
--
2.25.1
next prev parent reply other threads:[~2021-03-12 13:35 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-12 13:35 [PATCH v2 00/21] ppc: qemu: Add eTSEC support Bin Meng
2021-03-12 13:35 ` [PATCH v2 01/21] dt-bindings: net: Add the old DT bindings for "fixed-link" Bin Meng
2021-03-13 12:10 ` Vladimir Oltean
2021-03-13 12:59 ` Vladimir Oltean
2021-03-12 13:35 ` [PATCH v2 02/21] of: extra: Introduce ofnode_phy_is_fixed_link() API Bin Meng
2021-03-13 12:14 ` Vladimir Oltean
2021-03-13 12:29 ` Vladimir Oltean
2021-03-13 14:34 ` Bin Meng
2021-03-13 13:03 ` Vladimir Oltean
2021-03-13 14:32 ` Bin Meng
2021-03-12 13:35 ` [PATCH v2 03/21] test: dm: Add a case to test ofnode_phy_is_fixed_link() Bin Meng
2021-03-13 13:13 ` Vladimir Oltean
2021-03-12 13:35 ` [PATCH v2 04/21] dm: mdio: Use ofnode_phy_is_fixed_link() API Bin Meng
2021-03-13 13:13 ` Vladimir Oltean
2021-03-12 13:35 ` [PATCH v2 05/21] net: phy: fixed: Be compatible with live OF tree Bin Meng
2021-03-13 13:15 ` Vladimir Oltean
2021-03-12 13:35 ` [PATCH v2 06/21] net: phy: fixed: Drop #ifdef CONFIG_DM_ETH around phy_connect_fixed Bin Meng
2021-03-13 13:15 ` Vladimir Oltean
2021-03-12 13:35 ` [PATCH v2 07/21] net: phy: xilinx: Be compatible with live OF tree Bin Meng
2021-03-12 14:11 ` Michal Simek
2021-03-12 13:35 ` [PATCH v2 08/21] net: phy: xilinx: Drop #ifdef CONFIG_DM_ETH around phy_connect_gmii2rgmii() Bin Meng
2021-03-13 13:16 ` Vladimir Oltean
2021-03-12 13:35 ` [PATCH v2 09/21] net: phy: Simplify the logic of phy_connect_fixed() Bin Meng
2021-03-13 13:17 ` Vladimir Oltean
2021-03-12 13:35 ` [PATCH v2 10/21] net: phy: fixed: Make driver ops static Bin Meng
2021-03-13 13:17 ` Vladimir Oltean
2021-03-12 13:35 ` [PATCH v2 11/21] net: phy: fixed: Add the missing ending newline Bin Meng
2021-03-13 13:18 ` Vladimir Oltean
2021-03-12 13:35 ` [PATCH v2 12/21] net: phy: fixed: Support the old DT binding Bin Meng
2021-03-13 13:19 ` Vladimir Oltean
2021-03-12 13:35 ` [PATCH v2 13/21] net: tsec: Use dm_eth_phy_connect() directly for the DM case Bin Meng
2021-03-13 13:20 ` Vladimir Oltean
2021-03-12 13:35 ` [PATCH v2 14/21] sandbox: Add a DSA sandbox driver and unit test Bin Meng
2021-03-12 13:35 ` [PATCH v2 15/21] dt-bindings: net: Update Freescale TSEC to support "queue-group" Bin Meng
2021-03-13 12:50 ` Vladimir Oltean
2021-03-12 13:35 ` [PATCH v2 16/21] net: tsec: Support <reg> property from the subnode "queue-group" Bin Meng
2021-03-13 13:28 ` Vladimir Oltean
2021-03-12 13:35 ` [PATCH v2 17/21] dm: core: Correctly read <ranges> of simple-bus Bin Meng
2021-03-12 15:47 ` Simon Glass
2021-03-12 13:35 ` Bin Meng [this message]
2021-03-12 13:36 ` [PATCH v2 19/21] ppc: qemu: Create a virtual memory mapping of the platform bus Bin Meng
2021-03-13 13:48 ` Vladimir Oltean
2021-03-12 13:36 ` [PATCH v2 20/21] ppc: qemu: Enable eTSEC support Bin Meng
2021-03-13 13:49 ` Vladimir Oltean
2021-03-12 13:36 ` [PATCH v2 21/21] doc: board: qemu-ppce500: Document eTSEC usage Bin Meng
2021-03-13 13:50 ` Vladimir Oltean
2021-03-12 15:12 ` [PATCH v2 00/21] ppc: qemu: Add eTSEC support Bin Meng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210312133602.31105-19-bmeng.cn@gmail.com \
--to=bmeng.cn@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox