Patch "nvmem: imx-ocotp-ele: fix MAC address byte order" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    nvmem: imx-ocotp-ele: fix MAC address byte order

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     nvmem-imx-ocotp-ele-fix-mac-address-byte-order.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 93f1413f9c6dcfb7728c8df89f42dfede86d75cf
Author: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
Date:   Mon Dec 30 14:18:58 2024 +0000

    nvmem: imx-ocotp-ele: fix MAC address byte order
    
    [ Upstream commit 391b06ecb63e6eacd054582cb4eb738dfbf5eb77 ]
    
    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.
    
    Fixes: 22e9e6fcfb50 ("nvmem: imx: support i.MX93 OCOTP")
    Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
    Cc: stable <stable@xxxxxxxxxx>
    Reviewed-by: Peng Fan <peng.fan@xxxxxxx>
    Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20241230141901.263976-4-srinivas.kandagatla@xxxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/nvmem/imx-ocotp-ele.c b/drivers/nvmem/imx-ocotp-ele.c
index dfc925edfc83e..1356ec93bfd00 100644
--- a/drivers/nvmem/imx-ocotp-ele.c
+++ b/drivers/nvmem/imx-ocotp-ele.c
@@ -107,6 +107,26 @@ static int imx_ocotp_reg_read(void *context, unsigned int offset, void *val, siz
 	return 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;
@@ -133,6 +153,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);




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux