platform/msm_shared/mmc.c
static unsigned int
mmc_boot_adjust_interface_speed(struct mmc_boot_host *host,
				struct mmc_boot_card *card)
{
	unsigned int mmc_ret = MMC_BOOT_E_SUCCESS;
	unsigned int status;
	unsigned int wait_count = 100;

	/* Setting HS_TIMING in EXT_CSD (CMD6) */
	mmc_ret = mmc_boot_switch_cmd(card, MMC_BOOT_ACCESS_WRITE,
				      MMC_BOOT_EXT_CMMC_HS_TIMING, 1);

	if (mmc_ret != MMC_BOOT_E_SUCCESS) {
		return mmc_ret;
	}

	/* Wait for the card to complete the switch command processing */
	do {
		mmc_ret = mmc_boot_get_card_status(card, 0, &status);
		if (mmc_ret != MMC_BOOT_E_SUCCESS) {
			dprintf(CRITICAL, "WARNING: Failed to get card status after"
							  "cmd6. ret = %d wait_count = %d\n",
					mmc_ret, wait_count);
		}

		wait_count--;
		if (wait_count == 0) {
			return MMC_BOOT_E_FAILURE;
		}
	}
	while (MMC_BOOT_CARD_STATUS(status) == MMC_BOOT_PROG_STATE);

	clock_config_mmc(mmc_slot, MMC_CLK_50MHZ);

	host->mclk_rate = MMC_CLK_50MHZ;

	return MMC_BOOT_E_SUCCESS;
}
/*
 * Adjust the interface speed to optimal speed
 */
Adjust the interface speed to optimal speed
Adjust the interface speed to optimal speed
static unsigned int
mmc_boot_adjust_interface_speed(struct mmc_boot_host *host,
				struct mmc_boot_card *card)
{
	unsigned int mmc_ret = MMC_BOOT_E_SUCCESS;
	unsigned int status;
	unsigned int wait_count = 100;
	mmc_ret = mmc_boot_switch_cmd(card, MMC_BOOT_ACCESS_WRITE,
				      MMC_BOOT_EXT_CMMC_HS_TIMING, 1);
	if (mmc_ret != MMC_BOOT_E_SUCCESS) {
		return mmc_ret;
	}
	do {
		mmc_ret = mmc_boot_get_card_status(card, 0, &status);
		if (mmc_ret != MMC_BOOT_E_SUCCESS) {
			dprintf(CRITICAL, "WARNING: Failed to get card status after"
							  "cmd6. ret = %d wait_count = %d\n",
					mmc_ret, wait_count);
		}
		wait_count--;
		if (wait_count == 0) {
			return MMC_BOOT_E_FAILURE;
		}
	}
	while (MMC_BOOT_CARD_STATUS(status) == MMC_BOOT_PROG_STATE);
	clock_config_mmc(mmc_slot, MMC_CLK_50MHZ);
	host->mclk_rate = MMC_CLK_50MHZ;
	return MMC_BOOT_E_SUCCESS;
}
static unsigned int mmc_boot_adjust_interface_speed ( struct mmc_boot_host * host , struct mmc_boot_card * card ) { unsigned int mmc_ret = MMC_BOOT_E_SUCCESS ; unsigned int status ; unsigned int wait_count = 100 ; mmc_ret = mmc_boot_switch_cmd ( card , MMC_BOOT_ACCESS_WRITE , MMC_BOOT_EXT_CMMC_HS_TIMING , 1 ) ; if ( mmc_ret != MMC_BOOT_E_SUCCESS ) { return mmc_ret ; } do { mmc_ret = mmc_boot_get_card_status ( card , 0 , & status ) ; if ( mmc_ret != MMC_BOOT_E_SUCCESS ) { dprintf ( CRITICAL , " " " \n " , mmc_ret , wait_count ) ; } wait_count -- ; if ( wait_count == 0 ) { return MMC_BOOT_E_FAILURE ; } } while ( MMC_BOOT_CARD_STATUS ( status ) == MMC_BOOT_PROG_STATE ) ; clock_config_mmc ( mmc_slot , MMC_CLK_50MHZ ) ; host -> mclk_rate = MMC_CLK_50MHZ ; return MMC_BOOT_E_SUCCESS ; }
Adjust the interface speed to optimal speed
Adjust the interface speed to optimal speed
/* Setting HS_TIMING in EXT_CSD (CMD6) */ /* Wait for the card to complete the switch command processing */