1107-mtd-fsl-quadspi-disable-AHB-buffer-prefetch.patch 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. From 50aac689d5be0a086f076cd4bc8b14ee0b9ab995 Mon Sep 17 00:00:00 2001
  2. From: Yunhui Cui <yunhui.cui@nxp.com>
  3. Date: Tue, 8 Mar 2016 14:38:52 +0800
  4. Subject: [PATCH 107/113] mtd: fsl-quadspi: disable AHB buffer prefetch
  5. A-009282: QuadSPI: QuadSPI data pre-fetch can result in incorrect data
  6. Affects: QuadSPI
  7. Description: With AHB buffer prefetch enabled, the QuadSPI may return
  8. incorrect data on the AHB
  9. interface. The buffer pre-fetch is enabled if the fetch size as
  10. configured either in the LUT or in
  11. the BUFxCR register is greater than 8 bytes.
  12. Impact: Only 64 bit read allowed.
  13. Workaround: Keep the read data size to 64 bits (8 Bytes), which disables
  14. the prefetch on the AHB buffer,
  15. and prevents this issue from occurring.
  16. Signed-off-by: Yunhui Cui <yunhui.cui@nxp.com>
  17. ---
  18. drivers/mtd/spi-nor/fsl-quadspi.c | 29 +++++++++++++++++++++++------
  19. 1 file changed, 23 insertions(+), 6 deletions(-)
  20. --- a/drivers/mtd/spi-nor/fsl-quadspi.c
  21. +++ b/drivers/mtd/spi-nor/fsl-quadspi.c
  22. @@ -794,19 +794,36 @@ static void fsl_qspi_init_abh_read(struc
  23. {
  24. void __iomem *base = q->iobase;
  25. int seqid;
  26. + const struct fsl_qspi_devtype_data *devtype_data = q->devtype_data;
  27. /* AHB configuration for access buffer 0/1/2 .*/
  28. qspi_writel(q, QUADSPI_BUFXCR_INVALID_MSTRID, base + QUADSPI_BUF0CR);
  29. qspi_writel(q, QUADSPI_BUFXCR_INVALID_MSTRID, base + QUADSPI_BUF1CR);
  30. qspi_writel(q, QUADSPI_BUFXCR_INVALID_MSTRID, base + QUADSPI_BUF2CR);
  31. +
  32. /*
  33. - * Set ADATSZ with the maximum AHB buffer size to improve the
  34. - * read performance.
  35. + * Errata: A-009282: QuadSPI data prefetch may result in incorrect data
  36. + * Workaround: Keep the read data size to 64 bits (8 bytes).
  37. + * This disables the prefetch on the AHB buffer and
  38. + * prevents this issue from occurring.
  39. */
  40. - qspi_writel(q, QUADSPI_BUF3CR_ALLMST_MASK |
  41. - ((q->devtype_data->ahb_buf_size / 8)
  42. - << QUADSPI_BUF3CR_ADATSZ_SHIFT),
  43. - base + QUADSPI_BUF3CR);
  44. + if (devtype_data->devtype == FSL_QUADSPI_LS2080A ||
  45. + devtype_data->devtype == FSL_QUADSPI_LS1021A) {
  46. +
  47. + qspi_writel(q, QUADSPI_BUF3CR_ALLMST_MASK |
  48. + (1 << QUADSPI_BUF3CR_ADATSZ_SHIFT),
  49. + base + QUADSPI_BUF3CR);
  50. +
  51. + } else {
  52. + /*
  53. + * Set ADATSZ with the maximum AHB buffer size to improve the
  54. + * read performance.
  55. + */
  56. + qspi_writel(q, QUADSPI_BUF3CR_ALLMST_MASK |
  57. + ((q->devtype_data->ahb_buf_size / 8)
  58. + << QUADSPI_BUF3CR_ADATSZ_SHIFT),
  59. + base + QUADSPI_BUF3CR);
  60. + }
  61. /* We only use the buffer3 */
  62. qspi_writel(q, 0, base + QUADSPI_BUF0IND);