From: "Kathpalia, Tanmay" <tanmay.kathpalia@altera.com>
To: "NG, TZE YEE" <tze.yee.ng@altera.com>,
Adrian Hunter <adrian.hunter@intel.com>,
linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
devicetree@vger.kernel.org, Ulf Hansson <ulfh@kernel.org>
Subject: Re: [PATCH v3 2/4] mmc: sdhci-cadence6: program PHONY_DQS_TIMING for extended-read DDR
Date: Thu, 19 Nov 2026 00:34:08 +0530 [thread overview]
Message-ID: <fa378079-aedc-4848-9e29-2d55c4a30d64@altera.com> (raw)
In-Reply-To: <7879888a-b4cd-4c45-bb92-8db776f10d8d@altera.com>
On 17-11-2026 13:27, NG, TZE YEE wrote:
> Hi Tanmay,
>
> Thanks for the careful review, and sorry for the mixed signals between
> the two threads.
Hi Tze,
You're welcome, and thank you for staying on top of the review feedback.
Could you please confirm the document you cited for the rebar pulse
width as cdn_ip6185?
I will be on annual leave until the first week of January and may not be
able to review during
that time. Thank you for sending v4 with the feedback incorporated while
I am away. I will
review it once I am back.
Thanks,
Tanmay
>
> On 15/11/2026 10:51 pm, Kathpalia, Tanmay wrote:
>>
>> On 06-11-2026 11:46, tze.yee.ng@altera.com wrote:
>>> From: Tze Yee Ng <tze.yee.ng@altera.com>
>>>
>>> The SD6HC PHY left PHONY_DQS_TIMING (phy_ctrl_reg[9:4]) at 0 in all
>>> modes. Per the Cadence DLL PHY documentation it must be the rebar (RE#)
>>> pulse width in clk_phy cycles minus 1 in extended read mode, and 0
>>> otherwise. Leaving it 0 in extended-read DDR duplicates one DDR edge
>>> (the silent odd/even edge-capture defect).
>>>
>>> On this integration the rebar pulse is 2 clk_phy cycles, so extended-
>>
>> In the U-Boot thread you said this width is documented in the Cadence
>> SD/eMMC DFI spec; in v1 here
>> you said there is no IP-level document. Which is it? If documented,
>> please cite it here and in the
>> macro comment. If it is Agilex5-specific, please take it from the
>> altr,agilex5-sd6hc match data
>> instead of a constant for every cdns,sd6hc user.
>>
>
> You're right the threads were inconsistent. At v1 I had no IP-level
> reference and used the characterised rebar width. While debugging the
> U-Boot side I found the Cadence documents that actually describe this,
> and I'll cite them from v4 on:
>
> - COMBO DLL PHY User Guide (cdn_ip6182), phy_ctrl_reg (0x2080)
> bits[9:4] phony_dqs_timing: 0 when extended_read_mode is disabled,
> otherwise the rebar pulse width in clk_phy cycles minus 1 (its own
> example: width 4 -> 3).
> - SD/eMMC DFI Interface spec (cdn_ip6185) section 1.2.6.2, "DAT input
> in extended clock mode" (Fig 1.23 DDR, Fig 1.26 SDR): the rebar
> pulse spans half an SDCLK period.
>
> So the rule is IP-documented; what I didn't have at v1 was the
> reference, not a different rule.
>
>>> read DDR needs 1; confirmed on DDR50 hardware (1 captures both beats, 2
>>
>> In v1 you confirmed DDR52 was validated too and said you would name
>> both modes.
>>
>
> Yes, DDR52 is validated too. I'll name both DDR50 and DDR52 in the
> commit message.
>
>>> corrupts reads). Derive it from the extended-read-mode state and apply
>>> it only in DDR modes, since SDR extended-read samples a single edge and
>>> is unaffected.
>>
>> In v1 you agreed this is not proof ("Agreed the single-edge argument
>> alone is not proof") and kept
>> these modes at 0 because they pass there. On 5 Nov, in the U-Boot
>> thread, you wrote the opposite
>> rule: by the PHY guide the value "is 1 in extended-read mode and 0
>> otherwise", and U-Boot v2 does
>> set 1 for the divided SDR modes. This patch still leaves them at 0,
>> so the two trees disagree. The
>> PHY guide is not limited to DDR: 0 when extended read is off, and the
>> rebar width minus 1 when it
>> is on. With the rebar width of 2, that is 1 in every extended-read
>> mode. Please program 1 in these
>> modes here as well.
>>
>
> Combining the two docs: rebar width (in clk_phy cycles) = (SDCLK/2) /
> clk_phy = divider/2, hence phony_dqs_timing = divider/2 - 1. The "2"
> in v3 was just that evaluated at our clk_phy (~200 MHz -> divider 4
> for DDR50/DDR52).
>
> Rather than hard-code a number that silently assumes Agilex5's clock,
> or push it into the altr,agilex5-sd6hc match data, I'll derive it from
> the clock ratio the driver already has (t_sdclk / t_sdmclk). That is
> correct for any cdns,sd6hc instance and drops the magic constant,
> which also removes the "this integration" vs "this controller" wording
> mismatch, since there's no macro left to reconcile.
>
>>>
>>> Acked-by: Adrian Hunter <adrian.hunter@intel.com>
>>> Signed-off-by: Tze Yee Ng <tze.yee.ng@altera.com>
>>> ---
>>> Changes in v3:
>>> - No change; retains Adrian's Acked-by.
>>>
>>> Changes in v2:
>>> - Added Adrian's Acked-by.
>>> - Reworded the commit message to drop the "generic to any SD6HC-PHY
>>> SoC"
>>> framing. (Adrian Hunter)
>>> ---
>>> drivers/mmc/host/sdhci-cadence-phy-v6.c | 15 +++++++++++++++
>>> 1 file changed, 15 insertions(+)
>>>
>>> diff --git a/drivers/mmc/host/sdhci-cadence-phy-v6.c b/drivers/mmc/
>>> host/sdhci-cadence-phy-v6.c
>>> index 22d56bb46d75..8d6a9c26c139 100644
>>> --- a/drivers/mmc/host/sdhci-cadence-phy-v6.c
>>> +++ b/drivers/mmc/host/sdhci-cadence-phy-v6.c
>>> @@ -90,6 +90,9 @@
>>> #define SDHCI_CDNS6_PHY_CTRL_REG 0x2080
>>> #define SDHCI_CDNS6_PHY_CTRL_PHONY_DQS_TIMING GENMASK(9, 4)
>>> +/* Width of this controller's rebar (RE#) pulse in clk_phy cycles. */
>>> +#define SDHCI_CDNS6_PHY_REBAR_PULSE_CYCLES 2
>>> +
>>
>> The commit says "this integration", the comment says "this
>> controller". Please make them match,
>> with a source (see above).
>>
>
> See my reply above. This macro and comment will be removed.
>
>>> /* Default PHY settings */
>>> #define SDHCI_CDNS6_PHY_DEFAULT_IOCELL_DELAY 2500
>>> #define SDHCI_CDNS6_PHY_DEFAULT_DELAY_ELEMENT 24
>>> @@ -143,6 +146,9 @@ struct sdhci_cdns6_phy {
>>> bool cp_use_phony_dqs; /* bit [20] */
>>> bool cp_use_phony_dqs_cmd; /* bit [19] */
>>> + /* PHY_CTRL register fields */
>>> + u32 cp_phony_dqs_timing;
>>> +
>>
>> u8 with /* bits [9:4] */, similar to the other cp_* fields.
>>
>
> Will change to u8 with a /* bits [9:4] */ comment, to match the other
> cp_* fields.
>
>>> /* HRS07 register - IO delay Information */
>>> u8 sdhc_rw_compensate; /* bits [20:16] */
>>> u8 sdhc_idelay_val; /* bits [4:0] */
>>> @@ -517,6 +523,13 @@ static void sdhci_cdns6_phy_calc_dat_in(struct
>>> sdhci_cdns6_phy *phy)
>>> if (phy->mode == MMC_TIMING_MMC_HS200)
>>> phy->cp_read_dqs_delay = phy->hs200_tune_val;
>>> + if (phy->sdhc_extended_rd_mode &&
>>> + (phy->mode == MMC_TIMING_UHS_DDR50 ||
>>> + phy->mode == MMC_TIMING_MMC_DDR52))
>>> + phy->cp_phony_dqs_timing =
>>> SDHCI_CDNS6_PHY_REBAR_PULSE_CYCLES - 1;
>>> + else
>>> + phy->cp_phony_dqs_timing = 0;
>>> +
>>
>> The PHY guide asks for width - 1 whenever extended read is on, which
>> here also covers DS/HS/SDR
>> modes. In U-Boot v2 you now do exactly that (1 in every extended-read
>> mode), and said it matches
>> the Linux change, but this patch keeps those modes at 0. It's
>> confusing, I would suggest to follow
>> the Cadence PHY user guide.
>>
>
> Agreed. The guide keys the field on extended_read_mode, not on DDR,
> and U-Boot v2 already programs width-1 in every extended-read mode.
> The computed form does exactly that: phony_dqs_timing = divider/2 - 1
> whenever extended_read_mode is set, 0 otherwise. So the two trees will
> agree.
>
>>> if (strobe_dat) {
>>> /* dqs loopback input via IO cell */
>>> hcsdclkadj += phy->iocell_input_delay;
>>> @@ -715,6 +728,8 @@ int sdhci_cdns6_phy_init(struct sdhci_cdns_priv
>>> *priv)
>>> reg = sdhci_cdns6_read_phy_reg(priv, SDHCI_CDNS6_PHY_CTRL_REG);
>>> reg &= ~SDHCI_CDNS6_PHY_CTRL_PHONY_DQS_TIMING;
>>> + reg |= FIELD_PREP(SDHCI_CDNS6_PHY_CTRL_PHONY_DQS_TIMING,
>>> + phy->cp_phony_dqs_timing);
>>
>> This write always runs with the loopback DQS selected. The setting
>> you tested was the phony DQS
>> (use_lpbk_dqs = 0) and a read delay of 96. The PHY guide says this
>> field times the phony strobe,
>> so with loopback it may change nothing. Does this patch by itself fix
>> the bad reads on the
>> default loopback path? If not, please put it after patch 4, or merge
>> it into patch 4.
>
>
> Agreed it has no standalone effect. The loopback is force‑selected
> until the opt‑in lands, so the write is muxed out. I'll fold the
> PHONY_DQS_TIMING programming into patch 4, so the phony‑DQS opt‑in and
> its correct timing land together and no commit can select phony DQS
> with phony_dqs_timing = 0.
>
> Thanks,
> Tze Yee
next prev parent reply other threads:[~2026-11-18 19:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 6:16 [PATCH v3 0/4] mmc: sdhci-cadence: SD6HC DDR50/DDR52 read-path tuning and fixes tze.yee.ng
2026-11-06 6:16 ` [PATCH v3 1/4] mmc: sdhci-cadence: abort failed tuning command on SD6HC tze.yee.ng
2026-11-15 19:24 ` Kathpalia, Tanmay
[not found] ` <74458f24-9380-4c90-8f6e-6a6f345cc676@altera.com>
2026-11-16 7:59 ` NG, TZE YEE
2026-11-06 6:16 ` [PATCH v3 2/4] mmc: sdhci-cadence6: program PHONY_DQS_TIMING for extended-read DDR tze.yee.ng
2026-11-15 14:51 ` Kathpalia, Tanmay
2026-11-17 7:57 ` NG, TZE YEE
2026-11-18 19:04 ` Kathpalia, Tanmay [this message]
2026-11-06 6:16 ` [PATCH v3 3/4] dt-bindings: mmc: cdns,sd6hc: add SD6HC DDR50 read-path tuning tze.yee.ng
2026-11-06 12:40 ` Krzysztof Kozlowski
2026-11-06 6:16 ` [PATCH v3 4/4] mmc: sdhci-cadence6: read SD6HC DDR50 tuning from device tree tze.yee.ng
2026-11-15 18:47 ` Kathpalia, Tanmay
2026-11-18 11:01 ` NG, TZE YEE
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=fa378079-aedc-4848-9e29-2d55c4a30d64@altera.com \
--to=tanmay.kathpalia@altera.com \
--cc=adrian.hunter@intel.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=robh@kernel.org \
--cc=tze.yee.ng@altera.com \
--cc=ulfh@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®