Re: [PATCH v3 05/13] spi: spi-mem: add execute_tuning callback and spi_mem_execute_tuning()
From: Miquel Raynal
Date: Thu May 28 2026 - 04:46:56 EST
On 27/05/2026 at 23:25:19 +0530, Santhosh Kumar K <s-k6@xxxxxx> wrote:
> SPI memory controllers that support high-speed operating modes often
> require a tuning procedure to calibrate internal timing before operating
> at maximum frequency. There is currently no standard spi-mem interface
> for drivers to trigger this procedure.
>
> Add an execute_tuning callback to struct spi_controller_mem_ops. The
> callback receives a mandatory read op template and an optional write op
> template. On success the controller sets op->max_freq in each provided
> template to the validated clock rate.
>
> Add the corresponding spi_mem_execute_tuning() wrapper that validates
> inputs and returns -EOPNOTSUPP when the controller has not implemented
> the callback, allowing callers to handle controllers that do not support
> tuning gracefully.
>
> Signed-off-by: Santhosh Kumar K <s-k6@xxxxxx>
This approach looks so much better.
Reviewed-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>
Thanks,
Miquèl