projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
dm: pci: Allow PCI bus numbering aliases
[oweals/u-boot.git]
/
test
/
dm
/
test-fdt.c
diff --git
a/test/dm/test-fdt.c
b/test/dm/test-fdt.c
index dc4ebf9adaf90e4aecc0848c3af9f873d5d8e911..49a36cb1932e67794d5f55ec7359e2c54920885a 100644
(file)
--- a/
test/dm/test-fdt.c
+++ b/
test/dm/test-fdt.c
@@
-12,9
+12,9
@@
#include <asm/io.h>
#include <dm/test.h>
#include <dm/root.h>
#include <asm/io.h>
#include <dm/test.h>
#include <dm/root.h>
-#include <dm/ut.h>
#include <dm/uclass-internal.h>
#include <dm/util.h>
#include <dm/uclass-internal.h>
#include <dm/util.h>
+#include <test/ut.h>
DECLARE_GLOBAL_DATA_PTR;
DECLARE_GLOBAL_DATA_PTR;
@@
-51,6
+51,13
@@
static int testfdt_drv_probe(struct udevice *dev)
priv->ping_total += DM_TEST_START_TOTAL;
priv->ping_total += DM_TEST_START_TOTAL;
+ /*
+ * If this device is on a bus, the uclass_flag will be set before
+ * calling this function. This is used by
+ * dm_test_bus_child_pre_probe_uclass().
+ */
+ priv->uclass_total += priv->uclass_flag;
+
return 0;
}
return 0;
}
@@
-89,9
+96,10
@@
int testfdt_ping(struct udevice *dev, int pingval, int *pingret)
UCLASS_DRIVER(testfdt) = {
.name = "testfdt",
.id = UCLASS_TEST_FDT,
UCLASS_DRIVER(testfdt) = {
.name = "testfdt",
.id = UCLASS_TEST_FDT,
+ .flags = DM_UC_FLAG_SEQ_ALIAS,
};
};
-int dm_check_devices(struct
dm_test_state *dm
s, int num_devices)
+int dm_check_devices(struct
unit_test_state *ut
s, int num_devices)
{
struct udevice *dev;
int ret;
{
struct udevice *dev;
int ret;
@@
-118,7
+126,7
@@
int dm_check_devices(struct dm_test_state *dms, int num_devices)
debug("dev=%d, base=%d: %s\n", i, base,
fdt_get_name(gd->fdt_blob, dev->of_offset, NULL));
debug("dev=%d, base=%d: %s\n", i, base,
fdt_get_name(gd->fdt_blob, dev->of_offset, NULL));
- ut_assert(!dm_check_operations(
dm
s, dev, base,
+ ut_assert(!dm_check_operations(
ut
s, dev, base,
dev_get_priv(dev)));
}
dev_get_priv(dev)));
}
@@
-126,9
+134,9
@@
int dm_check_devices(struct dm_test_state *dms, int num_devices)
}
/* Test that FDT-based binding works correctly */
}
/* Test that FDT-based binding works correctly */
-static int dm_test_fdt(struct
dm_test_state *dm
s)
+static int dm_test_fdt(struct
unit_test_state *ut
s)
{
{
- const int num_devices =
4
;
+ const int num_devices =
6
;
struct udevice *dev;
struct uclass *uc;
int ret;
struct udevice *dev;
struct uclass *uc;
int ret;
@@
-151,13
+159,13
@@
static int dm_test_fdt(struct dm_test_state *dms)
ut_assert(dev->platdata);
}
ut_assert(dev->platdata);
}
- ut_assertok(dm_check_devices(
dm
s, num_devices));
+ ut_assertok(dm_check_devices(
ut
s, num_devices));
return 0;
}
DM_TEST(dm_test_fdt, 0);
return 0;
}
DM_TEST(dm_test_fdt, 0);
-static int dm_test_fdt_pre_reloc(struct
dm_test_state *dm
s)
+static int dm_test_fdt_pre_reloc(struct
unit_test_state *ut
s)
{
struct uclass *uc;
int ret;
{
struct uclass *uc;
int ret;
@@
-176,7
+184,7
@@
static int dm_test_fdt_pre_reloc(struct dm_test_state *dms)
DM_TEST(dm_test_fdt_pre_reloc, 0);
/* Test that sequence numbers are allocated properly */
DM_TEST(dm_test_fdt_pre_reloc, 0);
/* Test that sequence numbers are allocated properly */
-static int dm_test_fdt_uclass_seq(struct
dm_test_state *dm
s)
+static int dm_test_fdt_uclass_seq(struct
unit_test_state *ut
s)
{
struct udevice *dev;
{
struct udevice *dev;
@@
-184,7
+192,7
@@
static int dm_test_fdt_uclass_seq(struct dm_test_state *dms)
ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_FDT, 3, true, &dev));
ut_asserteq_str("b-test", dev->name);
ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_FDT, 3, true, &dev));
ut_asserteq_str("b-test", dev->name);
- ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_FDT,
0
, true, &dev));
+ ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_FDT,
8
, true, &dev));
ut_asserteq_str("a-test", dev->name);
ut_asserteq(-ENODEV, uclass_find_device_by_seq(UCLASS_TEST_FDT, 5,
ut_asserteq_str("a-test", dev->name);
ut_asserteq(-ENODEV, uclass_find_device_by_seq(UCLASS_TEST_FDT, 5,
@@
-220,18
+228,18
@@
static int dm_test_fdt_uclass_seq(struct dm_test_state *dms)
ut_asserteq(-ENODEV, uclass_get_device_by_seq(UCLASS_TEST_FDT, 1,
&dev));
ut_assertok(uclass_get_device(UCLASS_TEST_FDT, 0, &dev));
ut_asserteq(-ENODEV, uclass_get_device_by_seq(UCLASS_TEST_FDT, 1,
&dev));
ut_assertok(uclass_get_device(UCLASS_TEST_FDT, 0, &dev));
- ut_assertok(uclass_get_device(UCLASS_TEST_FDT,
1
, &dev));
+ ut_assertok(uclass_get_device(UCLASS_TEST_FDT,
4
, &dev));
/* But now that it is probed, we can find it */
ut_assertok(uclass_get_device_by_seq(UCLASS_TEST_FDT, 1, &dev));
/* But now that it is probed, we can find it */
ut_assertok(uclass_get_device_by_seq(UCLASS_TEST_FDT, 1, &dev));
- ut_asserteq_str("
a
-test", dev->name);
+ ut_asserteq_str("
f
-test", dev->name);
return 0;
}
DM_TEST(dm_test_fdt_uclass_seq, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
/* Test that we can find a device by device tree offset */
return 0;
}
DM_TEST(dm_test_fdt_uclass_seq, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
/* Test that we can find a device by device tree offset */
-static int dm_test_fdt_offset(struct
dm_test_state *dm
s)
+static int dm_test_fdt_offset(struct
unit_test_state *ut
s)
{
const void *blob = gd->fdt_blob;
struct udevice *dev;
{
const void *blob = gd->fdt_blob;
struct udevice *dev;