linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Konstantin Dorfman" <kdorfman@codeaurora.org>
To: Jaehoon Chung <jh80.chung@samsung.com>
Cc: linux-mmc <linux-mmc@vger.kernel.org>,
	Chris Ball <cjb@laptop.org>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Hanumath Prasad <hanumath.prasad@stericsson.com>,
	Per FORLIN <per.forlin@stericsson.com>,
	Sebastian Rasmussen <sebras@gmail.com>,
	"Dong, Chuanxiao" <chuanxiao.dong@intel.com>,
	"svenkatr@ti.com" <svenkatr@ti.com>,
	Konstantin Dorfman <kdorfman@codeaurora.org>
Subject: Re: [PATCH v7] mmc: support BKOPS feature for eMMC
Date: Sun, 11 Mar 2012 18:06:52 +0200 (IST)	[thread overview]
Message-ID: <c498ff8b542c601db641988c35ae120c.squirrel@www.codeaurora.org> (raw)
In-Reply-To: <4F190E26.4040909@samsung.com>

Hello Jaehoon,

On Fri, January 20, 2012 8:48 am, Jaehoon Chung wrote:
...
> diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
> index 4d41fa9..109d0f0 100644
> --- a/drivers/mmc/core/mmc_ops.c
> +++ b/drivers/mmc/core/mmc_ops.c
> @@ -392,13 +392,22 @@ int mmc_switch(struct mmc_card *card, u8 set, u8
> index, u8 value,
>  		  (index << 16) |
>  		  (value << 8) |
>  		  set;
> -	cmd.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC;
> +	cmd.flags = MMC_CMD_AC;
> +	if (index == EXT_CSD_BKOPS_START &&
> +	    card->ext_csd.raw_bkops_status < EXT_CSD_BKOPS_LEVEL_2)
> +		cmd.flags |= MMC_RSP_SPI_R1 | MMC_RSP_R1;
> +	else
> +		cmd.flags |= MMC_RSP_SPI_R1B | MMC_RSP_R1B;

It is not good to use conditional on 'index', because this function
(mmc_switch)
is generic and in case you want functionality like here "in some cases cmd
 should not wait for PROG_DONE" it is better to use different approach:

1. Use internal function with additional parameter wait_for_prog_done:

int __mmc_switch(struct mmc_card *card, u8 set, u8 index,
                 unsigned int timeout_ms, u8 wait_for_prog_done)
{
...
    if(wait_for_prog_done)
      cmd.flags |= MMC_RSP_SPI_R1B | MMC_RSP_R1B;
    else
      cmd.flags |= MMC_RSP_SPI_R1 | MMC_RSP_R1;
...
}

2. implement mmc_switch through __mmc_switch()
   int mmc_switch(struct mmc_card *card, u8 set, u8 index,
                                   unsigned int timeout_ms)
   {
     return __mmc_switch(card, set, index, timeout_ms, 0);
   }
3. when you need to start bkops, use: __mmc_switch(card, set, index,
timeout_ms, 1);

Does it make sense?

-- 
Konstantin Dorfman
Consultant for Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum



  parent reply	other threads:[~2012-03-11 16:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-20  6:48 [PATCH v7] mmc: support BKOPS feature for eMMC Jaehoon Chung
2012-02-03 11:56 ` Jae hoon Chung
2012-02-13  2:07   ` Jaehoon Chung
2012-02-14 11:41 ` Saugata Das
2012-02-15  2:50   ` Jaehoon Chung
2012-02-21  9:00     ` Konstantin Dorfman
2012-02-21 14:21       ` Jae hoon Chung
2012-02-22  7:16         ` Jaehoon Chung
2012-02-22 14:11 ` Adrian Hunter
2012-02-23  2:21   ` Jaehoon Chung
2012-02-23  9:05     ` Adrian Hunter
2012-02-24  8:38       ` Jaehoon Chung
2012-02-24 11:43         ` Saugata Das
2012-02-24 12:57           ` Jae hoon Chung
2012-03-11 16:06 ` Konstantin Dorfman [this message]
2012-03-12  0:01   ` Jaehoon Chung

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c498ff8b542c601db641988c35ae120c.squirrel@www.codeaurora.org \
    --to=kdorfman@codeaurora.org \
    --cc=chuanxiao.dong@intel.com \
    --cc=cjb@laptop.org \
    --cc=hanumath.prasad@stericsson.com \
    --cc=jh80.chung@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=per.forlin@stericsson.com \
    --cc=sebras@gmail.com \
    --cc=svenkatr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).