1099-mtd-spi-nor-fsl-quadspi-Add-fast-read-mode-support.patch 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. From c501cdf57682265b72a8180c06e4a01dc2978375 Mon Sep 17 00:00:00 2001
  2. From: Yunhui Cui <B56489@freescale.com>
  3. Date: Mon, 1 Feb 2016 18:26:23 +0800
  4. Subject: [PATCH 099/113] mtd:spi-nor:fsl-quadspi:Add fast-read mode support
  5. The qspi driver add generic fast-read mode for different
  6. flash venders. There are some different board flash work on
  7. different mode, such fast-read, quad-mode.
  8. So we have to modify the third entrace parameter of spi_nor_scan().
  9. Signed-off-by: Yunhui Cui <B56489@freescale.com>
  10. ---
  11. drivers/mtd/spi-nor/fsl-quadspi.c | 27 +++++++++++++++++++++------
  12. 1 file changed, 21 insertions(+), 6 deletions(-)
  13. --- a/drivers/mtd/spi-nor/fsl-quadspi.c
  14. +++ b/drivers/mtd/spi-nor/fsl-quadspi.c
  15. @@ -389,11 +389,21 @@ static void fsl_qspi_init_lut(struct fsl
  16. /* Read */
  17. lut_base = SEQID_READ * 4;
  18. - qspi_writel(q, LUT0(CMD, PAD1, read_op) | LUT1(ADDR, PAD1, addrlen),
  19. - base + QUADSPI_LUT(lut_base));
  20. - qspi_writel(q, LUT0(DUMMY, PAD1, read_dm) |
  21. - LUT1(FSL_READ, PAD4, rxfifo),
  22. - base + QUADSPI_LUT(lut_base + 1));
  23. + if (nor->flash_read == SPI_NOR_FAST) {
  24. + qspi_writel(q, LUT0(CMD, PAD1, read_op) |
  25. + LUT1(ADDR, PAD1, addrlen),
  26. + base + QUADSPI_LUT(lut_base));
  27. + qspi_writel(q, LUT0(DUMMY, PAD1, read_dm) |
  28. + LUT1(FSL_READ, PAD1, rxfifo),
  29. + base + QUADSPI_LUT(lut_base + 1));
  30. + } else if (nor->flash_read == SPI_NOR_QUAD) {
  31. + qspi_writel(q, LUT0(CMD, PAD1, read_op) |
  32. + LUT1(ADDR, PAD1, addrlen),
  33. + base + QUADSPI_LUT(lut_base));
  34. + qspi_writel(q, LUT0(DUMMY, PAD1, read_dm) |
  35. + LUT1(FSL_READ, PAD4, rxfifo),
  36. + base + QUADSPI_LUT(lut_base + 1));
  37. + }
  38. /* Write enable */
  39. lut_base = SEQID_WREN * 4;
  40. @@ -468,6 +478,7 @@ static int fsl_qspi_get_seqid(struct fsl
  41. {
  42. switch (cmd) {
  43. case SPINOR_OP_READ_1_1_4:
  44. + case SPINOR_OP_READ_FAST:
  45. return SEQID_READ;
  46. case SPINOR_OP_WREN:
  47. return SEQID_WREN;
  48. @@ -964,6 +975,7 @@ static int fsl_qspi_probe(struct platfor
  49. struct spi_nor *nor;
  50. struct mtd_info *mtd;
  51. int ret, i = 0;
  52. + enum read_mode mode = SPI_NOR_QUAD;
  53. q = devm_kzalloc(dev, sizeof(*q), GFP_KERNEL);
  54. if (!q)
  55. @@ -1065,7 +1077,10 @@ static int fsl_qspi_probe(struct platfor
  56. /* set the chip address for READID */
  57. fsl_qspi_set_base_addr(q, nor);
  58. - ret = spi_nor_scan(nor, NULL, SPI_NOR_QUAD);
  59. + ret = of_property_read_bool(np, "m25p,fast-read");
  60. + mode = (ret) ? SPI_NOR_FAST : SPI_NOR_QUAD;
  61. +
  62. + ret = spi_nor_scan(nor, NULL, mode);
  63. if (ret)
  64. goto mutex_failed;