platform/msm_shared/mmc.c
static unsigned int
mmc_boot_send_read_command(struct mmc_boot_card *card,
			   unsigned int xfer_type, unsigned int data_addr)
{
	struct mmc_boot_command cmd;
	unsigned int mmc_ret = MMC_BOOT_E_SUCCESS;

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

	memset((struct mmc_boot_command *)&cmd, 0,
	       sizeof(struct mmc_boot_command));

	/* CMD17/18 Format:
	 * [31:0] Data Address
	 */
	if (xfer_type == MMC_BOOT_XFER_MULTI_BLOCK) {
		cmd.cmd_index = CMD18_READ_MULTIPLE_BLOCK;
	} else {
		cmd.cmd_index = CMD17_READ_SINGLE_BLOCK;
	}

	cmd.argument = data_addr;
	cmd.cmd_type = MMC_BOOT_CMD_ADDRESS;
	cmd.resp_type = MMC_BOOT_RESP_R1;

	/* send command */
	mmc_ret = mmc_boot_send_command(&cmd);
	if (mmc_ret != MMC_BOOT_E_SUCCESS) {
		return mmc_ret;
	}

	/* Response contains 32 bit Card status. Here we'll check
	   BLOCK_LEN_ERROR and ADDRESS_ERROR */
	if (cmd.resp[0] & MMC_BOOT_R1_BLOCK_LEN_ERR) {
		return MMC_BOOT_E_BLOCKLEN_ERR;
	}
	/* Misaligned address not matching block length */
	if (cmd.resp[0] & MMC_BOOT_R1_ADDR_ERR) {
		return MMC_BOOT_E_ADDRESS_ERR;
	}

	return MMC_BOOT_E_SUCCESS;
}
/*
 * A command to start data read from card. Either a single block or
 * multiple blocks can be read. Multiple blocks read will continuously
 * transfer data from card to host unless requested to stop by issuing
 * CMD12 - STOP_TRANSMISSION.
 */
A command to start data read from card. Either a single block or
multiple blocks can be read. Multiple blocks read will continuously
transfer data from card to host unless requested to stop by issuing
CMD12 - STOP_TRANSMISSION.
A command to start data read from card . Either a single block or multiple blocks can be read . Multiple blocks read will continuously transfer data from card to host unless requested to stop by issuing CMD12 - STOP_TRANSMISSION .
static unsigned int
mmc_boot_send_read_command(struct mmc_boot_card *card,
			   unsigned int xfer_type, unsigned int data_addr)
{
	struct mmc_boot_command cmd;
	unsigned int mmc_ret = MMC_BOOT_E_SUCCESS;
	if (card == NULL) {
		return MMC_BOOT_E_INVAL;
	}
	memset((struct mmc_boot_command *)&cmd, 0,
	       sizeof(struct mmc_boot_command));
	if (xfer_type == MMC_BOOT_XFER_MULTI_BLOCK) {
		cmd.cmd_index = CMD18_READ_MULTIPLE_BLOCK;
	} else {
		cmd.cmd_index = CMD17_READ_SINGLE_BLOCK;
	}
	cmd.argument = data_addr;
	cmd.cmd_type = MMC_BOOT_CMD_ADDRESS;
	cmd.resp_type = MMC_BOOT_RESP_R1;
	mmc_ret = mmc_boot_send_command(&cmd);
	if (mmc_ret != MMC_BOOT_E_SUCCESS) {
		return mmc_ret;
	}
	if (cmd.resp[0] & MMC_BOOT_R1_BLOCK_LEN_ERR) {
		return MMC_BOOT_E_BLOCKLEN_ERR;
	}
	if (cmd.resp[0] & MMC_BOOT_R1_ADDR_ERR) {
		return MMC_BOOT_E_ADDRESS_ERR;
	}
	return MMC_BOOT_E_SUCCESS;
}
static unsigned int mmc_boot_send_read_command ( struct mmc_boot_card * card , unsigned int xfer_type , unsigned int data_addr ) { struct mmc_boot_command cmd ; unsigned int mmc_ret = MMC_BOOT_E_SUCCESS ; if ( card == NULL ) { return MMC_BOOT_E_INVAL ; } memset ( ( struct mmc_boot_command * ) & cmd , 0 , sizeof ( struct mmc_boot_command ) ) ; if ( xfer_type == MMC_BOOT_XFER_MULTI_BLOCK ) { cmd . cmd_index = CMD18_READ_MULTIPLE_BLOCK ; } else { cmd . cmd_index = CMD17_READ_SINGLE_BLOCK ; } cmd . argument = data_addr ; cmd . cmd_type = MMC_BOOT_CMD_ADDRESS ; cmd . resp_type = MMC_BOOT_RESP_R1 ; mmc_ret = mmc_boot_send_command ( & cmd ) ; if ( mmc_ret != MMC_BOOT_E_SUCCESS ) { return mmc_ret ; } if ( cmd . resp [ 0 ] & MMC_BOOT_R1_BLOCK_LEN_ERR ) { return MMC_BOOT_E_BLOCKLEN_ERR ; } if ( cmd . resp [ 0 ] & MMC_BOOT_R1_ADDR_ERR ) { return MMC_BOOT_E_ADDRESS_ERR ; } return MMC_BOOT_E_SUCCESS ; }
A command to start data read from card.
A command to start data read from card .
/* basic check */ /* CMD17/18 Format:
	 * [31:0] Data Address
	 */ /* send command */ /* Response contains 32 bit Card status. Here we'll check
	   BLOCK_LEN_ERROR and ADDRESS_ERROR */ /* Misaligned address not matching block length */