From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: linux-kernel@vger.kernel.org
Cc: kernel@pengutronix.de, ceggers@arri.de,
Ahmad Fatoum <a.fatoum@pengutronix.de>,
Rob Herring <robh+dt@kernel.org>,
devicetree@vger.kernel.org
Subject: [PATCH v3 0/2] nvmem: skip nodes with compatibles other than "nvmem-cell"
Date: Tue, 28 Apr 2020 13:18:25 +0200 [thread overview]
Message-ID: <20200428111829.2215-1-a.fatoum@pengutronix.de> (raw)
The nvmem cell binding applies to all objects which match "^.*@[0-9a-f]+$",
without taking a compatible into account. This precludes extension of e.g.
eeprom nodes by any child nodes other than nvmem. Consider following example:
eeprom@0 {
reg = <0 64>;
#address-cells = <1>;
#size-cells = <1>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
bits = <64 64 64>; /* to verify it's skipped */
part@0 {
reg = <0x00 16>;
};
};
no-cell@10 {
compatible = "not-nvmem-cell";
reg = <0x10 4>;
bits = <64 64 64>; /* to verify it's skipped */
};
cell-old@14 {
reg = <0x14 0x2>;
};
cell-new@16 {
compatible = "nvmem-cell";
reg = <0x16 4>;
};
};
Without this series, the NVMEM driver interprets all direct children of eeprom@0
as NVMEM cells and driver probe fails, because the partitions node lacks a reg
property, e.g.:
nvmem 0-00000: nvmem: invalid reg on /eeprom@0
Running dtbs_check on the snippet will skip partitions (it doesn't match above
regex), but will flag no-cell@10 and cell-new@16 as invalid.
With this series applied, the driver will skip partitions and no-cell@10,
because they have a compatible but it's not "nvmem-cell".
Both cell-old@14 and cell-new@16 will be interpreted as cells.
Likewise, running dtbs_check on the snippet will skip partitions (compatible
doesn't match and regex doesn't either) and no-cell@10, but accept the other two.
This series resolves an existing clash between this nvmem-cell binding and
the barebox bootloader binding that extends the fixed-partitions MTD
binding to EEPROMs[1]. It's also a building block for getting nvmem cells and
partitions in MTD devices to co-exist in the same device tree node[2].
The changes are backwards-compatible, because, per binding, a compatible
property in a cell node was so far invalid. More details in the commit
messages.
[1]: https://www.mail-archive.com/barebox@lists.infradead.org/msg33944.html
[2]: https://patchwork.ozlabs.org/patch/890741/
v2 -> v3:
- use optional compatible property to weed out nodes instead of name
- extend binding documentation (Srini)
v1 -> v2:
- use ->full_name instead of ->name as to not break existing correct
cells (Christian)
Cheers,
Ahmad Fatoum (2):
dt-bindings: nvmem: skip nodes with compatibles other than
"nvmem-cell"
nvmem: core: skip nodes with compatibles other than "nvmem-cell"
Documentation/devicetree/bindings/nvmem/nvmem.yaml | 14 +++++++++++++-
drivers/nvmem/core.c | 4 ++++
2 files changed, 17 insertions(+), 1 deletion(-)
Cc: Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org
--
2.26.2
next reply other threads:[~2020-04-28 11:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-28 11:18 Ahmad Fatoum [this message]
2020-04-28 11:18 ` [PATCH v3 1/2] dt-bindings: nvmem: skip nodes with compatibles other than "nvmem-cell" Ahmad Fatoum
2020-05-08 6:56 ` Ahmad Fatoum
2020-04-28 11:18 ` [PATCH v3 2/2] nvmem: core: " Ahmad Fatoum
2020-05-11 11:33 ` Srinivas Kandagatla
2020-12-30 13:43 ` Kamel Bouhara
2021-01-18 13:25 ` Ahmad Fatoum
2020-05-12 14:18 ` [PATCH v3 0/2] nvmem: " Rob Herring
2020-10-12 15:36 ` Ahmad Fatoum
2020-11-02 15:23 ` Ahmad Fatoum
2020-11-16 17:04 ` Ahmad Fatoum
2020-11-16 17:21 ` Srinivas Kandagatla
2020-11-16 17:28 ` Ahmad Fatoum
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=20200428111829.2215-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=ceggers@arri.de \
--cc=devicetree@vger.kernel.org \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@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).