Commit 2cc3b37f authored by Rafał Miłecki's avatar Rafał Miłecki Committed by Greg Kroah-Hartman
Browse files

nvmem: add explicit config option to read old syntax fixed OF cells



Binding for fixed NVMEM cells defined directly as NVMEM device subnodes
has been deprecated. It has been replaced by the "fixed-layout" NVMEM
layout binding.

New syntax is meant to be clearer and should help avoiding imprecise
bindings.

NVMEM subsystem already supports the new binding. It should be a good
idea to limit support for old syntax to existing drivers that actually
support & use it (we can't break backward compatibility!). That way we
additionally encourage new bindings & drivers to ignore deprecated
binding.

It wasn't clear (to me) if rtc and w1 code actually uses old syntax
fixed cells. I enabled them to don't risk any breakage.

Signed-off-by: default avatarRafał Miłecki <rafal@milecki.pl>
[for meson-{efuse,mx-efuse}.c]
Acked-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
[for mtk-efuse.c, nvmem/core.c, nvmem-provider.h]
Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
[MT8192, MT8195 Chromebooks]
Tested-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
[for microchip-otpc.c]
Reviewed-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
[SAMA7G5-EK]
Tested-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
Acked-by: default avatarJernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20231020105545.216052-3-srinivas.kandagatla@linaro.org


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 16724d6e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -552,6 +552,7 @@ static int mtd_nvmem_add(struct mtd_info *mtd)
	config.dev = &mtd->dev;
	config.name = dev_name(&mtd->dev);
	config.owner = THIS_MODULE;
	config.add_legacy_fixed_of_cells = of_device_is_compatible(node, "nvmem-cells");
	config.reg_read = mtd_nvmem_reg_read;
	config.size = mtd->size;
	config.word_size = 1;
@@ -898,6 +899,7 @@ static struct nvmem_device *mtd_otp_nvmem_register(struct mtd_info *mtd,
	config.name = compatible;
	config.id = NVMEM_DEVID_AUTO;
	config.owner = THIS_MODULE;
	config.add_legacy_fixed_of_cells = true;
	config.type = NVMEM_TYPE_OTP;
	config.root_only = true;
	config.ignore_wp = true;
+1 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ static int apple_efuses_probe(struct platform_device *pdev)
	struct resource *res;
	struct nvmem_config config = {
		.dev = &pdev->dev,
		.add_legacy_fixed_of_cells = true,
		.read_only = true,
		.reg_read = apple_efuses_read,
		.stride = sizeof(u32),
+5 −3
Original line number Diff line number Diff line
@@ -997,9 +997,11 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
	if (rval)
		goto err_remove_cells;

	if (config->add_legacy_fixed_of_cells) {
		rval = nvmem_add_cells_from_legacy_of(nvmem);
		if (rval)
			goto err_remove_cells;
	}

	rval = nvmem_add_cells_from_fixed_layout(nvmem);
	if (rval)
+1 −0
Original line number Diff line number Diff line
@@ -220,6 +220,7 @@ static int imx_scu_ocotp_write(void *context, unsigned int offset,

static struct nvmem_config imx_scu_ocotp_nvmem_config = {
	.name = "imx-scu-ocotp",
	.add_legacy_fixed_of_cells = true,
	.read_only = false,
	.word_size = 4,
	.stride = 1,
+1 −0
Original line number Diff line number Diff line
@@ -615,6 +615,7 @@ static int imx_ocotp_probe(struct platform_device *pdev)
		return PTR_ERR(priv->clk);

	priv->params = of_device_get_match_data(&pdev->dev);
	imx_ocotp_nvmem_config.add_legacy_fixed_of_cells = true;
	imx_ocotp_nvmem_config.size = 4 * priv->params->nregs;
	imx_ocotp_nvmem_config.dev = dev;
	imx_ocotp_nvmem_config.priv = priv;
Loading