Lines Matching refs:brq
1339 static inline void mmc_apply_rel_rw(struct mmc_blk_request *brq, in mmc_apply_rel_rw() argument
1346 brq->data.blocks = 1; in mmc_apply_rel_rw()
1348 if (brq->data.blocks > card->ext_csd.rel_sectors) in mmc_apply_rel_rw()
1349 brq->data.blocks = card->ext_csd.rel_sectors; in mmc_apply_rel_rw()
1350 else if (brq->data.blocks < card->ext_csd.rel_sectors) in mmc_apply_rel_rw()
1351 brq->data.blocks = 1; in mmc_apply_rel_rw()
1367 static void mmc_blk_eval_resp_error(struct mmc_blk_request *brq) in mmc_blk_eval_resp_error() argument
1397 if (!brq->stop.error) { in mmc_blk_eval_resp_error()
1401 val = brq->stop.resp[0] & CMD_ERRORS; in mmc_blk_eval_resp_error()
1402 oor_with_open_end = val & R1_OUT_OF_RANGE && !brq->mrq.sbc; in mmc_blk_eval_resp_error()
1405 brq->stop.error = -EIO; in mmc_blk_eval_resp_error()
1415 struct mmc_blk_request *brq = &mqrq->brq; in mmc_blk_data_prep() local
1427 memset(brq, 0, sizeof(struct mmc_blk_request)); in mmc_blk_data_prep()
1431 brq->mrq.data = &brq->data; in mmc_blk_data_prep()
1432 brq->mrq.tag = req->tag; in mmc_blk_data_prep()
1434 brq->stop.opcode = MMC_STOP_TRANSMISSION; in mmc_blk_data_prep()
1435 brq->stop.arg = 0; in mmc_blk_data_prep()
1438 brq->data.flags = MMC_DATA_READ; in mmc_blk_data_prep()
1439 brq->stop.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC; in mmc_blk_data_prep()
1441 brq->data.flags = MMC_DATA_WRITE; in mmc_blk_data_prep()
1442 brq->stop.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC; in mmc_blk_data_prep()
1445 brq->data.blksz = 512; in mmc_blk_data_prep()
1446 brq->data.blocks = blk_rq_sectors(req); in mmc_blk_data_prep()
1447 brq->data.blk_addr = blk_rq_pos(req); in mmc_blk_data_prep()
1461 if (brq->data.blocks > card->host->max_blk_count) in mmc_blk_data_prep()
1462 brq->data.blocks = card->host->max_blk_count; in mmc_blk_data_prep()
1464 if (brq->data.blocks > 1) { in mmc_blk_data_prep()
1473 brq->data.blocks--; in mmc_blk_data_prep()
1481 brq->data.blocks = queue_physical_block_size(mq->queue) >> 9; in mmc_blk_data_prep()
1488 brq->data.blocks = card->host->ops->multi_io_quirk(card, in mmc_blk_data_prep()
1491 brq->data.blocks); in mmc_blk_data_prep()
1495 mmc_apply_rel_rw(brq, card, req); in mmc_blk_data_prep()
1496 brq->data.flags |= MMC_DATA_REL_WR; in mmc_blk_data_prep()
1506 ((brq->data.blocks * brq->data.blksz) >= in mmc_blk_data_prep()
1510 brq->data.flags |= MMC_DATA_DAT_TAG; in mmc_blk_data_prep()
1512 mmc_set_data_timeout(&brq->data, card); in mmc_blk_data_prep()
1514 brq->data.sg = mqrq->sg; in mmc_blk_data_prep()
1515 brq->data.sg_len = mmc_queue_map_sg(mq, mqrq); in mmc_blk_data_prep()
1521 if (brq->data.blocks != blk_rq_sectors(req)) { in mmc_blk_data_prep()
1522 int i, data_size = brq->data.blocks << 9; in mmc_blk_data_prep()
1525 for_each_sg(brq->data.sg, sg, brq->data.sg_len, i) { in mmc_blk_data_prep()
1533 brq->data.sg_len = i; in mmc_blk_data_prep()
1548 struct mmc_request *mrq = &mqrq->brq.mrq; in mmc_blk_cqe_complete_rq()
1617 brq.mrq); in mmc_blk_cqe_req_done()
1643 struct mmc_blk_request *brq = &mqrq->brq; in mmc_blk_cqe_prep_dcmd() local
1645 memset(brq, 0, sizeof(*brq)); in mmc_blk_cqe_prep_dcmd()
1647 brq->mrq.cmd = &brq->cmd; in mmc_blk_cqe_prep_dcmd()
1648 brq->mrq.tag = req->tag; in mmc_blk_cqe_prep_dcmd()
1650 return &brq->mrq; in mmc_blk_cqe_prep_dcmd()
1675 mqrq->brq.mrq.done = mmc_blk_hsq_req_done; in mmc_blk_hsq_issue_rw_rq()
1676 mmc_pre_req(host, &mqrq->brq.mrq); in mmc_blk_hsq_issue_rw_rq()
1678 err = mmc_cqe_start_req(host, &mqrq->brq.mrq); in mmc_blk_hsq_issue_rw_rq()
1680 mmc_post_req(host, &mqrq->brq.mrq, err); in mmc_blk_hsq_issue_rw_rq()
1695 return mmc_blk_cqe_start_req(mq->card->host, &mqrq->brq.mrq); in mmc_blk_cqe_issue_rw_rq()
1704 struct mmc_blk_request *brq = &mqrq->brq; in mmc_blk_rw_rq_prep() local
1711 brq->mrq.cmd = &brq->cmd; in mmc_blk_rw_rq_prep()
1713 brq->cmd.arg = blk_rq_pos(req); in mmc_blk_rw_rq_prep()
1715 brq->cmd.arg <<= 9; in mmc_blk_rw_rq_prep()
1716 brq->cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC; in mmc_blk_rw_rq_prep()
1718 if (brq->data.blocks > 1 || do_rel_wr) { in mmc_blk_rw_rq_prep()
1724 brq->mrq.stop = &brq->stop; in mmc_blk_rw_rq_prep()
1728 brq->mrq.stop = NULL; in mmc_blk_rw_rq_prep()
1732 brq->cmd.opcode = rq_data_dir(req) == READ ? readcmd : writecmd; in mmc_blk_rw_rq_prep()
1752 if ((md->flags & MMC_BLK_CMD23) && mmc_op_multi(brq->cmd.opcode) && in mmc_blk_rw_rq_prep()
1755 brq->sbc.opcode = MMC_SET_BLOCK_COUNT; in mmc_blk_rw_rq_prep()
1756 brq->sbc.arg = brq->data.blocks | in mmc_blk_rw_rq_prep()
1759 brq->sbc.flags = MMC_RSP_R1 | MMC_CMD_AC; in mmc_blk_rw_rq_prep()
1760 brq->mrq.sbc = &brq->sbc; in mmc_blk_rw_rq_prep()
1783 struct mmc_blk_request *brq = &mqrq->brq; in mmc_blk_fix_state() local
1784 unsigned int timeout = mmc_blk_data_timeout_ms(card->host, &brq->data); in mmc_blk_fix_state()
1804 struct mmc_request *mrq = &mqrq->brq.mrq; in mmc_blk_read_single()
1855 static inline bool mmc_blk_oor_valid(struct mmc_blk_request *brq) in mmc_blk_oor_valid() argument
1857 return !!brq->mrq.sbc; in mmc_blk_oor_valid()
1860 static inline u32 mmc_blk_stop_err_bits(struct mmc_blk_request *brq) in mmc_blk_stop_err_bits() argument
1862 return mmc_blk_oor_valid(brq) ? CMD_ERRORS : CMD_ERRORS_EXCL_OOR; in mmc_blk_stop_err_bits()
1872 struct mmc_blk_request *brq = &mqrq->brq; in mmc_blk_status_error() local
1879 stop_err_bits = mmc_blk_stop_err_bits(brq); in mmc_blk_status_error()
1881 return brq->cmd.resp[0] & CMD_ERRORS || in mmc_blk_status_error()
1882 brq->stop.resp[0] & stop_err_bits || in mmc_blk_status_error()
1887 static inline bool mmc_blk_cmd_started(struct mmc_blk_request *brq) in mmc_blk_cmd_started() argument
1889 return !brq->sbc.error && !brq->cmd.error && in mmc_blk_cmd_started()
1890 !(brq->cmd.resp[0] & CMD_ERRORS); in mmc_blk_cmd_started()
1913 struct mmc_blk_request *brq = &mqrq->brq; in mmc_blk_mq_rw_recovery() local
1926 brq->data.bytes_xfered = 0; in mmc_blk_mq_rw_recovery()
1953 if (!err && mmc_blk_cmd_started(brq) && mmc_card_sd(card) && in mmc_blk_mq_rw_recovery()
1956 brq->data.bytes_xfered = 0; in mmc_blk_mq_rw_recovery()
1958 brq->data.bytes_xfered = blocks << 9; in mmc_blk_mq_rw_recovery()
1973 if (brq->data.bytes_xfered) in mmc_blk_mq_rw_recovery()
1982 if (brq->sbc.error || brq->cmd.error) in mmc_blk_mq_rw_recovery()
1991 if (rq_data_dir(req) == READ && brq->data.blocks > in mmc_blk_mq_rw_recovery()
1999 static inline bool mmc_blk_rq_error(struct mmc_blk_request *brq) in mmc_blk_rq_error() argument
2001 mmc_blk_eval_resp_error(brq); in mmc_blk_rq_error()
2003 return brq->sbc.error || brq->cmd.error || brq->stop.error || in mmc_blk_rq_error()
2004 brq->data.error || brq->cmd.resp[0] & CMD_ERRORS; in mmc_blk_rq_error()
2061 mqrq->brq.data.bytes_xfered = 0; in mmc_blk_card_busy()
2074 if (cb_data.status & mmc_blk_stop_err_bits(&mqrq->brq)) { in mmc_blk_card_busy()
2075 mqrq->brq.data.bytes_xfered = 0; in mmc_blk_card_busy()
2081 mqrq->brq.cmd.resp[0] |= R1_EXCEPTION_EVENT; in mmc_blk_card_busy()
2097 unsigned int nr_bytes = mqrq->brq.data.bytes_xfered; in mmc_blk_mq_complete_rq()
2119 (mqrq->brq.cmd.resp[0] & R1_EXCEPTION_EVENT || in mmc_blk_urgent_bkops_needed()
2120 mqrq->brq.stop.resp[0] & R1_EXCEPTION_EVENT); in mmc_blk_urgent_bkops_needed()
2133 container_of(mrq, struct mmc_queue_req, brq.mrq); in mmc_blk_hsq_req_done()
2140 if (mmc_blk_rq_error(&mqrq->brq) || in mmc_blk_hsq_req_done()
2182 if (mmc_blk_rq_error(&mqrq->brq) || in mmc_blk_mq_poll_completion()
2215 struct mmc_request *mrq = &mqrq->brq.mrq; in mmc_blk_mq_post_req()
2245 if (mmc_blk_rq_error(&mqrq->brq)) { in mmc_blk_mq_recovery()
2290 brq.mrq); in mmc_blk_mq_req_done()
2327 if (mmc_blk_rq_error(&mqrq->brq) || in mmc_blk_mq_req_done()
2391 mqrq->brq.mrq.done = mmc_blk_mq_req_done; in mmc_blk_mq_issue_rw_rq()
2393 mmc_pre_req(host, &mqrq->brq.mrq); in mmc_blk_mq_issue_rw_rq()
2401 err = mmc_start_request(host, &mqrq->brq.mrq); in mmc_blk_mq_issue_rw_rq()
2415 mmc_post_req(host, &mqrq->brq.mrq, err); in mmc_blk_mq_issue_rw_rq()