public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Marek Vasut <marex@denx.de>
Cc: linux-i2c@vger.kernel.org,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Bartosz Golaszewski <brgl@bgdev.pl>,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Subject: Re: [PATCH v2 4/4] nvmem: core: Implement force_ro sysfs attribute
Date: Sun, 23 Jun 2024 08:13:55 +0200	[thread overview]
Message-ID: <2024062330-pound-endeared-b07a@gregkh> (raw)
In-Reply-To: <20240623031752.353818-4-marex@denx.de>

On Sun, Jun 23, 2024 at 05:15:47AM +0200, Marek Vasut wrote:
> Implement "force_ro" sysfs attribute to allow users to set read-write
> devices as read-only and back to read-write from userspace. The choice
> of the name is based on MMC core 'force_ro' attribute.
> 
> This solves a situation where an AT24 I2C EEPROM with GPIO based nWP
> signal may have to be occasionally updated. Such I2C EEPROM device is
> usually set as read-only during most of the regular system operation,
> but in case it has to be updated in a controlled manner, it could be
> unlocked using this new "force_ro" sysfs attribute and then re-locked
> again.
> 
> The "read-only" DT property and config->read_only configuration is
> respected and is used to set default state of the device, read-only
> or read-write, for devices which do implement .reg_write function.
> For devices which do not implement .reg_write function, the device
> is unconditionally read-only and the "force_ro" attribute is not
> visible.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> ---
> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Bartosz Golaszewski <brgl@bgdev.pl>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> Cc: linux-i2c@vger.kernel.org
> ---
> V2: - Document the force_ro attribute
>     - Use sysfs_emit()
> ---
>  Documentation/ABI/stable/sysfs-bus-nvmem | 13 +++++++
>  drivers/nvmem/core.c                     | 44 ++++++++++++++++++++++++
>  drivers/nvmem/internals.h                |  1 +
>  3 files changed, 58 insertions(+)
> 
> diff --git a/Documentation/ABI/stable/sysfs-bus-nvmem b/Documentation/ABI/stable/sysfs-bus-nvmem
> index 0e3a8492a1082..c713c4e6cecb1 100644
> --- a/Documentation/ABI/stable/sysfs-bus-nvmem
> +++ b/Documentation/ABI/stable/sysfs-bus-nvmem
> @@ -1,3 +1,16 @@
> +What:		/sys/bus/nvmem/devices/.../force_ro
> +Date:		June 2024
> +KernelVersion:	6.11
> +Contact:	Marek Vasut <marex@denx.de>
> +Description:
> +		This read/write attribute allows users to set read-write
> +		devices as read-only and back to read-write from userspace.
> +		This can be used to unlock and relock write-protection of
> +		devices which are generally locked, except during sporadic
> +		programming operation.
> +		Note: This file is only present if CONFIG_NVMEM_SYSFS
> +		is enabled

And what exactly are the values that can be read or written here?

thanks,

greg k-h

  reply	other threads:[~2024-06-23  6:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-23  3:15 [PATCH v2 1/4] nvmem: Replace spaces with tab in documentation Marek Vasut
2024-06-23  3:15 ` [PATCH v2 2/4] nvmem: Document type attribute Marek Vasut
2024-06-23 10:04   ` Alexandre Belloni
2024-06-23  3:15 ` [PATCH v2 3/4] nvmem: Use sysfs_emit() for " Marek Vasut
2024-06-23  3:15 ` [PATCH v2 4/4] nvmem: core: Implement force_ro sysfs attribute Marek Vasut
2024-06-23  6:13   ` Greg Kroah-Hartman [this message]
2024-06-24  0:19     ` Marek Vasut

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=2024062330-pound-endeared-b07a@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=arnd@arndb.de \
    --cc=brgl@bgdev.pl \
    --cc=linux-i2c@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=srinivas.kandagatla@linaro.org \
    /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