From: Marek Vasut <marex@nabladev.com>
To: Bartosz Golaszewski <brgl@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk@kernel.org>,
Conor Dooley <conor@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: Sun, 26 Apr 2026 04:49:58 +0200 [thread overview]
Message-ID: <a6b29aa2-8a92-440d-9026-5682af828a78@nabladev.com> (raw)
In-Reply-To: <CAMRc=McSHzmOZ2DgyiZNVVaeQm7QVG1GGnwGAPXUGdh7hPOS1Q@mail.gmail.com>
On 4/24/26 10:12 AM, Bartosz Golaszewski wrote:
> On Thu, Apr 23, 2026 at 9:15 PM Marek Vasut <marex@nabladev.com> wrote:
>>
>> On 4/23/26 4:19 PM, Bartosz Golaszewski wrote:
>>> On Thu, Apr 23, 2026 at 4:06 PM Marek Vasut <marex@nabladev.com> wrote:
>>>>
>>>> On 4/23/26 2:17 PM, Bartosz Golaszewski wrote:
>>>>> On Thu, Apr 23, 2026 at 2:04 PM Marek Vasut <marex@nabladev.com> wrote:
>>>>>>
>>>>>>>
>>>>>>> I see. Ok, please send a v2.
>>>>>> Does this patch require any changes ?
>>>>>>
>>>>>> I will be sending the DT changes separately.
>>>>>
>>>>> Sashiko is saying this:
>>>>> https://sashiko.dev/#/patchset/20260421140755.54222-1-marex%40nabladev.com
>>>>
>>>> What does this mean ?
>>>>
>>>>> Shouldn't we report the device as read-only in sysfs unless it was
>>>>> "unlocked" with force_ro?
>>>> This would be ideal, but I did not find a way to toggle the "nvmem" bin
>>>> attr permissions at runtime. Is that even possible ?
>>>
>>> Right, it seems like it's set once and can't be changed (Greg: correct
>>> me if I'm wrong).
>>>
>>> Ok, nevermind the comment then. Maybe just split the changes into
>>> nvmem and at24 changes and I can take both with an Ack from Srini.
>> I have two more ideas I would like to run past you ... how about either:
>>
>> - If wp-gpios is present, set the device as default RO after boot, and
>
> Isn't this already what happens though? nvmem core requests the GPIO
> as output-high and drives it low only when it's doing the writing.
It isn't, the default is read-write . But I now submitted a V2:
nvmem: core: Default to read-only if wp-gpios present
>> let force_ro sysfs attribute toggle the protection of the device back
>> and forth afterward. This would however change the userspace facing
>> behavior slightly, because right now, with wp-gpios present in DT, the
>> device is default RW.
>>
>
> Or do you mean just the file permissions?
>
> If the latter, then that does sound logically sound but yeah, it's
> asking for a regression report. :)
Please see "nvmem: core: Default to read-only if wp-gpios present" that
I just submitted.
>> - Introduce new DT property, wp-gpios-default-read-only or
>> default-read-only or some such, to indicate the device should be in
>> read-only mode by default. That would mitigate the downside of the
>> aforementioned point, but would require a new DT property.
>>
>> Thoughts ?
>
> I like "default-read-only" and it both allows to introduce this
> behavior and not break existing users. Let's loop in DT maintainers
> and see. I'd just like to clarify if we're talking about sysfs
> permissions or GPIO behavior here.
I think we might not need this, please see above.
prev parent reply other threads:[~2026-04-26 2:50 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
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 [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=a6b29aa2-8a92-440d-9026-5682af828a78@nabladev.com \
--to=marex@nabladev.com \
--cc=arnd@arndb.de \
--cc=brgl@kernel.org \
--cc=conor@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=krzk@kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@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