mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "NG, TZE YEE" <tze.yee.ng@altera.com>
To: "Kathpalia, Tanmay" <tanmay.kathpalia@altera.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Ulf Hansson <ulfh@kernel.org>,
	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
Subject: Re: [PATCH 2/4] mmc: sdhci-cadence6: program PHONY_DQS_TIMING for extended-read DDR
Date: Wed, 30 Sep 2026 18:24:12 +0800	[thread overview]
Message-ID: <de0c63de-952e-482d-81f9-405453275da5@altera.com> (raw)
In-Reply-To: <5c11f8eb-567b-4c1c-98ad-6704659e3fe5@altera.com>



On 26/9/2026 6:45 pm, Kathpalia, Tanmay wrote:
> 
> On 22-09-2026 16:42, 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).
>>
>> This controller's rebar pulse is a fixed 2 clk_phy cycles, so extended-
>> read DDR needs 1; confirmed on DDR50 hardware (1 captures both beats, 2
> 
> The code also applies this value to eMMC DDR52. Was the same behavior 
> verified in
> DDR52? If so, please mention both modes; otherwise, please test DDR52 as 
> well.
> 

Yes. The final setting (phony_dqs_timing=1, use_lpbk_dqs=0, 
read_dqs_delay=96) was validated on Agilex5 eMMC DDR52 as well as 
Agilex5 SD UHS-I DDR50, in both U-Boot SPL and Linux, read + write with 
byte-exact read-back. I will reword the commit message to name both modes.
> Also, please provide a reference showing that the SD6HC REBAR pulse is 
> fixed at
> two clk_phy cycles. The PHY guide defines the formula, but not the two- 
> cycle
> pulse width.
> 
> 

You are right. The formula (value = rebar pulse width - 1 while extended 
read is active) is from the Cadence DLL PHY guide. The "2 clk_phy 
cycles" is this controller integration's pulse. I don't have an IP-level 
document stating it generically. It is bracketed empirically:

- phony_dqs_timing=0 produces a silent odd/even read duplication (every 
odd byte replaced by a copy of the preceding even byte, zero controller CRC)

- phony_dqs_timing=1 captures both DDR beats cleanly on every card/board

- phony_dqs_timing=2 shifts the strobe a full clk_phy cycle and 
re-corrupts.

So the pulse is 2 and the correct value is 1. I will drop "generic to 
any SD6HC-PHY SoC" and describe it as this integration's value - it is 
not even SoC-generic, as the same SoC's modular SoM variant needs 0 due 
to its longer SD flight time (handled by a follow-up device-tree override).

>> 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.
> 
> The driver sets sdhc_extended_rd_mode whenever t_sdclk != t_sdmclk, so 
> extended
> read is also on for divided SDR modes. Sampling only one edge may 
> explain why the
> corruption was observed in DDR, but it does not establish that zero is the
> correct value for extended-read SDR.
> 
> 

Agreed the single-edge argument alone is not proof. Empirically, the
divided-SDR extended-read modes pass with the field left at 0: on this
hardware only DDR50 ever exhibited the defect (SDR12/25/50/104 and HS 
all pass). So 0 is the verified-good value for the extended-read SDR 
modes, and I scope the non-zero value to DDR to avoid moving modes that 
already pass onto an untested value. I can switch to the simpler
`if (extended_rd_mode) ... else 0` form if you prefer, but that would 
put the SDR modes on an unvalidated setting. I would rather keep the DDR 
gate unless you feel strongly.

>> This is generic to any SD6HC-PHY SoC, so it is kept
>> separate from the per-SoC read-path tuning.
> 
> Also, "this controller" and "generic to any SD6HC-PHY SoC" are not the same
> claim. The PHY guide's example is a 4-cycle RE# pulse, programmed as 3. 
> I do not
> see a statement that this pulse is fixed at 2 clk_phy cycles. Please 
> cite where 2
> comes from, and whether that width is SD6HC IP behavior or specific to this
> integration.
> 
>>
>> Signed-off-by: Tze Yee Ng<tze.yee.ng@altera.com>
>> ---
>>   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 35f35ef9c710..84592ae42762 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
>> +
> 
> Same question as above. Please cite the source of 2, and make the 
> comment match
> whether this is SD6HC-generic or SoC-specific.
> 
>>   /* 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;
>> +
>>       /* 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;
>> +
> 
> Based on the register description, I would expect:
> if (phy->sdhc_extended_rd_mode)
>      phy->cp_phony_dqs_timing = SDHCI_CDNS6_PHY_REBAR_PULSE_CYCLES - 1;
> else
>      phy->cp_phony_dqs_timing = 0;


  reply	other threads:[~2026-09-30 10:24 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22 11:12 [PATCH 0/4] mmc: sdhci-cadence: SD6HC DDR50 read-path tuning and fixes tze.yee.ng
2026-09-22 11:12 ` [PATCH 1/4] mmc: sdhci-cadence6: add PHY settle delay after tuning DLL re-lock tze.yee.ng
2026-09-24  6:41   ` Adrian Hunter
2026-09-30 11:11     ` NG, TZE YEE
2026-09-24  8:49   ` Kathpalia, Tanmay
2026-09-30 11:11     ` NG, TZE YEE
2026-09-26 10:44   ` Kathpalia, Tanmay
2026-09-30 12:05     ` NG, TZE YEE
2026-09-22 11:12 ` [PATCH 2/4] mmc: sdhci-cadence6: program PHONY_DQS_TIMING for extended-read DDR tze.yee.ng
2026-09-24  6:41   ` Adrian Hunter
2026-09-26 10:45   ` Kathpalia, Tanmay
2026-09-30 10:24     ` NG, TZE YEE [this message]
2026-09-22 11:12 ` [PATCH 3/4] dt-bindings: mmc: cdns,sdhci: add SD6HC DDR50 read-path tuning tze.yee.ng
2026-09-26 10:48   ` Kathpalia, Tanmay
2026-09-30 12:31     ` NG, TZE YEE
2026-09-30 13:16       ` NG, TZE YEE
2026-09-28  8:05   ` Krzysztof Kozlowski
2026-09-30 13:13     ` NG, TZE YEE
2026-09-22 11:12 ` [PATCH 4/4] mmc: sdhci-cadence: read SD6HC DDR50 tuning from device tree tze.yee.ng
2026-09-24  6:40   ` Adrian Hunter
2026-09-30 13:24     ` 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=de0c63de-952e-482d-81f9-405453275da5@altera.com \
    --to=tze.yee.ng@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=tanmay.kathpalia@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®