Commit 5ee294ff authored by Pratyush Yadav's avatar Pratyush Yadav
Browse files

spi: cadence-qspi: Tune PHY to allow running at higher frequencies

The controller can only run at 1/8 ref clock speed without PHY. With
PHY, it can run at the ref clock speed. So, to enable higher speed
operations, perform the PHY tuning algorithm and determine the RX, TX,
and read delay values for optimal performance. The details of the tuning
algorithm can be found at [0].

To allow this tuning to happen, pre-determined data must be programmed
in the flash at the start of the "ospi.phypattern" partition. Without
this data available there, the tuning would fail.

The tuning algorithm is a multi-variable search. We need to find the RX
and TX delays, along with the read delay that would work across a
temperature range. To do that, we first find the upper and lower RX
values at which the tuning pattern is readable (the "passing region")
with Tx = 16 incrementing the read delay for each iteration. If the two
RX values have the same read delay, we then search for RX boundaries at
TX = 48.

Once we find the RX boundaries, we look for the TX boundaries in a
similar fashion with RX set to 1/4 of the RX window (the difference
between the highest and lowest values). And similarly, if the TX
boundaries have the same read delay, we look for the TX boundaries with
RX set to 3/4 of the RX window.

There is a region around the boundary of the two passing regions. This
region is called the failing region. PHY reads will not work in this
region so we want to tune PHY as far from it as possible to allow
for temperature variations. This region is found using binary search
where we progressively narrow the window down until we arrive at the
final boundary's lower and upper limits.

Once PHY is successfully tuned, mark it as usable to allow operations to
run at high speeds.

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



Signed-off-by: default avatarPratyush Yadav <p.yadav@ti.com>
parent 40b107b7
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment