Erasing Flash NOR: ioctl(MEMUNLOCK) return status?

前端 未结 1 912
再見小時候
再見小時候 2021-01-05 06:26

I\'m trying to erase a NOR Flash memory with Linux MTD driver in C...

I\'m confused about the return status from the ioctl(MEMUNLOCK) call which returns

相关标签:
1条回答
  • 2021-01-05 07:28

    For a flash chip that I worked on (drivers/mtd/devices/m25p80.c), I found that UNLOCK was not implemented. The driver's ioctl(UNLOCK) returned -EOPNOTSUPP=95. And code inspection showed mtd_unlock return status being dropped on the floor, as you have found.

    These imply assumptions in the m25p80 driver that flash will just never be locked, and in the mtd drivers that it's OK for the device driver to omit UNLOCK. On the board I worked on, flash was being locked by u-boot after every write, so erase and reprogram from linux didn't work at all. I looked at u-boot driver and device datasheet, got some code to implement m25p80_lock and m25p80_unlock, it was not too difficult after I knew what was up. I did not upstream it.

    It does seem like a defect for chip drivers to not implement these.

    By the way Mousstix, very nice job providing full information in this question.

    0 讨论(0)
提交回复
热议问题