* [PATCH] mmc: core: Separate the timeout value for cache-ctrl
@ 2011-10-24 10:10 Seungwon Jeon
2011-10-24 10:55 ` Girish K S
0 siblings, 1 reply; 3+ messages in thread
From: Seungwon Jeon @ 2011-10-24 10:10 UTC (permalink / raw)
To: linux-mmc; +Cc: cjb, linux-samsung-soc, kgene.kim, dh.han
Turning the cache off implies flushing cache which doesn't define
maximum timeout unlike cache-on. This patch will apply the generic
CMD6 timeout only for cache-on. Additionally the kernel message is
added for checking failure case of cache-on.
Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
---
drivers/mmc/core/core.c | 22 +++++++++++++---------
drivers/mmc/core/mmc.c | 10 ++++++++--
2 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 5278ffb..65b5643 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2248,6 +2248,7 @@ EXPORT_SYMBOL(mmc_flush_cache);
int mmc_cache_ctrl(struct mmc_host *host, u8 enable)
{
struct mmc_card *card = host->card;
+ unsigned int timeout;
int err = 0;
if (!(host->caps2 & MMC_CAP2_CACHE_CTRL) ||
@@ -2258,16 +2259,19 @@ int mmc_cache_ctrl(struct mmc_host *host, u8 enable)
(card->ext_csd.cache_size > 0)) {
enable = !!enable;
- if (card->ext_csd.cache_ctrl ^ enable)
+ if (card->ext_csd.cache_ctrl ^ enable) {
+ timeout = enable ? card->ext_csd.generic_cmd6_time : 0;
err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
- EXT_CSD_CACHE_CTRL, enable, 0);
- if (err)
- pr_err("%s: cache %s error %d\n",
- mmc_hostname(card->host),
- enable ? "on" : "off",
- err);
- else
- card->ext_csd.cache_ctrl = enable;
+ EXT_CSD_CACHE_CTRL, enable, timeout);
+
+ if (err)
+ pr_err("%s: cache %s error %d\n",
+ mmc_hostname(card->host),
+ enable ? "on" : "off",
+ err);
+ else
+ card->ext_csd.cache_ctrl = enable;
+ }
}
return err;
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index fb5bf01..6354eb3 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1064,14 +1064,20 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
if ((host->caps2 & MMC_CAP2_CACHE_CTRL) &&
card->ext_csd.cache_size > 0) {
err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
- EXT_CSD_CACHE_CTRL, 1, 0);
+ EXT_CSD_CACHE_CTRL, 1,
+ card->ext_csd.generic_cmd6_time);
if (err && err != -EBADMSG)
goto free_card;
/*
* Only if no error, cache is turned on successfully.
*/
- card->ext_csd.cache_ctrl = err ? 0 : 1;
+ if (err) {
+ pr_warning("%s: Cache is supported, but enabling failed\n",
+ mmc_hostname(card->host));
+ err = 0;
+ } else
+ card->ext_csd.cache_ctrl = 1;
}
if (!oldcard)
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mmc: core: Separate the timeout value for cache-ctrl
2011-10-24 10:10 [PATCH] mmc: core: Separate the timeout value for cache-ctrl Seungwon Jeon
@ 2011-10-24 10:55 ` Girish K S
2011-10-24 23:51 ` Seungwon Jeon
0 siblings, 1 reply; 3+ messages in thread
From: Girish K S @ 2011-10-24 10:55 UTC (permalink / raw)
To: Seungwon Jeon; +Cc: linux-mmc, cjb, linux-samsung-soc, kgene.kim, dh.han
On 24 October 2011 15:40, Seungwon Jeon <tgih.jun@samsung.com> wrote:
> Turning the cache off implies flushing cache which doesn't define
> maximum timeout unlike cache-on. This patch will apply the generic
> CMD6 timeout only for cache-on. Additionally the kernel message is
> added for checking failure case of cache-on.
>
> Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
> ---
> drivers/mmc/core/core.c | 22 +++++++++++++---------
> drivers/mmc/core/mmc.c | 10 ++++++++--
> 2 files changed, 21 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 5278ffb..65b5643 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -2248,6 +2248,7 @@ EXPORT_SYMBOL(mmc_flush_cache);
> int mmc_cache_ctrl(struct mmc_host *host, u8 enable)
> {
> struct mmc_card *card = host->card;
> + unsigned int timeout;
> int err = 0;
>
> if (!(host->caps2 & MMC_CAP2_CACHE_CTRL) ||
> @@ -2258,16 +2259,19 @@ int mmc_cache_ctrl(struct mmc_host *host, u8 enable)
> (card->ext_csd.cache_size > 0)) {
> enable = !!enable;
>
> - if (card->ext_csd.cache_ctrl ^ enable)
> + if (card->ext_csd.cache_ctrl ^ enable) {
> + timeout = enable ? card->ext_csd.generic_cmd6_time : 0;
> err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
> - EXT_CSD_CACHE_CTRL, enable, 0);
Here timeout value used is 0. If it has to be 0 then why should you check
timeout = enable ? card->ext_csd.generic_cmd6_time : 0;
I think it should be card->ext_csd.generic_cmd6_time instead of 0
> - if (err)
> - pr_err("%s: cache %s error %d\n",
> - mmc_hostname(card->host),
> - enable ? "on" : "off",
> - err);
> - else
> - card->ext_csd.cache_ctrl = enable;
> + EXT_CSD_CACHE_CTRL, enable, timeout);
> +
> + if (err)
> + pr_err("%s: cache %s error %d\n",
> + mmc_hostname(card->host),
> + enable ? "on" : "off",
> + err);
> + else
> + card->ext_csd.cache_ctrl = enable;
> + }
> }
>
> return err;
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index fb5bf01..6354eb3 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -1064,14 +1064,20 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
> if ((host->caps2 & MMC_CAP2_CACHE_CTRL) &&
> card->ext_csd.cache_size > 0) {
> err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
> - EXT_CSD_CACHE_CTRL, 1, 0);
> + EXT_CSD_CACHE_CTRL, 1,
> + card->ext_csd.generic_cmd6_time);
> if (err && err != -EBADMSG)
> goto free_card;
>
> /*
> * Only if no error, cache is turned on successfully.
> */
> - card->ext_csd.cache_ctrl = err ? 0 : 1;
> + if (err) {
> + pr_warning("%s: Cache is supported, but enabling failed\n",
> + mmc_hostname(card->host));
> + err = 0;
> + } else
> + card->ext_csd.cache_ctrl = 1;
> }
>
> if (!oldcard)
> --
> 1.7.0.4
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] mmc: core: Separate the timeout value for cache-ctrl
2011-10-24 10:55 ` Girish K S
@ 2011-10-24 23:51 ` Seungwon Jeon
0 siblings, 0 replies; 3+ messages in thread
From: Seungwon Jeon @ 2011-10-24 23:51 UTC (permalink / raw)
To: 'Girish K S'; +Cc: linux-mmc, cjb, linux-samsung-soc, kgene.kim, dh.han
Girish K S wrote:
> On 24 October 2011 15:40, Seungwon Jeon <tgih.jun@samsung.com> wrote:
> > Turning the cache off implies flushing cache which doesn't define
> > maximum timeout unlike cache-on. This patch will apply the generic
> > CMD6 timeout only for cache-on. Additionally the kernel message is
> > added for checking failure case of cache-on.
> >
> > Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
> > ---
> > drivers/mmc/core/core.c | 22 +++++++++++++---------
> > drivers/mmc/core/mmc.c | 10 ++++++++--
> > 2 files changed, 21 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> > index 5278ffb..65b5643 100644
> > --- a/drivers/mmc/core/core.c
> > +++ b/drivers/mmc/core/core.c
> > @@ -2248,6 +2248,7 @@ EXPORT_SYMBOL(mmc_flush_cache);
> > int mmc_cache_ctrl(struct mmc_host *host, u8 enable)
> > {
> > struct mmc_card *card = host->card;
> > + unsigned int timeout;
> > int err = 0;
> >
> > if (!(host->caps2 & MMC_CAP2_CACHE_CTRL) ||
> > @@ -2258,16 +2259,19 @@ int mmc_cache_ctrl(struct mmc_host *host, u8
> enable)
> > (card->ext_csd.cache_size > 0)) {
> > enable = !!enable;
> >
> > - if (card->ext_csd.cache_ctrl ^ enable)
> > + if (card->ext_csd.cache_ctrl ^ enable) {
> > + timeout = enable ?
card->ext_csd.generic_cmd6_time :
> 0;
> > err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
> > - EXT_CSD_CACHE_CTRL, enable, 0);
> Here timeout value used is 0. If it has to be 0 then why should you check
> timeout = enable ? card->ext_csd.generic_cmd6_time : 0;
> I think it should be card->ext_csd.generic_cmd6_time instead of 0
Upper line you pointed was removed. Could check '-', please?
> > - if (err)
> > - pr_err("%s: cache %s error %d\n",
> > - mmc_hostname(card->host),
> > - enable ? "on" : "off",
> > - err);
> > - else
> > - card->ext_csd.cache_ctrl = enable;
> > + EXT_CSD_CACHE_CTRL, enable,
timeout);
Here is modified line.
Beset regards,
Seungwon Jeon.
> > +
> > + if (err)
> > + pr_err("%s: cache %s error %d\n",
> > +
mmc_hostname(card->host),
> > + enable ? "on" : "off",
> > + err);
> > + else
> > + card->ext_csd.cache_ctrl = enable;
> > + }
> > }
> >
> > return err;
> > diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> > index fb5bf01..6354eb3 100644
> > --- a/drivers/mmc/core/mmc.c
> > +++ b/drivers/mmc/core/mmc.c
> > @@ -1064,14 +1064,20 @@ static int mmc_init_card(struct mmc_host *host,
> u32 ocr,
> > if ((host->caps2 & MMC_CAP2_CACHE_CTRL) &&
> > card->ext_csd.cache_size > 0) {
> > err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
> > - EXT_CSD_CACHE_CTRL, 1, 0);
> > + EXT_CSD_CACHE_CTRL, 1,
> > + card->ext_csd.generic_cmd6_time);
> > if (err && err != -EBADMSG)
> > goto free_card;
> >
> > /*
> > * Only if no error, cache is turned on successfully.
> > */
> > - card->ext_csd.cache_ctrl = err ? 0 : 1;
> > + if (err) {
> > + pr_warning("%s: Cache is supported, but enabling
> failed\n",
> > + mmc_hostname(card->host));
> > + err = 0;
> > + } else
> > + card->ext_csd.cache_ctrl = 1;
> > }
> >
> > if (!oldcard)
> > --
> > 1.7.0.4
> >
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> >
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-10-24 23:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-24 10:10 [PATCH] mmc: core: Separate the timeout value for cache-ctrl Seungwon Jeon
2011-10-24 10:55 ` Girish K S
2011-10-24 23:51 ` Seungwon Jeon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox