Lines Matching refs:brq
1293 static inline void mmc_apply_rel_rw(struct mmc_blk_request *brq, in mmc_apply_rel_rw() argument
1300 brq->data.blocks = 1; in mmc_apply_rel_rw()
1302 if (brq->data.blocks > card->ext_csd.rel_sectors) in mmc_apply_rel_rw()
1303 brq->data.blocks = card->ext_csd.rel_sectors; in mmc_apply_rel_rw()
1304 else if (brq->data.blocks < card->ext_csd.rel_sectors) in mmc_apply_rel_rw()
1305 brq->data.blocks = 1; in mmc_apply_rel_rw()
1321 static void mmc_blk_eval_resp_error(struct mmc_blk_request *brq) in mmc_blk_eval_resp_error() argument
1351 if (!brq->stop.error) { in mmc_blk_eval_resp_error()
1355 val = brq->stop.resp[0] & CMD_ERRORS; in mmc_blk_eval_resp_error()
1356 oor_with_open_end = val & R1_OUT_OF_RANGE && !brq->mrq.sbc; in mmc_blk_eval_resp_error()
1359 brq->stop.error = -EIO; in mmc_blk_eval_resp_error()
1369 struct mmc_blk_request *brq = &mqrq->brq; in mmc_blk_data_prep() local
1381 memset(brq, 0, sizeof(struct mmc_blk_request)); in mmc_blk_data_prep()
1385 brq->mrq.data = &brq->data; in mmc_blk_data_prep()
1386 brq->mrq.tag = req->tag; in mmc_blk_data_prep()
1388 brq->stop.opcode = MMC_STOP_TRANSMISSION; in mmc_blk_data_prep()
1389 brq->stop.arg = 0; in mmc_blk_data_prep()
1392 brq->data.flags = MMC_DATA_READ; in mmc_blk_data_prep()
1393 brq->stop.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC; in mmc_blk_data_prep()
1395 brq->data.flags = MMC_DATA_WRITE; in mmc_blk_data_prep()
1396 brq->stop.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC; in mmc_blk_data_prep()
1399 brq->data.blksz = 512; in mmc_blk_data_prep()
1400 brq->data.blocks = blk_rq_sectors(req); in mmc_blk_data_prep()
1401 brq->data.blk_addr = blk_rq_pos(req); in mmc_blk_data_prep()
1415 if (brq->data.blocks > card->host->max_blk_count) in mmc_blk_data_prep()
1416 brq->data.blocks = card->host->max_blk_count; in mmc_blk_data_prep()
1418 if (brq->data.blocks > 1) { in mmc_blk_data_prep()
1427 brq->data.blocks--; in mmc_blk_data_prep()
1435 brq->data.blocks = queue_physical_block_size(mq->queue) >> 9; in mmc_blk_data_prep()
1442 brq->data.blocks = card->host->ops->multi_io_quirk(card, in mmc_blk_data_prep()
1445 brq->data.blocks); in mmc_blk_data_prep()
1449 mmc_apply_rel_rw(brq, card, req); in mmc_blk_data_prep()
1450 brq->data.flags |= MMC_DATA_REL_WR; in mmc_blk_data_prep()
1460 ((brq->data.blocks * brq->data.blksz) >= in mmc_blk_data_prep()
1464 brq->data.flags |= MMC_DATA_DAT_TAG; in mmc_blk_data_prep()
1466 mmc_set_data_timeout(&brq->data, card); in mmc_blk_data_prep()
1468 brq->data.sg = mqrq->sg; in mmc_blk_data_prep()
1469 brq->data.sg_len = mmc_queue_map_sg(mq, mqrq); in mmc_blk_data_prep()
1475 if (brq->data.blocks != blk_rq_sectors(req)) { in mmc_blk_data_prep()
1476 int i, data_size = brq->data.blocks << 9; in mmc_blk_data_prep()
1479 for_each_sg(brq->data.sg, sg, brq->data.sg_len, i) { in mmc_blk_data_prep()
1487 brq->data.sg_len = i; in mmc_blk_data_prep()
1502 struct mmc_request *mrq = &mqrq->brq.mrq; in mmc_blk_cqe_complete_rq()
1571 brq.mrq); in mmc_blk_cqe_req_done()
1597 struct mmc_blk_request *brq = &mqrq->brq; in mmc_blk_cqe_prep_dcmd() local
1599 memset(brq, 0, sizeof(*brq)); in mmc_blk_cqe_prep_dcmd()
1601 brq->mrq.cmd = &brq->cmd; in mmc_blk_cqe_prep_dcmd()
1602 brq->mrq.tag = req->tag; in mmc_blk_cqe_prep_dcmd()
1604 return &brq->mrq; in mmc_blk_cqe_prep_dcmd()
1629 mqrq->brq.mrq.done = mmc_blk_hsq_req_done; in mmc_blk_hsq_issue_rw_rq()
1630 mmc_pre_req(host, &mqrq->brq.mrq); in mmc_blk_hsq_issue_rw_rq()
1632 err = mmc_cqe_start_req(host, &mqrq->brq.mrq); in mmc_blk_hsq_issue_rw_rq()
1634 mmc_post_req(host, &mqrq->brq.mrq, err); in mmc_blk_hsq_issue_rw_rq()
1649 return mmc_blk_cqe_start_req(mq->card->host, &mqrq->brq.mrq); in mmc_blk_cqe_issue_rw_rq()
1658 struct mmc_blk_request *brq = &mqrq->brq; in mmc_blk_rw_rq_prep() local
1665 brq->mrq.cmd = &brq->cmd; in mmc_blk_rw_rq_prep()
1667 brq->cmd.arg = blk_rq_pos(req); in mmc_blk_rw_rq_prep()
1669 brq->cmd.arg <<= 9; in mmc_blk_rw_rq_prep()
1670 brq->cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC; in mmc_blk_rw_rq_prep()
1672 if (brq->data.blocks > 1 || do_rel_wr) { in mmc_blk_rw_rq_prep()
1678 brq->mrq.stop = &brq->stop; in mmc_blk_rw_rq_prep()
1682 brq->mrq.stop = NULL; in mmc_blk_rw_rq_prep()
1686 brq->cmd.opcode = rq_data_dir(req) == READ ? readcmd : writecmd; in mmc_blk_rw_rq_prep()
1706 if ((md->flags & MMC_BLK_CMD23) && mmc_op_multi(brq->cmd.opcode) && in mmc_blk_rw_rq_prep()
1709 brq->sbc.opcode = MMC_SET_BLOCK_COUNT; in mmc_blk_rw_rq_prep()
1710 brq->sbc.arg = brq->data.blocks | in mmc_blk_rw_rq_prep()
1713 brq->sbc.flags = MMC_RSP_R1 | MMC_CMD_AC; in mmc_blk_rw_rq_prep()
1714 brq->mrq.sbc = &brq->sbc; in mmc_blk_rw_rq_prep()
1737 struct mmc_blk_request *brq = &mqrq->brq; in mmc_blk_fix_state() local
1738 unsigned int timeout = mmc_blk_data_timeout_ms(card->host, &brq->data); in mmc_blk_fix_state()
1758 struct mmc_request *mrq = &mqrq->brq.mrq; in mmc_blk_read_single()
1809 static inline bool mmc_blk_oor_valid(struct mmc_blk_request *brq) in mmc_blk_oor_valid() argument
1811 return !!brq->mrq.sbc; in mmc_blk_oor_valid()
1814 static inline u32 mmc_blk_stop_err_bits(struct mmc_blk_request *brq) in mmc_blk_stop_err_bits() argument
1816 return mmc_blk_oor_valid(brq) ? CMD_ERRORS : CMD_ERRORS_EXCL_OOR; in mmc_blk_stop_err_bits()
1826 struct mmc_blk_request *brq = &mqrq->brq; in mmc_blk_status_error() local
1833 stop_err_bits = mmc_blk_stop_err_bits(brq); in mmc_blk_status_error()
1835 return brq->cmd.resp[0] & CMD_ERRORS || in mmc_blk_status_error()
1836 brq->stop.resp[0] & stop_err_bits || in mmc_blk_status_error()
1841 static inline bool mmc_blk_cmd_started(struct mmc_blk_request *brq) in mmc_blk_cmd_started() argument
1843 return !brq->sbc.error && !brq->cmd.error && in mmc_blk_cmd_started()
1844 !(brq->cmd.resp[0] & CMD_ERRORS); in mmc_blk_cmd_started()
1867 struct mmc_blk_request *brq = &mqrq->brq; in mmc_blk_mq_rw_recovery() local
1880 brq->data.bytes_xfered = 0; in mmc_blk_mq_rw_recovery()
1907 if (!err && mmc_blk_cmd_started(brq) && mmc_card_sd(card) && in mmc_blk_mq_rw_recovery()
1910 brq->data.bytes_xfered = 0; in mmc_blk_mq_rw_recovery()
1912 brq->data.bytes_xfered = blocks << 9; in mmc_blk_mq_rw_recovery()
1927 if (brq->data.bytes_xfered) in mmc_blk_mq_rw_recovery()
1936 if (brq->sbc.error || brq->cmd.error) in mmc_blk_mq_rw_recovery()
1945 if (rq_data_dir(req) == READ && brq->data.blocks > in mmc_blk_mq_rw_recovery()
1953 static inline bool mmc_blk_rq_error(struct mmc_blk_request *brq) in mmc_blk_rq_error() argument
1955 mmc_blk_eval_resp_error(brq); in mmc_blk_rq_error()
1957 return brq->sbc.error || brq->cmd.error || brq->stop.error || in mmc_blk_rq_error()
1958 brq->data.error || brq->cmd.resp[0] & CMD_ERRORS; in mmc_blk_rq_error()
2015 mqrq->brq.data.bytes_xfered = 0; in mmc_blk_card_busy()
2028 if (cb_data.status & mmc_blk_stop_err_bits(&mqrq->brq)) { in mmc_blk_card_busy()
2029 mqrq->brq.data.bytes_xfered = 0; in mmc_blk_card_busy()
2035 mqrq->brq.cmd.resp[0] |= R1_EXCEPTION_EVENT; in mmc_blk_card_busy()
2051 unsigned int nr_bytes = mqrq->brq.data.bytes_xfered; in mmc_blk_mq_complete_rq()
2073 (mqrq->brq.cmd.resp[0] & R1_EXCEPTION_EVENT || in mmc_blk_urgent_bkops_needed()
2074 mqrq->brq.stop.resp[0] & R1_EXCEPTION_EVENT); in mmc_blk_urgent_bkops_needed()
2087 container_of(mrq, struct mmc_queue_req, brq.mrq); in mmc_blk_hsq_req_done()
2094 if (mmc_blk_rq_error(&mqrq->brq) || in mmc_blk_hsq_req_done()
2136 if (mmc_blk_rq_error(&mqrq->brq) || in mmc_blk_mq_poll_completion()
2169 struct mmc_request *mrq = &mqrq->brq.mrq; in mmc_blk_mq_post_req()
2199 if (mmc_blk_rq_error(&mqrq->brq)) { in mmc_blk_mq_recovery()
2244 brq.mrq); in mmc_blk_mq_req_done()
2281 if (mmc_blk_rq_error(&mqrq->brq) || in mmc_blk_mq_req_done()
2345 mqrq->brq.mrq.done = mmc_blk_mq_req_done; in mmc_blk_mq_issue_rw_rq()
2347 mmc_pre_req(host, &mqrq->brq.mrq); in mmc_blk_mq_issue_rw_rq()
2355 err = mmc_start_request(host, &mqrq->brq.mrq); in mmc_blk_mq_issue_rw_rq()
2369 mmc_post_req(host, &mqrq->brq.mrq, err); in mmc_blk_mq_issue_rw_rq()