mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Oleksij Rempel <o.rempel@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v1 5/7] nvmem: regmap: Implement protect operation using regmap_seal
Date: Thu, 5 Jun 2025 06:40:34 +0200	[thread overview]
Message-ID: <aEEfwlq2ZGEhTRGo@pengutronix.de> (raw)
In-Reply-To: <aD11nyDMePysqzgE@pengutronix.de>

Hi Sascha,

On Mon, Jun 02, 2025 at 11:57:51AM +0200, Sascha Hauer wrote:
> > +	for (i = 0; i < bytes; i += reg_val_bytes) {
> > +		unsigned int current_reg_offset = offset + i;
> > +
> > +		ret = regmap_seal(map, current_reg_offset, seal_flags);
> > +		if (ret) {
> > +			dev_err(regmap_get_device(map), "regmap_seal failed for offset 0x%x: %pe\n",
> > +				current_reg_offset, ERR_PTR(ret));
> > +			/* No error handling for partial failures, we messed up
> > +			 * the HW state and can't recover.
> > +			 */
> > +			return ret;
> > +		}
> > +	}
> 
> The i.MX OCOTP offers write protection for fuses as well. AFAIR
> there are single fuses for protecting a whole range of fuses, so to
> support this we would have to pass the full range down to the driver
> instead of separating the range into registers here.
> 
> I never looked at the i.MX OCOTP locking capabilities very closely, so
> it could be that even passing a range is not good enough to make this
> implementable for the OCOTP. We might want to have a look into this
> before deciding if we want to implement protect for the drivers based on
> single registers.

Both are valid options and can be at least partially offloaded to the
framework. regmap already supports reg_[read|write] for per-register
accesses and [read|write] for bulk operations. The same we can do for
the seal operations - provide bulk or per-device ops of needed.

Best Regards,
Oleksij
-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



  reply	other threads:[~2025-06-05  4:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-30 11:40 [PATCH v1 0/7] NVMEM: Introduce write protection support Oleksij Rempel
2025-05-30 11:41 ` [PATCH v1 1/7] nvmem: Add 'protect' operation to core framework Oleksij Rempel
2025-06-02  9:04   ` Sascha Hauer
2025-05-30 11:41 ` [PATCH v1 2/7] nvmem: rmem: add write and protect support Oleksij Rempel
2025-06-02  9:33   ` Sascha Hauer
2025-05-30 11:41 ` [PATCH v1 3/7] commands: nvmem: Add support for creating dynamic rmem devices Oleksij Rempel
2025-06-02  9:41   ` Sascha Hauer
2025-05-30 11:41 ` [PATCH v1 4/7] regmap: Add reg_seal operation for hardware protection Oleksij Rempel
2025-06-02  9:47   ` Sascha Hauer
2025-05-30 11:41 ` [PATCH v1 5/7] nvmem: regmap: Implement protect operation using regmap_seal Oleksij Rempel
2025-06-02  9:57   ` Sascha Hauer
2025-06-05  4:40     ` Oleksij Rempel [this message]
2025-05-30 11:41 ` [PATCH v1 6/7] nvmem: bsec: Implement NVMEM protect via regmap_seal for OTP locking Oleksij Rempel
2025-05-30 11:41 ` [PATCH v1 7/7] nvmem: rmem: Use unique device name for NVMEM registration Oleksij Rempel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aEEfwlq2ZGEhTRGo@pengutronix.de \
    --to=o.rempel@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox