062-v4.11-0002-mtd-spi-nor-improve-macronix_quad_enable.patch 892 B

12345678910111213141516171819202122232425262728
  1. From 1e99d0d51ec97bf48edd277658004ce030543d98 Mon Sep 17 00:00:00 2001
  2. From: Cyrille Pitchen <cyrille.pitchen@atmel.com>
  3. Date: Tue, 6 Dec 2016 17:01:41 +0100
  4. Subject: [PATCH] mtd: spi-nor: improve macronix_quad_enable()
  5. The patch checks whether the Quad Enable bit is already set in the Status
  6. Register. If so, the function exits immediately with a successful return
  7. code.
  8. Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
  9. Reviewed-by: Jagan Teki <jagan@openedev.com>
  10. Acked-by: Marek Vasut <marek.vasut@gmail.com>
  11. ---
  12. drivers/mtd/spi-nor/spi-nor.c | 3 +++
  13. 1 file changed, 3 insertions(+)
  14. --- a/drivers/mtd/spi-nor/spi-nor.c
  15. +++ b/drivers/mtd/spi-nor/spi-nor.c
  16. @@ -1305,6 +1305,9 @@ static int macronix_quad_enable(struct s
  17. val = read_sr(nor);
  18. if (val < 0)
  19. return val;
  20. + if (val & SR_QUAD_EN_MX)
  21. + return 0;
  22. +
  23. write_enable(nor);
  24. write_sr(nor, val | SR_QUAD_EN_MX);