/* Returns a mask of interrupt flags to be enabled after the whole request has been prepared.  */
static u32 atmci_prepare_data(struct atmel_mci *host, struct mmc_data *data)
/* Returns a mask of interrupt flags to be enabled after the whole request has been prepared.  */
static u32 atmci_prepare_data(struct atmel_mci *host, struct mmc_data *data)
{
	u32 iflags;
	data->error = -EINPROGRESS;
	WARN_ON(host->data);
	host->sg = NULL;
	host->data = data;
	iflags = ATMCI_DATA_ERROR_FLAGS;
	if (atmci_prepare_data_dma(host, data)) {
		host->data_chan = NULL;
		if (data->blocks * data->blksz < 12
				|| (data->blocks * data->blksz) & 3)
			host->need_reset = true;
		host->sg = data->sg;
		host->pio_offset = 0;
		if (data->flags & MMC_DATA_READ)
			iflags |= MCI_RXRDY;
		else
			iflags |= MCI_TXRDY;
	}
	return iflags;
}