From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dirk Behme Date: Wed, 22 Aug 2012 18:25:57 +0200 Subject: [U-Boot] [PATCH 3/5] Add fuse API and commands In-Reply-To: <122060610.2688957.1345633901706.JavaMail.root@advansee.com> References: <122060610.2688957.1345633901706.JavaMail.root@advansee.com> Message-ID: <50350815.1040406@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 22.08.2012 13:11, Beno?t Th?baudeau wrote: > Hi Dirk, > > On Wednesday, August 22, 2012 12:43:05 PM, Dirk Behme wrote: >> On 14.08.2012 14:52, Beno?t Th?baudeau wrote: >>> This can be useful for fuse-like hardware, OTP SoC options, etc. >> >> For i.MX6, I have a port of the OTP support from Freescale's U-Boot >> to >> our mainline U-Boot in the queue [1]. >> >> As I don't have the overview over the various i.MXxx SoCs and don't >> understand much of this patch below: Should this implement the same >> functionality like my patch [1] for i.MX6? >> >> Or shall I send my patch [1] to this mailing list for official review >> because the functionality here and there is orthogonal? >> >> Thanks >> >> Dirk >> >> [1] >> https://github.com/dirkbehme/u-boot-imx6/commit/da718b338a79af160f7b7e542fe97b24edbfc36a > > This OTP IP is different from the IIM IP of other i.MXs, so having a different > driver for it is fine. > > What you can do is implement in your driver the fuse API You mean http://lists.denx.de/pipermail/u-boot/2012-August/130904.html here, correct? >that I've defined in > this series. In that way, you could drop your common/cmd_imxotp.c and use the > commands from this series. Let's see how this fits to i.MX6: My understanding is that the i.MX6 has 128 fuse 'registers' (#define IMX_OTP_ADDR_MAX 0x7F), each containing 32 fuses/bits. These fuses/bits can be written from 0 -> 1 once. Looking at your API [2] we could set 'bank' to 0 and interpret 'row' as the 'register' number. That might fit. Doing this, fuse_read_bit/row() and fuse_prog_bit/row() could be used for i.MX6. From i.MX6 point of view, as I don't know your use case, I'm not sure what fuse_sense_bit/row() and fuse_override_bit/row() might be good for? Anybody else: Does this make sense? Or should we keep the i.MX6 specific common/cmd_imxotp.c (see [1] above)?. Best regards Dirk [2] + * Read/Sense/Program/Override interface: + * bank: Fuse bank + * row: Fuse row within the bank + * bit: Fuse bit within the row + * val: Value to read/write + * + * Returns: 0 on success, not 0 on failure + */ +int fuse_read_bit(u32 bank, u32 row, u32 bit, u32 *val); +int fuse_read_row(u32 bank, u32 row, u32 *val); +int fuse_sense_bit(u32 bank, u32 row, u32 bit, u32 *val); +int fuse_sense_row(u32 bank, u32 row, u32 *val); +int fuse_prog_bit(u32 bank, u32 row, u32 bit); +int fuse_prog_row(u32 bank, u32 row, u32 val); +int fuse_override_bit(u32 bank, u32 row, u32 bit, u32 val); +int fuse_override_row(u32 bank, u32 row, u32 val);