On Thu Nov 5, 2026 at 11:58 AM CET, Santhosh Kumar K wrote: > This series implements PHY tuning support for the Cadence QSPI controller > to enable reliable high-speed operations. Without PHY tuning, controllers > use conservative timing that limits performance. PHY tuning calibrates > RX/TX delay lines to find optimal data capture timing windows, enabling > operation up to the controller's maximum frequency. > > Background: > High-speed SPI memory controllers require precise timing calibration for > reliable operation. At higher frequencies, board-to-board variations make > fixed timing parameters inadequate. The Cadence QSPI controller includes > a PHY interface with programmable delay lines (0-127 taps) for RX and TX > paths, but these require runtime calibration to find the valid timing > window. > > Approach: > Add SDR/DDR PHY tuning algorithms for the Cadence controller: > > SDR Mode Tuning (1D search): > - Searches for two consecutive valid RX delay windows > - Selects the larger window and uses its midpoint for maximum margin > - TX delay fixed at maximum (127) as it's less critical in SDR > > DDR Mode Tuning (2D search): > - Finds RX boundaries (rxlow/rxhigh) using TX window sweeps > - Finds TX boundaries (txlow/txhigh) at fixed RX positions > - Defines valid region corners and detects gaps via binary search > - Applies temperature compensation for optimal point selection > - Handles single or dual passing regions with different strategies > > Patch description: > Infrastructure (1-5): > - Patch 1: Add spi-max-post-config-frequency-hz to describe maximum > frequency achievable post controller configuration > - Patch 2: Add spi-phy-pattern-partition phandle for > NOR flash PHY tuning pattern location > - Patch 3: Parse spi-max-post-config-frequency-hz in spi.c; adds > spi_device.post_config_max_speed_hz (0 when not set > keeping all existing DT fully compatible) > - Patch 4: Extend spi_mem_adjust_op_freq() with a bypass: if > op->max_freq equals post_config_max_speed_hz, return > immediately leaving op->max_freq unchanged. All other > ops are capped to max_speed_hz. Also require per_op_freq > controller capability for post-config ops in > spi_mem_default_supports_op() > - Patch 5: Add execute_tuning callback to spi_controller_mem_ops and > spi_mem_execute_tuning() wrapper in SPI-MEM core; > serialises access via spi_mem_access_start/end and > rejects GPIO chip selects > > Cadence QSPI Implementation (6-14): > - Patch 6: Move cqspi_readdata_capture() earlier (preparatory) > - Patch 7: Add DQS bit to cqspi_readdata_capture() (preparatory) > - Patch 8: Add complete PHY tuning support: DLL management, pattern > verification (NOR via spi-phy-pattern-partition phandle, > NAND via write-to-cache), SDR 1D and DDR 2D search > algorithms with temperature compensation, AM654-specific > execute_tuning entry point > - Patch 9: Reject 2-byte-address DDR operations via a new > CQSPI_NO_PHY_TUNING_WITH_ODDR_2B_ADDR quirk flag to work > around AM654 OSPI erratum i2383 > - Patch 10: Refactor direct read path for PHY support (preparatory) > - Patch 11: Enable PHY for direct reads at the calibrated frequency > when both transfer boundaries are 16-byte aligned, > falling back to non-PHY DMA otherwise; also reprograms > DLL on chip-select switch when two devices have > different calibrated settings > - Patch 12: Enable PHY for indirect writes of at least > CQSPI_PHY_MIN_INDIRECT_WRITE_LEN bytes > - Patch 13: Reprogram per-device CS timing on any chip-select switch > - Patch 14: Reprogram the PHY DLL (master config and RX/TX taps) on > runtime resume, since the DLL loses its lock when the > OSPI controller is power-gated > > MTD core (15-19): > - Patch 15: Extract spinand_select_op_variant() into a shared helper > spinand_op_find_best_variant() with a skip_mask > - Patch 16: Negotiate optimal controller operating point before dirmap > creation; iterate all read variants in performance order > across ODTR and SSDR interfaces; re-pair cont_read_cache after > PHY tuning via protocol-shape matching > - Patch 17: Extract spi_nor_spimem_get_read_op() helper (preparatory) > - Patch 18: Execute controller optimization in spi_nor_probe() before > creating dirmaps > - Patch 19: Reset max_read_op frequency for security register reads So what is the merging strategy here? Getting the first parts in and then getting the spinand and spi_nor in in the next cycle? FWIW, the spi-nor parts looks good. -michael