diff options
Diffstat (limited to 'test/dm/test-fdt.c')
-rw-r--r-- | test/dm/test-fdt.c | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c index 79b1f1de45..e43acb21d5 100644 --- a/test/dm/test-fdt.c +++ b/test/dm/test-fdt.c | |||
@@ -55,10 +55,13 @@ static int testfdt_drv_probe(struct udevice *dev) | |||
55 | 55 | ||
56 | /* | 56 | /* |
57 | * If this device is on a bus, the uclass_flag will be set before | 57 | * If this device is on a bus, the uclass_flag will be set before |
58 | * calling this function. This is used by | 58 | * calling this function. In the meantime the uclass_postp is |
59 | * dm_test_bus_child_pre_probe_uclass(). | 59 | * initlized to a value -1. These are used respectively by |
60 | * dm_test_bus_child_pre_probe_uclass() and | ||
61 | * dm_test_bus_child_post_probe_uclass(). | ||
60 | */ | 62 | */ |
61 | priv->uclass_total += priv->uclass_flag; | 63 | priv->uclass_total += priv->uclass_flag; |
64 | priv->uclass_postp = -1; | ||
62 | 65 | ||
63 | return 0; | 66 | return 0; |
64 | } | 67 | } |
@@ -84,6 +87,25 @@ U_BOOT_DRIVER(testfdt_drv) = { | |||
84 | .platdata_auto_alloc_size = sizeof(struct dm_test_pdata), | 87 | .platdata_auto_alloc_size = sizeof(struct dm_test_pdata), |
85 | }; | 88 | }; |
86 | 89 | ||
90 | static const struct udevice_id testfdt1_ids[] = { | ||
91 | { | ||
92 | .compatible = "denx,u-boot-fdt-test1", | ||
93 | .data = DM_TEST_TYPE_FIRST }, | ||
94 | { } | ||
95 | }; | ||
96 | |||
97 | U_BOOT_DRIVER(testfdt1_drv) = { | ||
98 | .name = "testfdt1_drv", | ||
99 | .of_match = testfdt1_ids, | ||
100 | .id = UCLASS_TEST_FDT, | ||
101 | .ofdata_to_platdata = testfdt_ofdata_to_platdata, | ||
102 | .probe = testfdt_drv_probe, | ||
103 | .ops = &test_ops, | ||
104 | .priv_auto_alloc_size = sizeof(struct dm_test_priv), | ||
105 | .platdata_auto_alloc_size = sizeof(struct dm_test_pdata), | ||
106 | .flags = DM_FLAG_PRE_RELOC, | ||
107 | }; | ||
108 | |||
87 | /* From here is the testfdt uclass code */ | 109 | /* From here is the testfdt uclass code */ |
88 | int testfdt_ping(struct udevice *dev, int pingval, int *pingret) | 110 | int testfdt_ping(struct udevice *dev, int pingval, int *pingret) |
89 | { | 111 | { |
@@ -168,7 +190,7 @@ int dm_check_devices(struct unit_test_state *uts, int num_devices) | |||
168 | /* Test that FDT-based binding works correctly */ | 190 | /* Test that FDT-based binding works correctly */ |
169 | static int dm_test_fdt(struct unit_test_state *uts) | 191 | static int dm_test_fdt(struct unit_test_state *uts) |
170 | { | 192 | { |
171 | const int num_devices = 7; | 193 | const int num_devices = 8; |
172 | struct udevice *dev; | 194 | struct udevice *dev; |
173 | struct uclass *uc; | 195 | struct uclass *uc; |
174 | int ret; | 196 | int ret; |
@@ -208,8 +230,12 @@ static int dm_test_fdt_pre_reloc(struct unit_test_state *uts) | |||
208 | ret = uclass_get(UCLASS_TEST_FDT, &uc); | 230 | ret = uclass_get(UCLASS_TEST_FDT, &uc); |
209 | ut_assert(!ret); | 231 | ut_assert(!ret); |
210 | 232 | ||
211 | /* These is only one pre-reloc device */ | 233 | /* |
212 | ut_asserteq(1, list_count_items(&uc->dev_head)); | 234 | * These are 2 pre-reloc devices: |
235 | * one with "u-boot,dm-pre-reloc" property (a-test node), and the other | ||
236 | * one whose driver marked with DM_FLAG_PRE_RELOC flag (h-test node). | ||
237 | */ | ||
238 | ut_asserteq(2, list_count_items(&uc->dev_head)); | ||
213 | 239 | ||
214 | return 0; | 240 | return 0; |
215 | } | 241 | } |