devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dt-bindings: mtd: Change the schema for nodename which includes "sram"
@ 2024-01-04 11:23 Zhenhua Huang
  2024-01-09 18:43 ` Bjorn Andersson
  0 siblings, 1 reply; 4+ messages in thread
From: Zhenhua Huang @ 2024-01-04 11:23 UTC (permalink / raw)
  To: miquel.raynal, richard, vigneshr, robh+dt, krzysztof.kozlowski+dt,
	conor+dt
  Cc: linux-mtd, devicetree, linux-kernel, quic_tingweiz, quic_bjorande,
	Zhenhua Huang

Node name which includes "sram" not only represents MTD devices, but also
lots of sram devices(eg, qcom,imem.yaml, rules in folder sram/*).

To avoid the conflicts, change the schema as:
 - if node name includes "sram", must select "compatible" to match
(I have listed all "comptible" string in mtd.yaml by searching
drivers/mtd/* to find applicable drivers)
 - if node name is nand/flash, use "nodename" to select.

Fixes: 7bdc671822e9 ("dt-bindings: mtd: physmap: Reuse the generic definitions")
Signed-off-by: Zhenhua Huang <quic_zhenhuah@quicinc.com>
---
Hello,

Tested a few devicetree nodes, which confirms:
"qcom,imem.yaml" which in sram/ not matches with mtd.yaml anymore.
All nodes include string "sram" must have "compatible" which listed in
mtd.yaml to be matched.

Current I just modify the rule for "sram" as it is definitely conflicting with
rules in sram/*. I have not much backgrounds on nand/flash whether they may have
similar conflicts.

 Documentation/devicetree/bindings/mtd/mtd.yaml | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/mtd/mtd.yaml b/Documentation/devicetree/bindings/mtd/mtd.yaml
index f322290..1704437 100644
--- a/Documentation/devicetree/bindings/mtd/mtd.yaml
+++ b/Documentation/devicetree/bindings/mtd/mtd.yaml
@@ -10,10 +10,28 @@ maintainers:
   - Miquel Raynal <miquel.raynal@bootlin.com>
   - Richard Weinberger <richard@nod.at>
 
-properties:
-  $nodename:
-    pattern: "^(flash|.*sram|nand)(@.*)?$"
+select:
+  if:
+    properties:
+      $nodename:
+        pattern: "^.*sram(@.*)?$"
+  then:
+    properties:
+      compatible:
+        enum:
+          - arm,vexpress-psram
+          - cypress,cy7c1019dv33-10zsxi
+          - microchip,48l640
+          - mtd-ram
+  else:
+    properties:
+      $nodename:
+        pattern: "^(flash|nand)(@.*)?$"
 
+  required:
+    - $nodename
+
+properties:
   label:
     description:
       User-defined MTD device name. Can be used to assign user friendly
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] dt-bindings: mtd: Change the schema for nodename which includes "sram"
  2024-01-04 11:23 [PATCH] dt-bindings: mtd: Change the schema for nodename which includes "sram" Zhenhua Huang
@ 2024-01-09 18:43 ` Bjorn Andersson
  2024-01-09 21:22   ` Rob Herring
  0 siblings, 1 reply; 4+ messages in thread
From: Bjorn Andersson @ 2024-01-09 18:43 UTC (permalink / raw)
  To: Zhenhua Huang
  Cc: miquel.raynal, richard, vigneshr, robh+dt, krzysztof.kozlowski+dt,
	conor+dt, linux-mtd, devicetree, linux-kernel, quic_tingweiz

On Thu, Jan 04, 2024 at 07:23:02PM +0800, Zhenhua Huang wrote:
> Node name which includes "sram" not only represents MTD devices, but also
> lots of sram devices(eg, qcom,imem.yaml, rules in folder sram/*).
> 
> To avoid the conflicts, change the schema as:
>  - if node name includes "sram", must select "compatible" to match
> (I have listed all "comptible" string in mtd.yaml by searching
> drivers/mtd/* to find applicable drivers)
>  - if node name is nand/flash, use "nodename" to select.
> 

You're right, it doesn't seem appropriate for the mtd binding to be
selected for nodes intended to match e.g. the qcom,imem binding.

> Fixes: 7bdc671822e9 ("dt-bindings: mtd: physmap: Reuse the generic definitions")
> Signed-off-by: Zhenhua Huang <quic_zhenhuah@quicinc.com>
> ---
> Hello,
> 
> Tested a few devicetree nodes, which confirms:
> "qcom,imem.yaml" which in sram/ not matches with mtd.yaml anymore.
> All nodes include string "sram" must have "compatible" which listed in
> mtd.yaml to be matched.
> 
> Current I just modify the rule for "sram" as it is definitely conflicting with
> rules in sram/*. I have not much backgrounds on nand/flash whether they may have
> similar conflicts.
> 
>  Documentation/devicetree/bindings/mtd/mtd.yaml | 24 +++++++++++++++++++++---
>  1 file changed, 21 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/mtd/mtd.yaml b/Documentation/devicetree/bindings/mtd/mtd.yaml
> index f322290..1704437 100644
> --- a/Documentation/devicetree/bindings/mtd/mtd.yaml
> +++ b/Documentation/devicetree/bindings/mtd/mtd.yaml
> @@ -10,10 +10,28 @@ maintainers:
>    - Miquel Raynal <miquel.raynal@bootlin.com>
>    - Richard Weinberger <richard@nod.at>
>  
> -properties:
> -  $nodename:

The mtd binding is $ref'ed by other bindings, similar to how we do with
other bindings of common properties.

So, I think the problem with mtd is that this ($nodename) turns into a
"select" automatically, which causes this binding to match nodes by
name, rather than just those $ref'ing it.


We should be able to avoid the automatically created select from the
$nodename, and rely on $ref, by just adding:

select: false

Regards,
Bjorn

> -    pattern: "^(flash|.*sram|nand)(@.*)?$"
> +select:
> +  if:
> +    properties:
> +      $nodename:
> +        pattern: "^.*sram(@.*)?$"
> +  then:
> +    properties:
> +      compatible:
> +        enum:
> +          - arm,vexpress-psram
> +          - cypress,cy7c1019dv33-10zsxi
> +          - microchip,48l640
> +          - mtd-ram
> +  else:
> +    properties:
> +      $nodename:
> +        pattern: "^(flash|nand)(@.*)?$"
>  
> +  required:
> +    - $nodename
> +
> +properties:
>    label:
>      description:
>        User-defined MTD device name. Can be used to assign user friendly
> -- 
> 2.7.4
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] dt-bindings: mtd: Change the schema for nodename which includes "sram"
  2024-01-09 18:43 ` Bjorn Andersson
@ 2024-01-09 21:22   ` Rob Herring
  2024-01-10  2:10     ` Zhenhua Huang
  0 siblings, 1 reply; 4+ messages in thread
From: Rob Herring @ 2024-01-09 21:22 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Zhenhua Huang, miquel.raynal, richard, vigneshr,
	krzysztof.kozlowski+dt, conor+dt, linux-mtd, devicetree,
	linux-kernel, quic_tingweiz

On Tue, Jan 09, 2024 at 10:43:23AM -0800, Bjorn Andersson wrote:
> On Thu, Jan 04, 2024 at 07:23:02PM +0800, Zhenhua Huang wrote:
> > Node name which includes "sram" not only represents MTD devices, but also
> > lots of sram devices(eg, qcom,imem.yaml, rules in folder sram/*).
> > 
> > To avoid the conflicts, change the schema as:
> >  - if node name includes "sram", must select "compatible" to match
> > (I have listed all "comptible" string in mtd.yaml by searching
> > drivers/mtd/* to find applicable drivers)
> >  - if node name is nand/flash, use "nodename" to select.
> > 
> 
> You're right, it doesn't seem appropriate for the mtd binding to be
> selected for nodes intended to match e.g. the qcom,imem binding.
> 
> > Fixes: 7bdc671822e9 ("dt-bindings: mtd: physmap: Reuse the generic definitions")
> > Signed-off-by: Zhenhua Huang <quic_zhenhuah@quicinc.com>
> > ---
> > Hello,
> > 
> > Tested a few devicetree nodes, which confirms:
> > "qcom,imem.yaml" which in sram/ not matches with mtd.yaml anymore.
> > All nodes include string "sram" must have "compatible" which listed in
> > mtd.yaml to be matched.
> > 
> > Current I just modify the rule for "sram" as it is definitely conflicting with
> > rules in sram/*. I have not much backgrounds on nand/flash whether they may have
> > similar conflicts.
> > 
> >  Documentation/devicetree/bindings/mtd/mtd.yaml | 24 +++++++++++++++++++++---
> >  1 file changed, 21 insertions(+), 3 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/mtd/mtd.yaml b/Documentation/devicetree/bindings/mtd/mtd.yaml
> > index f322290..1704437 100644
> > --- a/Documentation/devicetree/bindings/mtd/mtd.yaml
> > +++ b/Documentation/devicetree/bindings/mtd/mtd.yaml
> > @@ -10,10 +10,28 @@ maintainers:
> >    - Miquel Raynal <miquel.raynal@bootlin.com>
> >    - Richard Weinberger <richard@nod.at>
> >  
> > -properties:
> > -  $nodename:
> 
> The mtd binding is $ref'ed by other bindings, similar to how we do with
> other bindings of common properties.
> 
> So, I think the problem with mtd is that this ($nodename) turns into a
> "select" automatically, which causes this binding to match nodes by
> name, rather than just those $ref'ing it.
> 
> 
> We should be able to avoid the automatically created select from the
> $nodename, and rely on $ref, by just adding:
> 
> select: false

Yes.

Rob

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] dt-bindings: mtd: Change the schema for nodename which includes "sram"
  2024-01-09 21:22   ` Rob Herring
@ 2024-01-10  2:10     ` Zhenhua Huang
  0 siblings, 0 replies; 4+ messages in thread
From: Zhenhua Huang @ 2024-01-10  2:10 UTC (permalink / raw)
  To: Rob Herring, Bjorn Andersson
  Cc: miquel.raynal, richard, vigneshr, krzysztof.kozlowski+dt,
	conor+dt, linux-mtd, devicetree, linux-kernel, quic_tingweiz



On 2024/1/10 5:22, Rob Herring wrote:
> On Tue, Jan 09, 2024 at 10:43:23AM -0800, Bjorn Andersson wrote:
>> On Thu, Jan 04, 2024 at 07:23:02PM +0800, Zhenhua Huang wrote:
>>> Node name which includes "sram" not only represents MTD devices, but also
>>> lots of sram devices(eg, qcom,imem.yaml, rules in folder sram/*).
>>>
>>> To avoid the conflicts, change the schema as:
>>>   - if node name includes "sram", must select "compatible" to match
>>> (I have listed all "comptible" string in mtd.yaml by searching
>>> drivers/mtd/* to find applicable drivers)
>>>   - if node name is nand/flash, use "nodename" to select.
>>>
>>
>> You're right, it doesn't seem appropriate for the mtd binding to be
>> selected for nodes intended to match e.g. the qcom,imem binding.
>>
>>> Fixes: 7bdc671822e9 ("dt-bindings: mtd: physmap: Reuse the generic definitions")
>>> Signed-off-by: Zhenhua Huang <quic_zhenhuah@quicinc.com>
>>> ---
>>> Hello,
>>>
>>> Tested a few devicetree nodes, which confirms:
>>> "qcom,imem.yaml" which in sram/ not matches with mtd.yaml anymore.
>>> All nodes include string "sram" must have "compatible" which listed in
>>> mtd.yaml to be matched.
>>>
>>> Current I just modify the rule for "sram" as it is definitely conflicting with
>>> rules in sram/*. I have not much backgrounds on nand/flash whether they may have
>>> similar conflicts.
>>>
>>>   Documentation/devicetree/bindings/mtd/mtd.yaml | 24 +++++++++++++++++++++---
>>>   1 file changed, 21 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/Documentation/devicetree/bindings/mtd/mtd.yaml b/Documentation/devicetree/bindings/mtd/mtd.yaml
>>> index f322290..1704437 100644
>>> --- a/Documentation/devicetree/bindings/mtd/mtd.yaml
>>> +++ b/Documentation/devicetree/bindings/mtd/mtd.yaml
>>> @@ -10,10 +10,28 @@ maintainers:
>>>     - Miquel Raynal <miquel.raynal@bootlin.com>
>>>     - Richard Weinberger <richard@nod.at>
>>>   
>>> -properties:
>>> -  $nodename:
>>
>> The mtd binding is $ref'ed by other bindings, similar to how we do with
>> other bindings of common properties.
>>
>> So, I think the problem with mtd is that this ($nodename) turns into a
>> "select" automatically, which causes this binding to match nodes by
>> name, rather than just those $ref'ing it.
>>
>>
>> We should be able to avoid the automatically created select from the
>> $nodename, and rely on $ref, by just adding:
>>
>> select: false
> 
> Yes.
> 
> Rob

Thanks Bjorn and Rob for your suggestion. Let me try and update one new 
version.

Thanks,
Zhenhua

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-10  2:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-04 11:23 [PATCH] dt-bindings: mtd: Change the schema for nodename which includes "sram" Zhenhua Huang
2024-01-09 18:43 ` Bjorn Andersson
2024-01-09 21:22   ` Rob Herring
2024-01-10  2:10     ` Zhenhua Huang

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).