mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Abd-Alrhman Masalkhi <abd.masalkhi@gmail.com>
To: gregkh@linuxfoundation.org
Cc: abd.masalkhi@gmail.com, arnd@arndb.de, conor+dt@kernel.org,
	devicetree@vger.kernel.org, krzk+dt@kernel.org,
	linux-kernel@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v3 3/3] ABI: sysfs: add documentation for ST M24LR EEPROM and control interface
Date: Sat,  7 Jun 2025 09:25:37 +0000	[thread overview]
Message-ID: <20250607092537.3141131-1-abd.masalkhi@gmail.com> (raw)
In-Reply-To: <2025060618-errant-audible-4c52@gregkh>

Hi Greg,

> > >> +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.
> > 
> > The depth of the sysfs tree depends on the M24LR variant. For example,
> > the M24LR04E-R has 4 sectors, resulting in 4 entries: sss0 through sss3.
> > 
> > I understand the concern about exposing multiple sysfs entries. The
> > reason for this design is that each sector has its own SSS byte, and
> > separating them helps reflect the per-sector nature of the access
> > control. That said, I'm open to refactoring this to expose the SSS
> > area via a single binary file if that's more in line with expected
> > kernel interfaces.
> 
> Who and what is going to be talking to this device through this
> interface?  Is this unique and special to ONLY this one chip/device or
> does it fit in with all other types of this device (i.e. eeproms)?  You
> can't create a userspace api without actually having a user at all, so
> if there is no userspace code using this, why even have this?

A userspace application specific to the M24LR series is intended to
interface with this driver. The M24LR devices support dual access
to the EEPROM: via I2C and over RFID. The purpose of exposing the
Sector Security Status (SSS) registers to userspace is to provide
dynamic control over when and how the EEPROM is accessible to an
RFID reader. This allows userspace to decide whether to permit or
deny EEPROM reads/writes via RFID, or to configure protection for
specific memory sectors.

The SSS registers define per-sector read/write permissions and
password protection, directly determining how external RFID readers
interact with the tag. By exposing this configuration through sysfs,
userspace software can modify RFID access behavior at runtime for
example, to enable secure provisioning workflows, implement time-based
access, or prevent unauthorized access after setup.

Given that this is a per-sector control mechanism unique to the M24LR
series, would exposing the entire SSS region via a single binary sysfs
file be considered more appropriate than individual attributes per sector?

Best regards,
Abd-Alrhman Masalkhi

      parent reply	other threads:[~2025-06-07  9:25 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
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         ` Abd-Alrhman Masalkhi [this message]

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=20250607092537.3141131-1-abd.masalkhi@gmail.com \
    --to=abd.masalkhi@gmail.com \
    --cc=arnd@arndb.de \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.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

all inboxes | Powered by JetHome®