Lines Matching defs:data
237 static inline void wbsd_init_sg(struct wbsd_host *host, struct mmc_data *data)
240 * Get info. about SG list from data structure.
242 host->cur_sg = data->sg;
243 host->num_sg = data->sg_len;
273 static inline void wbsd_sg_to_dma(struct wbsd_host *host, struct mmc_data *data)
278 for (i = 0; i < data->sg_len; i++)
279 len += data->sg[i].length;
280 sg_copy_to_buffer(data->sg, data->sg_len, host->dma_buffer, len);
283 static inline void wbsd_dma_to_sg(struct wbsd_host *host, struct mmc_data *data)
288 for (i = 0; i < data->sg_len; i++)
289 len += data->sg[i].length;
290 sg_copy_from_buffer(data->sg, data->sg_len, host->dma_buffer, len);
402 struct mmc_data *data = host->mrq->cmd->data;
407 * Handle excessive data.
436 data->bytes_xfered++;
461 if ((data->blocks * data->blksz - data->bytes_xfered) < 16)
467 struct mmc_data *data = host->mrq->cmd->data;
502 data->bytes_xfered++;
530 static void wbsd_prepare_data(struct wbsd_host *host, struct mmc_data *data)
540 size = data->blocks * data->blksz;
546 if (data->timeout_ns > 127000000)
550 data->timeout_ns / 1000000);
553 if (data->timeout_clks > 255)
556 wbsd_write_index(host, WBSD_IDX_NSAC, data->timeout_clks);
564 * Two bytes are needed for each data line.
567 blksize = data->blksz + 2;
572 blksize = data->blksz + 2 * 4;
578 data->error = -EINVAL;
600 data->error = -EINVAL;
605 * Transfer data from the SG list to
608 if (data->flags & MMC_DATA_WRITE)
609 wbsd_sg_to_dma(host, data);
617 if (data->flags & MMC_DATA_READ)
641 wbsd_init_sg(host, data);
652 if (data->flags & MMC_DATA_READ) {
662 data->error = 0;
665 static void wbsd_finish_data(struct wbsd_host *host, struct mmc_data *data)
676 if (data->stop)
677 wbsd_send_command(host, data->stop);
680 * Wait for the controller to leave data
705 data->bytes_xfered = host->mrq->data->blocks *
706 host->mrq->data->blksz - count;
707 data->bytes_xfered -= data->bytes_xfered % data->blksz;
710 * Any leftover data?
717 if (!data->error)
718 data->error = -EIO;
721 * Transfer data from DMA buffer to
724 if (data->flags & MMC_DATA_READ)
725 wbsd_dma_to_sg(host, data);
728 if (data->error) {
729 if (data->bytes_xfered)
730 data->bytes_xfered -= data->blksz;
767 if (cmd->data) {
770 * of "data" commands. If a command isn't on this list, it'll
771 * just go back to the idle state and won't send any data
803 * Does the request include data?
805 if (cmd->data) {
806 wbsd_prepare_data(host, cmd->data);
808 if (cmd->data->error)
815 * If this is a data transfer the request
816 * will be finished after the data has
819 if (cmd->data && !cmd->error) {
903 * setting up the data transfer.
983 WARN_ON(!host->mrq->cmd->data);
984 if (!host->mrq->cmd->data)
987 return host->mrq->cmd->data;
1042 struct mmc_data *data;
1049 data = wbsd_get_data(host);
1050 if (!data)
1053 if (data->flags & MMC_DATA_WRITE)
1073 struct mmc_data *data;
1080 data = wbsd_get_data(host);
1081 if (!data)
1086 data->error = -EILSEQ;
1097 struct mmc_data *data;
1104 data = wbsd_get_data(host);
1105 if (!data)
1110 data->error = -ETIMEDOUT;
1121 struct mmc_data *data;
1129 data = wbsd_get_data(host);
1130 if (!data)
1133 wbsd_finish_data(host, data);