mmc: core: Separate the timeout value for cache-ctrl
Subsystems (2)
PATCH 1/1 mmc: core: Separate the timeout value for cache-ctrl
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.
--- drivers/mmc/core/core.c | 22 +++++++++++++--------- drivers/mmc/core/mmc.c | 10 ++++++++-- 2 files changed, 21 insertions(+), 11 deletions(-)
drivers/mmc/core/core.c +13 -9
@@ -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;
drivers/mmc/core/mmc.c +8 -2
@@ -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
Quoted 24 lines · Seungwon Jeon
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 <[email protected]>---
drivers/mmc/core/core.c | 22 +++++++++++++---------drivers/mmc/core/mmc.c| 10 ++++++++--2 files changed, 21 insertions(+), 11 deletions(-)drivers/mmc/core/core.c +1
-0@@ -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) ||
drivers/mmc/core/core.c int mmc_cache_ctrl(struct mmc_host *host, u8 enable) · line 2263
Quoted 8 lines
drivers/mmc/core/core.c +2
-2@@ -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
Quoted 56 lines
drivers/mmc/core/core.c +10
-7- 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;drivers/mmc/core/mmc.c +0
-0@@ -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)
gotofree_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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 23 lines · Girish K S
Quoted 22 lines · Seungwon Jeon
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 <[email protected]>---
drivers/mmc/core/core.c | 22 +++++++++++++---------drivers/mmc/core/mmc.c| 10 ++++++++--2 files changed, 21 insertions(+), 11 deletions(-)drivers/mmc/core/core.c +1
-0@@ -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;
Quoted 9 lines
drivers/mmc/core/core.c int mmc_cache_ctrl(struct mmc_host *host, u8
Quoted 2 lines
if (!(host->caps2 &
MMC_CAP2_CACHE_CTRL) ||drivers/mmc/core/core.c +0
-0@@ -2258,16 +2259,19 @@ int mmc_cache_ctrl(struct mmc_host *host, u8enable)
Quoted 6 lines
drivers/mmc/core/core.c +2
-1(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 :
Quoted 6 lines
0;
drivers/mmc/core/core.c int mmc_cache_ctrl(struct mmc_host *host, u8 enable) · line 2263
Quoted 2 lines
drivers/mmc/core/core.c +0
-1err = 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 becard->ext_csd.generic_cmd6_timeinstead of 0
Upper line you pointed was removed. Could check '-', please?
Quoted 8 lines
drivers/mmc/core/core.c int mmc_cache_ctrl(struct mmc_host *host, u8 enable)
Quoted 8 lines
drivers/mmc/core/core.c +1
-7- 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.
Quoted 4 lines
drivers/mmc/core/core.c int mmc_cache_ctrl(struct mmc_host *host, u8 enable)
Quoted 4 lines
drivers/mmc/core/core.c +4
-0+ + if (err) + pr_err("%s: cache %s error %d\n", +
mmc_hostname(card->host),
Quoted 46 lines
drivers/mmc/core/mmc.c static int mmc_init_card(struct mmc_host *host,
Quoted 13 lines
drivers/mmc/core/core.c +5
-0+ enable ? "on" : "off", + err); + else + card->ext_csd.cache_ctrl = enable; + } } return err;drivers/mmc/core/mmc.c +0
-0@@ -1064,14 +1064,20 @@ static int mmc_init_card(struct mmc_host *host,u32 ocr,
Quoted 9 lines
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)
gotofree_card;Quoted 6 lines
/*
* 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 enablingfailed\n",
Quoted 16 lines
+
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html