spi: stm32-qspi: flags management fixes
Merge series from patrice.chotard@foss.st.com <patrice.chotard@foss.st.com> Patrice Chotard <patrice.chotard@foss.st.com>: From: Patrice Chotard <patrice.chotard@foss.st.com> This series update flags management in the following cases: - In APM mode, don't take care of TCF and TEF flags - Always check TCF flag in stm32_qspi_wait_cmd() - Don't check BUSY flag when sending new command
This commit is contained in:
commit
d5efbfc521
|
@ -1782,7 +1782,7 @@ static const struct cqspi_driver_platdata intel_lgm_qspi = {
|
|||
};
|
||||
|
||||
static const struct cqspi_driver_platdata socfpga_qspi = {
|
||||
.quirks = CQSPI_NO_SUPPORT_WR_COMPLETION,
|
||||
.quirks = CQSPI_DISABLE_DAC_MODE | CQSPI_NO_SUPPORT_WR_COMPLETION,
|
||||
};
|
||||
|
||||
static const struct cqspi_driver_platdata versal_ospi = {
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <linux/pm_runtime.h>
|
||||
#include <linux/spi/spi.h>
|
||||
#include <linux/spi/spi-mem.h>
|
||||
#include <linux/sched/task_stack.h>
|
||||
|
||||
#include "internals.h"
|
||||
|
||||
|
@ -211,6 +212,15 @@ static int spi_mem_check_op(const struct spi_mem_op *op)
|
|||
!spi_mem_buswidth_is_valid(op->data.buswidth))
|
||||
return -EINVAL;
|
||||
|
||||
/* Buffers must be DMA-able. */
|
||||
if (WARN_ON_ONCE(op->data.dir == SPI_MEM_DATA_IN &&
|
||||
object_is_on_stack(op->data.buf.in)))
|
||||
return -EINVAL;
|
||||
|
||||
if (WARN_ON_ONCE(op->data.dir == SPI_MEM_DATA_OUT &&
|
||||
object_is_on_stack(op->data.buf.out)))
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -305,10 +305,8 @@ static int stm32_qspi_wait_cmd(struct stm32_qspi *qspi,
|
|||
u32 cr, sr;
|
||||
int err = 0;
|
||||
|
||||
if (!op->data.nbytes)
|
||||
goto wait_nobusy;
|
||||
|
||||
if (readl_relaxed(qspi->io_base + QSPI_SR) & SR_TCF)
|
||||
if ((readl_relaxed(qspi->io_base + QSPI_SR) & SR_TCF) ||
|
||||
qspi->fmode == CCR_FMODE_APM)
|
||||
goto out;
|
||||
|
||||
reinit_completion(&qspi->data_completion);
|
||||
|
@ -327,7 +325,6 @@ static int stm32_qspi_wait_cmd(struct stm32_qspi *qspi,
|
|||
out:
|
||||
/* clear flags */
|
||||
writel_relaxed(FCR_CTCF | FCR_CTEF, qspi->io_base + QSPI_FCR);
|
||||
wait_nobusy:
|
||||
if (!err)
|
||||
err = stm32_qspi_wait_nobusy(qspi);
|
||||
|
||||
|
@ -372,10 +369,6 @@ static int stm32_qspi_send(struct spi_mem *mem, const struct spi_mem_op *op)
|
|||
op->dummy.buswidth, op->data.buswidth,
|
||||
op->addr.val, op->data.nbytes);
|
||||
|
||||
err = stm32_qspi_wait_nobusy(qspi);
|
||||
if (err)
|
||||
goto abort;
|
||||
|
||||
cr = readl_relaxed(qspi->io_base + QSPI_CR);
|
||||
cr &= ~CR_PRESC_MASK & ~CR_FSEL;
|
||||
cr |= FIELD_PREP(CR_PRESC_MASK, flash->presc);
|
||||
|
|
Loading…
Reference in New Issue