Commit a74bbc00 authored by Sergei Miroshnichenko's avatar Sergei Miroshnichenko

RM#1357 qspi: stm32: Add transaction abort write/erase

Based on information from ST:
  "Workarounds linked to Silicon Limitation:
    Extra data written in the FIFO at the end of a read transfer";
parent 79f75672
...@@ -296,6 +296,28 @@ fail: ...@@ -296,6 +296,28 @@ fail:
return err; return err;
} }
static int stm32_qspi_abort(struct stm32_qspi_priv *priv)
{
int err;
priv->regs->cr &= ~QSPI_CR_DMAEN;
priv->regs->cr |= QSPI_CR_ABORT;
err = wait_until_complete(priv);
priv->regs->cr |= QSPI_CR_DMAEN;
if (err)
goto fail;
err = wait_while_busy(priv);
if (err)
goto fail;
return 0;
fail:
error("%s: failed: %d\n", __func__, err);
return err;
}
static int switch_to_memory_mapped(struct stm32_qspi_priv *priv) static int switch_to_memory_mapped(struct stm32_qspi_priv *priv)
{ {
int err; int err;
...@@ -379,6 +401,8 @@ static int erase(struct stm32_qspi_priv *priv, u32 address, size_t size) ...@@ -379,6 +401,8 @@ static int erase(struct stm32_qspi_priv *priv, u32 address, size_t size)
return -EINVAL; return -EINVAL;
} }
stm32_qspi_abort(priv);
while (size) { while (size) {
int err = erase_block(priv, address); int err = erase_block(priv, address);
if (err) if (err)
...@@ -463,6 +487,8 @@ static int write(struct stm32_qspi_priv *priv, u32 address, const u8 *buf, size_ ...@@ -463,6 +487,8 @@ static int write(struct stm32_qspi_priv *priv, u32 address, const u8 *buf, size_
return -EINVAL; return -EINVAL;
} }
stm32_qspi_abort(priv);
current_size = current_size =
(((address & (priv->write_size-1)) + size) > priv->write_size) (((address & (priv->write_size-1)) + size) > priv->write_size)
? (priv->write_size - (address & (priv->write_size-1))) ? (priv->write_size - (address & (priv->write_size-1)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment