Introduce new quirk to use reserved timeout
Subsystems (3)
cover Introduce new quirk to use reserved timeout
Introduce a new quirk for letting vendor drivers to use reserved timeout value (0xF) in timeout control register.
Sarthak Garg (2):
mmc: sdhci: Introduce new quirk to use reserved timeout
mmc: sdhci-msm: Use maximum possible data timeout value
drivers/mmc/host/sdhci-msm.c | 3 ++- drivers/mmc/host/sdhci.c | 3 ++- drivers/mmc/host/sdhci.h | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-)
Signature · 1 line
2.7.4
PATCH 1/2 mmc: sdhci: Introduce new quirk to use reserved timeout
Introduce a new quirk for letting vendor drivers to use reserved timeout value (0xF) in timeout control register.
--- drivers/mmc/host/sdhci.c | 3 ++- drivers/mmc/host/sdhci.h | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci.c +2 -1
@@ -967,7 +967,8 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd, }if (count >=0xF ) { -if (!(host->quirks2 &SDHCI_QUIRK2_DISABLE_HW_TIMEOUT )) +if (!(host->quirks2 &SDHCI_QUIRK2_DISABLE_HW_TIMEOUT ) || + !(host->quirks2 &SDHCI_QUIRK2_USE_RESERVED_MAX_TIMEOUT ))DBG ("Too large timeout 0x%x requested for CMD%d!\n" , count, cmd->opcode); count =0xE ;
drivers/mmc/host/sdhci.h +5 -0
@@ -476,6 +476,11 @@ struct sdhci_host {* block count. */ #define SDHCI_QUIRK2_USE_32BIT_BLK_CNT (1<<18) +/* +* Some controllers define the usage of 0xF in data timeout counter +* register (0x2E) which is actually a reserved bit as per specification. +*/ +#define SDHCI_QUIRK2_USE_RESERVED_MAX_TIMEOUT (1<<19)int irq;/* Device IRQ */ void __iomem *ioaddr;/* Mapped address */
Signature · 1 line
2.7.4
Re: [PATCH V1 1/2] mmc: sdhci: Introduce new quirk to use reserved timeout
Quoted 16 lines · Sarthak Garg
Introduce a new quirk for letting vendor drivers to use reserved timeout value (
0xF) in timeout control register.Signed-off-by Sahitya Tummala <[email protected]>Signed-off-by Sarthak Garg <[email protected]>--- drivers/mmc/host/sdhci.c | 3 ++- drivers/mmc/host/sdhci.h | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-)drivers/mmc/host/sdhci.c +0
-0
drivers/mmc/host/sdhci.c static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd, · line 971
Quoted 6 lines
drivers/mmc/host/sdhci.c +2
-1@@ -967,7 +967,8 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd, }if (count >=0xF ) { -if (!(host->quirks2 &SDHCI_QUIRK2_DISABLE_HW_TIMEOUT )) +if (!(host->quirks2 &SDHCI_QUIRK2_DISABLE_HW_TIMEOUT ) || + !(host->quirks2 &SDHCI_QUIRK2_USE_RESERVED_MAX_TIMEOUT ))
I don't quite get how this can make your variant use 0xF rather than 0xE?
To me it looks like an updated conditional check to print a debug message, no?
Quoted 20 lines
drivers/mmc/host/sdhci.c +0
-0DBG ("Too large timeout 0x%x requested for CMD%d!\n" , count, cmd->opcode); count =0xE ;drivers/mmc/host/sdhci.h +5
-1@@ -476,6 +476,11 @@ struct sdhci_host {* block count. */ #define SDHCI_QUIRK2_USE_32BIT_BLK_CNT (1<<18) +/* +* Some controllers define the usage of 0xF in data timeout counter +* register (0x2E) which is actually a reserved bit as per specification. +*/ +#define SDHCI_QUIRK2_USE_RESERVED_MAX_TIMEOUT (1<<19)int irq;/* Device IRQ */ void __iomem *ioaddr;/* Mapped address */ --
Quoted 2 lines
2.7.4
Kind regards
Uffe
Adrian Hunter
maintainerRe: [PATCH V1 1/2] mmc: sdhci: Introduce new quirk to use reserved timeout
Quoted 19 lines · Ulf Hansson
Quoted 18 lines · Sarthak Garg
Introduce a new quirk for letting vendor drivers to use reserved timeout value (
0xF) in timeout control register.Signed-off-by Sahitya Tummala <[email protected]>Signed-off-by Sarthak Garg <[email protected]>--- drivers/mmc/host/sdhci.c | 3 ++- drivers/mmc/host/sdhci.h | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-)drivers/mmc/host/sdhci.c +0
-0@@ -967,7 +967,8 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd, }
Quoted 8 lines
drivers/mmc/host/sdhci.c static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd, · line 971
Quoted 4 lines
drivers/mmc/host/sdhci.c +2
-1if (count >=0xF ) { -if (!(host->quirks2 &SDHCI_QUIRK2_DISABLE_HW_TIMEOUT )) +if (!(host->quirks2 &SDHCI_QUIRK2_DISABLE_HW_TIMEOUT ) || + !(host->quirks2 &SDHCI_QUIRK2_USE_RESERVED_MAX_TIMEOUT ))I don't quite get how this can make your variant use
0xFrather than0xE?To me it looks like an updated conditional check to print a debug message, no?
Probably need to introduce host->max_timeout_count, set it to 0xE in sdhci_alloc_host(), and change sdhci_calc_timeout() to use it in place of all the 0xE and 0xF constants.
Quoted 27 lines
Quoted 21 lines
drivers/mmc/host/sdhci.c +0
-0DBG ("Too large timeout 0x%x requested for CMD%d!\n" , count, cmd->opcode); count =0xE ;drivers/mmc/host/sdhci.h +5
-1@@ -476,6 +476,11 @@ struct sdhci_host {* block count. */ #define SDHCI_QUIRK2_USE_32BIT_BLK_CNT (1<<18) +/* +* Some controllers define the usage of 0xF in data timeout counter +* register (0x2E) which is actually a reserved bit as per specification. +*/ +#define SDHCI_QUIRK2_USE_RESERVED_MAX_TIMEOUT (1<<19)int irq;/* Device IRQ */ void __iomem *ioaddr;/* Mapped address */ --Quoted 2 lines
2.7.4
Kind regards
Uffe
Re: [PATCH V1 1/2] mmc: sdhci: Introduce new quirk to use reserved timeout
Quoted 28 lines · Adrian Hunter
Quoted 26 lines · Ulf Hansson
Quoted 16 lines · Sarthak Garg
Introduce a new quirk for letting vendor drivers to use reserved timeout value (
0xF) in timeout control register.Signed-off-by Sahitya Tummala <[email protected]>Signed-off-by Sarthak Garg <[email protected]>--- drivers/mmc/host/sdhci.c | 3 ++- drivers/mmc/host/sdhci.h | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-)drivers/mmc/host/sdhci.c +0
-0drivers/mmc/host/sdhci.c static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd, · line 971
Quoted 6 lines
drivers/mmc/host/sdhci.c +2
-1@@ -967,7 +967,8 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd, }if (count >=0xF ) { -if (!(host->quirks2 &SDHCI_QUIRK2_DISABLE_HW_TIMEOUT )) +if (!(host->quirks2 &SDHCI_QUIRK2_DISABLE_HW_TIMEOUT ) || + !(host->quirks2 &SDHCI_QUIRK2_USE_RESERVED_MAX_TIMEOUT ))I don't quite get how this can make your variant use
0xFrather than0xE?
Quoted 5 lines
Quoted 1 line
To me it looks like an updated conditional check to print a debug message, no?
Probably need to introduce
host->max_timeout_count, set it to0xEinsdhci_alloc_host(), and changesdhci_calc_timeout()to use it in place of all the0xEand0xFconstants.
Yep, that seems like a reasonable approach to me as well.
[...]
Kind regards
Uffe
Re: [PATCH V1 1/2] mmc: sdhci: Introduce new quirk to use reserved timeout
Quoted 35 lines · Ulf Hansson
Quoted 28 lines · Adrian Hunter
Quoted 26 lines · Ulf Hansson
Quoted 16 lines · Sarthak Garg
Introduce a new quirk for letting vendor drivers to use reserved timeout value (
0xF) in timeout control register.Signed-off-by Sahitya Tummala <[email protected]>Signed-off-by Sarthak Garg <[email protected]>--- drivers/mmc/host/sdhci.c | 3 ++- drivers/mmc/host/sdhci.h | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-)drivers/mmc/host/sdhci.c +0
-0drivers/mmc/host/sdhci.c static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd, · line 971
Quoted 6 lines
drivers/mmc/host/sdhci.c +2
-1@@ -967,7 +967,8 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd, }if (count >=0xF ) { -if (!(host->quirks2 &SDHCI_QUIRK2_DISABLE_HW_TIMEOUT )) +if (!(host->quirks2 &SDHCI_QUIRK2_DISABLE_HW_TIMEOUT ) || + !(host->quirks2 &SDHCI_QUIRK2_USE_RESERVED_MAX_TIMEOUT ))I don't quite get how this can make your variant use
0xFrather than0xE?Quoted 5 lines
Quoted 1 line
To me it looks like an updated conditional check to print a debug message, no?
Probably need to introduce
host->max_timeout_count, set it to0xEinsdhci_alloc_host(), and changesdhci_calc_timeout()to use it in place of all the0xEand0xFconstants.
Quoted 6 lines
Yep, that seems like a reasonable approach to me as well.
[...]
Kind regards
Uffe
Resending the mail again as can't see my comment on the https://patchwork.kernel.org/ page. Sorry for the mistake just want to update the logic as below.
- count = 0xE;
+ if(!(host->quirks2 & SDHCI_QUIRK2_USE_RESERVED_MAX_TIMEOUT))
+ count = 0xE;
Adrian Hunter
maintainerRe: [PATCH V1 1/2] mmc: sdhci: Introduce new quirk to use reserved timeout
Quoted 45 lines · On 19/05/20 5:08 pm, [email protected] wrote:
Quoted 37 lines · Ulf Hansson
Quoted 27 lines · Adrian Hunter
Quoted 12 lines · Ulf Hansson
Quoted 11 lines · Sarthak Garg
Introduce a new quirk for letting vendor drivers to use reserved timeout value (
0xF) in timeout control register.Signed-off-by Sahitya Tummala <[email protected]>Signed-off-by Sarthak Garg <[email protected]>---
drivers/mmc/host/sdhci.c| 3 ++-
drivers/mmc/host/sdhci.h| 5 +++++2 files changed, 7 insertions(+), 1 deletion(-)Quoted 5 lines
drivers/mmc/host/sdhci.c static u8 sdhci_calc_timeout(struct sdhci_host
Quoted 5 lines
drivers/mmc/host/sdhci.c +0
-0@@ -967,7 +967,8 @@ static u8 sdhci_calc_timeout(struct sdhci_host*host, struct
mmc_command*cmd,Quoted 7 lines
Quoted 6 lines
drivers/mmc/host/sdhci.c +2
-1} if (count >= 0xF) { - if (!(host->quirks2 & SDHCI_QUIRK2_DISABLE_HW_TIMEOUT)) + if (!(host->quirks2 & SDHCI_QUIRK2_DISABLE_HW_TIMEOUT) || + !(host->quirks2 & SDHCI_QUIRK2_USE_RESERVED_MAX_TIMEOUT))Quoted 8 lines
Quoted 3 lines
I don't quite get how this can make your variant use
0xFrather than0xE?To me it looks like an updated conditional check to print a debug
message, no?
Probably need to introduce
host->max_timeout_count, set it to0xEinsdhci_alloc_host(), and changesdhci_calc_timeout()to use it in place of all the0xEand0xFconstants.Quoted 6 lines
Yep, that seems like a reasonable approach to me as well.
[...]
Kind regards
Uffe
Quoted 6 lines
Resending the mail again as can't see my comment on the
https://patchwork.kernel.org/ page.
Sorry for the mistake just want to update the logic as below.
- count =0xE;
+if(!(host->quirks2 & SDHCI_QUIRK2_USE_RESERVED_MAX_TIMEOUT))+ count =0xE;
I think it is conceptually simpler to define SDHCI constants as variables and let vendor drivers change them if need be. In other words, what I wrote above. It changes more code, but the overall result is more consistent.
PATCH 2/2 mmc: sdhci-msm: Use maximum possible data timeout value
In reply to Sarthak GargThe MSM SD controller defines the usage of 0xF in data timeout counter register (0x2E) which is actually a reserved bit as per specification. This would result in maximum of 21.26 secs timeout value.
Some SDcard taking more time than 2.67secs (timeout value corresponding to 0xE) and with that observed data timeout errors.
So increasing the timeout value to max possible timeout.
--- drivers/mmc/host/sdhci-msm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-msm.c +2 -1
@@ -1888,7 +1888,8 @@ static const struct sdhci_pltfm_data sdhci_msm_pdata = {SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN | SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12, - .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN, + .quirks2 =SDHCI_QUIRK2_PRESET_VALUE_BROKEN | + SDHCI_QUIRK2_USE_RESERVED_MAX_TIMEOUT, .ops = &sdhci_msm_ops, };
Signature · 1 line
2.7.4