mmc: core: Support packed command for eMMC4.5 device
Subsystems (2)
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
On Wed, Nov 2, 2011 at 1:33 PM, Seungwon Jeon <[email protected]>
Quoted 1 line · wrote:
Quoted 1 line
Review static int mmc_blk_err_check(struct mmc_card
Quoted 1 line
(quoted diff) +0
-0@@ -943,7 +950,8 @@ static int mmc_blk_err_check(struct mmc_card*card,
Quoted 1 line
Quoted 1 line
Quoted 1 line
(quoted diff) +0
-0* kind. If it was a write, we may have transitioned to
* program mode, which we have to wait for it to complete. */
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Review static int mmc_blk_err_check(struct mmc_card · line 944
Quoted 1 line
(quoted diff) +0
-1- if (!mmc_host_is_spi(card->host) && rq_data_dir(req) !=READ) {
Quoted 1 line
Quoted 1 line
Review static int mmc_blk_err_check(struct mmc_card · line 951
Quoted 1 line
(quoted diff) +1
-0+ if ((!mmc_host_is_spi(card->host) && rq_data_dir(req) !=READ) ||
Quoted 1 line
Quoted 1 line
Quoted 1 line
(quoted diff) +1
-0+ (mq_mrq->packed_cmd == MMC_PACKED_WR_HDR))
Since the header's direction is WRITE I don't think we also need to check if mq_mrq->packed_cmd == MMC_PACKED_WR_HDR since it will be covered by the original condition.
Quoted 4 lines
Quoted 4 lines
{
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(quoted diff) +0
-0u32 status; do { int err = get_card_status(card, &status,
5);
A general question, not related specifically to packed commands - Do you know why the status is not checked to see which error we got?
Quoted 16 lines
Quoted 16 lines
Quoted 1 line
Quoted 1 line
Review static int mmc_blk_err_check(struct mmc_card
Quoted 1 line
(quoted diff) +0
-0@@ -980,12 +988,67 @@ static int mmc_blk_err_check(struct mmc_card*card,
Quoted 5 lines
Quoted 5 lines
Review static int mmc_blk_err_check(struct mmc_card · line 992
Quoted 5 lines
(quoted diff) +2
-0if (!brq->data.bytes_xfered) return MMC_BLK_RETRY; + if (mq_mrq->packed_cmd != MMC_PACKED_NONE) { + if (unlikely(brq->data.blocks << 9 !=
brq->data.bytes_xfered))Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
(quoted diff) +5
-0+ return MMC_BLK_PARTIAL; + else + return MMC_BLK_SUCCESS; + } + if (blk_rq_bytes(req) != brq->data.bytes_xfered) return MMC_BLK_PARTIAL;
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Review static int mmc_blk_err_check(struct mmc_card · line 1004
Quoted 4 lines
(quoted diff) +1
-0return MMC_BLK_SUCCESS; } +static int mmc_blk_packed_err_check(struct mmc_card *card, +
struct mmc_async_req *areq)
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Review static int mmc_blk_err_check(struct mmc_card · line 1006
Quoted 2 lines
(quoted diff) +2
-0+{ + struct mmc_queue_req *mq_mrq = container_of(areq, struct
mmc_queue_req,Quoted 1 line
Quoted 1 line
Quoted 1 line
(quoted diff) +1
-0+ mmc_active); +
int err, check, status;
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Review static int mmc_blk_err_check(struct mmc_card · line 1013
Quoted 6 lines
(quoted diff) +6
-0+ u8 ext_csd[512]; + + check = mmc_blk_err_check(card, areq); + + if (check == MMC_BLK_SUCCESS) + return check;
I think we need to check the status for all cases and not only in case of MMC_BLK_PARTIAL. For example, in cases where the header was traferred successfully but had logic errors (wrong number of sectors etc.) mmc_blk_err_check will return MMC_BLK_SUCCESS although the packed commands failed.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Review static int mmc_blk_err_check(struct mmc_card · line 1021
Quoted 8 lines
(quoted diff) +8
-0+ + if (check == MMC_BLK_PARTIAL) { + err = get_card_status(card, &status, 0); + if (err) + return MMC_BLK_ABORT; + + if (status & R1_EXP_EVENT) { + err = mmc_send_ext_csd(card, ext_csd); +
if (err)
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Review static int mmc_blk_err_check(struct mmc_card · line 1024
Quoted 3 lines
(quoted diff) +3
-0+ return MMC_BLK_ABORT; + + if ((ext_csd[EXT_CSD_EXP_EVENTS_STATUS +
0]
why do we need the + 0?
Quoted 4 lines
Quoted 4 lines
&
Quoted 1 line
Quoted 1 line
Review static int mmc_blk_err_check(struct mmc_card · line 1025
Quoted 1 line
(quoted diff) +1
-0+
EXT_CSD_PACKED_INDEXED_ERROR) {Quoted 1 line
Quoted 1 line
Quoted 1 line
(quoted diff) +1
-0+ /* Make be 0-based */
The comment is not understood
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Review static int mmc_blk_err_check(struct mmc_card · line 1027
Quoted 1 line
(quoted diff) +1
-0+ mq_mrq->packed_fail_idx =
+
Thanks,
Maya Erez
--
Seny by a Consultant for Qualcomm innovation center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
Quoted 7 lines · Maya Erez
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
On Wed, Nov 2, 2011 at 1:33 PM, Seungwon Jeon <[email protected]>
Quoted 1 line · wrote:
Quoted 1 line
Review static int mmc_blk_err_check(struct mmc_card
Quoted 1 line
(quoted diff) +0
-0@@ -943,7 +950,8 @@ static int mmc_blk_err_check(struct mmc_card*card,
Quoted 1 line
Quoted 1 line
Quoted 1 line
(quoted diff) +0
-0* kind. If it was a write, we may have transitioned to* program mode, which we have to wait for it to complete. */
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Review static int mmc_blk_err_check(struct mmc_card · line 944
Quoted 1 line
(quoted diff) +0
-1- if (!mmc_host_is_spi(card->host) && rq_data_dir(req) !=READ) {
Quoted 1 line
Quoted 1 line
Review static int mmc_blk_err_check(struct mmc_card · line 951
Quoted 1 line
(quoted diff) +1
-0+ if ((!mmc_host_is_spi(card->host) && rq_data_dir(req) !=READ) ||
Quoted 1 line
Quoted 1 line
Quoted 1 line
(quoted diff) +1
-0+ (mq_mrq->packed_cmd == MMC_PACKED_WR_HDR))Since the header's direction is WRITE I don't think we also need to check if
mq_mrq->packed_cmd==MMC_PACKED_WR_HDRsince it will be covered by the original condition.
The header is written. But origin request is about read. That means rq_data_dir(req) is READ. So new condition is needed.
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
{
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
(quoted diff) +0
-0u32 status; do { int err = get_card_status(card, &status,5);
A general question, not related specifically to packed commands - Do you know why the status is not checked to see which error we got?
This status is for checking whether the card is ready for new data.
Quoted 26 lines
Quoted 16 lines
Quoted 16 lines
Quoted 1 line
Quoted 1 line
Review static int mmc_blk_err_check(struct mmc_card
Quoted 1 line
(quoted diff) +0
-0@@ -980,12 +988,67 @@ static int mmc_blk_err_check(struct mmc_card*card,
Quoted 5 lines
Quoted 5 lines
Review static int mmc_blk_err_check(struct mmc_card · line 992
Quoted 5 lines
(quoted diff) +2
-0if (!brq->data.bytes_xfered) return MMC_BLK_RETRY; + if (mq_mrq->packed_cmd != MMC_PACKED_NONE) { + if (unlikely(brq->data.blocks << 9 !=
brq->data.bytes_xfered))Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
(quoted diff) +5
-0+ return MMC_BLK_PARTIAL; + else + return MMC_BLK_SUCCESS; + } + if (blk_rq_bytes(req) != brq->data.bytes_xfered) return MMC_BLK_PARTIAL;Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Review static int mmc_blk_err_check(struct mmc_card · line 1004
Quoted 4 lines
(quoted diff) +1
-0return MMC_BLK_SUCCESS; } +static int mmc_blk_packed_err_check(struct mmc_card *card, +struct
mmc_async_req*areq)Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Review static int mmc_blk_err_check(struct mmc_card · line 1006
Quoted 2 lines
(quoted diff) +2
-0+{ + struct mmc_queue_req *mq_mrq = container_of(areq, struct
mmc_queue_req,Quoted 1 line
Quoted 1 line
Quoted 1 line
(quoted diff) +1
-0+ mmc_active); +int err, check, status;
Quoted 11 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Review static int mmc_blk_err_check(struct mmc_card · line 1013
Quoted 6 lines
(quoted diff) +6
-0+ u8 ext_csd[512]; + + check = mmc_blk_err_check(card, areq); + + if (check == MMC_BLK_SUCCESS) + return check;I think we need to check the status for all cases and not only in case of
MMC_BLK_PARTIAL. For example, in cases where the header was traferred successfully but had logic errors (wrong number of sectors etc.)mmc_blk_err_checkwill returnMMC_BLK_SUCCESSalthough the packed commands failed.
Similarly, Sahitya Tummala is already mentioned this. Other error case will be checked in next version. The case you suggested is about read or write? Device may detect error and stop transferring the data.
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Review static int mmc_blk_err_check(struct mmc_card · line 1021
Quoted 8 lines
(quoted diff) +8
-0+ + if (check == MMC_BLK_PARTIAL) { + err = get_card_status(card, &status, 0); + if (err) + return MMC_BLK_ABORT; + + if (status & R1_EXP_EVENT) { + err = mmc_send_ext_csd(card, ext_csd); +if (err)
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Review static int mmc_blk_err_check(struct mmc_card · line 1024
Quoted 3 lines
(quoted diff) +3
-0+ return MMC_BLK_ABORT; + + if ((ext_csd[EXT_CSD_EXP_EVENTS_STATUS +0]
why do we need the + 0?
It is explicit expression, no more, no less. Actually, there is no need.
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
&
Quoted 1 line
Quoted 1 line
Review static int mmc_blk_err_check(struct mmc_card · line 1025
Quoted 1 line
(quoted diff) +1
-0+
EXT_CSD_PACKED_INDEXED_ERROR) {Quoted 1 line
Quoted 1 line
Quoted 1 line
(quoted diff) +1
-0+ /* Make be 0-based */The comment is not understood
PACKED_FAILURE_INDEX starts from '1'
It is converted to 0-base for use.
Quoted 13 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Review static int mmc_blk_err_check(struct mmc_card · line 1027
Quoted 1 line
(quoted diff) +1
-0+ mq_mrq->packed_fail_idx =+
Thanks,
Maya Erez
--
Seny by a Consultant for Qualcomm innovation center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 45 lines
Quoted 31 lines · Maya Erez
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
On Wed, Nov 2, 2011 at 1:33 PM, Seungwon Jeon
Quoted 2 lines
Quoted 2 lines
Quoted 1 line · wrote:
Quoted 1 line
Review static int mmc_blk_err_check(struct
Quoted 1 line
(quoted diff) +0
-0@@ -980,12 +988,67 @@ static int mmc_blk_err_check(struct
mmc_cardQuoted 15 lines
Quoted 15 lines
*card,
Quoted 5 lines
Quoted 5 lines
Review static int mmc_blk_err_check(struct · line 992
Quoted 5 lines
(quoted diff) +2
-0if (!brq->data.bytes_xfered) return MMC_BLK_RETRY; + if (mq_mrq->packed_cmd != MMC_PACKED_NONE) { + if (unlikely(brq->data.blocks << 9 !=
brq->data.bytes_xfered))Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
(quoted diff) +5
-0+ return MMC_BLK_PARTIAL; + else + return MMC_BLK_SUCCESS; + } + if (blk_rq_bytes(req) != brq->data.bytes_xfered) return MMC_BLK_PARTIAL;Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Review static int mmc_blk_err_check(struct · line 1004
Quoted 4 lines
(quoted diff) +1
-0return MMC_BLK_SUCCESS; } +static int mmc_blk_packed_err_check(struct mmc_card *card, +struct
mmc_async_req*areq)Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Review static int mmc_blk_err_check(struct · line 1006
Quoted 2 lines
(quoted diff) +2
-0+{ + struct mmc_queue_req *mq_mrq = container_of(areq, struct
mmc_queue_req,Quoted 1 line
Quoted 1 line
Quoted 1 line
(quoted diff) +1
-0+ mmc_active);+
int err, check, status;Quoted 13 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Review static int mmc_blk_err_check(struct · line 1013
Quoted 6 lines
(quoted diff) +6
-0+ u8 ext_csd[512]; + + check = mmc_blk_err_check(card, areq); + + if (check == MMC_BLK_SUCCESS) + return check;I think we need to check the status for all cases and not only in case of
MMC_BLK_PARTIAL. For example, in cases where the header was traferred successfully but had logic errors (wrong number of sectors etc.)mmc_blk_err_checkwill returnMMC_BLK_SUCCESSalthough the packed commands
failed.
Quoted 4 lines
Similarly, Sahitya Tummala is already mentioned this. Other error case will be checked in next version. The case you suggested is about read or write? Device may detect error and stop transferring the data.
Sahitya suggested to also check other error cases that mmc_blk_err_check returns (such as MMC_BLK_CMD_ERR, MMC_BLK_ECC_ERR and MMC_BLK_DATA_ERR). I suggest to also check the exception bit in the status even if mmc_blk_err_check returned success, since mmc_blk_err_check might not catch all the packed commands failures. One example for such a failure is when the header of read packed commands will have logical error.
Thanks,
Maya
--
Seny by a Consultant for Qualcomm innovation center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
Quoted 49 lines · Maya Erez
Quoted 45 lines
Quoted 31 lines · Maya Erez
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
On Wed, Nov 2, 2011 at 1:33 PM, Seungwon Jeon
Quoted 2 lines
Quoted 2 lines
Quoted 1 line · wrote:
Quoted 1 line
Review static int mmc_blk_err_check(struct
Quoted 1 line
(quoted diff) +0
-0@@ -980,12 +988,67 @@ static int mmc_blk_err_check(struct
mmc_cardQuoted 15 lines
Quoted 15 lines
*card,
Quoted 5 lines
Quoted 5 lines
Review static int mmc_blk_err_check(struct · line 992
Quoted 5 lines
(quoted diff) +2
-0if (!brq->data.bytes_xfered) return MMC_BLK_RETRY; + if (mq_mrq->packed_cmd != MMC_PACKED_NONE) { + if (unlikely(brq->data.blocks << 9 !=
brq->data.bytes_xfered))Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
(quoted diff) +5
-0+ return MMC_BLK_PARTIAL; + else + return MMC_BLK_SUCCESS; + } + if (blk_rq_bytes(req) != brq->data.bytes_xfered) return MMC_BLK_PARTIAL;Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Review static int mmc_blk_err_check(struct · line 1004
Quoted 4 lines
(quoted diff) +1
-0return MMC_BLK_SUCCESS; } +static int mmc_blk_packed_err_check(struct mmc_card *card, +struct
mmc_async_req*areq)Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Review static int mmc_blk_err_check(struct · line 1006
Quoted 2 lines
(quoted diff) +2
-0+{ + struct mmc_queue_req *mq_mrq = container_of(areq, struct
mmc_queue_req,Quoted 1 line
Quoted 1 line
Quoted 1 line
(quoted diff) +1
-0+ mmc_active);+
int err, check, status;Quoted 13 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Review static int mmc_blk_err_check(struct · line 1013
Quoted 6 lines
(quoted diff) +6
-0+ u8 ext_csd[512]; + + check = mmc_blk_err_check(card, areq); + + if (check == MMC_BLK_SUCCESS) + return check;I think we need to check the status for all cases and not only in case of
MMC_BLK_PARTIAL. For example, in cases where the header was traferred successfully but had logic errors (wrong number of sectors etc.)mmc_blk_err_checkwill returnMMC_BLK_SUCCESSalthough the packed commands
failed.Quoted 4 lines
Similarly, Sahitya Tummala is already mentioned this. Other error case will be checked in next version. The case you suggested is about read or write? Device may detect error and stop transferring the data.
Quoted 6 lines
Sahitya suggested to also check other error cases that
mmc_blk_err_checkreturns (such asMMC_BLK_CMD_ERR,MMC_BLK_ECC_ERRandMMC_BLK_DATA_ERR). I suggest to also check the exception bit in the status even ifmmc_blk_err_checkreturned success, sincemmc_blk_err_checkmight not catch all the packed commands failures. One example for such a failure is when the header of read packed commands will have logical error.
This part is modified in next version.
Thanks,
Seungwon Jeon.
Quoted 12 lines
Thanks,
Maya
--
Seny by a Consultant for Qualcomm innovation center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html