FAILED: patch "[PATCH] nvmem: imx-ocotp-ele: fix MAC address byte order" failed to apply to 6.6-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x 391b06ecb63e6eacd054582cb4eb738dfbf5eb77
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2025021141-negotiate-many-f58a@gregkh' --subject-prefix 'PATCH 6.6.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 391b06ecb63e6eacd054582cb4eb738dfbf5eb77 Mon Sep 17 00:00:00 2001
From: Sascha Hauer <[email protected]>
Date: Mon, 30 Dec 2024 14:18:58 +0000
Subject: [PATCH] nvmem: imx-ocotp-ele: fix MAC address byte order
According to the i.MX93 Fusemap the two MAC addresses are stored in words 315 to 317 like this:
315 MAC1_ADDR_31_0[31:0]
316 MAC1_ADDR_47_32[47:32]
MAC2_ADDR_15_0[15:0]
317 MAC2_ADDR_47_16[31:0]
This means the MAC addresses are stored in reverse byte order. We have to swap the bytes before passing them to the upper layers. The storage format is consistent to the one used on i.MX6 using imx-ocotp driver which does the same byte swapping as introduced here.
With this patch the MAC address on my i.MX93 TQ board correctly reads as 00:d0:93:6b:27:b8 instead of b8:27:6b:93:d0:00.
drivers/nvmem/imx-ocotp-ele.c +22 -0
@@ -111,6 +111,26 @@ static int imx_ocotp_reg_read(void *context, unsigned int offset, void *val, sizreturn 0 ; }; +static int imx_ocotp_cell_pp (void *context,const char *id,int index, +unsigned int offset,void *data,size_t bytes) +{ +u8 *buf = data; +int i; + +/* Deal with some post processing of nvmem cell data */ +if (id && !strcmp (id,"mac-address" )) +for (i =0 ; i < bytes /2 ; i++) +swap (buf[i], buf[bytes - i -1 ]); + +return 0 ; +} + +static void imx_ocotp_fixup_dt_cell_info (struct nvmem_device *nvmem, +struct nvmem_cell_info *cell) +{ + cell->read_post_process = imx_ocotp_cell_pp; +} +static int imx_ele_ocotp_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;
@@ -137,6 +157,8 @@ static int imx_ele_ocotp_probe(struct platform_device *pdev) priv->config.stride =1 ; priv->config.priv = priv; priv->config.read_only = true; + priv->config.add_legacy_fixed_of_cells = true; + priv->config.fixup_dt_cell_info = imx_ocotp_fixup_dt_cell_info;mutex_init (&priv->lock); nvmem =devm_nvmem_register (dev, &priv->config);