platform/msm_shared/mmc.c
static unsigned int
mmc_boot_init_card(struct mmc_boot_host *host, struct mmc_boot_card *card)
{
	unsigned int mmc_retry = 0;
	unsigned int mmc_return = MMC_BOOT_E_SUCCESS;

	/* basic check */
	if ((host == NULL) || (card == NULL)) {
		return MMC_BOOT_E_INVAL;
	}

	/* 1. Card Reset - CMD0 */
	mmc_return = mmc_boot_reset_cards();
	if (mmc_return != MMC_BOOT_E_SUCCESS) {
		dprintf(CRITICAL,
			"Error No.:%d: Failure resetting MMC cards!\n",
			mmc_return);
		return mmc_return;
	}

	/* 2. Card Initialization process */

	/* Send CMD1 to identify and reject cards that do not match host's VDD range
	   profile. Cards sends its OCR register in response.
	 */
	mmc_retry = 0;
	do {
		mmc_return = mmc_boot_send_op_cond(host, card);
		/* Card returns busy status. We'll retry again! */
		if (mmc_return == MMC_BOOT_E_CARD_BUSY) {
			mmc_retry++;
			mdelay(1);
			continue;
		} else if (mmc_return == MMC_BOOT_E_SUCCESS) {
			break;
		} else {
			dprintf(CRITICAL,
				"Error No. %d: Failure Initializing MMC Card!\n",
				mmc_return);

			/* Check for sD card */
			mmc_return = mmc_boot_sd_init_card(card);
			return mmc_return;
		}
	}
	while (mmc_retry < host->cmd_retry);

	/* If card still returned busy status we are out of luck.
	 * Card cannot be initialized */
	if (mmc_return == MMC_BOOT_E_CARD_BUSY) {
		dprintf(CRITICAL, "Error No. %d: Card has busy status set. \
                Initialization not completed\n", mmc_return);
		return MMC_BOOT_E_CARD_BUSY;
	}
	return MMC_BOOT_E_SUCCESS;
}
/*
 * Routine to initialize MMC card. It resets a card to idle state, verify operating
 * voltage and set the card inready state.
 */
Routine to initialize MMC card. It resets a card to idle state, verify operating
voltage and set the card inready state.
Routine to initialize MMC card . It resets a card to idle state verify operating voltage and set the card inready state .
static unsigned int
mmc_boot_init_card(struct mmc_boot_host *host, struct mmc_boot_card *card)
{
	unsigned int mmc_retry = 0;
	unsigned int mmc_return = MMC_BOOT_E_SUCCESS;
	if ((host == NULL) || (card == NULL)) {
		return MMC_BOOT_E_INVAL;
	}
	mmc_return = mmc_boot_reset_cards();
	if (mmc_return != MMC_BOOT_E_SUCCESS) {
		dprintf(CRITICAL,
			"Error No.:%d: Failure resetting MMC cards!\n",
			mmc_return);
		return mmc_return;
	}
	mmc_retry = 0;
	do {
		mmc_return = mmc_boot_send_op_cond(host, card);
		if (mmc_return == MMC_BOOT_E_CARD_BUSY) {
			mmc_retry++;
			mdelay(1);
			continue;
		} else if (mmc_return == MMC_BOOT_E_SUCCESS) {
			break;
		} else {
			dprintf(CRITICAL,
				"Error No. %d: Failure Initializing MMC Card!\n",
				mmc_return);
			mmc_return = mmc_boot_sd_init_card(card);
			return mmc_return;
		}
	}
	while (mmc_retry < host->cmd_retry);
	if (mmc_return == MMC_BOOT_E_CARD_BUSY) {
		dprintf(CRITICAL, "Error No. %d: Card has busy status set. \
                Initialization not completed\n", mmc_return);
		return MMC_BOOT_E_CARD_BUSY;
	}
	return MMC_BOOT_E_SUCCESS;
}
static unsigned int mmc_boot_init_card ( struct mmc_boot_host * host , struct mmc_boot_card * card ) { unsigned int mmc_retry = 0 ; unsigned int mmc_return = MMC_BOOT_E_SUCCESS ; if ( ( host == NULL ) || ( card == NULL ) ) { return MMC_BOOT_E_INVAL ; } mmc_return = mmc_boot_reset_cards ( ) ; if ( mmc_return != MMC_BOOT_E_SUCCESS ) { dprintf ( CRITICAL , " \n " , mmc_return ) ; return mmc_return ; } mmc_retry = 0 ; do { mmc_return = mmc_boot_send_op_cond ( host , card ) ; if ( mmc_return == MMC_BOOT_E_CARD_BUSY ) { mmc_retry ++ ; mdelay ( 1 ) ; continue ; } else if ( mmc_return == MMC_BOOT_E_SUCCESS ) { break ; } else { dprintf ( CRITICAL , " \n " , mmc_return ) ; mmc_return = mmc_boot_sd_init_card ( card ) ; return mmc_return ; } } while ( mmc_retry < host -> cmd_retry ) ; if ( mmc_return == MMC_BOOT_E_CARD_BUSY ) { dprintf ( CRITICAL , " \
 \n " , mmc_return ) ; return MMC_BOOT_E_CARD_BUSY ; } return MMC_BOOT_E_SUCCESS ; }
Routine to initialize MMC card.
Routine to initialize MMC card .
/* basic check */ /* 1. Card Reset - CMD0 */ /* 2. Card Initialization process */ /* Send CMD1 to identify and reject cards that do not match host's VDD range
	   profile. Cards sends its OCR register in response.
	 */ /* Card returns busy status. We'll retry again! */ /* Check for sD card */ /* If card still returned busy status we are out of luck.
	 * Card cannot be initialized */