Lines Matching refs:mrq

190 				 struct mmc_request *mrq, unsigned int blocks)  in mmc_test_prepare_sbc()  argument
194 if (!mrq->sbc || !mmc_host_cmd23(card->host) || in mmc_test_prepare_sbc()
195 !mmc_test_card_cmd23(card) || !mmc_op_multi(mrq->cmd->opcode) || in mmc_test_prepare_sbc()
197 mrq->sbc = NULL; in mmc_test_prepare_sbc()
201 mrq->sbc->opcode = MMC_SET_BLOCK_COUNT; in mmc_test_prepare_sbc()
202 mrq->sbc->arg = blocks; in mmc_test_prepare_sbc()
203 mrq->sbc->flags = MMC_RSP_R1 | MMC_CMD_AC; in mmc_test_prepare_sbc()
210 struct mmc_request *mrq, struct scatterlist *sg, unsigned sg_len, in mmc_test_prepare_mrq() argument
213 if (WARN_ON(!mrq || !mrq->cmd || !mrq->data || !mrq->stop)) in mmc_test_prepare_mrq()
217 mrq->cmd->opcode = write ? in mmc_test_prepare_mrq()
220 mrq->cmd->opcode = write ? in mmc_test_prepare_mrq()
224 mrq->cmd->arg = dev_addr; in mmc_test_prepare_mrq()
226 mrq->cmd->arg <<= 9; in mmc_test_prepare_mrq()
228 mrq->cmd->flags = MMC_RSP_R1 | MMC_CMD_ADTC; in mmc_test_prepare_mrq()
231 mrq->stop = NULL; in mmc_test_prepare_mrq()
233 mrq->stop->opcode = MMC_STOP_TRANSMISSION; in mmc_test_prepare_mrq()
234 mrq->stop->arg = 0; in mmc_test_prepare_mrq()
235 mrq->stop->flags = MMC_RSP_R1B | MMC_CMD_AC; in mmc_test_prepare_mrq()
238 mrq->data->blksz = blksz; in mmc_test_prepare_mrq()
239 mrq->data->blocks = blocks; in mmc_test_prepare_mrq()
240 mrq->data->flags = write ? MMC_DATA_WRITE : MMC_DATA_READ; in mmc_test_prepare_mrq()
241 mrq->data->sg = sg; in mmc_test_prepare_mrq()
242 mrq->data->sg_len = sg_len; in mmc_test_prepare_mrq()
244 mmc_test_prepare_sbc(test, mrq, blocks); in mmc_test_prepare_mrq()
246 mmc_set_data_timeout(mrq->data, test->card); in mmc_test_prepare_mrq()
292 struct mmc_request mrq = {}; in mmc_test_buffer_transfer() local
299 mrq.cmd = &cmd; in mmc_test_buffer_transfer()
300 mrq.data = &data; in mmc_test_buffer_transfer()
301 mrq.stop = &stop; in mmc_test_buffer_transfer()
305 mmc_test_prepare_mrq(test, &mrq, &sg, 1, addr, 1, blksz, write); in mmc_test_buffer_transfer()
307 mmc_wait_for_req(test->card->host, &mrq); in mmc_test_buffer_transfer()
673 struct mmc_request *mrq, int write) in mmc_test_prepare_broken_mrq() argument
675 if (WARN_ON(!mrq || !mrq->cmd || !mrq->data)) in mmc_test_prepare_broken_mrq()
678 if (mrq->data->blocks > 1) { in mmc_test_prepare_broken_mrq()
679 mrq->cmd->opcode = write ? in mmc_test_prepare_broken_mrq()
681 mrq->stop = NULL; in mmc_test_prepare_broken_mrq()
683 mrq->cmd->opcode = MMC_SEND_STATUS; in mmc_test_prepare_broken_mrq()
684 mrq->cmd->arg = test->card->rca << 16; in mmc_test_prepare_broken_mrq()
692 struct mmc_request *mrq) in mmc_test_check_result() argument
696 if (WARN_ON(!mrq || !mrq->cmd || !mrq->data)) in mmc_test_check_result()
701 if (mrq->sbc && mrq->sbc->error) in mmc_test_check_result()
702 ret = mrq->sbc->error; in mmc_test_check_result()
703 if (!ret && mrq->cmd->error) in mmc_test_check_result()
704 ret = mrq->cmd->error; in mmc_test_check_result()
705 if (!ret && mrq->data->error) in mmc_test_check_result()
706 ret = mrq->data->error; in mmc_test_check_result()
707 if (!ret && mrq->stop && mrq->stop->error) in mmc_test_check_result()
708 ret = mrq->stop->error; in mmc_test_check_result()
709 if (!ret && mrq->data->bytes_xfered != in mmc_test_check_result()
710 mrq->data->blocks * mrq->data->blksz) in mmc_test_check_result()
723 struct mmc_request *mrq) in mmc_test_check_broken_result() argument
727 if (WARN_ON(!mrq || !mrq->cmd || !mrq->data)) in mmc_test_check_broken_result()
732 if (!ret && mrq->cmd->error) in mmc_test_check_broken_result()
733 ret = mrq->cmd->error; in mmc_test_check_broken_result()
734 if (!ret && mrq->data->error == 0) in mmc_test_check_broken_result()
736 if (!ret && mrq->data->error != -ETIMEDOUT) in mmc_test_check_broken_result()
737 ret = mrq->data->error; in mmc_test_check_broken_result()
738 if (!ret && mrq->stop && mrq->stop->error) in mmc_test_check_broken_result()
739 ret = mrq->stop->error; in mmc_test_check_broken_result()
740 if (mrq->data->blocks > 1) { in mmc_test_check_broken_result()
741 if (!ret && mrq->data->bytes_xfered > mrq->data->blksz) in mmc_test_check_broken_result()
744 if (!ret && mrq->data->bytes_xfered > 0) in mmc_test_check_broken_result()
755 struct mmc_request mrq; member
770 rq->mrq.cmd = &rq->cmd; in mmc_test_req_reset()
771 rq->mrq.data = &rq->data; in mmc_test_req_reset()
772 rq->mrq.stop = &rq->stop; in mmc_test_req_reset()
785 static void mmc_test_wait_done(struct mmc_request *mrq) in mmc_test_wait_done() argument
787 complete(&mrq->completion); in mmc_test_wait_done()
791 struct mmc_request *mrq, in mmc_test_start_areq() argument
797 if (mrq) { in mmc_test_start_areq()
798 init_completion(&mrq->completion); in mmc_test_start_areq()
799 mrq->done = mmc_test_wait_done; in mmc_test_start_areq()
800 mmc_pre_req(host, mrq); in mmc_test_start_areq()
810 if (!err && mrq) { in mmc_test_start_areq()
811 err = mmc_start_request(host, mrq); in mmc_test_start_areq()
819 if (err && mrq) in mmc_test_start_areq()
820 mmc_post_req(host, mrq, err); in mmc_test_start_areq()
830 struct mmc_request *mrq, *prev_mrq; in mmc_test_nonblock_transfer() local
844 mrq = &rq1->mrq; in mmc_test_nonblock_transfer()
848 mmc_test_req_reset(container_of(mrq, struct mmc_test_req, mrq)); in mmc_test_nonblock_transfer()
849 mmc_test_prepare_mrq(test, mrq, sg, t->sg_len, dev_addr, in mmc_test_nonblock_transfer()
851 ret = mmc_test_start_areq(test, mrq, prev_mrq); in mmc_test_nonblock_transfer()
856 prev_mrq = &rq2->mrq; in mmc_test_nonblock_transfer()
858 swap(mrq, prev_mrq); in mmc_test_nonblock_transfer()
877 struct mmc_request mrq = {}; in mmc_test_simple_transfer() local
882 mrq.cmd = &cmd; in mmc_test_simple_transfer()
883 mrq.data = &data; in mmc_test_simple_transfer()
884 mrq.stop = &stop; in mmc_test_simple_transfer()
886 mmc_test_prepare_mrq(test, &mrq, sg, sg_len, dev_addr, in mmc_test_simple_transfer()
889 mmc_wait_for_req(test->card->host, &mrq); in mmc_test_simple_transfer()
893 return mmc_test_check_result(test, &mrq); in mmc_test_simple_transfer()
902 struct mmc_request mrq = {}; in mmc_test_broken_transfer() local
909 mrq.cmd = &cmd; in mmc_test_broken_transfer()
910 mrq.data = &data; in mmc_test_broken_transfer()
911 mrq.stop = &stop; in mmc_test_broken_transfer()
915 mmc_test_prepare_mrq(test, &mrq, &sg, 1, 0, blocks, blksz, write); in mmc_test_broken_transfer()
916 mmc_test_prepare_broken_mrq(test, &mrq, write); in mmc_test_broken_transfer()
918 mmc_wait_for_req(test->card->host, &mrq); in mmc_test_broken_transfer()
922 return mmc_test_check_broken_result(test, &mrq); in mmc_test_broken_transfer()
2374 struct mmc_request *mrq; in mmc_test_ongoing_transfer() local
2384 mrq = &rq->mrq; in mmc_test_ongoing_transfer()
2386 mrq->sbc = &rq->sbc; in mmc_test_ongoing_transfer()
2387 mrq->cap_cmd_during_tfr = true; in mmc_test_ongoing_transfer()
2389 mmc_test_prepare_mrq(test, mrq, t->sg, t->sg_len, dev_addr, t->blocks, in mmc_test_ongoing_transfer()
2392 if (use_sbc && t->blocks > 1 && !mrq->sbc) { in mmc_test_ongoing_transfer()
2401 ret = mmc_test_start_areq(test, mrq, NULL); in mmc_test_ongoing_transfer()
2405 mmc_wait_for_req(host, mrq); in mmc_test_ongoing_transfer()
2423 if (mmc_is_req_done(host, mrq)) in mmc_test_ongoing_transfer()
2437 ret = mmc_test_start_areq(test, NULL, mrq); in mmc_test_ongoing_transfer()
2439 mmc_wait_for_req_done(test->card->host, mrq); in mmc_test_ongoing_transfer()
2446 if (mrq->data->stop && (mrq->data->error || !mrq->sbc)) { in mmc_test_ongoing_transfer()
2448 mmc_wait_for_cmd(host, mrq->data->stop, 0); in mmc_test_ongoing_transfer()
2450 ret = mmc_wait_for_cmd(host, mrq->data->stop, 0); in mmc_test_ongoing_transfer()
2461 ret = mmc_test_check_result(test, mrq); in mmc_test_ongoing_transfer()