Skip to contentSkip to conversation

mmc: sdhci: Update the software timeout value for sdhc

PATCH Superseded Shaik Sajida Bhanu 3 participants 7 messages Jun 27, 2021 – Jul 7, 2021

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mmc: sdhci: Update the software timeout value for sdhc

Whenever SDHC run at clock rate 50MHZ or below, the hardware data timeout value will be 21.47secs, which is approx. 22secs and we have a current software timeout value as 10secs. We have to set software timeout value more than the hardware data timeout value to avioid seeing the below register dumps.

[  332.953670] mmc2: Timeout waiting for hardware interrupt.
[  332.959608] mmc2: sdhci: ============ SDHCI REGISTER DUMP ===========
[  332.966450] mmc2: sdhci: Sys addr:  0x00000000 | Version:  0x00007202
[  332.973256] mmc2: sdhci: Blk size:  0x00000200 | Blk cnt:  0x00000001
[  332.980054] mmc2: sdhci: Argument:  0x00000000 | Trn mode: 0x00000027
[  332.986864] mmc2: sdhci: Present:   0x01f801f6 | Host ctl: 0x0000001f
[  332.993671] mmc2: sdhci: Power:     0x00000001 | Blk gap:  0x00000000
[  333.000583] mmc2: sdhci: Wake-up:   0x00000000 | Clock:    0x00000007
[  333.007386] mmc2: sdhci: Timeout:   0x0000000e | Int stat: 0x00000000
[  333.014182] mmc2: sdhci: Int enab:  0x03ff100b | Sig enab: 0x03ff100b
[  333.020976] mmc2: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000000
[  333.027771] mmc2: sdhci: Caps:      0x322dc8b2 | Caps_1:   0x0000808f
[  333.034561] mmc2: sdhci: Cmd:       0x0000183a | Max curr: 0x00000000
[  333.041359] mmc2: sdhci: Resp[0]:   0x00000900 | Resp[1]:  0x00000000
[  333.048157] mmc2: sdhci: Resp[2]:   0x00000000 | Resp[3]:  0x00000000
[  333.054945] mmc2: sdhci: Host ctl2: 0x00000000
[  333.059657] mmc2: sdhci: ADMA Err:  0x00000000 | ADMA Ptr:
0x0000000ffffff218
[  333.067178] mmc2: sdhci_msm: ----------- VENDOR REGISTER DUMP
-----------
[  333.074343] mmc2: sdhci_msm: DLL sts: 0x00000000 | DLL cfg:
0x6000642c | DLL cfg2: 0x0020a000
[  333.083417] mmc2: sdhci_msm: DLL cfg3: 0x00000000 | DLL usr ctl:
0x00000000 | DDR cfg: 0x80040873
[  333.092850] mmc2: sdhci_msm: Vndr func: 0x00008a9c | Vndr func2 :
0xf88218a8 Vndr func3: 0x02626040
[  333.102371] mmc2: sdhci: ============================================

So, set software timeout value more than hardware timeout value.

---

Changes since V1:
- Moved software data timeout update part to qcom specific file as suggested by Veerabhadrarao Badiganti.

---
 drivers/mmc/host/sdhci-msm.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/mmc/host/sdhci-msm.c +9 -0
index e44b7a6..58e651e 100644
@@ -2089,6 +2089,14 @@ static void sdhci_msm_cqe_disable(struct mmc_host *mmc, bool recovery)
 	sdhci_cqe_disable(mmc, recovery);
 }
 
+static void sdhci_msm_set_timeout(struct sdhci_host *host, struct mmc_command *cmd)
+{
+
+	__sdhci_set_timeout(host, cmd);
+	if (cmd && (cmd->data) && (host->clock > 400000) && (host->clock <= 50000000))
+		host->data_timeout = 22 * NSEC_PER_SEC;
+}
+
 static const struct cqhci_host_ops sdhci_msm_cqhci_ops = {
 	.enable		= sdhci_msm_cqe_enable,
 	.disable	= sdhci_msm_cqe_disable,
@@ -2438,6 +2446,7 @@ static const struct sdhci_ops sdhci_msm_ops = {
 	.irq	= sdhci_msm_cqe_irq,
 	.dump_vendor_regs = sdhci_msm_dump_vendor_regs,
 	.set_power = sdhci_set_power_noreg,
+	.set_timeout = sdhci_msm_set_timeout,
 };
 
 static const struct sdhci_pltfm_data sdhci_msm_pdata = {
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member 
of Code Aurora Forum, hosted by The Linux Foundation
#1 lore raw
Thank you for the patch! Perhaps something to improve:

Hi Shaik,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.13-rc7 next-20210625]
[cannot apply to ulf.hansson-mmc/next mmc/mmc-next]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Shaik-Sajida-Bhanu/mmc-sdhci-Update-the-software-timeout-value-for-sdhc/20210627-224156
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 625acffd7ae2c52898d249e6c5c39f348db0d8df
config: m68k-allmodconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/ee7ea08b7e3f660ca8a04f777aeabcb0962f1668
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Shaik-Sajida-Bhanu/mmc-sdhci-Update-the-software-timeout-value-for-sdhc/20210627-224156 git checkout ee7ea08b7e3f660ca8a04f777aeabcb0962f1668
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=m68k

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

drivers/mmc/host/sdhci-msm.c: In function 'sdhci_msm_set_timeout':

>> drivers/mmc/host/sdhci-msm.c:2097:27: warning: integer overflow in expression of type 'long int' results in '525163520' [-Woverflow]
    2097 |   host->data_timeout = 22 * NSEC_PER_SEC;
         |                           ^

vim +2097 drivers/mmc/host/sdhci-msm.c

2094
2095 __sdhci_set_timeout(host, cmd);
2096 if (cmd && (cmd->data) && (host->clock > 400000) && (host->clock <= 50000000))

> 2097			host->data_timeout = 22 * NSEC_PER_SEC;

2098 }
2099

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#2 lore raw
In reply to Shaik Sajida Bhanu
Thank you for the patch! Perhaps something to improve:

Hi Shaik,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.13 next-20210625]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Shaik-Sajida-Bhanu/mmc-sdhci-Update-the-software-timeout-value-for-sdhc/20210627-224156
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 625acffd7ae2c52898d249e6c5c39f348db0d8df
config: riscv-randconfig-r005-20210628 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 4c92e31dd0f1bd152eda883af20ff7fbcaa14945)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/ee7ea08b7e3f660ca8a04f777aeabcb0962f1668
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Shaik-Sajida-Bhanu/mmc-sdhci-Update-the-software-timeout-value-for-sdhc/20210627-224156 git checkout ee7ea08b7e3f660ca8a04f777aeabcb0962f1668
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

>> drivers/mmc/host/sdhci-msm.c:2097:27: warning: overflow in expression; result is 525163520 with type 'long' [-Winteger-overflow]
                   host->data_timeout = 22 * NSEC_PER_SEC;
                                           ^

1 warning generated.

vim +/long +2097 drivers/mmc/host/sdhci-msm.c

2094
2095 __sdhci_set_timeout(host, cmd);
2096 if (cmd && (cmd->data) && (host->clock > 400000) && (host->clock <= 50000000))

> 2097			host->data_timeout = 22 * NSEC_PER_SEC;

2098 }
2099

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

maintainer
#3 lore raw
In reply to Shaik Sajida Bhanu
Quoted 51 lines · Shaik Sajida Bhanu

Whenever SDHC run at clock rate 50MHZ or below, the hardware data timeout value will be 21.47secs, which is approx. 22secs and we have a current software timeout value as 10secs. We have to set software timeout value more than the hardware data timeout value to avioid seeing the below register dumps.

[  332.953670] mmc2: Timeout waiting for hardware interrupt.
[  332.959608] mmc2: sdhci: ============ SDHCI REGISTER DUMP ===========
[  332.966450] mmc2: sdhci: Sys addr:  0x00000000 | Version:  0x00007202
[  332.973256] mmc2: sdhci: Blk size:  0x00000200 | Blk cnt:  0x00000001
[  332.980054] mmc2: sdhci: Argument:  0x00000000 | Trn mode: 0x00000027
[  332.986864] mmc2: sdhci: Present:   0x01f801f6 | Host ctl: 0x0000001f
[  332.993671] mmc2: sdhci: Power:     0x00000001 | Blk gap:  0x00000000
[  333.000583] mmc2: sdhci: Wake-up:   0x00000000 | Clock:    0x00000007
[  333.007386] mmc2: sdhci: Timeout:   0x0000000e | Int stat: 0x00000000
[  333.014182] mmc2: sdhci: Int enab:  0x03ff100b | Sig enab: 0x03ff100b
[  333.020976] mmc2: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000000
[  333.027771] mmc2: sdhci: Caps:      0x322dc8b2 | Caps_1:   0x0000808f
[  333.034561] mmc2: sdhci: Cmd:       0x0000183a | Max curr: 0x00000000
[  333.041359] mmc2: sdhci: Resp[0]:   0x00000900 | Resp[1]:  0x00000000
[  333.048157] mmc2: sdhci: Resp[2]:   0x00000000 | Resp[3]:  0x00000000
[  333.054945] mmc2: sdhci: Host ctl2: 0x00000000
[  333.059657] mmc2: sdhci: ADMA Err:  0x00000000 | ADMA Ptr:
0x0000000ffffff218
[  333.067178] mmc2: sdhci_msm: ----------- VENDOR REGISTER DUMP
-----------
[  333.074343] mmc2: sdhci_msm: DLL sts: 0x00000000 | DLL cfg:
0x6000642c | DLL cfg2: 0x0020a000
[  333.083417] mmc2: sdhci_msm: DLL cfg3: 0x00000000 | DLL usr ctl:
0x00000000 | DDR cfg: 0x80040873
[  333.092850] mmc2: sdhci_msm: Vndr func: 0x00008a9c | Vndr func2 :
0xf88218a8 Vndr func3: 0x02626040
[  333.102371] mmc2: sdhci: ============================================

So, set software timeout value more than hardware timeout value.

---

Changes since V1:
- Moved software data timeout update part to qcom specific file as suggested by Veerabhadrarao Badiganti.

---
 drivers/mmc/host/sdhci-msm.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/mmc/host/sdhci-msm.c +0 -0
index e44b7a6..58e651e 100644

drivers/mmc/host/sdhci-msm.c static void sdhci_msm_cqe_disable(struct mmc_host *mmc, bool recovery) · line 2096

Quoted 8 lines
drivers/mmc/host/sdhci-msm.c +5 -0
@@ -2089,6 +2089,14 @@ static void sdhci_msm_cqe_disable(struct mmc_host *mmc, bool recovery)
 	sdhci_cqe_disable(mmc, recovery);
 }
 
+static void sdhci_msm_set_timeout(struct sdhci_host *host, struct mmc_command *cmd)
+{
+
+	__sdhci_set_timeout(host, cmd);
+	if (cmd && (cmd->data) && (host->clock > 400000) && (host->clock <= 50000000))

There are some redundant parenthesis there and cmd is never NULL i.e. could be:

	if (cmd->data && host->clock > 400000 && host->clock <= 50000000)

drivers/mmc/host/sdhci-msm.c static void sdhci_msm_cqe_disable(struct mmc_host *mmc, bool recovery) · line 2097

Quoted 1 line
drivers/mmc/host/sdhci-msm.c +1 -0
+		host->data_timeout = 22 * NSEC_PER_SEC;

That needs to be 22LL to make the compiler warning go away

Quoted 14 lines
drivers/mmc/host/sdhci-msm.c +3 -0
+}
+
 static const struct cqhci_host_ops sdhci_msm_cqhci_ops = {
 	.enable		= sdhci_msm_cqe_enable,
 	.disable	= sdhci_msm_cqe_disable,
@@ -2438,6 +2446,7 @@ static const struct sdhci_ops sdhci_msm_ops = {
 	.irq	= sdhci_msm_cqe_irq,
 	.dump_vendor_regs = sdhci_msm_dump_vendor_regs,
 	.set_power = sdhci_set_power_noreg,
+	.set_timeout = sdhci_msm_set_timeout,
 };
 
 static const struct sdhci_pltfm_data sdhci_msm_pdata = {
#4 lore raw
Quoted 66 lines · Adrian Hunter
Quoted 52 lines · Shaik Sajida Bhanu

Whenever SDHC run at clock rate 50MHZ or below, the hardware data timeout value will be 21.47secs, which is approx. 22secs and we have a current software timeout value as 10secs. We have to set software timeout value more than the hardware data timeout value to avioid seeing the below register dumps.

[  332.953670] mmc2: Timeout waiting for hardware interrupt.
[  332.959608] mmc2: sdhci: ============ SDHCI REGISTER DUMP ===========
[  332.966450] mmc2: sdhci: Sys addr:  0x00000000 | Version:  0x00007202
[  332.973256] mmc2: sdhci: Blk size:  0x00000200 | Blk cnt:  0x00000001
[  332.980054] mmc2: sdhci: Argument:  0x00000000 | Trn mode: 0x00000027
[  332.986864] mmc2: sdhci: Present:   0x01f801f6 | Host ctl: 0x0000001f
[  332.993671] mmc2: sdhci: Power:     0x00000001 | Blk gap:  0x00000000
[  333.000583] mmc2: sdhci: Wake-up:   0x00000000 | Clock:    0x00000007
[  333.007386] mmc2: sdhci: Timeout:   0x0000000e | Int stat: 0x00000000
[  333.014182] mmc2: sdhci: Int enab:  0x03ff100b | Sig enab: 0x03ff100b
[  333.020976] mmc2: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000000
[  333.027771] mmc2: sdhci: Caps:      0x322dc8b2 | Caps_1:   0x0000808f
[  333.034561] mmc2: sdhci: Cmd:       0x0000183a | Max curr: 0x00000000
[  333.041359] mmc2: sdhci: Resp[0]:   0x00000900 | Resp[1]:  0x00000000
[  333.048157] mmc2: sdhci: Resp[2]:   0x00000000 | Resp[3]:  0x00000000
[  333.054945] mmc2: sdhci: Host ctl2: 0x00000000
[  333.059657] mmc2: sdhci: ADMA Err:  0x00000000 | ADMA Ptr:
0x0000000ffffff218
[  333.067178] mmc2: sdhci_msm: ----------- VENDOR REGISTER DUMP
-----------
[  333.074343] mmc2: sdhci_msm: DLL sts: 0x00000000 | DLL cfg:
0x6000642c | DLL cfg2: 0x0020a000
[  333.083417] mmc2: sdhci_msm: DLL cfg3: 0x00000000 | DLL usr ctl:
0x00000000 | DDR cfg: 0x80040873
[  333.092850] mmc2: sdhci_msm: Vndr func: 0x00008a9c | Vndr func2 :
0xf88218a8 Vndr func3: 0x02626040
[  333.102371] mmc2: sdhci: ============================================

So, set software timeout value more than hardware timeout value.

---

Changes since V1:
- Moved software data timeout update part to qcom specific file as suggested by Veerabhadrarao Badiganti.

---
 drivers/mmc/host/sdhci-msm.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/mmc/host/sdhci-msm.c +0 -0
index e44b7a6..58e651e 100644
@@ -2089,6 +2089,14 @@ static void sdhci_msm_cqe_disable(struct 
 mmc_host *mmc, bool recovery)

drivers/mmc/host/sdhci-msm.c static void sdhci_msm_cqe_disable(struct · line 2099

Quoted 10 lines
drivers/mmc/host/sdhci-msm.c +5 -0
 	sdhci_cqe_disable(mmc, recovery);
 }
 
+static void sdhci_msm_set_timeout(struct sdhci_host *host, struct 
 mmc_command *cmd)
+{
+
+	__sdhci_set_timeout(host, cmd);
+	if (cmd && (cmd->data) && (host->clock > 400000) && (host->clock <= 
 50000000))

There are some redundant parenthesis there and cmd is never NULL i.e. could be:

Quoted 1 line
	if (cmd->data && host->clock > 400000 && host->clock <= 50000000)

Sure

Quoted 5 lines

drivers/mmc/host/sdhci-msm.c static void sdhci_msm_cqe_disable(struct mmc_host *mmc, bool recovery) · line 2097

Quoted 2 lines
drivers/mmc/host/sdhci-msm.c +1 -0
+		host->data_timeout = 22 * NSEC_PER_SEC;

That needs to be 22LL to make the compiler warning go away

Sure

Quoted 14 lines
Quoted 14 lines
drivers/mmc/host/sdhci-msm.c +2 -0
+}
+

static const struct cqhci_host_ops sdhci_msm_cqhci_ops = {

drivers/mmc/host/sdhci-msm.c +1 -0
 	.enable		= sdhci_msm_cqe_enable,
 	.disable	= sdhci_msm_cqe_disable,
@@ -2438,6 +2446,7 @@ static const struct sdhci_ops sdhci_msm_ops = {
 	.irq	= sdhci_msm_cqe_irq,
 	.dump_vendor_regs = sdhci_msm_dump_vendor_regs,
 	.set_power = sdhci_set_power_noreg,
+	.set_timeout = sdhci_msm_set_timeout,
 };
 
 static const struct sdhci_pltfm_data sdhci_msm_pdata = {
#5 lore raw
Quoted 67 lines · On 2021-07-01 22:28, [email protected] wrote:
Quoted 66 lines · Adrian Hunter
Quoted 52 lines · Shaik Sajida Bhanu

Whenever SDHC run at clock rate 50MHZ or below, the hardware data timeout value will be 21.47secs, which is approx. 22secs and we have a current software timeout value as 10secs. We have to set software timeout value more than the hardware data timeout value to avioid seeing the below register dumps.

[  332.953670] mmc2: Timeout waiting for hardware interrupt.
[  332.959608] mmc2: sdhci: ============ SDHCI REGISTER DUMP ===========
[  332.966450] mmc2: sdhci: Sys addr:  0x00000000 | Version:  0x00007202
[  332.973256] mmc2: sdhci: Blk size:  0x00000200 | Blk cnt:  0x00000001
[  332.980054] mmc2: sdhci: Argument:  0x00000000 | Trn mode: 0x00000027
[  332.986864] mmc2: sdhci: Present:   0x01f801f6 | Host ctl: 0x0000001f
[  332.993671] mmc2: sdhci: Power:     0x00000001 | Blk gap:  0x00000000
[  333.000583] mmc2: sdhci: Wake-up:   0x00000000 | Clock:    0x00000007
[  333.007386] mmc2: sdhci: Timeout:   0x0000000e | Int stat: 0x00000000
[  333.014182] mmc2: sdhci: Int enab:  0x03ff100b | Sig enab: 0x03ff100b
[  333.020976] mmc2: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000000
[  333.027771] mmc2: sdhci: Caps:      0x322dc8b2 | Caps_1:   0x0000808f
[  333.034561] mmc2: sdhci: Cmd:       0x0000183a | Max curr: 0x00000000
[  333.041359] mmc2: sdhci: Resp[0]:   0x00000900 | Resp[1]:  0x00000000
[  333.048157] mmc2: sdhci: Resp[2]:   0x00000000 | Resp[3]:  0x00000000
[  333.054945] mmc2: sdhci: Host ctl2: 0x00000000
[  333.059657] mmc2: sdhci: ADMA Err:  0x00000000 | ADMA Ptr:
0x0000000ffffff218
[  333.067178] mmc2: sdhci_msm: ----------- VENDOR REGISTER DUMP
-----------
[  333.074343] mmc2: sdhci_msm: DLL sts: 0x00000000 | DLL cfg:
0x6000642c | DLL cfg2: 0x0020a000
[  333.083417] mmc2: sdhci_msm: DLL cfg3: 0x00000000 | DLL usr ctl:
0x00000000 | DDR cfg: 0x80040873
[  333.092850] mmc2: sdhci_msm: Vndr func: 0x00008a9c | Vndr func2 :
0xf88218a8 Vndr func3: 0x02626040
[  333.102371] mmc2: sdhci: ============================================

So, set software timeout value more than hardware timeout value.

---

Changes since V1:
- Moved software data timeout update part to qcom specific file as suggested by Veerabhadrarao Badiganti.

---
 drivers/mmc/host/sdhci-msm.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/mmc/host/sdhci-msm.c +0 -0
index e44b7a6..58e651e 100644
@@ -2089,6 +2089,14 @@ static void sdhci_msm_cqe_disable(struct 
 mmc_host *mmc, bool recovery)

drivers/mmc/host/sdhci-msm.c static void sdhci_msm_cqe_disable(struct · line 2099

Quoted 10 lines
drivers/mmc/host/sdhci-msm.c +5 -0
 	sdhci_cqe_disable(mmc, recovery);
 }
 
+static void sdhci_msm_set_timeout(struct sdhci_host *host, struct 
 mmc_command *cmd)
+{
+
+	__sdhci_set_timeout(host, cmd);
+	if (cmd && (cmd->data) && (host->clock > 400000) && (host->clock <= 
 50000000))

There are some redundant parenthesis there and cmd is never NULL i.e. could be:

Quoted 2 lines
Quoted 1 line
	if (cmd->data && host->clock > 400000 && host->clock <= 50000000)

Sure

Hi,

We are passing cmd as NULL in sdhci_cqe_enable( ) for eMMC so, i think we should check cmd.

Thanks,
Sajida

Quoted 20 lines
Quoted 5 lines

drivers/mmc/host/sdhci-msm.c static void sdhci_msm_cqe_disable(struct mmc_host *mmc, bool recovery) · line 2097

Quoted 2 lines
drivers/mmc/host/sdhci-msm.c +1 -0
+		host->data_timeout = 22 * NSEC_PER_SEC;

That needs to be 22LL to make the compiler warning go away

Sure

Quoted 14 lines
Quoted 14 lines
drivers/mmc/host/sdhci-msm.c +2 -0
+}
+

static const struct cqhci_host_ops sdhci_msm_cqhci_ops = {

drivers/mmc/host/sdhci-msm.c +1 -0
 	.enable		= sdhci_msm_cqe_enable,
 	.disable	= sdhci_msm_cqe_disable,
@@ -2438,6 +2446,7 @@ static const struct sdhci_ops sdhci_msm_ops = {
 	.irq	= sdhci_msm_cqe_irq,
 	.dump_vendor_regs = sdhci_msm_dump_vendor_regs,
 	.set_power = sdhci_set_power_noreg,
+	.set_timeout = sdhci_msm_set_timeout,
 };
 
 static const struct sdhci_pltfm_data sdhci_msm_pdata = {
maintainer
#6 lore raw
Quoted 65 lines · On 5/07/21 5:09 pm, [email protected] wrote:
Quoted 64 lines · On 2021-07-01 22:28, [email protected] wrote:
Quoted 63 lines · Adrian Hunter
Quoted 51 lines · Shaik Sajida Bhanu

Whenever SDHC run at clock rate 50MHZ or below, the hardware data timeout value will be 21.47secs, which is approx. 22secs and we have a current software timeout value as 10secs. We have to set software timeout value more than the hardware data timeout value to avioid seeing the below register dumps.

[  332.953670] mmc2: Timeout waiting for hardware interrupt. [  332.959608] mmc2: sdhci: ============ SDHCI REGISTER DUMP ===========

[  332.966450] mmc2: sdhci: Sys addr:  0x00000000 | Version:  0x00007202
[  332.973256] mmc2: sdhci: Blk size:  0x00000200 | Blk cnt:  0x00000001
[  332.980054] mmc2: sdhci: Argument:  0x00000000 | Trn mode: 0x00000027

[  332.986864] mmc2: sdhci: Present:   0x01f801f6 | Host ctl: 0x0000001f [  332.993671] mmc2: sdhci: Power:     0x00000001 | Blk gap:  0x00000000 [  333.000583] mmc2: sdhci: Wake-up:   0x00000000 | Clock:    0x00000007 [  333.007386] mmc2: sdhci: Timeout:   0x0000000e | Int stat: 0x00000000 [  333.014182] mmc2: sdhci: Int enab:  0x03ff100b | Sig enab: 0x03ff100b [  333.020976] mmc2: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000000 [  333.027771] mmc2: sdhci: Caps:      0x322dc8b2 | Caps_1:   0x0000808f [  333.034561] mmc2: sdhci: Cmd:       0x0000183a | Max curr: 0x00000000 [  333.041359] mmc2: sdhci: Resp[0]:   0x00000900 | Resp[1]:  0x00000000 [  333.048157] mmc2: sdhci: Resp[2]:   0x00000000 | Resp[3]:  0x00000000 [  333.054945] mmc2: sdhci: Host ctl2: 0x00000000
[  333.059657] mmc2: sdhci: ADMA Err:  0x00000000 | ADMA Ptr:
0x0000000ffffff218
[  333.067178] mmc2: sdhci_msm: ----------- VENDOR REGISTER DUMP
-----------
[  333.074343] mmc2: sdhci_msm: DLL sts: 0x00000000 | DLL cfg:
0x6000642c | DLL cfg2: 0x0020a000
[  333.083417] mmc2: sdhci_msm: DLL cfg3: 0x00000000 | DLL usr ctl:
0x00000000 | DDR cfg: 0x80040873
[  333.092850] mmc2: sdhci_msm: Vndr func: 0x00008a9c | Vndr func2 :
0xf88218a8 Vndr func3: 0x02626040
[  333.102371] mmc2: sdhci: ============================================

So, set software timeout value more than hardware timeout value.

---

Changes since V1:
    - Moved software data timeout update part to qcom specific file as suggested by Veerabhadrarao Badiganti.
---
 drivers/mmc/host/sdhci-msm.c | 9 +++++++++

 1 file changed, 9 insertions(+)
drivers/mmc/host/sdhci-msm.c +0 -0
index e44b7a6..58e651e 100644

drivers/mmc/host/sdhci-msm.c static void sdhci_msm_cqe_disable(struct mmc_host *mmc, bool recovery) · line 2096

Quoted 8 lines
drivers/mmc/host/sdhci-msm.c +5 -0
@@ -2089,6 +2089,14 @@ static void sdhci_msm_cqe_disable(struct mmc_host *mmc, bool recovery)
      sdhci_cqe_disable(mmc, recovery);
  }
 
+static void sdhci_msm_set_timeout(struct sdhci_host *host, struct mmc_command *cmd)
+{
+
+    __sdhci_set_timeout(host, cmd);
+    if (cmd && (cmd->data) && (host->clock > 400000) && (host->clock <= 50000000))

There are some redundant parenthesis there and cmd is never NULL i.e. could be:

Quoted 5 lines
Quoted 2 lines
Quoted 1 line

    if (cmd->data && host->clock > 400000 && host->clock <= 50000000)

Sure

Hi,

We are passing cmd as NULL in sdhci_cqe_enable( ) for eMMC so, i think we should check cmd.

Very true.