Re: [RFC PATCH 4/6] spi: cadence-qspi: Use PHY for DAC reads if possible

From: Michael Walle
Date: Thu Apr 29 2021 - 18:23:19 EST


Am 2021-04-29 20:19, schrieb Pratyush Yadav:
On 29/04/21 06:28PM, Michael Walle wrote:
Am 2021-03-12 11:17, schrieb Pratyush Yadav:
> On 12/03/21 09:13AM, Tudor.Ambarus@xxxxxxxxxxxxx wrote:
> > On 3/11/21 9:12 PM, Pratyush Yadav wrote:
> > > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> > >
> > > Check if a read is eligible for PHY and if it is, enable PHY and DQS.
> >
> > DQS as in data strobe? Shouldn't the upper layer inform the QSPI
> > controller
> > whether DS is required or not?
>
> Yes, DQS as in data strobe. I need to check this again, but IIRC the
> controller cannot run in PHY mode unless DS is used. Ideally the upper
> layer should indeed inform the controller whether DS is supported/in-use
> or not. That can be used to decide whether PHY mode (and consequently
> the DS line) is to be used or not.
>
> Currently there are only two flashes that use 8D-8D-8D mode (S28HS512T
> and MT35XU512ABA), and both of them drive the DS line.

The LS1028A datasheet explicitly states that the calibration is only
used for non-DQS flashes. Which makes sense, because it just determine at
which point the input data is sampled. And if the flash provides a data
strobe, it already know when to sample it. What I am missing here?

If there was 0 delay in transferring the signals from flash to
SoC/controller, you would be right. But in practice there is a small but
noticeable delay from when the flash launches the signal and when it is
received by the device. So by the time the DQS signal reaches the SoC it
might already be too late and the data lines might not be valid any
more. The calibration accounts for these (and some others) delays.

DQS and the data signals are trace length matched, so for data reads
they will end up on the IO pad of the SoC at the same time. This is
also mentioned in [1] (Fig 1.1, point 4 and 5). So while there needs
to be a delay on the clock line for the receiving FF, the best value
for this should be half the SCK clock period.

Does this work without DQS? That should be the main purpose for a
calibration, no? Because in this case, you'll have to determine
the delay between SCK and the data signals (for reads).

Btw. I can't get my head around how the TX delay search would work.
Basically you shift the SCK to the command / data to the flash. So
the flash will either recognize a valid read command or if the delay
is too short/too long the flash will (hopefully) ignore the wrong
command, correct? Might there be any misinterpreted commands which
might be harmful? Are there any flashes which actually need a delay
between data out and SCK?

Of course, the calibration might help with broken hardware where the
SCK/DQ/DQS traces are not length matched.

-michael


See [0] for a somewhat similar discussion I had with Tudor.

[0] https://lore.kernel.org/linux-mtd/20210312181447.dlecnw2oed7jtxe7@xxxxxx/

[1] https://www.ti.com/lit/an/spract2/spract2.pdf