tests: subsys: sd: sdmmc: Convert to use DEVICE_DT_GET

Move to use DEVICE_DT_GET instead of device_get_binding as
we work on phasing out use of DTS 'label' property.

Move to using alias 'sdhc0' for SDHC controller.

Signed-off-by: Kumar Gala <galak@kernel.org>
This commit is contained in:
Kumar Gala 2022-07-07 16:42:27 -05:00 committed by Carles Cufí
commit 02d0d20d59
3 changed files with 3 additions and 17 deletions

View file

@ -1,13 +0,0 @@
# Copyright 2022 NXP
# SPDX-License-Identifier: Apache-2.0
mainmenu "SD Host controller test"
source "Kconfig.zephyr"
config SDHC_LABEL
string "SD host controller label"
default "SDHC_0"
help
Devicetree label for SD host controller. Used to get reference to
device

View file

@ -14,7 +14,7 @@
#define SECTOR_COUNT 32 #define SECTOR_COUNT 32
#define SECTOR_SIZE 512 /* subsystem should set all cards to 512 byte blocks */ #define SECTOR_SIZE 512 /* subsystem should set all cards to 512 byte blocks */
#define BUF_SIZE SECTOR_SIZE * SECTOR_COUNT #define BUF_SIZE SECTOR_SIZE * SECTOR_COUNT
const struct device *sdhc_dev; static const struct device *sdhc_dev = DEVICE_DT_GET(DT_ALIAS(sdhc0));
static struct sd_card card; static struct sd_card card;
static uint8_t buf[BUF_SIZE] __aligned(CONFIG_SDHC_BUFFER_ALIGNMENT); static uint8_t buf[BUF_SIZE] __aligned(CONFIG_SDHC_BUFFER_ALIGNMENT);
static uint8_t check_buf[BUF_SIZE] __aligned(CONFIG_SDHC_BUFFER_ALIGNMENT); static uint8_t check_buf[BUF_SIZE] __aligned(CONFIG_SDHC_BUFFER_ALIGNMENT);
@ -29,8 +29,7 @@ ZTEST(sd_stack, test_init)
{ {
int ret; int ret;
sdhc_dev = device_get_binding(CONFIG_SDHC_LABEL); zassert_true(device_is_ready(sdhc_dev), "SDHC device is not ready");
zassert_not_null(sdhc_dev, "Could not get SD host controller dev");
ret = sd_is_card_present(sdhc_dev); ret = sd_is_card_present(sdhc_dev);
zassert_equal(ret, 1, "SD card not present in slot"); zassert_equal(ret, 1, "SD card not present in slot");

View file

@ -6,7 +6,7 @@ tests:
harness: ztest harness: ztest
harness_config: harness_config:
fixture: fixture_sdhc fixture: fixture_sdhc
filter: CONFIG_SD_STACK filter: dt_alias_exists("sdhc0")
tags: sdhc tags: sdhc
min_ram: 32 min_ram: 32
integration_platforms: integration_platforms: