From: Haibo Chen <haibo.chen@nxp.com>
USDHC hardware auto tuning circuit support check 1/4/8 data lines
and cmd line. Out of reset uSDHC, it default select check 4 data
lines and do not check cmd line. This is incorrect if we use 8 data
lines. So need to config the auto tuning mode according to current
bus width.
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
drivers/mmc/host/sdhci-esdhc-imx.c | 33 ++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
@@ -407,6 +413,30 @@ static inline void esdhc_wait_for_card_clock_gate_off(struct sdhci_host *host)dev_warn(mmc_dev(host->mmc),"%s: card clock still not gate off in 100us!.\n",__func__);}+/* Enable the auto tuning circuit to check the CMD line and BUS line */+staticinlinevoidusdhc_auto_tuning_mode_sel(structsdhci_host*host)+{+u32buswidth,auto_tune_buswidth;++buswidth=USDHC_GET_BUSWIDTH(readl(host->ioaddr+SDHCI_HOST_CONTROL));++switch(buswidth){+caseESDHC_CTRL_8BITBUS:+auto_tune_buswidth=ESDHC_VEND_SPEC2_AUTO_TUNE_8BIT_EN;+break;+caseESDHC_CTRL_4BITBUS:+auto_tune_buswidth=ESDHC_VEND_SPEC2_AUTO_TUNE_4BIT_EN;+break;+default:/* 1BITBUS */+auto_tune_buswidth=ESDHC_VEND_SPEC2_AUTO_TUNE_1BIT_EN;+break;+}++esdhc_clrset_le(host,ESDHC_VEND_SPEC2_AUTO_TUNE_MODE_MASK,+auto_tune_buswidth|ESDHC_VEND_SPEC2_AUTO_TUNE_CMD_EN,+ESDHC_VEND_SPEC2);+}+staticu32esdhc_readl_le(structsdhci_host*host,intreg){structsdhci_pltfm_host*pltfm_host=sdhci_priv(host);
From: Haibo Chen <haibo.chen@nxp.com>
Add a new fsl,broken-auto-tuning binding for sdio devices. When sdio
device support sdio interrupt, need to use this property to disable
auto-tuning. Auto-tuning circuit is conflict with sdio interrupt.
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.yaml | 9 +++++++++
1 file changed, 9 insertions(+)
@@ -93,6 +93,15 @@ properties:tuning step can't find the proper delay window within limited tuning retries.default:0+fsl,broken-auto-tuning:+description:|+Recommend for SDIO cards that enables SDIO interrupt for SDR104 and SDR50 mode.+SDIO interrupt uses DAT[1] to signal the card's interrupt. Auto-tuning circuit+will detect this interrupt on DAT[1] when in 4Bit bus mode, and take it just+as normal data, wrongly adjust the delay cell. This property is used to disable+the auto-tuning function.+type:boolean+fsl,strobe-dll-delay-target:$ref:/schemas/types.yaml#/definitions/uint32description:|
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Haibo Chen <haibo.chen@nxp.com>
Add a method to enable/disable auto-tuning function. auto-tuning function
is conflict with sdio interrupt. For sdio device with sdio interrupt,
need to disable auto-tuning function.
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
drivers/mmc/host/sdhci-esdhc-imx.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
@@ -226,6 +226,7 @@ struct esdhc_platform_data {unsignedinttuning_step;/* The delay cell steps in tuning procedure */unsignedinttuning_start_tap;/* The start delay cell point in tuning procedure */unsignedintstrobe_dll_delay_target;/* The delay cell for strobe pad (read clock) */+boolbroken_auto_tuning;/* Disable the auto tuning circuit */};structesdhc_soc_data{
From: Haibo Chen <haibo.chen@nxp.com>
Add the sdio wifi support on imx8mm-evk board.
Disable auto tuning for this sdio wifi since it support sdio
interrupt.
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
arch/arm64/boot/dts/freescale/imx8mm-evk.dts | 20 ++++++++++
arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi | 39 +++++++++++++++++++
2 files changed, 59 insertions(+)
From: Haibo Chen <haibo.chen@nxp.com>
Add sdio wifi support on imx8mn-evk board.
Disable auto tuning for this sdio wifi since it support sdio
interrupt.
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
arch/arm64/boot/dts/freescale/imx8mn-evk.dtsi | 59 +++++++++++++++++++
1 file changed, 59 insertions(+)
From: Rob Herring <robh@kernel.org> Date: 2021-08-18 18:49:04
On Wed, Aug 18, 2021 at 07:16:52PM +0800, haibo.chen@nxp.com wrote:
quoted hunk
From: Haibo Chen <haibo.chen@nxp.com>
Add a new fsl,broken-auto-tuning binding for sdio devices. When sdio
device support sdio interrupt, need to use this property to disable
auto-tuning. Auto-tuning circuit is conflict with sdio interrupt.
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.yaml | 9 +++++++++
1 file changed, 9 insertions(+)
@@ -93,6 +93,15 @@ properties:tuning step can't find the proper delay window within limited tuning retries.default:0+fsl,broken-auto-tuning:+description:|+Recommend for SDIO cards that enables SDIO interrupt for SDR104 and SDR50 mode.+SDIO interrupt uses DAT[1] to signal the card's interrupt. Auto-tuning circuit+will detect this interrupt on DAT[1] when in 4Bit bus mode, and take it just+as normal data, wrongly adjust the delay cell. This property is used to disable+the auto-tuning function.+type:boolean
Seems like something that could be broken on a variety of hosts and
should be common?
If auto tuning is broken, shouldn't that speed be disabled?
Rob
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Lucas Stach <l.stach@pengutronix.de> Date: 2021-08-19 14:11:15
Hi Haibo,
Am Mittwoch, dem 18.08.2021 um 19:16 +0800 schrieb haibo.chen@nxp.com:
From: Haibo Chen <haibo.chen@nxp.com>
Add a new fsl,broken-auto-tuning binding for sdio devices. When sdio
device support sdio interrupt, need to use this property to disable
auto-tuning. Auto-tuning circuit is conflict with sdio interrupt.
Wouldn't it be possible to do this automatically by the driver without
a DT property when a SDIO card is detected?
Regards,
Lucas
@@ -93,6 +93,15 @@ properties:tuning step can't find the proper delay window within limited tuning retries.default:0+fsl,broken-auto-tuning:+description:|+Recommend for SDIO cards that enables SDIO interrupt for SDR104 and SDR50 mode.+SDIO interrupt uses DAT[1] to signal the card's interrupt. Auto-tuning circuit+will detect this interrupt on DAT[1] when in 4Bit bus mode, and take it just+as normal data, wrongly adjust the delay cell. This property is used to disable+the auto-tuning function.+type:boolean+fsl,strobe-dll-delay-target:$ref:/schemas/types.yaml#/definitions/uint32description:|
Add a method to enable/disable auto-tuning function. auto-tuning function
is conflict with sdio interrupt. For sdio device with sdio interrupt,
need to disable auto-tuning function.
I tested this patch on an imx8mm system and it made things completely
unstable. I was never really able to log into the system properly and
just got lots of messages similar to the following:
[ 31.946640] rcu: INFO: rcu_preempt self-detected stall on CPU
[ 31.952422] rcu: 0-....: (2106 ticks this GP)
idle=849/1/0x4000000000000000 softirq=902/904 fqs=743
[ 31.961663] (t=2100 jiffies g=33 q=1158)
[ 31.965682] Task dump for CPU 0:
[ 31.968915] task:kworker/0:1 state:R running task stack:
0 pid: 33 ppid: 2 flags:0x0000000a
[ 31.978859] Workqueue: 0x0 (pm)
While working on this I also came across
https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/uSDHC-auto-tuning-and-possible-SDIO-failures/ta-p/1352855
which seems to address the same issue as your proposed patch.
That article suggests only enabling auto tuning for one data line as a
workaround. I tried this method and so far it seems to have addressed
the -84 errors I was seeing with SDIO communication to a WiFi module.
Some thoughts / questions:
Why does this proposed patch make my system unstable? (I was testing
with a v5.16 mainline based kernel, but I did not see anything in later
versions of sdhci-esdhc-imx that seemed like this should be a problem.)
Why does this patch try to disable auto tune entirely vs just setting it
up for one data bit as suggested in the NXP knowledge base article?
As some other have suggested it seems like it would be nicer if the
workaround could be applied automatically if the device using the SDIO
interface enabled IRQs. Having to include a non standard entry in the DT
for a hardware bug you may not know about or understand seems error
prone. I guess maybe some device could generate an IRQ before they
actually enable IRQs? In that case maybe a DT entry is required, but
maybe the driver could generate a warning if IRQs are enabled without
the DT entry?
Thanks,
Kevin
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
-----Original Message-----
From: Kevin Groeneveld <redacted>
Sent: 2022年12月5日 23:00
To: Bough Chen <haibo.chen@nxp.com>; adrian.hunter@intel.com;
ulf.hansson@linaro.org; shawnguo@kernel.org; robh+dt@kernel.org;
s.hauer@pengutronix.de
Cc: kernel@pengutronix.de; festevam@gmail.com; linux-mmc@vger.kernel.org;
dl-linux-imx [off-list ref]; devicetree@vger.kernel.org;
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 4/6] mmc: host: sdhci-esdhc-imx.c: disable auto-tuning
when necessary
Thank you Haibo for pointing me here from
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.spi
nics.net%2Flists%2Flinux-mmc%2Fmsg73270.html&data=05%7C01%7Chai
bo.chen%40nxp.com%7C2c5b5f4d53d04051475308dad6d16673%7C686ea1d3b
c2b4c6fa92cd99c5c301635%7C0%7C0%7C638058492114803922%7CUnknown
%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwi
LCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=sCV8u6Gv7x%2Bqi6kYSvZ
uZUZeQQ1TaKPwhKpizt49qps%3D&reserved=0.
On 2021-08-18 07:16, haibo.chen@nxp.com wrote:
quoted
Add a method to enable/disable auto-tuning function. auto-tuning
function is conflict with sdio interrupt. For sdio device with sdio
interrupt, need to disable auto-tuning function.
I tested this patch on an imx8mm system and it made things completely
unstable. I was never really able to log into the system properly and just got lots
of messages similar to the following:
[ 31.946640] rcu: INFO: rcu_preempt self-detected stall on CPU
[ 31.952422] rcu: 0-....: (2106 ticks this GP)
idle=849/1/0x4000000000000000 softirq=902/904 fqs=743
[ 31.961663] (t=2100 jiffies g=33 q=1158)
[ 31.965682] Task dump for CPU 0:
[ 31.968915] task:kworker/0:1 state:R running task stack:
0 pid: 33 ppid: 2 flags:0x0000000a
[ 31.978859] Workqueue: 0x0 (pm)
These patch also exist on our local tree, and we do not meet this issue. Can you show me
The detail change you added?
While working on this I also came across
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcommuni
ty.nxp.com%2Ft5%2Fi-MX-Processors-Knowledge-Base%2FuSDHC-auto-tuning-a
nd-possible-SDIO-failures%2Fta-p%2F1352855&data=05%7C01%7Chaibo.c
hen%40nxp.com%7C2c5b5f4d53d04051475308dad6d16673%7C686ea1d3bc2b
4c6fa92cd99c5c301635%7C0%7C0%7C638058492114960153%7CUnknown%7C
TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJX
VCI6Mn0%3D%7C3000%7C%7C%7C&sdata=w3VEjXfQKTIXvIIef1INySnQFU
xW09uafNRdkkv8e7M%3D&reserved=0
which seems to address the same issue as your proposed patch.
That article suggests only enabling auto tuning for one data line as a
workaround. I tried this method and so far it seems to have addressed the -84
errors I was seeing with SDIO communication to a WiFi module.
Some thoughts / questions:
Why does this proposed patch make my system unstable? (I was testing with a
v5.16 mainline based kernel, but I did not see anything in later versions of
sdhci-esdhc-imx that seemed like this should be a problem.)
Why does this patch try to disable auto tune entirely vs just setting it up for one
data bit as suggested in the NXP knowledge base article?
As some other have suggested it seems like it would be nicer if the workaround
could be applied automatically if the device using the SDIO interface enabled
IRQs. Having to include a non standard entry in the DT for a hardware bug you
may not know about or understand seems error prone. I guess maybe some
device could generate an IRQ before they actually enable IRQs? In that case
maybe a DT entry is required, but maybe the driver could generate a warning if
IRQs are enabled without the DT entry?
Yes, your method seems better, I will try to do like that. Thanks
Best Regards
Haibo Chen