.platdata_auto_alloc_size = sizeof(struct dm_test_pdata),
};
+static const struct udevice_id testfdt1_ids[] = {
+ {
+ .compatible = "denx,u-boot-fdt-test1",
+ .data = DM_TEST_TYPE_FIRST },
+ { }
+};
+
+U_BOOT_DRIVER(testfdt1_drv) = {
+ .name = "testfdt1_drv",
+ .of_match = testfdt1_ids,
+ .id = UCLASS_TEST_FDT,
+ .ofdata_to_platdata = testfdt_ofdata_to_platdata,
+ .probe = testfdt_drv_probe,
+ .ops = &test_ops,
+ .priv_auto_alloc_size = sizeof(struct dm_test_priv),
+ .platdata_auto_alloc_size = sizeof(struct dm_test_pdata),
+ .flags = DM_FLAG_PRE_RELOC,
+};
+
/* From here is the testfdt uclass code */
int testfdt_ping(struct udevice *dev, int pingval, int *pingret)
{
/* Test that FDT-based binding works correctly */
static int dm_test_fdt(struct unit_test_state *uts)
{
- const int num_devices = 7;
+ const int num_devices = 8;
struct udevice *dev;
struct uclass *uc;
int ret;
ret = uclass_get(UCLASS_TEST_FDT, &uc);
ut_assert(!ret);
- /* These is only one pre-reloc device */
- ut_asserteq(1, list_count_items(&uc->dev_head));
+ /*
+ * These are 2 pre-reloc devices:
+ * one with "u-boot,dm-pre-reloc" property (a-test node), and the other
+ * one whose driver marked with DM_FLAG_PRE_RELOC flag (h-test node).
+ */
+ ut_asserteq(2, list_count_items(&uc->dev_head));
return 0;
}