]>
git.ipfire.org Git - people/ms/u-boot.git/blob - test/dm/mmc.c
2 * Copyright (C) 2015 Google, Inc
4 * SPDX-License-Identifier: GPL-2.0+
13 DECLARE_GLOBAL_DATA_PTR
;
16 * Basic test of the mmc uclass. We could expand this by implementing an MMC
17 * stack for sandbox, or at least implementing the basic operation.
19 static int dm_test_mmc_base(struct unit_test_state
*uts
)
23 ut_assertok(uclass_get_device(UCLASS_MMC
, 0, &dev
));
27 DM_TEST(dm_test_mmc_base
, DM_TESTF_SCAN_PDATA
| DM_TESTF_SCAN_FDT
);
29 static int dm_test_mmc_blk(struct unit_test_state
*uts
)
32 struct blk_desc
*dev_desc
;
35 ut_assertok(uclass_get_device(UCLASS_MMC
, 0, &dev
));
36 ut_assertok(blk_get_device_by_str("mmc", "0", &dev_desc
));
38 /* Read a few blocks and look for the string we expect */
39 ut_asserteq(512, dev_desc
->blksz
);
40 memset(cmp
, '\0', sizeof(cmp
));
41 ut_asserteq(2, blk_dread(dev_desc
, 0, 2, cmp
));
42 ut_assertok(strcmp(cmp
, "this is a test"));
46 DM_TEST(dm_test_mmc_blk
, DM_TESTF_SCAN_PDATA
| DM_TESTF_SCAN_FDT
);