1113-mtd-spi-nor-fsl-quad-move-mtd_device_register-to-the.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. From 6f1195d231ab576809fe2f4cff44a6e48cff2457 Mon Sep 17 00:00:00 2001
  2. From: Yutang Jiang <yutang.jiang@nxp.com>
  3. Date: Fri, 2 Sep 2016 22:00:16 +0800
  4. Subject: [PATCH 113/113] mtd: spi-nor: fsl-quad: move mtd_device_register to
  5. the last of probe
  6. After call mtd_device_register, the mtd devices should be workable immediately.
  7. If before finish all of init work call the mtd_device_register, it will not
  8. respond work request timely.
  9. For example, openwrt/lede have a AUTO split special flash partitions mechanism
  10. while mtd driver register. So, before call mtd_device_register, must let all of
  11. init work ready.
  12. Signed-off-by: Yutang Jiang <yutang.jiang@nxp.com>
  13. ---
  14. drivers/mtd/spi-nor/fsl-quadspi.c | 14 ++++++++++----
  15. 1 file changed, 10 insertions(+), 4 deletions(-)
  16. --- a/drivers/mtd/spi-nor/fsl-quadspi.c
  17. +++ b/drivers/mtd/spi-nor/fsl-quadspi.c
  18. @@ -1280,10 +1280,6 @@ static int fsl_qspi_probe(struct platfor
  19. if (ret)
  20. goto mutex_failed;
  21. - ret = mtd_device_register(mtd, NULL, 0);
  22. - if (ret)
  23. - goto mutex_failed;
  24. -
  25. /* Set the correct NOR size now. */
  26. if (q->nor_size == 0) {
  27. q->nor_size = mtd->size;
  28. @@ -1313,6 +1309,16 @@ static int fsl_qspi_probe(struct platfor
  29. goto last_init_failed;
  30. fsl_qspi_clk_disable_unprep(q);
  31. +
  32. + for (i = 0; i < q->nor_num; i++) {
  33. + /* skip the holes */
  34. + if (!q->has_second_chip)
  35. + i *= 2;
  36. +
  37. + ret = mtd_device_register(&q->nor[i].mtd, NULL, 0);
  38. + if (ret)
  39. + goto last_init_failed;
  40. + }
  41. return 0;
  42. last_init_failed: