Re: [PATCH v4 3/3] spi: stm32-qspi: add automatic poll status feature

From: Boris Brezillon
Date: Tue May 18 2021 - 10:37:14 EST


On Tue, 18 May 2021 15:43:32 +0200
<patrice.chotard@xxxxxxxxxxx> wrote:

> +static int stm32_qspi_poll_status(struct spi_mem *mem, const struct spi_mem_op *op,
> + u16 mask, u16 match,
> + unsigned long initial_delay_us,
> + unsigned long polling_rate_us,
> + unsigned long timeout_ms)
> +{
> + struct stm32_qspi *qspi = spi_controller_get_devdata(mem->spi->master);
> + int ret;
> +

The spi_mem_supports_op() call is still missing.

> + ret = pm_runtime_get_sync(qspi->dev);
> + if (ret < 0) {
> + pm_runtime_put_noidle(qspi->dev);
> + return ret;
> + }
> +
> + mutex_lock(&qspi->lock);
> +
> + writel_relaxed(mask, qspi->io_base + QSPI_PSMKR);
> + writel_relaxed(match, qspi->io_base + QSPI_PSMAR);
> + qspi->fmode = CCR_FMODE_APM;
> + qspi->status_timeout = timeout_ms;
> +
> + ret = stm32_qspi_send(mem, op);
> + mutex_unlock(&qspi->lock);
> +
> + pm_runtime_mark_last_busy(qspi->dev);
> + pm_runtime_put_autosuspend(qspi->dev);
> +
> + return ret;
> +}