0071-driver-fsl_qspi-disable-AHB-buffer-prefetch.patch 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. From e2a5bba97cd6e42b2b631bd17012aa26ffdb5f67 Mon Sep 17 00:00:00 2001
  2. From: Yunhui Cui <[email protected]>
  3. Date: Tue, 12 Jul 2016 10:30:08 +0800
  4. Subject: [PATCH 71/93] driver: fsl_qspi: disable AHB buffer prefetch
  5. Errata: A-009282: QuadSPI data pre-fetch can result in incorrect data
  6. When we enable the CONFIG_SYS_FSL_QSPI_AHB, we need this errata workaround.
  7. Signed-off-by: Yunhui Cui <[email protected]>
  8. ---
  9. drivers/spi/fsl_qspi.c | 12 +++++++++++-
  10. include/configs/ls1012a_common.h | 1 +
  11. 2 files changed, 12 insertions(+), 1 deletion(-)
  12. diff --git a/drivers/spi/fsl_qspi.c b/drivers/spi/fsl_qspi.c
  13. index 09759fa..f1c87f5 100644
  14. --- a/drivers/spi/fsl_qspi.c
  15. +++ b/drivers/spi/fsl_qspi.c
  16. @@ -441,13 +441,23 @@ static void qspi_enable_ddr_mode(struct fsl_qspi_priv *priv)
  17. static void qspi_init_ahb_read(struct fsl_qspi_priv *priv)
  18. {
  19. struct fsl_qspi_regs *regs = priv->regs;
  20. + int rx_size = 0x80;
  21. /* AHB configuration for access buffer 0/1/2 .*/
  22. qspi_write32(priv->flags, &regs->buf0cr, QSPI_BUFXCR_INVALID_MSTRID);
  23. qspi_write32(priv->flags, &regs->buf1cr, QSPI_BUFXCR_INVALID_MSTRID);
  24. qspi_write32(priv->flags, &regs->buf2cr, QSPI_BUFXCR_INVALID_MSTRID);
  25. +
  26. +#ifdef CONFIG_SYS_FSL_ERRATUM_A009282
  27. + /*A-009282: QuadSPI data pre-fetch can result in incorrect data
  28. + *Workaround: Keep the read data size to 64 bits (8 Bytes), which
  29. + *disables the prefetch on the AHB buffer,and prevents this issue
  30. + *from occurring.
  31. + */
  32. + rx_size = 0x1;
  33. +#endif
  34. qspi_write32(priv->flags, &regs->buf3cr, QSPI_BUF3CR_ALLMST_MASK |
  35. - (0x80 << QSPI_BUF3CR_ADATSZ_SHIFT));
  36. + (rx_size << QSPI_BUF3CR_ADATSZ_SHIFT));
  37. /* We only use the buffer3 */
  38. qspi_write32(priv->flags, &regs->buf0ind, 0);
  39. diff --git a/include/configs/ls1012a_common.h b/include/configs/ls1012a_common.h
  40. index 47b8ec3..f0ae355 100644
  41. --- a/include/configs/ls1012a_common.h
  42. +++ b/include/configs/ls1012a_common.h
  43. @@ -68,6 +68,7 @@
  44. #define FSL_QSPI_FLASH_SIZE (1 << 26)
  45. #define FSL_QSPI_FLASH_NUM 2
  46. #define CONFIG_SYS_FSL_QSPI_AHB
  47. +#define CONFIG_SYS_FSL_ERRATUM_A009282
  48. /*
  49. * Environment
  50. --
  51. 1.7.9.5