Hi there,
I'm working with kernel 4.9.21 on a i.MX28. I've configured the mxs-ocotp driver and I can read out the hexdump
from the nvmem device.
hexdump /sys/bus/platform/drivers/mxs-ocotp/8002c000.ocotp/mxs-ocotp0/nvmem
0000000 0000 0000 0000 0000 0000 0000 0000 0000
*
0000020 ffd9 c302 0000 0000 0000 0000 0000 0000
0000030 0000 0000 0000 0000 0000 0000 0000 0000
0000040 ffff c302 0000 0000 0000 0000 0000 0000
0000050 0000 0000 0000 0000 0000 0000 0000 0000
*
0000120 0000 000c 0000 0000 0000 0000 0000 0000
0000130 0000 0000 0000 0000 0000 0000 0000 0000
0000140 0105 853b 0000 0000 0000 0000 0000 0000
0000150 312e d449 0000 0000 0000 0000 0000 0000
0000160 01e3 ade5 0000 0000 0000 0000 0000 0000
0000170 0000 0000 0000 0000 0000 0000 0000 0000
*
0000190 01e3 ade5 0000 0000 0000 0000 0000 0000
00001a0 0000 0000 0000 0000 0000 0000 0000 0000
*
0000210 0000 0010 0000 0000 0000 0000 0000 0000
0000220 0000 0000 0000 0000 0000 0000 0000 0000
*
00002a0
So far so good... Now I want to write the MAC addr into the otp register. first of all, there is no implementation for a write function in the mx-ocotp.c. I've now added one, by my self. Now my question is, how can I write the in the correct way my parameters to this function...?
I'm pretty sure there is a simple way to write this stuff....
or does anyone know a better solution for this issue?
Here is the implementation:
static int mxs_ocotp_write(void *context, unsigned int offset,
void *val, size_t bytes)
{
/* We don't want to support writing */
printk("Writing otp would be nice....!!!!!!\n");
printk("offset: %i, value: %lu, bytes: %i ....!!!!!!\n", offset, val, bytes);
return 0;
}
static struct nvmem_config ocotp_config = {
.name = "mxs-ocotp",
.read_only = false,
.stride = 16,
.word_size = 4,
.owner = THIS_MODULE,
.reg_read = mxs_ocotp_read,
.reg_write = mxs_ocotp_write,
};
Thanks for your help.
cheers
Tom