/* Perform init required for both SD and SDIO cards. This function performs the following portions of SD initialization */
static int sd_common_init(struct sd_card *card)
/* Perform init required for both SD and SDIO cards. This function performs the following portions of SD initialization */
static int sd_common_init(struct sd_card *card)
{
	int ret;
	ret = sd_idle(card);
	if (ret) {
		LOG_ERR("Card error on CMD0");
		return ret;
	}
	ret = sd_retry(sd_send_interface_condition, card, CONFIG_SD_RETRY_COUNT);
	if (ret == -ETIMEDOUT) {
		LOG_INF("Card does not support CMD8, assuming legacy card");
		return sd_idle(card);
	} else if (ret) {
		LOG_ERR("Card error on CMD 8");
		return ret;
	}
	if (card->host_props.is_spi &&
		IS_ENABLED(CONFIG_SDHC_SUPPORTS_SPI_MODE)) {
		ret = sd_enable_crc(card);
	}
	return ret;
}