803-nvmem-core-fix-support-for-fixed-cells-NVMEM-layout.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <[email protected]>
  2. Date: Thu, 13 Jul 2023 17:30:59 +0200
  3. Subject: [PATCH] nvmem: core: fix support for fixed cells NVMEM layout
  4. MIME-Version: 1.0
  5. Content-Type: text/plain; charset=UTF-8
  6. Content-Transfer-Encoding: 8bit
  7. Returning -EPROBE_DEFER for "fixed-layout" makes nvmem_register() always
  8. fail (that layout is supported internally with no external module). That
  9. makes callers (e.g. mtd_nvmem_add()) fail as well and prevents booting
  10. on devices with "fixed-layout" in DT.
  11. Add a quick workaround for it.
  12. Fixes: 6468a6f45148 ("nvmem: core: handle the absence of expected layouts")
  13. Signed-off-by: Rafał Miłecki <[email protected]>
  14. ---
  15. --- a/drivers/nvmem/core.c
  16. +++ b/drivers/nvmem/core.c
  17. @@ -798,6 +798,19 @@ static struct nvmem_layout *nvmem_layout
  18. return NULL;
  19. /*
  20. + * We should return -EPROBE_DEFER only when layout driver is expected to
  21. + * become available later. Otherwise NVMEM will never probe successfully
  22. + * for unsupported layouts. There is no known solution for that right
  23. + * now.
  24. + *
  25. + * This problem also affects "fixed-layout". It's supported in NVMEM
  26. + * core code so there never will be layout for it. We shouldn't return
  27. + * -EPROBE_DEFER in such case. Add a quick workaround for that.
  28. + */
  29. + if (of_device_is_compatible(layout_np, "fixed-layout"))
  30. + return NULL;
  31. +
  32. + /*
  33. * In case the nvmem device was built-in while the layout was built as a
  34. * module, we shall manually request the layout driver loading otherwise
  35. * we'll never have any match.