Commit ea8971cd authored by Bin Meng's avatar Bin Meng Committed by Priyanka Jain
Browse files

test: dm: Add a test case for simple-bus <ranges>



This adds a test case to verify reading <ranges> of a simple-bus is
working as expected.
Signed-off-by: Bin Meng's avatarBin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
Reviewed-by: Priyanka Jain's avatarPriyanka Jain <priyanka.jain@nxp.com>
parent 80279fa1
......@@ -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
......
......@@ -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
......
// 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@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@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);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment