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