linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Abd-Alrhman Masalkhi <abd.masalkhi@gmail.com>
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	arnd@arndb.de, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org
Subject: Re: [PATCH v3 3/3] ABI: sysfs: add documentation for ST M24LR EEPROM and control interface
Date: Fri, 6 Jun 2025 14:28:30 +0200	[thread overview]
Message-ID: <2025060632-luridness-carpool-bf90@gregkh> (raw)
In-Reply-To: <20250606120631.3140054-4-abd.masalkhi@gmail.com>

On Fri, Jun 06, 2025 at 12:06:31PM +0000, Abd-Alrhman Masalkhi wrote:
> Add sysfs ABI documentation for the STMicroelectronics M24LR device,
> covering both the control interface (e.g., unlock, password update, UID,
> memory size, and SSS entries) and EEPROM access via the nvmem subsystem.
> 
> Signed-off-by: Abd-Alrhman Masalkhi <abd.masalkhi@gmail.com>
> ---
> Changes in v3:
>  - Updated sysfs entry paths to use <busnum>-<primary-addr> to reflect the
>    control address.
> 
> Changes in v2:
>  - Added initial sysfs ABI documentation.
> ---
>  .../ABI/testing/sysfs-bus-i2c-devices-m24lr   | 96 +++++++++++++++++++
>  1 file changed, 96 insertions(+)
>  create mode 100644 Documentation/ABI/testing/sysfs-bus-i2c-devices-m24lr
> 
> diff --git a/Documentation/ABI/testing/sysfs-bus-i2c-devices-m24lr b/Documentation/ABI/testing/sysfs-bus-i2c-devices-m24lr
> new file mode 100644
> index 000000000000..53b6fe39162c
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-bus-i2c-devices-m24lr
> @@ -0,0 +1,96 @@
> +What:           /sys/bus/i2c/devices/<busnum>-<primary-addr>/unlock
> +Date:           2025-05-31

It's later than this.

> +KernelVersion:  6.16

This will not be showing up in 6.16, sorry, it's too late for that.

> +Contact:        Abd-Alrhman Masalkhi <abd.masalkhi@gmail.com>
> +Description:
> +                Write-only attribute used to present a password and unlock
> +                access to protected areas of the M24LR chip, including
> +                configuration registers such as the Sector Security Status
> +                (SSS) bytes. A valid password must be written to enable write
> +                access to these regions via the I2C interface.
> +
> +                Format:
> +                  - Hexadecimal string representing a 32-bit (4-byte) password
> +                  - Accepts 1 to 8 hex digits (e.g., "c", "1F", "a1b2c3d4")
> +                  - No "0x" prefix, whitespace, or trailing newline
> +                  - Case-insensitive
> +
> +                Behavior:
> +                  - If the password matches the internal stored value,
> +                    access to protected memory/configuration is granted
> +                  - If the password does not match the internally stored value,
> +                    it will fail silently

Why is the kernel in the business of adding passwords to devices?  That
feels wrong, and a way to just flood the device with a "try all the
values" attempt if needed.

> +What:           /sys/bus/i2c/devices/<busnum>-<primary-addr>/sss<N>
> +Date:           2025-05-31
> +KernelVersion:  6.16
> +Contact:        Abd-Alrhman Masalkhi <abd.masalkhi@gmail.com>
> +Description:
> +                Read/write attribute representing the Sector Security Status
> +                (SSS) byte for EEPROM sector <N> in the M24LR chips. Each sector
> +                has one SSS byte, which defines I2c and RF access control via a
> +                combination of protection and password settings.
> +
> +                Format:
> +                  - Read: returns a 8-bit hexadecimal value followed by a
> +                          newline
> +                  - Write: requires exactly one or two hexadecimal digits
> +                      - No "0x" prefix, whitespace, or trailing newline
> +                      - Case-insensitive
> +
> +                Notes:
> +                  - Refer to the M24LR chip datasheet for full bit definitions
> +                    and usage
> +                  - Write access requires prior password authentication in I2C
> +                    mode

How "deep" does this sysfs tree get here?  This feels like the wrong api
for read/write to the device, just do it with a single binary file if
you really want a "passthrough" way to get to the hardware.

thanks,

greg k-h

  reply	other threads:[~2025-06-06 12:28 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-06 12:06 [PATCH v3 0/3] Add support for STMicroelectronics M24LR EEPROM/NFC chips Abd-Alrhman Masalkhi
2025-06-06 12:06 ` [PATCH v3 1/3] dt-bindings: eeprom: Add ST M24LR support Abd-Alrhman Masalkhi
2025-06-06 13:10   ` Krzysztof Kozlowski
2025-06-06 15:06     ` Abd-Alrhman Masalkhi
2025-06-06 12:06 ` [PATCH v3 2/3] misc: add driver for ST M24LR series RFID/NFC EEPROM chips Abd-Alrhman Masalkhi
2025-06-06 12:19   ` Greg KH
2025-06-06 13:38     ` Abd-Alrhman Masalkhi
2025-06-06 12:25   ` Greg KH
2025-06-06 14:24     ` Abd-Alrhman Masalkhi
2025-06-06 15:58       ` Greg KH
2025-06-07 11:33   ` kernel test robot
2025-06-06 12:06 ` [PATCH v3 3/3] ABI: sysfs: add documentation for ST M24LR EEPROM and control interface Abd-Alrhman Masalkhi
2025-06-06 12:28   ` Greg KH [this message]
2025-06-06 14:46     ` Abd-Alrhman Masalkhi
2025-06-06 16:02       ` Greg KH
2025-06-07  9:18         ` [PATCH v3 1/3] dt-bindings: eeprom: Add ST M24LR support Abd-Alrhman Masalkhi
2025-06-07  9:25         ` [PATCH v3 3/3] ABI: sysfs: add documentation for ST M24LR EEPROM and control interface Abd-Alrhman Masalkhi

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=2025060632-luridness-carpool-bf90@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=abd.masalkhi@gmail.com \
    --cc=arnd@arndb.de \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.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;
as well as URLs for NNTP newsgroup(s).