From: Tanmay Kathpalia <tanmay.kathpalia@altera.com>
To: Peng Fan <peng.fan@oss.nxp.com>
Cc: u-boot@lists.denx.de, peng.fan@nxp.com, jh80.chung@samsung.com,
trini@konsulko.com, marex@denx.de, tien.fong.chee@altera.com,
balsundar.ponnusamy@altera.com
Subject: Re: [PATCH 8/8] mmc: sdhci-cadence6: Add DLL master control and improve tuning reliability
Date: Thu, 20 Nov 2025 20:20:10 +0530 [thread overview]
Message-ID: <459daefa-1d56-4591-a922-af40934db942@altera.com> (raw)
In-Reply-To: <aRwRKx7CILf0y1qr@nxa18884-linux>
On 11/18/2025 11:54 AM, Peng Fan wrote:
> On Mon, Nov 10, 2025 at 09:37:37AM -0800, Tanmay Kathpalia wrote:
>> - Add support for configuring the PHY DLL master control register for all
>> SD/eMMC timing modes (DS, HS, SDR, DDR, HS200, HS400) by extending the
>> PHY configuration arrays and writing the value during PHY adjustment.
>> - Fix tuning reliability by toggling the DLL reset before and after
>> updating the PHY_DLL_SLAVE_CTRL_REG_ADDR register.
>>
>> Signed-off-by: Tanmay Kathpalia <tanmay.kathpalia@altera.com>
>> Reviewed-by: Balsundar Ponnusamy <balsundar.ponnusamy@altera.com>
>> ---
>> drivers/mmc/sdhci-cadence6.c | 21 ++++++++++++++++++++-
>> 1 file changed, 20 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/mmc/sdhci-cadence6.c b/drivers/mmc/sdhci-cadence6.c
>> index d9467293807..91a245aa490 100644
>> --- a/drivers/mmc/sdhci-cadence6.c
>> +++ b/drivers/mmc/sdhci-cadence6.c
>> @@ -58,7 +58,7 @@
>> #define PHY_DLL_SLAVE_CTRL_REG_READ_DQS_CMD_DELAY GENMASK(31, 24)
>> #define PHY_DLL_SLAVE_CTRL_REG_READ_DQS_DELAY GENMASK(7, 0)
>>
>> -#define SDHCI_CDNS6_PHY_CFG_NUM 4
>> +#define SDHCI_CDNS6_PHY_CFG_NUM 5
>> #define SDHCI_CDNS6_CTRL_CFG_NUM 4
>>
>> struct sdhci_cdns6_phy_cfg {
>> @@ -76,6 +76,7 @@ static struct sdhci_cdns6_phy_cfg sd_ds_phy_cfgs[] = {
>> { "cdns,phy-gate-lpbk-ctrl-delay-sd-ds", 0x01A00040, },
>> { "cdns,phy-dll-slave-ctrl-sd-ds", 0x00000000, },
>> { "cdns,phy-dq-timing-delay-sd-ds", 0x00000001, },
>> + { "cdns,phy-dll-master-ctrl-sd-ds", 0x00800004, },
>> };
>>
>> static struct sdhci_cdns6_phy_cfg sd_hs_phy_cfgs[] = {
>> @@ -83,6 +84,7 @@ static struct sdhci_cdns6_phy_cfg sd_hs_phy_cfgs[] = {
>> { "cdns,phy-gate-lpbk-ctrl-delay-sd-hs", 0x01A00040, },
>> { "cdns,phy-dll-slave-ctrl-sd-hs", 0x00000000, },
>> { "cdns,phy-dq-timing-delay-sd-hs", 0x00000001, },
>> + { "cdns,phy-dll-master-ctrl-sd-hs", 0x00800004, },
>> };
>>
>> static struct sdhci_cdns6_phy_cfg emmc_sdr_phy_cfgs[] = {
>> @@ -90,6 +92,7 @@ static struct sdhci_cdns6_phy_cfg emmc_sdr_phy_cfgs[] = {
>> { "cdns,phy-gate-lpbk-ctrl-delay-emmc-sdr", 0x01A00040, },
>> { "cdns,phy-dll-slave-ctrl-emmc-sdr", 0x00000000, },
>> { "cdns,phy-dq-timing-delay-emmc-sdr", 0x00000001, },
>> + { "cdns,phy-dll-master-ctrl-emmc-sdr", 0x00800004, },
>> };
>>
>> static struct sdhci_cdns6_phy_cfg emmc_ddr_phy_cfgs[] = {
>> @@ -97,6 +100,7 @@ static struct sdhci_cdns6_phy_cfg emmc_ddr_phy_cfgs[] = {
>> { "cdns,phy-gate-lpbk-ctrl-delay-emmc-ddr", 0x01A00040, },
>> { "cdns,phy-dll-slave-ctrl-emmc-ddr", 0x00000000, },
>> { "cdns,phy-dq-timing-delay-emmc-ddr", 0x10000001, },
>> + { "cdns,phy-dll-master-ctrl-emmc-ddr", 0x00800004, },
>> };
>>
>> static struct sdhci_cdns6_phy_cfg emmc_hs200_phy_cfgs[] = {
>> @@ -104,6 +108,7 @@ static struct sdhci_cdns6_phy_cfg emmc_hs200_phy_cfgs[] = {
>> { "cdns,phy-gate-lpbk-ctrl-delay-emmc-hs200", 0x01A00040, },
>> { "cdns,phy-dll-slave-ctrl-emmc-hs200", 0x00DADA00, },
>> { "cdns,phy-dq-timing-delay-emmc-hs200", 0x00000001, },
>> + { "cdns,phy-dll-master-ctrl-emmc-hs200", 0x00000004, },
>> };
>>
>> static struct sdhci_cdns6_phy_cfg emmc_hs400_phy_cfgs[] = {
>> @@ -111,6 +116,7 @@ static struct sdhci_cdns6_phy_cfg emmc_hs400_phy_cfgs[] = {
>> { "cdns,phy-gate-lpbk-ctrl-delay-emmc-hs400", 0x01A00040, },
>> { "cdns,phy-dll-slave-ctrl-emmc-hs400", 0x00DAD800, },
>> { "cdns,phy-dq-timing-delay-emmc-hs400", 0x00000001, },
>> + { "cdns,phy-dll-master-ctrl-emmc-hs400", 0x00000004, },
>> };
>>
>> static struct sdhci_cdns6_ctrl_cfg sd_ds_ctrl_cfgs[] = {
>> @@ -252,6 +258,7 @@ int sdhci_cdns6_phy_adj(struct udevice *dev, struct sdhci_cdns_plat *plat, u32 m
>>
>> sdhci_cdns6_write_phy_reg(plat, PHY_DQS_TIMING_REG_ADDR, sdhci_cdns6_phy_cfgs[0].val);
>> sdhci_cdns6_write_phy_reg(plat, PHY_GATE_LPBK_CTRL_REG_ADDR, sdhci_cdns6_phy_cfgs[1].val);
>> + sdhci_cdns6_write_phy_reg(plat, PHY_DLL_MASTER_CTRL_REG_ADDR, sdhci_cdns6_phy_cfgs[4].val);
>> sdhci_cdns6_write_phy_reg(plat, PHY_DLL_SLAVE_CTRL_REG_ADDR, sdhci_cdns6_phy_cfgs[2].val);
>>
>> /* Switch Off the DLL Reset */
>> @@ -296,6 +303,7 @@ int sdhci_cdns6_phy_init(struct udevice *dev, struct sdhci_cdns_plat *plat)
>> int sdhci_cdns6_set_tune_val(struct sdhci_cdns_plat *plat, unsigned int val)
>> {
>> u32 tmp, tuneval;
>> + int ret;
>>
>> tuneval = (val * 256) / SDHCI_CDNS_MAX_TUNING_LOOP;
>>
>> @@ -304,7 +312,18 @@ int sdhci_cdns6_set_tune_val(struct sdhci_cdns_plat *plat, unsigned int val)
>> PHY_DLL_SLAVE_CTRL_REG_READ_DQS_DELAY);
>> tmp |= FIELD_PREP(PHY_DLL_SLAVE_CTRL_REG_READ_DQS_CMD_DELAY, tuneval) |
>> FIELD_PREP(PHY_DLL_SLAVE_CTRL_REG_READ_DQS_DELAY, tuneval);
>> +
>> + /* Switch On the DLL Reset */
>> + sdhci_cdns6_reset_phy_dll(plat, true);
>
> There is no err return check, but
>
>> +
>> sdhci_cdns6_write_phy_reg(plat, PHY_DLL_SLAVE_CTRL_REG_ADDR, tmp);
>>
>> + /* Switch Off the DLL Reset */
>> + ret = sdhci_cdns6_reset_phy_dll(plat, false);
>
> there is err check here. Should these be aligned or the usage is intentional?
>
The difference is intentional.
sdhci_cdns6_reset_phy_dll always returns 0 when the second argument is
true (i.e., when switching the DLL reset On).
When switching the DLL reset Off (false), the function waits for the PHY
initialization completion bit to be set within the defined time period,
so a return value check is necessary to catch any failure during this step.
> Regards
> Peng
>
>> + if (ret) {
>> + printf("sdhci_cdns6_reset_phy is not completed\n");
>> + return ret;
>> + }
>> +
>> return 0;
>> }
>> --
>> 2.43.7
>>
>>
prev parent reply other threads:[~2025-11-20 14:50 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-10 17:37 [PATCH 0/8] mmc: sdhci-cadence: Improvements and fixes for Cadence SDHCI driver Tanmay Kathpalia
2025-11-10 17:37 ` [PATCH 1/8] mmc: sdhci-cadence: Add reset control support Tanmay Kathpalia
2025-11-18 5:09 ` Peng Fan
2025-11-20 14:59 ` Tanmay Kathpalia
2025-11-26 2:17 ` Peng Fan
2025-11-27 8:29 ` Tanmay Kathpalia
2025-11-27 9:48 ` Peng Fan
2025-11-27 9:52 ` Tanmay Kathpalia
2025-11-10 17:37 ` [PATCH 2/8] mmc: sdhci-cadence: Use max-frequency property from device tree Tanmay Kathpalia
2025-11-18 6:13 ` Peng Fan
2025-11-20 14:31 ` Tanmay Kathpalia
2025-11-10 17:37 ` [PATCH 3/8] mmc: sdhci-cadence: Set controller and PHY speed modes for SD and eMMC cards Tanmay Kathpalia
2025-11-10 17:37 ` [PATCH 4/8] mmc: sdhci: Add SDHCI_SPEC_400, _410, and _420 version defines Tanmay Kathpalia
2025-11-10 17:37 ` [PATCH 5/8] mmc: sdhci-cadence: Use hardware version field for Cadence SDHCI controller Tanmay Kathpalia
2025-11-10 17:37 ` [PATCH 6/8] mmc: sdhci-cadence: Enable software tuning for both SD and eMMC interfaces Tanmay Kathpalia
2025-11-10 17:37 ` [PATCH 7/8] mmc: sdhci-cadence6: socfpga: Fix DT property naming convention Tanmay Kathpalia
2025-11-18 6:22 ` Peng Fan
2025-11-20 14:42 ` Tanmay Kathpalia
2025-11-10 17:37 ` [PATCH 8/8] mmc: sdhci-cadence6: Add DLL master control and improve tuning reliability Tanmay Kathpalia
2025-11-18 6:24 ` Peng Fan
2025-11-20 14:50 ` Tanmay Kathpalia [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=459daefa-1d56-4591-a922-af40934db942@altera.com \
--to=tanmay.kathpalia@altera.com \
--cc=balsundar.ponnusamy@altera.com \
--cc=jh80.chung@samsung.com \
--cc=marex@denx.de \
--cc=peng.fan@nxp.com \
--cc=peng.fan@oss.nxp.com \
--cc=tien.fong.chee@altera.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.