mmc: sdhci-of-arasan: Override SDHCI_RETUNING_TIMER_COUNT_MASK on ZynqMP
Subsystems (3)
PATCH 1/1 mmc: sdhci-of-arasan: Override SDHCI_RETUNING_TIMER_COUNT_MASK on ZynqMP
On Xilinx ZynqMP, the reg_capabilities (SDIO) Register
https://www.xilinx.com/htmldocs/registers/ug1087/sdio___reg_capabilities.html#
Absolute Address 0x00FF160040 (SD0)
Reset Value 0x280737EC6481
really reads 0x200737EC6481 . The interesting part is the top 32 bits, which are SDHCI_CAPABILITIES_1 = 0x2007. The missing 0x800 is SDHCI_RETUNING_TIMER_COUNT_MASK=0, which makes the SDHCI core disable retuning timer.
Fix this up here by explicitly setting tuning_count to 8 as it should be, otherwise an eMMC might fail in various thermal conditions
Note that the diff is best shown with -w option, this makes it visible what happened with !sdhci_arasan->has_cqe conditional, which is placed between sdhci_setup_host() and __sdhci_add_host() calls. Since sdhci_add_host() is also a sequence of these two calls and host->tuning_count must be overriden before calling __sdhci_add_host(), call the two calls separately and do all the adjustments between them in either case.
---
Cc: Michal Simek <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Ulf Hansson <[email protected]>
Cc: [email protected]
To: [email protected]
--- drivers/mmc/host/sdhci-of-arasan.c | 57 ++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 19 deletions(-)
drivers/mmc/host/sdhci-of-arasan.c +38 -19
@@ -1521,37 +1521,56 @@ static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan,return 0 ; } -static int sdhci_arasan_add_host (struct sdhci_arasan_data *sdhci_arasan) +static int sdhci_arasan_add_host (struct sdhci_arasan_data *sdhci_arasan, +struct device *dev) {struct sdhci_host *host = sdhci_arasan->host;struct cqhci_host *cq_host;bool dma64;int ret; -if (!sdhci_arasan->has_cqe) -return sdhci_add_host (host); - ret =sdhci_setup_host (host);if (ret)return ret; - cq_host =devm_kzalloc (host->mmc->parent, -sizeof (*cq_host),GFP_KERNEL ); -if (!cq_host) { - ret = -ENOMEM ; - goto cleanup; - } +/* +* On Xilinx ZynqMP, the reg_capabilities (SDIO) Register +* +* https://www.xilinx.com/htmldocs/registers/ug1087/sdio___reg_capabilities.html# +* Absolute Address 0x00FF160040 (SD0) +* Reset Value 0x280737EC6481 +* +* really reads 0x200737EC6481 . The interesting part is the +* top 32 bits, which are SDHCI_CAPABILITIES_1 = 0x2007. The +* missing 0x800 is SDHCI_RETUNING_TIMER_COUNT_MASK=0, which +* makes the SDHCI core disable retuning timer. +* +* Fix this up here by explicitly setting tuning_count to 8 +* as it should be, otherwise an eMMC might fail in various +* thermal conditions. +*/ +if (of_device_is_compatible (dev->of_node,"xlnx,zynqmp-8.9a" )) + host->tuning_count =1 << (8 -1 ); + +if (sdhci_arasan->has_cqe) { + cq_host =devm_kzalloc (host->mmc->parent, +sizeof (*cq_host),GFP_KERNEL ); +if (!cq_host) { + ret = -ENOMEM ; + goto cleanup; + } - cq_host->mmio = host->ioaddr +SDHCI_ARASAN_CQE_BASE_ADDR ; - cq_host->ops = &sdhci_arasan_cqhci_ops; + cq_host->mmio = host->ioaddr +SDHCI_ARASAN_CQE_BASE_ADDR ; + cq_host->ops = &sdhci_arasan_cqhci_ops; - dma64 = host->flags &SDHCI_USE_64_BIT_DMA ; -if (dma64) - cq_host->caps |=CQHCI_TASK_DESC_SZ_128 ; + dma64 = host->flags &SDHCI_USE_64_BIT_DMA ; +if (dma64) + cq_host->caps |=CQHCI_TASK_DESC_SZ_128 ; - ret =cqhci_init (cq_host, host->mmc, dma64); -if (ret) - goto cleanup; + ret =cqhci_init (cq_host, host->mmc, dma64); +if (ret) + goto cleanup; + } ret =__sdhci_add_host (host);if (ret)
@@ -1711,7 +1730,7 @@ static int sdhci_arasan_probe(struct platform_device *pdev) host->mmc->caps2 |=MMC_CAP2_CQE_DCMD ; } - ret =sdhci_arasan_add_host (sdhci_arasan); + ret =sdhci_arasan_add_host (sdhci_arasan, &pdev->dev);if (ret) goto err_add_host;
Signature · 1 line
2.35.1
Adrian Hunter
maintainerQuoted 15 lines · Marek Vasut
On Xilinx ZynqMP, the
reg_capabilities(SDIO) Registerhttps://www.xilinx.com/htmldocs/registers/ug1087/sdio___reg_capabilities.html#
Absolute Address0x00FF160040(SD0)
Reset Value0x280737EC6481really reads
0x200737EC6481. The interesting part is the top 32 bits, which areSDHCI_CAPABILITIES_1=0x2007. The missing0x800is SDHCI_RETUNING_TIMER_COUNT_MASK=0, which makes the SDHCI core disable retuning timer.Fix this up here by explicitly setting
tuning_countto 8 as it should be, otherwise an eMMC might fail in various thermal conditions
Quoted 5 lines
Note that the diff is best shown with -w option, this makes it visible what happened with !sdhci_arasan->has_cqe conditional, which is placed between
sdhci_setup_host()and__sdhci_add_host()calls. Sincesdhci_add_host()is also a sequence of these two calls andhost->tuning_countmust be overriden before calling
overriden -> overridden
Quoted 45 lines
__sdhci_add_host(), call the two calls separately and do all the adjustments between them in either case.Signed-off-by Marek Vasut <[email protected]>---
Cc: Michal Simek <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Ulf Hansson <[email protected]>
Cc: [email protected]
To: [email protected]--- drivers/mmc/host/sdhci-of-arasan.c | 57 ++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 19 deletions(-)drivers/mmc/host/sdhci-of-arasan.c +3
-10@@ -1521,37 +1521,56 @@ static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan,return 0 ; } -static int sdhci_arasan_add_host (struct sdhci_arasan_data *sdhci_arasan) +static int sdhci_arasan_add_host (struct sdhci_arasan_data *sdhci_arasan, +struct device *dev) {struct sdhci_host *host = sdhci_arasan->host;struct cqhci_host *cq_host;bool dma64;int ret; -if (!sdhci_arasan->has_cqe) -return sdhci_add_host (host); - ret =sdhci_setup_host (host);if (ret)return ret; - cq_host =devm_kzalloc (host->mmc->parent, -sizeof (*cq_host),GFP_KERNEL ); -if (!cq_host) { - ret = -ENOMEM ; - goto cleanup; - } +/*
drivers/mmc/host/sdhci-of-arasan.c static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan, · line 1546
Quoted 10 lines
drivers/mmc/host/sdhci-of-arasan.c +10
-0+* On Xilinx ZynqMP, the reg_capabilities (SDIO) Register +* +* https://www.xilinx.com/htmldocs/registers/ug1087/sdio___reg_capabilities.html# +* Absolute Address 0x00FF160040 (SD0) +* Reset Value 0x280737EC6481 +* +* really reads 0x200737EC6481 . The interesting part is the +* top 32 bits, which are SDHCI_CAPABILITIES_1 = 0x2007. The +* missing 0x800 is SDHCI_RETUNING_TIMER_COUNT_MASK=0, which +* makes the SDHCI core disable retuning timer.
Are you aware that caps can be changed in DT via "sdhci-caps" and "sdhci-caps-mask" ?
Quoted 47 lines
drivers/mmc/host/sdhci-of-arasan.c +25
-9+* +* Fix this up here by explicitly setting tuning_count to 8 +* as it should be, otherwise an eMMC might fail in various +* thermal conditions. +*/ +if (of_device_is_compatible (dev->of_node,"xlnx,zynqmp-8.9a" )) + host->tuning_count =1 << (8 -1 ); + +if (sdhci_arasan->has_cqe) { + cq_host =devm_kzalloc (host->mmc->parent, +sizeof (*cq_host),GFP_KERNEL ); +if (!cq_host) { + ret = -ENOMEM ; + goto cleanup; + } - cq_host->mmio = host->ioaddr +SDHCI_ARASAN_CQE_BASE_ADDR ; - cq_host->ops = &sdhci_arasan_cqhci_ops; + cq_host->mmio = host->ioaddr +SDHCI_ARASAN_CQE_BASE_ADDR ; + cq_host->ops = &sdhci_arasan_cqhci_ops; - dma64 = host->flags &SDHCI_USE_64_BIT_DMA ; -if (dma64) - cq_host->caps |=CQHCI_TASK_DESC_SZ_128 ; + dma64 = host->flags &SDHCI_USE_64_BIT_DMA ; +if (dma64) + cq_host->caps |=CQHCI_TASK_DESC_SZ_128 ; - ret =cqhci_init (cq_host, host->mmc, dma64); -if (ret) - goto cleanup; + ret =cqhci_init (cq_host, host->mmc, dma64); +if (ret) + goto cleanup; + } ret =__sdhci_add_host (host);if (ret)@@ -1711,7 +1730,7 @@ static int sdhci_arasan_probe(struct platform_device *pdev) host->mmc->caps2 |=MMC_CAP2_CQE_DCMD ; } - ret =sdhci_arasan_add_host (sdhci_arasan); + ret =sdhci_arasan_add_host (sdhci_arasan, &pdev->dev);if (ret) goto err_add_host;
Quoted 16 lines · Adrian Hunter
Quoted 15 lines · Marek Vasut
On Xilinx ZynqMP, the
reg_capabilities(SDIO) Registerhttps://www.xilinx.com/htmldocs/registers/ug1087/sdio___reg_capabilities.html#
Absolute Address0x00FF160040(SD0)
Reset Value0x280737EC6481really reads
0x200737EC6481. The interesting part is the top 32 bits, which areSDHCI_CAPABILITIES_1=0x2007. The missing0x800is SDHCI_RETUNING_TIMER_COUNT_MASK=0, which makes the SDHCI core disable retuning timer.Fix this up here by explicitly setting
tuning_countto 8 as it should be, otherwise an eMMC might fail in various thermal conditions
Quoted 7 lines
Quoted 5 lines
Note that the diff is best shown with -w option, this makes it visible what happened with !sdhci_arasan->has_cqe conditional, which is placed between
sdhci_setup_host()and__sdhci_add_host()calls. Sincesdhci_add_host()is also a sequence of these two calls andhost->tuning_countmust be overriden before callingoverriden -> overridden
Fixed
Quoted 50 lines
Quoted 50 lines
__sdhci_add_host(), call the two calls separately and do all the adjustments between them in either case.Signed-off-by Marek Vasut <[email protected]>---
Cc: Michal Simek <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Ulf Hansson <[email protected]>
Cc: [email protected]
To: [email protected]--- drivers/mmc/host/sdhci-of-arasan.c | 57 ++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 19 deletions(-)drivers/mmc/host/sdhci-of-arasan.c +8
-10@@ -1521,37 +1521,56 @@ static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan,return 0 ; } -static int sdhci_arasan_add_host (struct sdhci_arasan_data *sdhci_arasan) +static int sdhci_arasan_add_host (struct sdhci_arasan_data *sdhci_arasan, +struct device *dev) {struct sdhci_host *host = sdhci_arasan->host;struct cqhci_host *cq_host;bool dma64;int ret; -if (!sdhci_arasan->has_cqe) -return sdhci_add_host (host); - ret =sdhci_setup_host (host);if (ret)return ret; - cq_host =devm_kzalloc (host->mmc->parent, -sizeof (*cq_host),GFP_KERNEL ); -if (!cq_host) { - ret = -ENOMEM ; - goto cleanup; - } +/* +* On Xilinx ZynqMP, the reg_capabilities (SDIO) Register +* +* https://www.xilinx.com/htmldocs/registers/ug1087/sdio___reg_capabilities.html# +* Absolute Address 0x00FF160040 (SD0) +* Reset Value 0x280737EC6481
Quoted 8 lines
drivers/mmc/host/sdhci-of-arasan.c static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan, · line 1546
Quoted 5 lines
drivers/mmc/host/sdhci-of-arasan.c +5
-0+* +* really reads 0x200737EC6481 . The interesting part is the +* top 32 bits, which are SDHCI_CAPABILITIES_1 = 0x2007. The +* missing 0x800 is SDHCI_RETUNING_TIMER_COUNT_MASK=0, which +* makes the SDHCI core disable retuning timer. Are you aware that caps can be changed in DT via "sdhci-caps" and "sdhci-caps-mask" ?
No, I wasn't aware of those.
Is that the preferred approach to this fix, over handling it in the driver ?
I think the driver-side fix would be preferable, because it also fixes systems which use legacy DTs without the sdhci-caps properties, which would be all ZynqMP systems thus far.
(and I would also still prefer to get feedback from Xilinx on why does the value specified in UG1087 not match what is read out of the hardware)
[...]
Hi Marek,
Quoted 110 lines
-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Wednesday, October 26, 2022 2:50 PM
To: Adrian Hunter <[email protected]>; [email protected]
Cc: Michal Simek <[email protected]>; Ulf Hansson <[email protected]>; [email protected]
Subject: Re: [PATCH] mmc: sdhci-of-arasan: OverrideSDHCI_RETUNING_TIMER_COUNT_MASKon ZynqMPCAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email.
Quoted 11 lines · Adrian Hunter
Quoted 10 lines · Marek Vasut
On Xilinx ZynqMP, the
reg_capabilities(SDIO) Registerhttps://www.xilinx.com/htmldocs/registers/ug1087/sdio___reg_capabilit
ies.html#
Absolute Address0x00FF160040(SD0)
Reset Value0x280737EC6481really reads
0x200737EC6481. The interesting part is the top 32 bits, which areSDHCI_CAPABILITIES_1=0x2007. The missing0x800is SDHCI_RETUNING_TIMER_COUNT_MASK=0, which makes the SDHCI coredisable
Quoted 5 lines
Quoted 5 lines
retuning timer.
Fix this up here by explicitly setting
tuning_countto 8 as it should be, otherwise an eMMC might fail in various thermal conditionsQuoted 7 lines
Quoted 5 lines
Note that the diff is best shown with -w option, this makes it visible what happened with !sdhci_arasan->has_cqe conditional, which is placed between
sdhci_setup_host()and__sdhci_add_host()calls. Sincesdhci_add_host()is also a sequence of these two calls andhost->tuning_countmust be overriden before callingoverriden -> overridden
Fixed
Quoted 12 lines
Quoted 4 lines
__sdhci_add_host(), call the two calls separately and do all the adjustments between them in either case.Signed-off-by Marek Vasut <[email protected]>Quoted 8 lines
---
Cc: Michal Simek <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Ulf Hansson <[email protected]>
Cc: [email protected]
To: [email protected]--- drivers/mmc/host/sdhci-of-arasan.c | 57 ++++++++++++++++++++----------
Quoted 8 lines
drivers/mmc/host/sdhci-of-arasan.c static int sdhci_arasan_register_sdclk(struct
Quoted 8 lines
1 file changed, 38 insertions(+), 19 deletions(-)drivers/mmc/host/sdhci-of-arasan.c +0
-0@@ -1521,37 +1521,56 @@ static int sdhci_arasan_register_sdclk(struct
sdhci_arasan_data*sdhci_arasan,Quoted 6 lines
drivers/mmc/host/sdhci-of-arasan.c static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan,
Quoted 6 lines
drivers/mmc/host/sdhci-of-arasan.c +1
-1return 0 ; } -static int sdhci_arasan_add_host (struct sdhci_arasan_data *sdhci_arasan) +static int sdhci_arasan_add_host(struct sdhci_arasan_data
*sdhci_arasan,Quoted 14 lines
Quoted 14 lines
drivers/mmc/host/sdhci-of-arasan.c +1
-3+ struct device *dev) {struct sdhci_host *host = sdhci_arasan->host;struct cqhci_host *cq_host;bool dma64;int ret; -if (!sdhci_arasan->has_cqe) -return sdhci_add_host (host); - ret =sdhci_setup_host (host);if (ret)return ret;Quoted 10 lines
drivers/mmc/host/sdhci-of-arasan.c static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan, · line 1542
Quoted 10 lines
drivers/mmc/host/sdhci-of-arasan.c +4
-6- cq_host =devm_kzalloc (host->mmc->parent, -sizeof (*cq_host),GFP_KERNEL ); -if (!cq_host) { - ret = -ENOMEM ; - goto cleanup; - } +/* +* On Xilinx ZynqMP, the reg_capabilities (SDIO) Register +* +* https://www.xilinx.com/htmldocs/registers/ug1087/sdio___reg_capabilities.
html#Quoted 10 lines
drivers/mmc/host/sdhci-of-arasan.c static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan, · line 1546
Quoted 7 lines
drivers/mmc/host/sdhci-of-arasan.c +7
-0+* Absolute Address 0x00FF160040 (SD0) +* Reset Value 0x280737EC6481 +* +* really reads 0x200737EC6481 . The interesting part is the +* top 32 bits, which are SDHCI_CAPABILITIES_1 = 0x2007. The +* missing 0x800 is SDHCI_RETUNING_TIMER_COUNT_MASK=0, which +* makes the SDHCI core disable retuning timer. Are you aware that caps can be changed in DT via "sdhci-caps" and "sdhci-caps-mask" ?
No, I wasn't aware of those.
Quoted 8 lines
Is that the preferred approach to this fix, over handling it in the driver ?
I think the driver-side fix would be preferable, because it also fixes systems which use legacy DTs without the sdhci-caps properties, which would be all ZynqMP systems thus far.
(and I would also still prefer to get feedback from Xilinx on why does the value specified in UG1087 not match what is read out of the hardware)
Reset value of the retuning timer count is set to 0x0 via ZynqMP FSBL, we have an ERRATA for the same.
https://support.xilinx.com/s/article/68550?language=en_US
Xilinx recommendation is to program the appropriate value in the retuning timer count field based on the specific requirements via DT property.
Regards
Sai Krishna
Quoted 1 line · Sai Krishna
Hi Marek,
Hi,
Quoted 98 lines
Quoted 98 lines
Quoted 8 lines
Quoted 8 lines
https://www.xilinx.com/htmldocs/registers/ug1087/sdio___reg_capabilit
ies.html#
Absolute Address0x00FF160040(SD0)
Reset Value0x280737EC6481really reads
0x200737EC6481. The interesting part is the top 32 bits, which areSDHCI_CAPABILITIES_1=0x2007. The missing0x800is SDHCI_RETUNING_TIMER_COUNT_MASK=0, which makes the SDHCI coredisable
Quoted 5 lines
Quoted 5 lines
retuning timer.
Fix this up here by explicitly setting
tuning_countto 8 as it should be, otherwise an eMMC might fail in various thermal conditionsQuoted 7 lines
Quoted 5 lines
Note that the diff is best shown with -w option, this makes it visible what happened with !sdhci_arasan->has_cqe conditional, which is placed between
sdhci_setup_host()and__sdhci_add_host()calls. Sincesdhci_add_host()is also a sequence of these two calls andhost->tuning_countmust be overriden before callingoverriden -> overridden
Fixed
Quoted 12 lines
Quoted 4 lines
__sdhci_add_host(), call the two calls separately and do all the adjustments between them in either case.Signed-off-by Marek Vasut <[email protected]>Quoted 8 lines
---
Cc: Michal Simek <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Ulf Hansson <[email protected]>
Cc: [email protected]
To: [email protected]--- drivers/mmc/host/sdhci-of-arasan.c | 57 ++++++++++++++++++++----------
Quoted 8 lines
drivers/mmc/host/sdhci-of-arasan.c static int sdhci_arasan_register_sdclk(struct
Quoted 8 lines
1 file changed, 38 insertions(+), 19 deletions(-)drivers/mmc/host/sdhci-of-arasan.c +0
-0@@ -1521,37 +1521,56 @@ static int sdhci_arasan_register_sdclk(struct
sdhci_arasan_data*sdhci_arasan,Quoted 6 lines
drivers/mmc/host/sdhci-of-arasan.c static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan,
Quoted 6 lines
drivers/mmc/host/sdhci-of-arasan.c +1
-1return 0 ; } -static int sdhci_arasan_add_host (struct sdhci_arasan_data *sdhci_arasan) +static int sdhci_arasan_add_host(struct sdhci_arasan_data
*sdhci_arasan,Quoted 14 lines
Quoted 14 lines
drivers/mmc/host/sdhci-of-arasan.c +1
-3+ struct device *dev) {struct sdhci_host *host = sdhci_arasan->host;struct cqhci_host *cq_host;bool dma64;int ret; -if (!sdhci_arasan->has_cqe) -return sdhci_add_host (host); - ret =sdhci_setup_host (host);if (ret)return ret;Quoted 10 lines
drivers/mmc/host/sdhci-of-arasan.c static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan, · line 1542
Quoted 10 lines
drivers/mmc/host/sdhci-of-arasan.c +4
-6- cq_host =devm_kzalloc (host->mmc->parent, -sizeof (*cq_host),GFP_KERNEL ); -if (!cq_host) { - ret = -ENOMEM ; - goto cleanup; - } +/* +* On Xilinx ZynqMP, the reg_capabilities (SDIO) Register +* +* https://www.xilinx.com/htmldocs/registers/ug1087/sdio___reg_capabilities.
html#Quoted 10 lines
drivers/mmc/host/sdhci-of-arasan.c static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan, · line 1546
Quoted 7 lines
drivers/mmc/host/sdhci-of-arasan.c +7
-0+* Absolute Address 0x00FF160040 (SD0) +* Reset Value 0x280737EC6481 +* +* really reads 0x200737EC6481 . The interesting part is the +* top 32 bits, which are SDHCI_CAPABILITIES_1 = 0x2007. The +* missing 0x800 is SDHCI_RETUNING_TIMER_COUNT_MASK=0, which +* makes the SDHCI core disable retuning timer. Are you aware that caps can be changed in DT via "sdhci-caps" and "sdhci-caps-mask" ?
No, I wasn't aware of those.
Is that the preferred approach to this fix, over handling it in the driver ?
I think the driver-side fix would be preferable, because it also fixes systems which use legacy DTs without the sdhci-caps properties, which would be all ZynqMP systems thus far.
Quoted 8 lines
Quoted 2 lines
(and I would also still prefer to get feedback from Xilinx on why does the value specified in UG1087 not match what is read out of the hardware)
Reset value of the retuning timer count is set to
0x0via ZynqMP FSBL, we have an ERRATA for the same.
https://support.xilinx.com/s/article/68550?language=en_USXilinx recommendation is to program the appropriate value in the retuning timer count field based on the specific requirements via DT property.
Why is the retuning timer disabled for HS200 mode ?
Hi Marek,
Quoted 129 lines
-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Wednesday, December 21, 2022 3:10 PM
To: Potthuri, Sai Krishna <[email protected]>; Adrian Hunter <[email protected]>; [email protected]
Cc: Michal Simek <[email protected]>; Ulf Hansson <[email protected]>; [email protected]
Subject: Re: [PATCH] mmc: sdhci-of-arasan: OverrideSDHCI_RETUNING_TIMER_COUNT_MASKon ZynqMPQuoted 1 line · Sai Krishna
Hi Marek,
Hi,
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
https://www.xilinx.com/htmldocs/registers/ug1087/sdio___reg_capabil
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
it
ies.html#
Absolute Address0x00FF160040(SD0)
Reset Value0x280737EC6481really reads
0x200737EC6481. The interesting part is the top 32 bits, which areSDHCI_CAPABILITIES_1=0x2007. The missing0x800is SDHCI_RETUNING_TIMER_COUNT_MASK=0, which makes the SDHCIcore
Quoted 10 lines
Quoted 10 lines
disable
Quoted 9 lines
Quoted 9 lines
retuning timer.
Fix this up here by explicitly setting
tuning_countto 8 as it should be, otherwise an eMMC might fail in various thermal conditionsNote that the diff is best shown with -w option, this makes it visible what happened with !sdhci_arasan->has_cqe conditional, which is placed between
sdhci_setup_host()and__sdhci_add_host()calls.
Quoted 52 lines
Quoted 52 lines
Quoted 4 lines
Quoted 2 lines
Since
sdhci_add_host()is also a sequence of these two calls andhost->tuning_countmust be overriden before callingoverriden -> overridden
Fixed
Quoted 13 lines
Quoted 10 lines
__sdhci_add_host(), call the two calls separately and do all the adjustments between them in either case.Signed-off-by Marek Vasut <[email protected]>---
Cc: Michal Simek <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Ulf Hansson <[email protected]>
Cc: [email protected]
To: [email protected]Quoted 3 lines
--- drivers/mmc/host/sdhci-of-arasan.c | 57++++++++++++++++++++---------
-
Quoted 9 lines
Quoted 9 lines
1 file changed, 38 insertions(+), 19 deletions(-)drivers/mmc/host/sdhci-of-arasan.c +0
-0@@ -1521,37 +1521,56 @@ static intsdhci_arasan_register_sdclk(struct
sdhci_arasan_data*sdhci_arasan,Quoted 6 lines
Quoted 6 lines
return 0;}
-static int
sdhci_arasan_add_host(struct sdhci_arasan_data *sdhci_arasan)
+static int sdhci_arasan_add_host(structsdhci_arasan_data
*sdhci_arasan,Quoted 14 lines
Quoted 14 lines
drivers/mmc/host/sdhci-of-arasan.c +1
-3+ struct device *dev) {struct sdhci_host *host = sdhci_arasan->host;struct cqhci_host *cq_host;bool dma64;int ret; -if (!sdhci_arasan->has_cqe) -return sdhci_add_host (host); - ret =sdhci_setup_host (host);if (ret)return ret;Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
drivers/mmc/host/sdhci-of-arasan.c static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan, · line 1542
Quoted 10 lines
drivers/mmc/host/sdhci-of-arasan.c +4
-6- cq_host =devm_kzalloc (host->mmc->parent, -sizeof (*cq_host),GFP_KERNEL ); -if (!cq_host) { - ret = -ENOMEM ; - goto cleanup; - } +/* +* On Xilinx ZynqMP, the reg_capabilities (SDIO) Register +* +* https://www.xilinx.com/htmldocs/registers/ug1087/sdio___reg_capabilities.
Quoted 7 lines
Quoted 7 lines
html#
Quoted 6 lines
Quoted 6 lines
drivers/mmc/host/sdhci-of-arasan.c +6
-0+* Absolute Address 0x00FF160040 (SD0) +* Reset Value 0x280737EC6481 +* +* really reads 0x200737EC6481 . The interesting part is the +* top 32 bits, which are SDHCI_CAPABILITIES_1 = 0x2007. The +* missing 0x800 is SDHCI_RETUNING_TIMER_COUNT_MASK=0, which
Quoted 20 lines
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
+ * makes the SDHCI core disable retuning timer.
Are you aware that caps can be changed in DT via "sdhci-caps" and "sdhci-caps-mask" ?
No, I wasn't aware of those.
Is that the preferred approach to this fix, over handling it in the driver ?
Quoted 7 lines
I think the driver-side fix would be preferable, because it also fixes systems which use legacy DTs without the sdhci-caps properties, which would be all ZynqMP systems thus far.
(and I would also still prefer to get feedback from Xilinx on why does the value specified in UG1087 not match what is read out of the hardware)
Reset value of the retuning timer count is set to
0x0via ZynqMP FSBL, we have an ERRATA for the same.
https://support.xilinx.com/s/article/68550?language=en_US
Quoted 5 lines
Quoted 2 lines
Xilinx recommendation is to program the appropriate value in the retuning timer count field based on the specific requirements via DT
property.
Why is the retuning timer disabled for HS200 mode ?
Based on discussions with the Xilinx IP design team, they told retuning is not required as Xilinx uses DLL for higher frequency modes.
So, we disabled retuning by default even in Xilinx next generation platforms like Versal.
Even in our internal PVT testing also, without retuning we didn't see any issues.
Did you face any real issue without this re-tuning? If yes, could you please provide some details about the test case.
Regards
Sai Krishna
Quoted 131 lines · Sai Krishna
Hi Marek,
Quoted 129 lines
-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Wednesday, December 21, 2022 3:10 PM
To: Potthuri, Sai Krishna <[email protected]>; Adrian Hunter <[email protected]>; [email protected]
Cc: Michal Simek <[email protected]>; Ulf Hansson <[email protected]>; [email protected]
Subject: Re: [PATCH] mmc: sdhci-of-arasan: OverrideSDHCI_RETUNING_TIMER_COUNT_MASKon ZynqMPQuoted 1 line · Sai Krishna
Hi Marek,
Hi,
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
https://www.xilinx.com/htmldocs/registers/ug1087/sdio___reg_capabil
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
it
ies.html#
Absolute Address0x00FF160040(SD0)
Reset Value0x280737EC6481really reads
0x200737EC6481. The interesting part is the top 32 bits, which areSDHCI_CAPABILITIES_1=0x2007. The missing0x800is SDHCI_RETUNING_TIMER_COUNT_MASK=0, which makes the SDHCIcore
Quoted 10 lines
Quoted 10 lines
disable
Quoted 9 lines
Quoted 9 lines
retuning timer.
Fix this up here by explicitly setting
tuning_countto 8 as it should be, otherwise an eMMC might fail in various thermal conditionsNote that the diff is best shown with -w option, this makes it visible what happened with !sdhci_arasan->has_cqe conditional, which is placed between
sdhci_setup_host()and__sdhci_add_host()calls.
Quoted 52 lines
Quoted 52 lines
Quoted 4 lines
Quoted 2 lines
Since
sdhci_add_host()is also a sequence of these two calls andhost->tuning_countmust be overriden before callingoverriden -> overridden
Fixed
Quoted 13 lines
Quoted 10 lines
__sdhci_add_host(), call the two calls separately and do all the adjustments between them in either case.Signed-off-by Marek Vasut <[email protected]>---
Cc: Michal Simek <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Ulf Hansson <[email protected]>
Cc: [email protected]
To: [email protected]Quoted 3 lines
--- drivers/mmc/host/sdhci-of-arasan.c | 57++++++++++++++++++++---------
-
Quoted 9 lines
Quoted 9 lines
1 file changed, 38 insertions(+), 19 deletions(-)drivers/mmc/host/sdhci-of-arasan.c +0
-0@@ -1521,37 +1521,56 @@ static intsdhci_arasan_register_sdclk(struct
sdhci_arasan_data*sdhci_arasan,Quoted 6 lines
Quoted 6 lines
return 0; }-static int
sdhci_arasan_add_host(struct sdhci_arasan_data *sdhci_arasan)
+static int sdhci_arasan_add_host(structsdhci_arasan_data
*sdhci_arasan,Quoted 14 lines
Quoted 14 lines
drivers/mmc/host/sdhci-of-arasan.c +1
-3+ struct device *dev) {struct sdhci_host *host = sdhci_arasan->host;struct cqhci_host *cq_host;bool dma64;int ret; -if (!sdhci_arasan->has_cqe) -return sdhci_add_host (host); - ret =sdhci_setup_host (host);if (ret)return ret;Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
drivers/mmc/host/sdhci-of-arasan.c static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan, · line 1542
Quoted 10 lines
drivers/mmc/host/sdhci-of-arasan.c +4
-6- cq_host =devm_kzalloc (host->mmc->parent, -sizeof (*cq_host),GFP_KERNEL ); -if (!cq_host) { - ret = -ENOMEM ; - goto cleanup; - } +/* +* On Xilinx ZynqMP, the reg_capabilities (SDIO) Register +* +* https://www.xilinx.com/htmldocs/registers/ug1087/sdio___reg_capabilities.
Quoted 7 lines
Quoted 7 lines
html#
Quoted 6 lines
Quoted 6 lines
drivers/mmc/host/sdhci-of-arasan.c +6
-0+* Absolute Address 0x00FF160040 (SD0) +* Reset Value 0x280737EC6481 +* +* really reads 0x200737EC6481 . The interesting part is the +* top 32 bits, which are SDHCI_CAPABILITIES_1 = 0x2007. The +* missing 0x800 is SDHCI_RETUNING_TIMER_COUNT_MASK=0, which
Quoted 20 lines
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
+ * makes the SDHCI core disable retuning timer.
Are you aware that caps can be changed in DT via "sdhci-caps" and "sdhci-caps-mask" ?
No, I wasn't aware of those.
Is that the preferred approach to this fix, over handling it in the driver ?
Quoted 7 lines
I think the driver-side fix would be preferable, because it also fixes systems which use legacy DTs without the sdhci-caps properties, which would be all ZynqMP systems thus far.
(and I would also still prefer to get feedback from Xilinx on why does the value specified in UG1087 not match what is read out of the hardware)
Reset value of the retuning timer count is set to
0x0via ZynqMP FSBL, we have an ERRATA for the same.
https://support.xilinx.com/s/article/68550?language=en_US
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Xilinx recommendation is to program the appropriate value in the retuning timer count field based on the specific requirements via DT
property.
Why is the retuning timer disabled for HS200 mode ?
Based on discussions with the Xilinx IP design team, they told retuning is not required as Xilinx uses DLL for higher frequency modes.
Does this require the eMMC "DS" line ?
Quoted 6 lines
So, we disabled retuning by default even in Xilinx next generation platforms like Versal.
Even in our internal PVT testing also, without retuning we didn't see any issues.Did you face any real issue without this re-tuning? If yes, could you please provide some details about the test case.
Yes, on devices with wider temperature range, the eMMC might suffer read failures over time.
Hi Marek,
Quoted 153 lines
-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Wednesday, January 4, 2023 2:17 AM
To: Potthuri, Sai Krishna <[email protected]>; Adrian Hunter <[email protected]>; [email protected]
Cc: Michal Simek <[email protected]>; Ulf Hansson <[email protected]>; [email protected]; Goud, Srinivas <[email protected]>
Subject: Re: [PATCH] mmc: sdhci-of-arasan: OverrideSDHCI_RETUNING_TIMER_COUNT_MASKon ZynqMPCAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email.
Quoted 27 lines · Sai Krishna
Hi Marek,
Quoted 25 lines
-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Wednesday, December 21, 2022 3:10 PM
To: Potthuri, Sai Krishna <[email protected]>; Adrian Hunter <[email protected]>; [email protected]
Cc: Michal Simek <[email protected]>; Ulf Hansson <[email protected]>; [email protected]
Subject: Re: [PATCH] mmc: sdhci-of-arasan: OverrideSDHCI_RETUNING_TIMER_COUNT_MASKon ZynqMPQuoted 1 line · Sai Krishna
Hi Marek,
Hi,
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
https://www.xilinx.com/htmldocs/registers/ug1087/sdio___reg_capabil
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
it
ies.html#
Absolute Address0x00FF160040(SD0)
Reset Value0x280737EC6481really reads
0x200737EC6481. The interesting part is the top 32 bits, which areSDHCI_CAPABILITIES_1=0x2007. The missing0x800is SDHCI_RETUNING_TIMER_COUNT_MASK=0, which makes theSDHCI
Quoted 64 lines
Quoted 64 lines
core
Quoted 10 lines
Quoted 10 lines
disable
Quoted 9 lines
Quoted 9 lines
retuning timer.
Fix this up here by explicitly setting
tuning_countto 8 as it should be, otherwise an eMMC might fail in various thermal conditionsNote that the diff is best shown with -w option, this makes it visible what happened with !sdhci_arasan->has_cqe conditional, which is placed between
sdhci_setup_host()and__sdhci_add_host()calls.
Quoted 52 lines
Quoted 52 lines
Quoted 4 lines
Quoted 2 lines
Since
sdhci_add_host()is also a sequence of these two calls andhost->tuning_countmust be overriden before callingoverriden -> overridden
Fixed
Quoted 13 lines
Quoted 10 lines
__sdhci_add_host(), call the two calls separately and do all the adjustments between them in either case.Signed-off-by Marek Vasut <[email protected]>---
Cc: Michal Simek <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Ulf Hansson <[email protected]>
Cc: [email protected]
To: [email protected]Quoted 3 lines
--- drivers/mmc/host/sdhci-of-arasan.c | 57++++++++++++++++++++---------
-
Quoted 9 lines
Quoted 9 lines
1 file changed, 38 insertions(+), 19 deletions(-)drivers/mmc/host/sdhci-of-arasan.c +0
-0@@ -1521,37 +1521,56 @@ static intsdhci_arasan_register_sdclk(struct
sdhci_arasan_data*sdhci_arasan,Quoted 6 lines
Quoted 6 lines
return 0; }-static int
sdhci_arasan_add_host(struct sdhci_arasan_data *sdhci_arasan)
+static int sdhci_arasan_add_host(structsdhci_arasan_data
*sdhci_arasan,Quoted 14 lines
Quoted 14 lines
drivers/mmc/host/sdhci-of-arasan.c +1
-3+ struct device *dev) {struct sdhci_host *host = sdhci_arasan->host;struct cqhci_host *cq_host;bool dma64;int ret; -if (!sdhci_arasan->has_cqe) -return sdhci_add_host (host); - ret =sdhci_setup_host (host);if (ret)return ret;Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
drivers/mmc/host/sdhci-of-arasan.c
Quoted 10 lines
drivers/mmc/host/sdhci-of-arasan.c +4
-6- cq_host =devm_kzalloc (host->mmc->parent, -sizeof (*cq_host),GFP_KERNEL ); -if (!cq_host) { - ret = -ENOMEM ; - goto cleanup; - } +/* +* On Xilinx ZynqMP, the reg_capabilities (SDIO) Register +* +* https://www.xilinx.com/htmldocs/registers/ug1087/sdio___reg_capabilities.
Quoted 31 lines
Quoted 31 lines
Quoted 7 lines
Quoted 7 lines
html#
Quoted 6 lines
Quoted 6 lines
drivers/mmc/host/sdhci-of-arasan.c +6
-0+* Absolute Address 0x00FF160040 (SD0) +* Reset Value 0x280737EC6481 +* +* really reads 0x200737EC6481 . The interesting part is the +* top 32 bits, which are SDHCI_CAPABILITIES_1 = 0x2007. The +* missing 0x800 is SDHCI_RETUNING_TIMER_COUNT_MASK=0, which
Quoted 23 lines
Quoted 9 lines
Quoted 4 lines
Quoted 1 line
+ * makes the SDHCI core disable retuning timer.
Are you aware that caps can be changed in DT via "sdhci-caps" and "sdhci-caps-mask" ?
No, I wasn't aware of those.
Is that the preferred approach to this fix, over handling it in the driver ?
Quoted 8 lines
I think the driver-side fix would be preferable, because it also fixes systems which use legacy DTs without the sdhci-caps properties, which would be all ZynqMP systems thus far.
(and I would also still prefer to get feedback from Xilinx on why does the value specified in UG1087 not match what is read out of the
hardware)Reset value of the retuning timer count is set to
0x0via ZynqMP FSBL, we have an ERRATA for the same.
https://support.xilinx.com/s/article/68550?language=en_USXilinx recommendation is to program the appropriate value in the retuning timer count field based on the specific requirements via DT
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
property.
Why is the retuning timer disabled for HS200 mode ?
Based on discussions with the Xilinx IP design team, they told retuning is not required as Xilinx uses DLL for higher frequency modes.
Does this require the eMMC "DS" line ?
No.
Quoted 11 lines
Quoted 4 lines
So, we disabled retuning by default even in Xilinx next generation platforms like Versal.
Even in our internal PVT testing also, without retuning we didn't see anyissues.
Quoted 3 lines
Did you face any real issue without this re-tuning? If yes, could you please provide some details about the test case.
Yes, on devices with wider temperature range, the eMMC might suffer read failures over time.
During Xilinx internal PVT testing we didn't see any issues without doing the retuning. If you can see the issue at a particular temperature, please let us know.
In case if there is any issue, we can make use of the DT property as mentioned.
Regards
Sai Krishna
Adrian Hunter
maintainerQuoted 83 lines · Marek Vasut
Quoted 16 lines · Adrian Hunter
Quoted 15 lines · Marek Vasut
On Xilinx ZynqMP, the
reg_capabilities(SDIO) Registerhttps://www.xilinx.com/htmldocs/registers/ug1087/sdio___reg_capabilities.html#
Absolute Address0x00FF160040(SD0)
Reset Value0x280737EC6481really reads
0x200737EC6481. The interesting part is the top 32 bits, which areSDHCI_CAPABILITIES_1=0x2007. The missing0x800is SDHCI_RETUNING_TIMER_COUNT_MASK=0, which makes the SDHCI core disable retuning timer.Fix this up here by explicitly setting
tuning_countto 8 as it should be, otherwise an eMMC might fail in various thermal conditionsQuoted 7 lines
Quoted 5 lines
Note that the diff is best shown with -w option, this makes it visible what happened with !sdhci_arasan->has_cqe conditional, which is placed between
sdhci_setup_host()and__sdhci_add_host()calls. Sincesdhci_add_host()is also a sequence of these two calls andhost->tuning_countmust be overriden before callingoverriden -> overridden
Fixed
Quoted 47 lines
Quoted 47 lines
__sdhci_add_host(), call the two calls separately and do all the adjustments between them in either case.Signed-off-by Marek Vasut <[email protected]>---
Cc: Michal Simek <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Ulf Hansson <[email protected]>
Cc: [email protected]
To: [email protected]
---
drivers/mmc/host/sdhci-of-arasan.c| 57 ++++++++++++++++++++----------1 file changed, 38 insertions(+), 19 deletions(-)drivers/mmc/host/sdhci-of-arasan.c +8
-7@@ -1521,37 +1521,56 @@ static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan, return 0; } -static int sdhci_arasan_add_host(struct sdhci_arasan_data *sdhci_arasan) +static int sdhci_arasan_add_host(struct sdhci_arasan_data *sdhci_arasan, + struct device *dev) { struct sdhci_host *host = sdhci_arasan->host; struct cqhci_host *cq_host; bool dma64; int ret; - if (!sdhci_arasan->has_cqe) - return sdhci_add_host(host); - ret = sdhci_setup_host(host); if (ret) return ret; - cq_host = devm_kzalloc(host->mmc->parent, - sizeof(*cq_host), GFP_KERNEL); - if (!cq_host) { - ret = -ENOMEM; - goto cleanup; - } + /* +* On Xilinx ZynqMP, the reg_capabilities (SDIO) Register +* +* https://www.xilinx.com/htmldocs/registers/ug1087/sdio___reg_capabilities.html# +* Absolute Address 0x00FF160040 (SD0) +* Reset Value 0x280737EC6481 Quoted 8 lines
drivers/mmc/host/sdhci-of-arasan.c static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan, · line 1546
Quoted 5 lines
drivers/mmc/host/sdhci-of-arasan.c +5
-0+ * + * really reads 0x200737EC6481 . The interesting part is the + * top 32 bits, which are SDHCI_CAPABILITIES_1 = 0x2007. The + * missing 0x800 is SDHCI_RETUNING_TIMER_COUNT_MASK=0, which + * makes the SDHCI core disable retuning timer.Are you aware that caps can be changed in DT via "sdhci-caps" and "sdhci-caps-mask" ?
Quoted 3 lines
No, I wasn't aware of those.
Is that the preferred approach to this fix, over handling it in the driver ?
I guess ideally. Mainline does not really need the driver fix because it seems it can be done by DT. Older kernels are a separate issue really.
Quoted 2 lines
I think the driver-side fix would be preferable, because it also fixes systems which use legacy DTs without the sdhci-caps properties, which would be all ZynqMP systems thus far.
You could backport support of the properties "sdhci-caps" and "sdhci-caps-mask".
Quoted 4 lines
(and I would also still prefer to get feedback from Xilinx on why does the value specified in UG1087 not match what is read out of the hardware)
[...]
Quoted 93 lines · Adrian Hunter
Quoted 83 lines · Marek Vasut
Quoted 16 lines · Adrian Hunter
Quoted 15 lines · Marek Vasut
On Xilinx ZynqMP, the
reg_capabilities(SDIO) Registerhttps://www.xilinx.com/htmldocs/registers/ug1087/sdio___reg_capabilities.html#
Absolute Address0x00FF160040(SD0)
Reset Value0x280737EC6481really reads
0x200737EC6481. The interesting part is the top 32 bits, which areSDHCI_CAPABILITIES_1=0x2007. The missing0x800is SDHCI_RETUNING_TIMER_COUNT_MASK=0, which makes the SDHCI core disable retuning timer.Fix this up here by explicitly setting
tuning_countto 8 as it should be, otherwise an eMMC might fail in various thermal conditionsQuoted 7 lines
Quoted 5 lines
Note that the diff is best shown with -w option, this makes it visible what happened with !sdhci_arasan->has_cqe conditional, which is placed between
sdhci_setup_host()and__sdhci_add_host()calls. Sincesdhci_add_host()is also a sequence of these two calls andhost->tuning_countmust be overriden before callingoverriden -> overridden
Fixed
Quoted 47 lines
Quoted 47 lines
__sdhci_add_host(), call the two calls separately and do all the adjustments between them in either case.Signed-off-by Marek Vasut <[email protected]>---
Cc: Michal Simek <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Ulf Hansson <[email protected]>
Cc: [email protected]
To: [email protected]--- drivers/mmc/host/sdhci-of-arasan.c | 57 ++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 19 deletions(-)drivers/mmc/host/sdhci-of-arasan.c +8
-7@@ -1521,37 +1521,56 @@ static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan, return 0; } -static int sdhci_arasan_add_host(struct sdhci_arasan_data *sdhci_arasan) +static int sdhci_arasan_add_host(struct sdhci_arasan_data *sdhci_arasan, + struct device *dev) { struct sdhci_host *host = sdhci_arasan->host; struct cqhci_host *cq_host; bool dma64; int ret; - if (!sdhci_arasan->has_cqe) - return sdhci_add_host(host); - ret = sdhci_setup_host(host); if (ret) return ret; - cq_host = devm_kzalloc(host->mmc->parent, - sizeof(*cq_host), GFP_KERNEL); - if (!cq_host) { - ret = -ENOMEM; - goto cleanup; - } + /* +* On Xilinx ZynqMP, the reg_capabilities (SDIO) Register +* +* https://www.xilinx.com/htmldocs/registers/ug1087/sdio___reg_capabilities.html# +* Absolute Address 0x00FF160040 (SD0) +* Reset Value 0x280737EC6481 Quoted 8 lines
drivers/mmc/host/sdhci-of-arasan.c static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan, · line 1546
Quoted 5 lines
drivers/mmc/host/sdhci-of-arasan.c +5
-0+ * + * really reads 0x200737EC6481 . The interesting part is the + * top 32 bits, which are SDHCI_CAPABILITIES_1 = 0x2007. The + * missing 0x800 is SDHCI_RETUNING_TIMER_COUNT_MASK=0, which + * makes the SDHCI core disable retuning timer.Are you aware that caps can be changed in DT via "sdhci-caps" and "sdhci-caps-mask" ?
Quoted 3 lines
No, I wasn't aware of those.
Is that the preferred approach to this fix, over handling it in the driver ?
I guess ideally. Mainline does not really need the driver fix because it seems it can be done by DT. Older kernels are a separate issue really.
Quoted 1 line
Quoted 4 lines
Quoted 1 line
I think the driver-side fix would be preferable, because it also fixes systems which use legacy DTs without the sdhci-caps properties, which would be all ZynqMP systems thus far.
You could backport support of the properties "sdhci-caps" and "sdhci-caps-mask".
This won't help. Vivado (the xilinx FPGA design tool) is capable of generating DTs, so you can end up with a combination of new Linux kernel and old generated DT, which is still missing the sdhci-caps/sdhci-caps-mask .
Adrian Hunter
maintainerQuoted 94 lines · Marek Vasut
Quoted 93 lines · Adrian Hunter
Quoted 83 lines · Marek Vasut
Quoted 16 lines · Adrian Hunter
Quoted 15 lines · Marek Vasut
On Xilinx ZynqMP, the
reg_capabilities(SDIO) Registerhttps://www.xilinx.com/htmldocs/registers/ug1087/sdio___reg_capabilities.html#
Absolute Address0x00FF160040(SD0)
Reset Value0x280737EC6481really reads
0x200737EC6481. The interesting part is the top 32 bits, which areSDHCI_CAPABILITIES_1=0x2007. The missing0x800is SDHCI_RETUNING_TIMER_COUNT_MASK=0, which makes the SDHCI core disable retuning timer.Fix this up here by explicitly setting
tuning_countto 8 as it should be, otherwise an eMMC might fail in various thermal conditionsQuoted 7 lines
Quoted 5 lines
Note that the diff is best shown with -w option, this makes it visible what happened with !sdhci_arasan->has_cqe conditional, which is placed between
sdhci_setup_host()and__sdhci_add_host()calls. Sincesdhci_add_host()is also a sequence of these two calls andhost->tuning_countmust be overriden before callingoverriden -> overridden
Fixed
Quoted 47 lines
Quoted 47 lines
__sdhci_add_host(), call the two calls separately and do all the adjustments between them in either case.Signed-off-by Marek Vasut <[email protected]>---
Cc: Michal Simek <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Ulf Hansson <[email protected]>
Cc: [email protected]
To: [email protected]
---
drivers/mmc/host/sdhci-of-arasan.c| 57 ++++++++++++++++++++----------1 file changed, 38 insertions(+), 19 deletions(-)drivers/mmc/host/sdhci-of-arasan.c +8
-7@@ -1521,37 +1521,56 @@ static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan, return 0; } -static int sdhci_arasan_add_host(struct sdhci_arasan_data *sdhci_arasan) +static int sdhci_arasan_add_host(struct sdhci_arasan_data *sdhci_arasan, + struct device *dev) { struct sdhci_host *host = sdhci_arasan->host; struct cqhci_host *cq_host; bool dma64; int ret; - if (!sdhci_arasan->has_cqe) - return sdhci_add_host(host); - ret = sdhci_setup_host(host); if (ret) return ret; - cq_host = devm_kzalloc(host->mmc->parent, - sizeof(*cq_host), GFP_KERNEL); - if (!cq_host) { - ret = -ENOMEM; - goto cleanup; - } + /* +* On Xilinx ZynqMP, the reg_capabilities (SDIO) Register +* +* https://www.xilinx.com/htmldocs/registers/ug1087/sdio___reg_capabilities.html# +* Absolute Address 0x00FF160040 (SD0) +* Reset Value 0x280737EC6481 Quoted 8 lines
drivers/mmc/host/sdhci-of-arasan.c static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan, · line 1546
Quoted 5 lines
drivers/mmc/host/sdhci-of-arasan.c +5
-0+ * + * really reads 0x200737EC6481 . The interesting part is the + * top 32 bits, which are SDHCI_CAPABILITIES_1 = 0x2007. The + * missing 0x800 is SDHCI_RETUNING_TIMER_COUNT_MASK=0, which + * makes the SDHCI core disable retuning timer.Are you aware that caps can be changed in DT via "sdhci-caps" and "sdhci-caps-mask" ?
Quoted 3 lines
No, I wasn't aware of those.
Is that the preferred approach to this fix, over handling it in the driver ?
I guess ideally. Mainline does not really need the driver fix because it seems it can be done by DT. Older kernels are a separate issue really.
Quoted 1 line
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
I think the driver-side fix would be preferable, because it also fixes systems which use legacy DTs without the sdhci-caps properties, which would be all ZynqMP systems thus far.
You could backport support of the properties "sdhci-caps" and "sdhci-caps-mask".
This won't help. Vivado (the xilinx FPGA design tool) is capable of generating DTs, so you can end up with a combination of new Linux kernel and old generated DT, which is still missing the sdhci-caps/sdhci-caps-mask .
That is a bit sad. You might want to push for changing that situation.
Send an updated patch then.
Michal Simek
maintainerQuoted 97 lines · Adrian Hunter
Quoted 96 lines · Marek Vasut
Quoted 95 lines · Adrian Hunter
Quoted 83 lines · Marek Vasut
Quoted 16 lines · Adrian Hunter
Quoted 15 lines · Marek Vasut
On Xilinx ZynqMP, the
reg_capabilities(SDIO) Registerhttps://www.xilinx.com/htmldocs/registers/ug1087/sdio___reg_capabilities.html#
Absolute Address0x00FF160040(SD0)
Reset Value0x280737EC6481really reads
0x200737EC6481. The interesting part is the top 32 bits, which areSDHCI_CAPABILITIES_1=0x2007. The missing0x800is SDHCI_RETUNING_TIMER_COUNT_MASK=0, which makes the SDHCI core disable retuning timer.Fix this up here by explicitly setting
tuning_countto 8 as it should be, otherwise an eMMC might fail in various thermal conditionsQuoted 7 lines
Quoted 5 lines
Note that the diff is best shown with -w option, this makes it visible what happened with !sdhci_arasan->has_cqe conditional, which is placed between
sdhci_setup_host()and__sdhci_add_host()calls. Sincesdhci_add_host()is also a sequence of these two calls andhost->tuning_countmust be overriden before callingoverriden -> overridden
Fixed
Quoted 47 lines
Quoted 47 lines
__sdhci_add_host(), call the two calls separately and do all the adjustments between them in either case.Signed-off-by Marek Vasut <[email protected]>---
Cc: Michal Simek <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Ulf Hansson <[email protected]>
Cc: [email protected]
To: [email protected]--- drivers/mmc/host/sdhci-of-arasan.c | 57 ++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 19 deletions(-)drivers/mmc/host/sdhci-of-arasan.c +8
-7@@ -1521,37 +1521,56 @@ static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan,return 0 ; } -static int sdhci_arasan_add_host(struct sdhci_arasan_data *sdhci_arasan) +static int sdhci_arasan_add_host(struct sdhci_arasan_data *sdhci_arasan, + struct device *dev) {struct sdhci_host *host = sdhci_arasan->host;struct cqhci_host *cq_host;bool dma64;int ret; - if (!sdhci_arasan->has_cqe) -return sdhci_add_host (host); - ret = sdhci_setup_host(host);if (ret)return ret; - cq_host = devm_kzalloc(host->mmc->parent, -sizeof (*cq_host),GFP_KERNEL ); -if (!cq_host) { - ret = -ENOMEM ; - goto cleanup; - } +/* +* On Xilinx ZynqMP, the reg_capabilities (SDIO) Register +* +* https://www.xilinx.com/htmldocs/registers/ug1087/sdio___reg_capabilities.html# +* Absolute Address 0x00FF160040 (SD0) +* Reset Value 0x280737EC6481 Quoted 8 lines
drivers/mmc/host/sdhci-of-arasan.c static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan, · line 1546
Quoted 5 lines
drivers/mmc/host/sdhci-of-arasan.c +5
-0+* +* really reads 0x200737EC6481 . The interesting part is the +* top 32 bits, which are SDHCI_CAPABILITIES_1 = 0x2007. The +* missing 0x800 is SDHCI_RETUNING_TIMER_COUNT_MASK=0, which +* makes the SDHCI core disable retuning timer. Are you aware that caps can be changed in DT via "sdhci-caps" and "sdhci-caps-mask" ?
Quoted 3 lines
No, I wasn't aware of those.
Is that the preferred approach to this fix, over handling it in the driver ?
I guess ideally. Mainline does not really need the driver fix because it seems it can be done by DT. Older kernels are a separate issue really.
Quoted 2 lines
I think the driver-side fix would be preferable, because it also fixes systems which use legacy DTs without the sdhci-caps properties, which would be all ZynqMP systems thus far.
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
You could backport support of the properties "sdhci-caps" and "sdhci-caps-mask".
This won't help. Vivado (the xilinx FPGA design tool) is capable of generating DTs, so you can end up with a combination of new Linux kernel and old generated DT, which is still missing the sdhci-caps/sdhci-caps-mask .
That is a bit sad. You might want to push for changing that situation.
Send an updated patch then.
Xilinx Device Tree Generator, which is the tool for DT generation, was never designed to be directly used without any change. It was designed to help you to describe the system as much as possible. It means you get the base and you need to change things which are not properly described. That's why just do it.
Thanks,
Michal
Quoted 107 lines · Michal Simek
Quoted 104 lines · Adrian Hunter
Quoted 103 lines · Marek Vasut
Quoted 101 lines · Adrian Hunter
Quoted 87 lines · Marek Vasut
Quoted 16 lines · Adrian Hunter
Quoted 15 lines · Marek Vasut
On Xilinx ZynqMP, the
reg_capabilities(SDIO) Registerhttps://www.xilinx.com/htmldocs/registers/ug1087/sdio___reg_capabilities.html#
Absolute Address0x00FF160040(SD0)
Reset Value0x280737EC6481really reads
0x200737EC6481. The interesting part is the top 32 bits, which areSDHCI_CAPABILITIES_1=0x2007. The missing0x800is SDHCI_RETUNING_TIMER_COUNT_MASK=0, which makes the SDHCI core disable retuning timer.Fix this up here by explicitly setting
tuning_countto 8 as it should be, otherwise an eMMC might fail in various thermal conditionsQuoted 7 lines
Quoted 5 lines
Note that the diff is best shown with -w option, this makes it visible what happened with !sdhci_arasan->has_cqe conditional, which is placed between
sdhci_setup_host()and__sdhci_add_host()calls. Sincesdhci_add_host()is also a sequence of these two calls andhost->tuning_countmust be overriden before callingoverriden -> overridden
Fixed
Quoted 51 lines
Quoted 51 lines
__sdhci_add_host(), call the two calls separately and do all the adjustments between them in either case.Signed-off-by Marek Vasut <[email protected]>---
Cc: Michal Simek <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Ulf Hansson <[email protected]>
Cc: [email protected]
To: [email protected]
---
drivers/mmc/host/sdhci-of-arasan.c| 57
++++++++++++++++++++----------1 file changed, 38 insertions(+), 19 deletions(-)drivers/mmc/host/sdhci-of-arasan.c +6
-7@@ -1521,37 +1521,56 @@ static int sdhci_arasan_register_sdclk(struct sdhci_arasan_data *sdhci_arasan, return 0; } -static int sdhci_arasan_add_host(struct sdhci_arasan_data *sdhci_arasan) +static int sdhci_arasan_add_host(struct sdhci_arasan_data *sdhci_arasan, + struct device *dev) { struct sdhci_host *host = sdhci_arasan->host; struct cqhci_host *cq_host; bool dma64; int ret; - if (!sdhci_arasan->has_cqe) - return sdhci_add_host(host); - ret = sdhci_setup_host(host); if (ret) return ret; - cq_host = devm_kzalloc(host->mmc->parent, - sizeof(*cq_host), GFP_KERNEL); - if (!cq_host) { - ret = -ENOMEM; - goto cleanup; - } + /* +* On Xilinx ZynqMP, the reg_capabilities (SDIO) Register +* +* https://www.xilinx.com/htmldocs/registers/ug1087/sdio___reg_capabilities.html#
+ * Absolute Address0x00FF160040(SD0)
+ * Reset Value0x280737EC6481Quoted 8 lines
Quoted 5 lines
+ *
+ * really reads0x200737EC6481. The interesting part is the + * top 32 bits, which areSDHCI_CAPABILITIES_1=0x2007. The + * missing0x800is SDHCI_RETUNING_TIMER_COUNT_MASK=0, which + * makes the SDHCI core disable retuning timer.Are you aware that caps can be changed in DT via "sdhci-caps" and "sdhci-caps-mask" ?
Quoted 3 lines
No, I wasn't aware of those.
Is that the preferred approach to this fix, over handling it in the driver ?
I guess ideally. Mainline does not really need the driver fix because it seems it can be done by DT. Older kernels are a separate issue really.
Quoted 2 lines
I think the driver-side fix would be preferable, because it also fixes systems which use legacy DTs without the sdhci-caps properties, which would be all ZynqMP systems thus far.
You could backport support of the properties "sdhci-caps" and "sdhci-caps-mask".
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
This won't help. Vivado (the xilinx FPGA design tool) is capable of generating DTs, so you can end up with a combination of new Linux kernel and old generated DT, which is still missing the sdhci-caps/sdhci-caps-mask .
That is a bit sad. You might want to push for changing that situation.
Send an updated patch then.
Xilinx Device Tree Generator, which is the tool for DT generation, was never designed to be directly used without any change. It was designed to help you to describe the system as much as possible. It means you get the base and you need to change things which are not properly described. That's why just do it.
I am under the impression that petalinux does pull the XSA from Vivado and directly builds U-Boot and Linux with DT somehow derived from the XSA, maybe using DTG ?
(note that I am not using petalinux)
Michal Simek
maintainerQuoted 110 lines · Marek Vasut
Quoted 109 lines · Michal Simek
Quoted 106 lines · Adrian Hunter
Quoted 96 lines · Marek Vasut
Quoted 95 lines · Adrian Hunter
Quoted 85 lines · Marek Vasut
Quoted 16 lines · Adrian Hunter
Quoted 15 lines · Marek Vasut
On Xilinx ZynqMP, the
reg_capabilities(SDIO) Registerhttps://www.xilinx.com/htmldocs/registers/ug1087/sdio___reg_capabilities.html#
Absolute Address0x00FF160040(SD0)
Reset Value0x280737EC6481really reads
0x200737EC6481. The interesting part is the top 32 bits, which areSDHCI_CAPABILITIES_1=0x2007. The missing0x800is SDHCI_RETUNING_TIMER_COUNT_MASK=0, which makes the SDHCI core disable retuning timer.Fix this up here by explicitly setting
tuning_countto 8 as it should be, otherwise an eMMC might fail in various thermal conditionsQuoted 7 lines
Quoted 5 lines
Note that the diff is best shown with -w option, this makes it visible what happened with !sdhci_arasan->has_cqe conditional, which is placed between
sdhci_setup_host()and__sdhci_add_host()calls. Sincesdhci_add_host()is also a sequence of these two calls andhost->tuning_countmust be overriden before callingoverriden -> overridden
Fixed
Quoted 49 lines
Quoted 49 lines
__sdhci_add_host(), call the two calls separately and do all the adjustments between them in either case.Signed-off-by Marek Vasut <[email protected]>---
Cc: Michal Simek <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Ulf Hansson <[email protected]>
Cc: [email protected]
To: [email protected]
---
drivers/mmc/host/sdhci-of-arasan.c| 57 ++++++++++++++++++++----------1 file changed, 38 insertions(+), 19 deletions(-)drivers/mmc/host/sdhci-of-arasan.c +6
-7@@ -1521,37 +1521,56 @@ static int sdhci_arasan_register_sdclk(structsdhci_arasan_data *sdhci_arasan, return 0; } -static int sdhci_arasan_add_host(struct sdhci_arasan_data *sdhci_arasan) +static int sdhci_arasan_add_host(struct sdhci_arasan_data *sdhci_arasan, + struct device *dev) { struct sdhci_host *host = sdhci_arasan->host; struct cqhci_host *cq_host; bool dma64; int ret; - if (!sdhci_arasan->has_cqe) - return sdhci_add_host(host); - ret = sdhci_setup_host(host); if (ret) return ret; - cq_host = devm_kzalloc(host->mmc->parent, - sizeof(*cq_host), GFP_KERNEL); - if (!cq_host) { - ret = -ENOMEM; - goto cleanup; - } + /* +* On Xilinx ZynqMP, the reg_capabilities (SDIO) Register +* +* https://www.xilinx.com/htmldocs/registers/ug1087/sdio___reg_capabilities.html#
+ * Absolute Address0x00FF160040(SD0)
+ * Reset Value0x280737EC6481Quoted 8 lines
Quoted 5 lines
+ *
+ * really reads0x200737EC6481. The interesting part is the + * top 32 bits, which areSDHCI_CAPABILITIES_1=0x2007. The + * missing0x800is SDHCI_RETUNING_TIMER_COUNT_MASK=0, which + * makes the SDHCI core disable retuning timer.Are you aware that caps can be changed in DT via "sdhci-caps" and "sdhci-caps-mask" ?
Quoted 3 lines
No, I wasn't aware of those.
Is that the preferred approach to this fix, over handling it in the driver ?
I guess ideally. Mainline does not really need the driver fix because it seems it can be done by DT. Older kernels are a separate issue really.
Quoted 1 line
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
I think the driver-side fix would be preferable, because it also fixes systems which use legacy DTs without the sdhci-caps properties, which would be all ZynqMP systems thus far.
You could backport support of the properties "sdhci-caps" and "sdhci-caps-mask".
This won't help. Vivado (the xilinx FPGA design tool) is capable of generating DTs, so you can end up with a combination of new Linux kernel and old generated DT, which is still missing the sdhci-caps/sdhci-caps-mask .
That is a bit sad. You might want to push for changing that situation.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Send an updated patch then.
Xilinx Device Tree Generator, which is the tool for DT generation, was never designed to be directly used without any change. It was designed to help you to describe the system as much as possible. It means you get the base and you need to change things which are not properly described. That's why just do it.
I am under the impression that petalinux does pull the XSA from Vivado and directly builds U-Boot and Linux with DT somehow derived from the XSA, maybe using DTG ?
(note that I am not using petalinux)
They do use it but they are not keeping backward compatibility that's why they don't need to solve this problem.
Thanks,
Michal