From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Rob Herring <robh@kernel.org>
Cc: linuxarm@huawei.com, mauro.chehab@huawei.com,
John Stultz <john.stultz@linaro.org>,
Manivannan Sadhasivam <mani@kernel.org>,
Andy Gross <agross@kernel.org>,
Bjorn Andersson <bjorn.andersson@linaro.org>,
Lee Jones <lee.jones@linaro.org>, Stephen Boyd <sboyd@kernel.org>,
Josh Cartwright <joshc@codeaurora.org>,
linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dt-bindings: convert spmi.txt to spmi.yaml
Date: Wed, 26 Aug 2020 06:16:26 +0200 [thread overview]
Message-ID: <20200826061150.3eb96ab3@coco.lan> (raw)
In-Reply-To: <20200819230812.GB2090217@bogus>
Em Wed, 19 Aug 2020 17:08:12 -0600
Rob Herring <robh@kernel.org> escreveu:
> Need to also define 'reg' constraints as defined by the bus:
>
> properties:
> reg:
> minItems: 1
> maxItems: 2 #??? Not sure about this. Is it 1 SPMI_USID and 1 \
> SPMI_GSID entry at most?
Each child have just one user ID (SPMI_USID). The group ID (SPMI_GSID) is an
optional feature. From what I know, only one group ID is allowed at most.
So, maxItems: 2 makes sense.
> items:
> items:
> - minimum: 0
> maximum: 0xf
> - enum: [ 0, 1 ]
If I use both maxItems:2 and the above, the example produces the following
error:
/devel/v4l/temp/Documentation/devicetree/bindings/spmi/spmi.example.dt.yaml: spmi@0: child@7:reg: Additional items are not allowed ([3, 1] was unexpected)
(full DT file enclosed)
This seems to be some bug at the parsing logic, which seems to be refusing
to accept both "items" and "maxItems".
-
That's said, looking at the code[1], only SPMI_USID is currently supported:
err = of_property_read_u32_array(node, "reg", reg, 2);
if (err) {
dev_err(&ctrl->dev,
"node %pOF err (%d) does not have 'reg' property\n",
node, err);
continue;
}
if (reg[1] != SPMI_USID) {
dev_err(&ctrl->dev,
"node %pOF contains unsupported 'reg' entry\n",
node);
continue;
}
if (reg[0] >= SPMI_MAX_SLAVE_ID) {
dev_err(&ctrl->dev, "invalid usid on node %pOF\n", node);
continue;
}
So, for now, using SPMI_GSID will fail.
[1] drivers/spmi/spmi.c
So, I'm inclined to define reg property as:
properties:
reg:
minItems: 1
maxItems: 2
items:
- minimum: 0
maximum: 0xf
- enum: [ 0 ]
description: |
0 means user ID address. 1 is reserved for group ID address.
And drop the group ID from the example. I'll send such version as a
second version of this patch.
Thanks,
Mauro
# SPDX-License-Identifier: GPL-2.0
%YAML 1.2
---
$id: http://devicetree.org/schemas/spmi/spmi.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: System Power Management Interface (SPMI) Controller
maintainers:
- Josh Cartwright <joshc@codeaurora.org>
description: |
The System Power Management (SPMI) controller is a 2-wire bus defined
by the MIPI Alliance for power management control to be used on SoC designs.
SPMI controllers are modelled in device tree using a generic set of
bindings defined here, plus any bus controller specific properties, if
needed.
Each SPMI controller has zero or more child nodes (up to 16 ones), each
one representing an unique slave at the bus.
properties:
$nodename:
pattern: "spmi@.*"
reg:
maxItems: 1
"#address-cells":
const: 2
"#size-cells":
const: 0
patternProperties:
".*@([0-9]|1[0-5])$":
description: up to 16 child PMIC nodes
type: object
properties:
reg:
minItems: 1
maxItems: 2
items:
- minimum: 0
maximum: 0xf
- enum: [ 0, 1 ]
required:
- reg
required:
- reg
examples:
- |
#include <dt-bindings/spmi/spmi.h>
spmi@0 {
reg = <0 0>;
#address-cells = <2>;
#size-cells = <0>;
child@0 {
reg = <0 SPMI_USID>;
};
child@7 {
reg = <7 SPMI_USID>,
<3 SPMI_GSID>;
};
};
next prev parent reply other threads:[~2020-08-26 4:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-19 15:20 [PATCH] dt-bindings: convert spmi.txt to spmi.yaml Mauro Carvalho Chehab
2020-08-19 22:38 ` Rob Herring
2020-08-19 23:08 ` Rob Herring
2020-08-25 9:29 ` Mauro Carvalho Chehab
2020-08-26 4:16 ` Mauro Carvalho Chehab [this message]
2020-08-26 4:36 ` [PATCH v2] " Mauro Carvalho Chehab
2020-09-08 22:52 ` Rob Herring
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=20200826061150.3eb96ab3@coco.lan \
--to=mchehab+huawei@kernel.org \
--cc=agross@kernel.org \
--cc=bjorn.andersson@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=john.stultz@linaro.org \
--cc=joshc@codeaurora.org \
--cc=lee.jones@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=mani@kernel.org \
--cc=mauro.chehab@huawei.com \
--cc=robh@kernel.org \
--cc=sboyd@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.