* Questions about OTP driver @ 2014-10-26 20:01 Stefan Wahren 2014-10-28 11:07 ` Christian Riesch 0 siblings, 1 reply; 3+ messages in thread From: Stefan Wahren @ 2014-10-26 20:01 UTC (permalink / raw) To: linux-mtd Hi, currently i try to port a driver for One Time Programmable memory pages on Freescale MX23/MX28 (ARM9) SoC. This driver gives readonly access to these memory pages via Sysfs. As i created a patch RFC [1], Arnd Bergmann suggested me to move the driver to MTD. Now i have some questions: 1. What exact directory is suggested for OTP on SoC driver? 2. What is a good example implementaton of an OTP driver? Best regards Stefan Wahren [1] - http://lists.infradead.org/pipermail/linux-arm-kernel/2014-October/295228.html ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Questions about OTP driver 2014-10-26 20:01 Questions about OTP driver Stefan Wahren @ 2014-10-28 11:07 ` Christian Riesch 2014-10-29 7:26 ` Stefan Wahren 0 siblings, 1 reply; 3+ messages in thread From: Christian Riesch @ 2014-10-28 11:07 UTC (permalink / raw) To: Stefan Wahren; +Cc: linux-mtd@lists.infradead.org, Arnd Bergmann Hi Stefan, I am not an expert in the mtd field, but in the last years I added OTP support for the drivers/mtd/chips/cfi_cmdset_0002.c driver and did a little cleanup. On Sun, Oct 26, 2014 at 9:01 PM, Stefan Wahren <stefan.wahren@i2se.com> wrote: > Hi, > > currently i try to port a driver for One Time Programmable memory pages on > Freescale MX23/MX28 (ARM9) SoC. > This driver gives readonly access to these memory pages via Sysfs. > > As i created a patch RFC [1], Arnd Bergmann suggested me to move the driver to > MTD. > > Now i have some questions: > > 1. What exact directory is suggested for OTP on SoC driver? drivers/mtd/devices? > 2. What is a good example implementaton of an OTP driver? For drivers that support OTP see git grep _read_user_prot_reg. It's the cfi_cmdset_0001.c (both from drivers/mtd/chips), the cfi_cmdset_0002.c, the drivers/mtd/devices/mtd_dataflash.c, and the drivers/mtd/onenand/onenand_base.c. All these devices are memory chips that have a little OTP memory in addition to the regular flash memory. I am not aware of OTP drivers for SoCs. The most simple implementation of OTP is probably the one in drivers/mtd/devices/mtd_dataflash.c (see the dataflash_get_otp_info and dataflash_read_{user,fact}_otp functions). The others are more complex since they support several flash devices concatenated, which means that there may be several OTP memory blocks. The driver must then walk through these blocks. Regarding your question on the arm kernel mailing list [1]: > Does MTD drivers have a readonly text (non binary) user interface? No, you offer a /dev/mtdX interface, with an ioctl you switch it to OTP operation (see flash_otp_dump from mtd-utils[2]). Then the OTP memory is offered in binary and can be read using read() etc. Regards, Christian [1] http://marc.info/?l=linux-arm-kernel&m=141381928515849&w=2 [2] http://git.infradead.org/mtd-utils.git/blob/HEAD:/flash_otp_dump.c ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Questions about OTP driver 2014-10-28 11:07 ` Christian Riesch @ 2014-10-29 7:26 ` Stefan Wahren 0 siblings, 0 replies; 3+ messages in thread From: Stefan Wahren @ 2014-10-29 7:26 UTC (permalink / raw) To: Christian Riesch; +Cc: linux-mtd@lists.infradead.org, Arnd Bergmann Hi Christian, Am 28.10.2014 um 12:07 schrieb Christian Riesch: > Hi Stefan, > I am not an expert in the mtd field, but in the last years I added OTP > support for the drivers/mtd/chips/cfi_cmdset_0002.c driver and did a > little cleanup. > > On Sun, Oct 26, 2014 at 9:01 PM, Stefan Wahren <stefan.wahren@i2se.com> wrote: >> Hi, >> >> currently i try to port a driver for One Time Programmable memory pages on >> Freescale MX23/MX28 (ARM9) SoC. >> This driver gives readonly access to these memory pages via Sysfs. >> >> As i created a patch RFC [1], Arnd Bergmann suggested me to move the driver to >> MTD. >> >> Now i have some questions: >> >> 1. What exact directory is suggested for OTP on SoC driver? > drivers/mtd/devices? > >> 2. What is a good example implementaton of an OTP driver? > For drivers that support OTP see git grep _read_user_prot_reg. It's > the cfi_cmdset_0001.c (both from drivers/mtd/chips), the > cfi_cmdset_0002.c, the drivers/mtd/devices/mtd_dataflash.c, and the > drivers/mtd/onenand/onenand_base.c. All these devices are memory chips > that have a little OTP memory in addition to the regular flash memory. > I am not aware of OTP drivers for SoCs. > > The most simple implementation of OTP is probably the one in > drivers/mtd/devices/mtd_dataflash.c (see the dataflash_get_otp_info > and dataflash_read_{user,fact}_otp functions). The others are more > complex since they support several flash devices concatenated, which > means that there may be several OTP memory blocks. The driver must > then walk through these blocks. > > Regarding your question on the arm kernel mailing list [1]: >> Does MTD drivers have a readonly text (non binary) user interface? > No, you offer a /dev/mtdX interface, with an ioctl you switch it to > OTP operation (see flash_otp_dump from mtd-utils[2]). Then the OTP > memory is offered in binary and can be read using read() etc. > > Regards, Christian > > [1] http://marc.info/?l=linux-arm-kernel&m=141381928515849&w=2 > [2] http://git.infradead.org/mtd-utils.git/blob/HEAD:/flash_otp_dump.c thanks a lot for your explanations, but it confirms me that's not the right way to merge all memory blocks in a single device. I think the term OTP is misleading and i should better talk about fuses. BR Stefan ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-10-29 7:26 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-10-26 20:01 Questions about OTP driver Stefan Wahren 2014-10-28 11:07 ` Christian Riesch 2014-10-29 7:26 ` Stefan Wahren
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.