Re: [PATCH v3] mmc: Add quirk MMC_QUIRK_BROKEN_CACHE_FLUSH for Micron eMMC Q2J54A

From: Ulf Hansson
Date: Mon Sep 25 2023 - 10:07:14 EST


On Thu, 21 Sept 2023 at 22:35, Bean Huo <beanhuo@xxxxxxxx> wrote:
>
> From: Bean Huo <beanhuo@xxxxxxxxxx>
>
> Micron MTFC4GACAJCN eMMC supports cache but requires that flush cache
> operation be allowed only after a write has occurred. Otherwise, the
> cache flush command or subsequent commands will time out.
>
> Signed-off-by: Bean Huo <beanhuo@xxxxxxxxxx>
> Co-developed-by: Rafael Beims <rafael.beims@xxxxxxxxxxx>
> Cc: stable@xxxxxxxxxxxxxxx
> ---
> Changelog:
>
> v2--v3:
> 1. Set card->written_flag in mmc_blk_mq_issue_rq().
> v1--v2:
> 1. Add Rafael's test-tag, and Co-developed-by.
> 2. Check host->card whether NULL or not in __mmc_start_request() before asserting host->card->->quirks
> ---
> drivers/mmc/core/block.c | 4 ++++
> drivers/mmc/core/mmc.c | 5 +++++
> drivers/mmc/core/quirks.h | 7 ++++---
> include/linux/mmc/card.h | 2 ++
> 4 files changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
> index 3a8f27c3e310..14d0dc7942de 100644
> --- a/drivers/mmc/core/block.c
> +++ b/drivers/mmc/core/block.c
> @@ -2387,6 +2387,10 @@ enum mmc_issued mmc_blk_mq_issue_rq(struct mmc_queue *mq, struct request *req)
> ret = mmc_blk_cqe_issue_rw_rq(mq, req);
> else
> ret = mmc_blk_mq_issue_rw_rq(mq, req);
> +
> + if (host->card->quirks & MMC_QUIRK_BROKEN_CACHE_FLUSH &&

Please add an inline helper function for this in
drivers/mmc/core/card.h, along with the others.

[...]

Kind regards
Uffe