public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@nabladev.com>
To: Bartosz Golaszewski <brgl@kernel.org>
Cc: linux-i2c@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Srinivas Kandagatla <srini@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] nvmem: core: eeprom: at24: Handle EEPROM with both read-only and wp-gpios
Date: Thu, 23 Apr 2026 11:37:18 +0200	[thread overview]
Message-ID: <faba330b-f98a-4e52-a180-d62cdb9a24eb@nabladev.com> (raw)
In-Reply-To: <CAMRc=MdqzeyvGD=typRApK0fKbpWoVT96_vAE-2yNymnjJxpAw@mail.gmail.com>

On 4/23/26 9:42 AM, Bartosz Golaszewski wrote:
> On Wed, Apr 22, 2026 at 7:01 PM Marek Vasut <marex@nabladev.com> wrote:
>>
>> On 4/22/26 1:33 PM, Marek Vasut wrote:
>>> On 4/22/26 11:07 AM, Bartosz Golaszewski wrote:
>>>> On Tue, Apr 21, 2026 at 4:08 PM Marek Vasut <marex@nabladev.com> wrote:
>>>>>
>>>>> Handle special-case of AT24 EEPROM described in DT, which contains both
>>>>> "read-only" and "wp-gpios" properties. Interpret this configuration as
>>>>> default read-only, but with the possibility of unlock via force_ro sysfs
>>>>> attribute.
>>>>>
>>>>
>>>> Patch looks ok code-wise but does this really make sense? If an EEPROM
>>>> is read-only, we should forbid writes in the kernel. Which board uses
>>>> it? Can we simply remove the read-only flag from DT?
>>>
>>> Currently I am not aware of any upstream users, I plan to introduce one
>>> once this patch or some for of it lands.
>>
>> I have to amend my statement, I would also like to adjust an already
>> upstream DT to make use of this default-read-only functionality now.
>>
>> I would however like to get go/no-go on this patch before I roll out the
>> DT patches.
>>
> 
> Yes, go ahead.
> 
>>> I have is an ID EEPROM which I would like to be able to program under
>>> special circumstances (hence the wp-gpios control) , but it should be by
>>> default read-only .
>>>
>>> If I remove the read-only, then by default the EEPROM is read-write,
>>> which is undesired. If I remote wp-gpios then I loose access to the
>>> force_ro attribute which controls the nWP GPIO from userspace, which is
>>> undesired.
>>>
>>> So I think defining this special-case where wp-gpios and read-only are
>>> used together as default-read-only is sensible.
>>>
>>>> Admittedly: the DT bindings do allow it as read-only and wp-gpios are
>>>> not mutually exclusive but I think it's more of an accidental omission
>>>> than a planned feature.
>>> I think it is currently an undefined behavior, and this patch defines it.
>>
>> Also, this default-read-only behavior is effectively the same behavior
>> like the eMMC HW BOOT partitions have, they are also default read-only,
>> but can be switched and written to by setting their force_ro sysfs
>> attribute.
> 
> I see. Ok, please send a v2.
Does this patch require any changes ?

I will be sending the DT changes separately.

  reply	other threads:[~2026-04-23 12:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-21 14:06 [PATCH] nvmem: core: eeprom: at24: Handle EEPROM with both read-only and wp-gpios Marek Vasut
2026-04-22  9:07 ` Bartosz Golaszewski
2026-04-22 11:33   ` Marek Vasut
2026-04-22 17:01     ` Marek Vasut
2026-04-23  7:42       ` Bartosz Golaszewski
2026-04-23  9:37         ` Marek Vasut [this message]
2026-04-23 12:17           ` Bartosz Golaszewski
2026-04-23 14:06             ` Marek Vasut
2026-04-23 14:19               ` Bartosz Golaszewski
2026-04-23 19:15                 ` Marek Vasut
2026-04-24  8:12                   ` Bartosz Golaszewski
2026-04-26  2:49                     ` 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=faba330b-f98a-4e52-a180-d62cdb9a24eb@nabladev.com \
    --to=marex@nabladev.com \
    --cc=arnd@arndb.de \
    --cc=brgl@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=srini@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