0016-mtd-spi-nor-remove-micron_quad_enable.patch 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. From 246e2a5cc60e2179bf8849310b7af9eaa5c505f9 Mon Sep 17 00:00:00 2001
  2. From: Cyrille Pitchen <cyrille.pitchen@atmel.com>
  3. Date: Fri, 8 Jan 2016 17:02:13 +0100
  4. Subject: [PATCH 16/33] mtd: spi-nor: remove micron_quad_enable()
  5. This patch remove the micron_quad_enable() function which force the Quad
  6. SPI mode. However, once this mode is enabled, the Micron memory expect ALL
  7. commands to use the SPI 4-4-4 protocol. Hence a failure does occur when
  8. calling spi_nor_wait_till_ready() right after the update of the Enhanced
  9. Volatile Configuration Register (EVCR) in the micron_quad_enable() as
  10. the SPI controller driver is not aware about the protocol change.
  11. Since there is almost no performance increase using Fast Read 4-4-4
  12. commands instead of Fast Read 1-1-4 commands, we rather keep on using the
  13. Extended SPI mode than enabling the Quad SPI mode.
  14. Let's take the example of the pretty standard use of 8 dummy cycles during
  15. Fast Read operations on 64KB erase sectors:
  16. Fast Read 1-1-4 requires 8 cycles for the command, then 24 cycles for the
  17. 3byte address followed by 8 dummy clock cycles and finally 65536*2 cycles
  18. for the read data; so 131112 clock cycles.
  19. On the other hand the Fast Read 4-4-4 would require 2 cycles for the
  20. command, then 6 cycles for the 3byte address followed by 8 dummy clock
  21. cycles and finally 65536*2 cycles for the read data. So 131088 clock
  22. cycles. The theorical bandwidth increase is 0.0%.
  23. Now using Fast Read operations on 512byte pages:
  24. Fast Read 1-1-4 needs 8+24+8+(512*2) = 1064 clock cycles whereas Fast
  25. Read 4-4-4 would requires 2+6+8+(512*2) = 1040 clock cycles. Hence the
  26. theorical bandwidth increase is 2.3%.
  27. Consecutive reads for non sequential pages is not a relevant use case so
  28. The Quad SPI mode is not worth it.
  29. mtd_speedtest seems to confirm these figures.
  30. Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
  31. Fixes: 548cd3ab54da ("mtd: spi-nor: Add quad I/O support for Micron SPI NOR")
  32. ---
  33. drivers/mtd/spi-nor/spi-nor.c | 46 +------------------------------------------
  34. 1 file changed, 1 insertion(+), 45 deletions(-)
  35. diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
  36. index f8f36d4..6e72e96 100644
  37. --- a/drivers/mtd/spi-nor/spi-nor.c
  38. +++ b/drivers/mtd/spi-nor/spi-nor.c
  39. @@ -1092,45 +1092,6 @@ static int spansion_quad_enable(struct spi_nor *nor)
  40. return 0;
  41. }
  42. -static int micron_quad_enable(struct spi_nor *nor)
  43. -{
  44. - int ret;
  45. - u8 val;
  46. -
  47. - ret = nor->read_reg(nor, SPINOR_OP_RD_EVCR, &val, 1);
  48. - if (ret < 0) {
  49. - dev_err(nor->dev, "error %d reading EVCR\n", ret);
  50. - return ret;
  51. - }
  52. -
  53. - write_enable(nor);
  54. -
  55. - /* set EVCR, enable quad I/O */
  56. - nor->cmd_buf[0] = val & ~EVCR_QUAD_EN_MICRON;
  57. - ret = nor->write_reg(nor, SPINOR_OP_WD_EVCR, nor->cmd_buf, 1);
  58. - if (ret < 0) {
  59. - dev_err(nor->dev, "error while writing EVCR register\n");
  60. - return ret;
  61. - }
  62. -
  63. - ret = spi_nor_wait_till_ready(nor);
  64. - if (ret)
  65. - return ret;
  66. -
  67. - /* read EVCR and check it */
  68. - ret = nor->read_reg(nor, SPINOR_OP_RD_EVCR, &val, 1);
  69. - if (ret < 0) {
  70. - dev_err(nor->dev, "error %d reading EVCR\n", ret);
  71. - return ret;
  72. - }
  73. - if (val & EVCR_QUAD_EN_MICRON) {
  74. - dev_err(nor->dev, "Micron EVCR Quad bit not clear\n");
  75. - return -EINVAL;
  76. - }
  77. -
  78. - return 0;
  79. -}
  80. -
  81. static int set_quad_mode(struct spi_nor *nor, const struct flash_info *info)
  82. {
  83. int status;
  84. @@ -1144,12 +1105,7 @@ static int set_quad_mode(struct spi_nor *nor, const struct flash_info *info)
  85. }
  86. return status;
  87. case SNOR_MFR_MICRON:
  88. - status = micron_quad_enable(nor);
  89. - if (status) {
  90. - dev_err(nor->dev, "Micron quad-read not enabled\n");
  91. - return -EINVAL;
  92. - }
  93. - return status;
  94. + return 0;
  95. default:
  96. status = spansion_quad_enable(nor);
  97. if (status) {
  98. --
  99. 2.8.1