Introduce max_timeout_count in sdhci_host for vendor needs
Subsystems (3)
cover Introduce max_timeout_count in sdhci_host for vendor needs
Introduce max_timeout_count in sdhci_host_struct to let vendor's modify the max timeout value as per their needs.
Sarthak Garg (2):
mmc: sdhci: Introduce max_timeout_count variable in sdhci_host
mmc: sdhci-msm: Use maximum possible data timeout value
drivers/mmc/host/sdhci-msm.c | 3 +++ drivers/mmc/host/sdhci.c | 15 +++++++++------ drivers/mmc/host/sdhci.h | 1 + 3 files changed, 13 insertions(+), 6 deletions(-)
Signature · 1 line
2.7.4
PATCH 1/2 mmc: sdhci: Introduce max_timeout_count variable in sdhci_host
Introduce max_timeout_count variable in the sdhci_host structure and use in timeout calculation. By default its set to 0xE (max timeout register value as per SDHC spec). But at the same time vendors drivers can update it if they support different max timeout register value than 0xE.
--- drivers/mmc/host/sdhci.c | 15 +++++++++------ drivers/mmc/host/sdhci.h | 1 + 2 files changed, 10 insertions(+), 6 deletions(-)
drivers/mmc/host/sdhci.c +9 -6
@@ -939,16 +939,16 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd,* timeout value. */ if (host->quirks &SDHCI_QUIRK_BROKEN_TIMEOUT_VAL ) -return 0xE ; +return host->max_timeout_count;/* Unspecified command, asume max */ if (cmd ==NULL ) -return 0xE ; +return host->max_timeout_count; data = cmd->data;/* Unspecified timeout, assume max */ if (!data && !cmd->busy_timeout) -return 0xE ; +return host->max_timeout_count;/* timeout in us */ target_timeout =sdhci_target_timeout (host, cmd, data);
@@ -968,15 +968,15 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd,while (current_timeout < target_timeout) { count++; current_timeout <<=1 ; -if (count >=0xF ) +if (count > host->max_timeout_count)break ; } -if (count >=0xF ) { +if (count > host->max_timeout_count) {if (!(host->quirks2 &SDHCI_QUIRK2_DISABLE_HW_TIMEOUT ))DBG ("Too large timeout 0x%x requested for CMD%d!\n" , count, cmd->opcode); - count =0xE ; + count = host->max_timeout_count; }else { *too_big = false; }
@@ -3940,6 +3940,9 @@ struct sdhci_host *sdhci_alloc_host(struct device *dev,*/ host->adma_table_cnt =SDHCI_MAX_SEGS *2 +1 ; +if (!host->max_timeout_count) + host->max_timeout_count =0xE ; +return host; }
drivers/mmc/host/sdhci.h +1 -0
@@ -517,6 +517,7 @@ struct sdhci_host {unsigned int max_clk;/* Max possible freq (MHz) */ unsigned int timeout_clk;/* Timeout freq (KHz) */ +u8 max_timeout_count;/* Vendor specific max timeout count */ unsigned int clk_mul;/* Clock Muliplier value */ unsigned int clock;/* Current clock (MHz) */
Signature · 1 line
2.7.4
PATCH 2/2 mmc: sdhci-msm: Use maximum possible data timeout value
In reply to Sarthak GargThe Qcom 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, 3 insertions(+)
drivers/mmc/host/sdhci-msm.c +3 -0
@@ -2696,6 +2696,9 @@ static int sdhci_msm_probe(struct platform_device *pdev) msm_host->mmc->caps |=MMC_CAP_WAIT_WHILE_BUSY |MMC_CAP_NEED_RSP_BUSY ; +/* Set the timeout value to max possible */ + host->max_timeout_count =0xF ; +pm_runtime_get_noresume (&pdev->dev);pm_runtime_set_active (&pdev->dev);pm_runtime_enable (&pdev->dev);
Signature · 1 line
2.7.4
Re: [PATCH V1 2/2] mmc: sdhci-msm: Use maximum possible data timeout value
Quoted 10 lines · Sarthak Garg
The Qcom SD controller defines the usage of
0xFin 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.Signed-off-by Sahitya Tummala <[email protected]>
The From: of the email says you wrote the patch, but the first person to certify its origin is Sahitya. Did you perhaps write this together? If so you should have a:
If Sahitya wrote the patch, certifies its origin and then you picks it up and certify that you got it from Sahitya, then you should write it as you did - but you should have retained Sahitya as author...
Regards,
Bjorn
Quoted 22 lines
Signed-off-by Sarthak Garg <[email protected]>--- drivers/mmc/host/sdhci-msm.c | 3 +++ 1 file changed, 3 insertions(+)drivers/mmc/host/sdhci-msm.c +3
-0@@ -2696,6 +2696,9 @@ static int sdhci_msm_probe(struct platform_device *pdev) msm_host->mmc->caps |=MMC_CAP_WAIT_WHILE_BUSY |MMC_CAP_NEED_RSP_BUSY ; +/* Set the timeout value to max possible */ + host->max_timeout_count =0xF ; +pm_runtime_get_noresume (&pdev->dev);pm_runtime_set_active (&pdev->dev);pm_runtime_enable (&pdev->dev);Signature · 1 line
2.7.4
v2 cover Introduce max_timeout_count in sdhci_host for vendor
In reply to Sarthak GargIntroduce max_timeout_count in sdhci_host_struct to let vendor's modify the max timeout value as per their needs.
Sahitya Tummala (1):
mmc: sdhci-msm: Use maximum possible data timeout value
Sarthak Garg (1):
mmc: sdhci: Introduce max_timeout_count variable in sdhci_host
drivers/mmc/host/sdhci-msm.c | 3 +++ drivers/mmc/host/sdhci.c | 15 +++++++++------ drivers/mmc/host/sdhci.h | 1 + 3 files changed, 13 insertions(+), 6 deletions(-)
Signature · 1 line
2.7.4
PATCH v2 1/2 mmc: sdhci: Introduce max_timeout_count variable in sdhci_host
Introduce max_timeout_count variable in the sdhci_host structure and use in timeout calculation. By default its set to 0xE (max timeout register value as per SDHC spec). But at the same time vendors drivers can update it if they support different max timeout register value than 0xE.
--- drivers/mmc/host/sdhci.c | 15 +++++++++------ drivers/mmc/host/sdhci.h | 1 + 2 files changed, 10 insertions(+), 6 deletions(-)
drivers/mmc/host/sdhci.c +9 -6
@@ -939,16 +939,16 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd,* timeout value. */ if (host->quirks &SDHCI_QUIRK_BROKEN_TIMEOUT_VAL ) -return 0xE ; +return host->max_timeout_count;/* Unspecified command, asume max */ if (cmd ==NULL ) -return 0xE ; +return host->max_timeout_count; data = cmd->data;/* Unspecified timeout, assume max */ if (!data && !cmd->busy_timeout) -return 0xE ; +return host->max_timeout_count;/* timeout in us */ target_timeout =sdhci_target_timeout (host, cmd, data);
@@ -968,15 +968,15 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd,while (current_timeout < target_timeout) { count++; current_timeout <<=1 ; -if (count >=0xF ) +if (count > host->max_timeout_count)break ; } -if (count >=0xF ) { +if (count > host->max_timeout_count) {if (!(host->quirks2 &SDHCI_QUIRK2_DISABLE_HW_TIMEOUT ))DBG ("Too large timeout 0x%x requested for CMD%d!\n" , count, cmd->opcode); - count =0xE ; + count = host->max_timeout_count; }else { *too_big = false; }
@@ -3940,6 +3940,9 @@ struct sdhci_host *sdhci_alloc_host(struct device *dev,*/ host->adma_table_cnt =SDHCI_MAX_SEGS *2 +1 ; +if (!host->max_timeout_count) + host->max_timeout_count =0xE ; +return host; }
drivers/mmc/host/sdhci.h +1 -0
@@ -517,6 +517,7 @@ struct sdhci_host {unsigned int max_clk;/* Max possible freq (MHz) */ unsigned int timeout_clk;/* Timeout freq (KHz) */ +u8 max_timeout_count;/* Vendor specific max timeout count */ unsigned int clk_mul;/* Clock Muliplier value */ unsigned int clock;/* Current clock (MHz) */
Signature · 1 line
2.7.4
Adrian Hunter
maintainerRe: [PATCH V2 1/2] mmc: sdhci: Introduce max_timeout_count variable in sdhci_host
Quoted 5 lines · Sarthak Garg
Introduce
max_timeout_countvariable in thesdhci_hoststructure and use in timeout calculation. By default its set to0xE(max timeout register value as per SDHC spec). But at the same time vendors drivers can update it if they support different max timeout register value than0xE.
Looks fine. A couple of minor comments below.
Quoted 12 lines
Signed-off-by Sarthak Garg <[email protected]>--- drivers/mmc/host/sdhci.c | 15 +++++++++------ drivers/mmc/host/sdhci.h | 1 + 2 files changed, 10 insertions(+), 6 deletions(-)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 942
Quoted 5 lines
drivers/mmc/host/sdhci.c +1
-1@@ -939,16 +939,16 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd,* timeout value. */ if (host->quirks &SDHCI_QUIRK_BROKEN_TIMEOUT_VAL ) -return 0xE ; +return host->max_timeout_count;
Please adjust the comment above this that also refers to 0xE e.g. "skip the check and use 0xE" -> "skip the check and use the maximum"
Quoted 34 lines
drivers/mmc/host/sdhci.c +5
-5/* Unspecified command, asume max */ if (cmd ==NULL ) -return 0xE ; +return host->max_timeout_count; data = cmd->data;/* Unspecified timeout, assume max */ if (!data && !cmd->busy_timeout) -return 0xE ; +return host->max_timeout_count;/* timeout in us */ target_timeout =sdhci_target_timeout (host, cmd, data);@@ -968,15 +968,15 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd,while (current_timeout < target_timeout) { count++; current_timeout <<=1 ; -if (count >=0xF ) +if (count > host->max_timeout_count)break ; } -if (count >=0xF ) { +if (count > host->max_timeout_count) {if (!(host->quirks2 &SDHCI_QUIRK2_DISABLE_HW_TIMEOUT ))DBG ("Too large timeout 0x%x requested for CMD%d!\n" , count, cmd->opcode); - count =0xE ; + count = host->max_timeout_count; }else { *too_big = false; }
drivers/mmc/host/sdhci.c struct sdhci_host *sdhci_alloc_host(struct device *dev, · line 3943
Quoted 4 lines
drivers/mmc/host/sdhci.c +1
-0@@ -3940,6 +3940,9 @@ struct sdhci_host *sdhci_alloc_host(struct device *dev,*/ host->adma_table_cnt =SDHCI_MAX_SEGS *2 +1 ; +if (!host->max_timeout_count)
'host' has just been (zero) allocated as part of 'mmc', so the 'if' is redundant here.
Quoted 18 lines
drivers/mmc/host/sdhci.c +2
-0+ host->max_timeout_count =0xE ; +return host; }drivers/mmc/host/sdhci.h +1
-0@@ -517,6 +517,7 @@ struct sdhci_host {unsigned int max_clk;/* Max possible freq (MHz) */ unsigned int timeout_clk;/* Timeout freq (KHz) */ +u8 max_timeout_count;/* Vendor specific max timeout count */ unsigned int clk_mul;/* Clock Muliplier value */ unsigned int clock;/* Current clock (MHz) */
v3 cover Introduce max_timeout_count in sdhci_host for vendor
In reply to Sarthak GargIntroduce max_timeout_count in sdhci_host_struct to let vendor's modify the max timeout value as per their needs.
Sahitya Tummala (1):
mmc: sdhci-msm: Use maximum possible data timeout value
Sarthak Garg (1):
mmc: sdhci: Introduce max_timeout_count variable in sdhci_host
drivers/mmc/host/sdhci-msm.c | 3 +++ drivers/mmc/host/sdhci.c | 16 +++++++++------- drivers/mmc/host/sdhci.h | 1 + 3 files changed, 13 insertions(+), 7 deletions(-)
Signature · 1 line
2.7.4
v3 cover Introduce max_timeout_count in sdhci_host for vendor needs
In reply to Sarthak GargIntroduce max_timeout_count in sdhci_host_struct to let vendor's modify the max timeout value as per their needs.
Sahitya Tummala (1):
mmc: sdhci-msm: Use maximum possible data timeout value
Sarthak Garg (1):
mmc: sdhci: Introduce max_timeout_count variable in sdhci_host
drivers/mmc/host/sdhci-msm.c | 3 +++ drivers/mmc/host/sdhci.c | 16 +++++++++------- drivers/mmc/host/sdhci.h | 1 + 3 files changed, 13 insertions(+), 7 deletions(-)
Signature · 1 line
2.7.4
PATCH v3 1/2 mmc: sdhci: Introduce max_timeout_count variable in sdhci_host
Introduce max_timeout_count variable in the sdhci_host structure and use in timeout calculation. By default its set to 0xE (max timeout register value as per SDHC spec). But at the same time vendors drivers can update it if they support different max timeout register value than 0xE.
--- drivers/mmc/host/sdhci.c | 16 +++++++++------- drivers/mmc/host/sdhci.h | 1 + 2 files changed, 10 insertions(+), 7 deletions(-)
drivers/mmc/host/sdhci.c +9 -7
@@ -934,21 +934,21 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd,/* * If the host controller provides us with an incorrect timeout -* value, just skip the check and use 0xE. The hardware may take +* value, just skip the check and use the maximum. The hardware may take * longer to time out, but that's much better than having a too-short * timeout value. */ if (host->quirks &SDHCI_QUIRK_BROKEN_TIMEOUT_VAL ) -return 0xE ; +return host->max_timeout_count;/* Unspecified command, asume max */ if (cmd ==NULL ) -return 0xE ; +return host->max_timeout_count; data = cmd->data;/* Unspecified timeout, assume max */ if (!data && !cmd->busy_timeout) -return 0xE ; +return host->max_timeout_count;/* timeout in us */ target_timeout =sdhci_target_timeout (host, cmd, data);
@@ -968,15 +968,15 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd,while (current_timeout < target_timeout) { count++; current_timeout <<=1 ; -if (count >=0xF ) +if (count > host->max_timeout_count)break ; } -if (count >=0xF ) { +if (count > host->max_timeout_count) {if (!(host->quirks2 &SDHCI_QUIRK2_DISABLE_HW_TIMEOUT ))DBG ("Too large timeout 0x%x requested for CMD%d!\n" , count, cmd->opcode); - count =0xE ; + count = host->max_timeout_count; }else { *too_big = false; }
@@ -3940,6 +3940,8 @@ struct sdhci_host *sdhci_alloc_host(struct device *dev,*/ host->adma_table_cnt =SDHCI_MAX_SEGS *2 +1 ; + host->max_timeout_count =0xE ; +return host; }
drivers/mmc/host/sdhci.h +1 -0
@@ -517,6 +517,7 @@ struct sdhci_host {unsigned int max_clk;/* Max possible freq (MHz) */ unsigned int timeout_clk;/* Timeout freq (KHz) */ +u8 max_timeout_count;/* Vendor specific max timeout count */ unsigned int clk_mul;/* Clock Muliplier value */ unsigned int clock;/* Current clock (MHz) */
Signature · 1 line
2.7.4
Re: [PATCH V3 1/2] mmc: sdhci: Introduce max_timeout_count variable in sdhci_host
Quoted 7 lines · Sarthak Garg
Introduce
max_timeout_countvariable in thesdhci_hoststructure and use in timeout calculation. By default its set to0xE(max timeout register value as per SDHC spec). But at the same time vendors drivers can update it if they support different max timeout register value than0xE.Signed-off-by Sarthak Garg <[email protected]>
Quoted 76 lines
--- drivers/mmc/host/sdhci.c | 16 +++++++++------- drivers/mmc/host/sdhci.h | 1 + 2 files changed, 10 insertions(+), 7 deletions(-)drivers/mmc/host/sdhci.c +9
-7@@ -934,21 +934,21 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd,/* * If the host controller provides us with an incorrect timeout -* value, just skip the check and use 0xE. The hardware may take +* value, just skip the check and use the maximum. The hardware may take * longer to time out, but that's much better than having a too-short * timeout value. */ if (host->quirks &SDHCI_QUIRK_BROKEN_TIMEOUT_VAL ) -return 0xE ; +return host->max_timeout_count;/* Unspecified command, asume max */ if (cmd ==NULL ) -return 0xE ; +return host->max_timeout_count; data = cmd->data;/* Unspecified timeout, assume max */ if (!data && !cmd->busy_timeout) -return 0xE ; +return host->max_timeout_count;/* timeout in us */ target_timeout =sdhci_target_timeout (host, cmd, data);@@ -968,15 +968,15 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd,while (current_timeout < target_timeout) { count++; current_timeout <<=1 ; -if (count >=0xF ) +if (count > host->max_timeout_count)break ; } -if (count >=0xF ) { +if (count > host->max_timeout_count) {if (!(host->quirks2 &SDHCI_QUIRK2_DISABLE_HW_TIMEOUT ))DBG ("Too large timeout 0x%x requested for CMD%d!\n" , count, cmd->opcode); - count =0xE ; + count = host->max_timeout_count; }else { *too_big = false; }@@ -3940,6 +3940,8 @@ struct sdhci_host *sdhci_alloc_host(struct device *dev,*/ host->adma_table_cnt =SDHCI_MAX_SEGS *2 +1 ; + host->max_timeout_count =0xE ; +return host; }drivers/mmc/host/sdhci.h +1
-0@@ -517,6 +517,7 @@ struct sdhci_host {unsigned int max_clk;/* Max possible freq (MHz) */ unsigned int timeout_clk;/* Timeout freq (KHz) */ +u8 max_timeout_count;/* Vendor specific max timeout count */ unsigned int clk_mul;/* Clock Muliplier value */ unsigned int clock;/* Current clock (MHz) */
PATCH v3 2/2 mmc: sdhci-msm: Use maximum possible data timeout value
In reply to Sarthak GargFrom: Sahitya Tummala <[email protected]>
The Qcom 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, 3 insertions(+)
drivers/mmc/host/sdhci-msm.c +3 -0
@@ -2696,6 +2696,9 @@ static int sdhci_msm_probe(struct platform_device *pdev) msm_host->mmc->caps |=MMC_CAP_WAIT_WHILE_BUSY |MMC_CAP_NEED_RSP_BUSY ; +/* Set the timeout value to max possible */ + host->max_timeout_count =0xF ; +pm_runtime_get_noresume (&pdev->dev);pm_runtime_set_active (&pdev->dev);pm_runtime_enable (&pdev->dev);
Signature · 1 line
2.7.4
Re: [PATCH V3 2/2] mmc: sdhci-msm: Use maximum possible data timeout value
Quoted 7 lines · Sarthak Garg
From: Sahitya Tummala <[email protected]>
The Qcom SD controller defines the usage of
0xFin 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.
Quoted 6 lines
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.Signed-off-by Sahitya Tummala <[email protected]>Signed-off-by Sarthak Garg <[email protected]>
Quoted 19 lines
--- drivers/mmc/host/sdhci-msm.c | 3 +++ 1 file changed, 3 insertions(+)drivers/mmc/host/sdhci-msm.c +3
-0@@ -2696,6 +2696,9 @@ static int sdhci_msm_probe(struct platform_device *pdev) msm_host->mmc->caps |=MMC_CAP_WAIT_WHILE_BUSY |MMC_CAP_NEED_RSP_BUSY ; +/* Set the timeout value to max possible */ + host->max_timeout_count =0xF ; +pm_runtime_get_noresume (&pdev->dev);pm_runtime_set_active (&pdev->dev);pm_runtime_enable (&pdev->dev);
Quoted 10 lines · Sarthak Garg
Introduce
max_timeout_countinsdhci_host_structto let vendor's modify the max timeout value as per their needs.Sahitya Tummala (1):
mmc: sdhci-msm: Use maximum possible data timeout valueSarthak Garg (1):
mmc: sdhci: Introducemax_timeout_countvariable insdhci_host
Quoted 8 lines
drivers/mmc/host/sdhci-msm.c | 3 +++ drivers/mmc/host/sdhci.c | 16 +++++++++------- drivers/mmc/host/sdhci.h | 1 + 3 files changed, 13 insertions(+), 7 deletions(-)--
2.7.4
Applied for next, thanks!
Kind regards
Uffe
PATCH v2 2/2 mmc: sdhci-msm: Use maximum possible data timeout value
In reply to Sarthak GargFrom: Sahitya Tummala <[email protected]>
The Qcom 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, 3 insertions(+)
drivers/mmc/host/sdhci-msm.c +3 -0
@@ -2696,6 +2696,9 @@ static int sdhci_msm_probe(struct platform_device *pdev) msm_host->mmc->caps |=MMC_CAP_WAIT_WHILE_BUSY |MMC_CAP_NEED_RSP_BUSY ; +/* Set the timeout value to max possible */ + host->max_timeout_count =0xF ; +pm_runtime_get_noresume (&pdev->dev);pm_runtime_set_active (&pdev->dev);pm_runtime_enable (&pdev->dev);
Signature · 1 line
2.7.4