Skip to content

Commit c3f9b7b

Browse files
MrVangregkh
authored andcommitted
nvmem: imx-ocotp-ele: support i.MX95
i.MX95 OCOTP has same accessing method, so add an entry for i.MX95, but some fuse has ECC feature, so only read out the lower 16bits for ECC fuses. Signed-off-by: Peng Fan <[email protected]> Signed-off-by: Srinivas Kandagatla <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 8ca1cfd commit c3f9b7b

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

drivers/nvmem/imx-ocotp-ele.c

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
#include <linux/slab.h>
1515

1616
enum fuse_type {
17-
FUSE_FSB = 1,
18-
FUSE_ELE = 2,
17+
FUSE_FSB = BIT(0),
18+
FUSE_ELE = BIT(1),
19+
FUSE_ECC = BIT(2),
1920
FUSE_INVALID = -1
2021
};
2122

@@ -93,7 +94,10 @@ static int imx_ocotp_reg_read(void *context, unsigned int offset, void *val, siz
9394
continue;
9495
}
9596

96-
*buf++ = readl_relaxed(reg + (i << 2));
97+
if (type & FUSE_ECC)
98+
*buf++ = readl_relaxed(reg + (i << 2)) & GENMASK(15, 0);
99+
else
100+
*buf++ = readl_relaxed(reg + (i << 2));
97101
}
98102

99103
memcpy(val, (u8 *)p, bytes);
@@ -155,8 +159,30 @@ static const struct ocotp_devtype_data imx93_ocotp_data = {
155159
},
156160
};
157161

162+
static const struct ocotp_devtype_data imx95_ocotp_data = {
163+
.reg_off = 0x8000,
164+
.reg_read = imx_ocotp_reg_read,
165+
.size = 2048,
166+
.num_entry = 12,
167+
.entry = {
168+
{ 0, 1, FUSE_FSB | FUSE_ECC },
169+
{ 7, 1, FUSE_FSB | FUSE_ECC },
170+
{ 9, 3, FUSE_FSB | FUSE_ECC },
171+
{ 12, 24, FUSE_FSB },
172+
{ 36, 2, FUSE_FSB | FUSE_ECC },
173+
{ 38, 14, FUSE_FSB },
174+
{ 63, 1, FUSE_ELE },
175+
{ 128, 16, FUSE_ELE },
176+
{ 188, 1, FUSE_ELE },
177+
{ 317, 2, FUSE_FSB | FUSE_ECC },
178+
{ 320, 7, FUSE_FSB },
179+
{ 328, 184, FUSE_FSB }
180+
},
181+
};
182+
158183
static const struct of_device_id imx_ele_ocotp_dt_ids[] = {
159184
{ .compatible = "fsl,imx93-ocotp", .data = &imx93_ocotp_data, },
185+
{ .compatible = "fsl,imx95-ocotp", .data = &imx95_ocotp_data, },
160186
{},
161187
};
162188
MODULE_DEVICE_TABLE(of, imx_ele_ocotp_dt_ids);

0 commit comments

Comments
 (0)