dt-bindings: tegra: pmc: Update aotag as an optional aperture
Subsystems (2)
Jon Hunter
maintainerPATCH 1/2 dt-bindings: tegra: pmc: Update aotag as an optional aperture
Not all Tegra SoCs or all versions of a particular Tegra SoC may include the AOTAG aperture. This change makes "aotag" as an optional aperture for Tegra234 and Tegra264.
---
Admittedly I don't know if there is a better way to handle this, but if there is please let me know!
.../arm/tegra/nvidia,tegra186-pmc.yaml | 57 ++++++++++++------- 1 file changed, 38 insertions(+), 19 deletions(-)
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml +38 -19
@@ -19,17 +19,12 @@ properties: - nvidia,tegra264-pmc reg: - minItems: 4 + minItems: 3 maxItems: 5 reg-names: - minItems: 4 - items: - - const: pmc - - const: wake - - const: aotag - - enum: [ scratch, misc ] - - const: misc + minItems: 3 + maxItems: 5 interrupt-controller: true
@@ -50,12 +45,12 @@ allOf: const: nvidia,tegra186-pmc then: properties: - reg: - maxItems: 4 reg-names: - maxItems: 4 - contains: - const: scratch + items: + - const: pmc + - const: wake + - const: aotag + - const: scratch - if: properties:
@@ -64,21 +59,45 @@ allOf: const: nvidia,tegra194-pmc then: properties: - reg: - minItems: 5 reg-names: - minItems: 5 + items: + - const: pmc + - const: wake + - const: aotag + - const: scratch + - const: misc - if: properties: compatible: contains: - const: nvidia,tegra234-pmc + enum: + - nvidia,tegra234-pmc + - nvidia,tegra264-pmc then: properties: reg-names: - contains: - const: misc + oneOf: + - items: + - const: pmc + - const: wake + - const: aotag + - const: scratch + - const: misc + - items: + - const: pmc + - const: wake + - const: aotag + - const: misc + - items: + - const: pmc + - const: wake + - const: scratch + - const: misc + - items: + - const: pmc + - const: wake + - const: misc patternProperties: "^[a-z0-9]+-[a-z0-9]+$":
Signature · 1 line
2.43.0
Jon Hunter
maintainerPATCH 2/2 soc/tegra: pmc: don't fail if "aotag" is not present
From: Prathamesh Shete <[email protected]>
The "aotog" is an optional aperture, so if that aperture is not defined for a given device, then initialise the 'aotag' pointer to NULL instead of returning an error. Note that the PMC driver will not use 'aotag' pointer if initialised to NULL.
--- drivers/soc/tegra/pmc.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/soc/tegra/pmc.c +10 -3
@@ -2897,9 +2897,16 @@ static int tegra_pmc_probe(struct platform_device *pdev)if (IS_ERR (pmc->wake))return PTR_ERR (pmc->wake); - pmc->aotag =devm_platform_ioremap_resource_byname (pdev,"aotag" ); -if (IS_ERR (pmc->aotag)) -return PTR_ERR (pmc->aotag); +/* "aotag" is an optional aperture */ + res =platform_get_resource_byname (pdev,IORESOURCE_MEM , +"aotag" ); +if (res) { + pmc->aotag =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (pmc->aotag)) +return PTR_ERR (pmc->aotag); + }else { + pmc->aotag =NULL ; + }/* "scratch" is an optional aperture */ res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
Signature · 1 line
2.43.0
Quoted 26 lines · Jon Hunter
Not all Tegra SoCs or all versions of a particular Tegra SoC may include the AOTAG aperture. This change makes "aotag" as an optional aperture for Tegra234 and Tegra264.
Co-developed-by Prathamesh Shete <[email protected]>Signed-off-by Prathamesh Shete <[email protected]>Signed-off-by Jon Hunter <[email protected]>---
Admittedly I don't know if there is a better way to handle this, but if there is please let me know!.../arm/tegra/nvidia,tegra186-pmc.yaml | 57 ++++++++++++------- 1 file changed, 38 insertions(+), 19 deletions(-)Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml +1
-1@@ -19,17 +19,12 @@ properties: - nvidia,tegra264-pmc reg: - minItems: 4 + minItems: 3 maxItems: 5
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml properties: · line 27
Quoted 10 lines
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml +2
-7reg-names: - minItems: 4 - items: - - const: pmc - - const: wake - - const: aotag - - enum: [ scratch, misc ] - - const: misc + minItems: 3 + maxItems: 5
minItems: 3
items:
- const: pmc
- const: wake
- enum: [ aotag, cratch, misc ]
- enum: [ scratch, misc ]
- const: misc
Should work, no?
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml allOf: · line 54
Quoted 8 lines
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml +0
-2interrupt-controller: true@@ -50,12 +45,12 @@ allOf: const: nvidia,tegra186-pmc then: properties: - reg: - maxItems: 4
You need to keep reg here. Each variant needs matching constraints between xxx and xxx-names.
Quoted 13 lines
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml +5
-3reg-names: - maxItems: 4 - contains: - const: scratch + items: + - const: pmc + - const: wake + - const: aotag + - const: scratch - if: properties:
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml allOf: · line 68
Quoted 5 lines
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml +0
-2@@ -64,21 +59,45 @@ allOf: const: nvidia,tegra194-pmc then: properties: - reg: - minItems: 5
Same here
Quoted 9 lines
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml +6
-1reg-names: - minItems: 5 + items: + - const: pmc + - const: wake + - const: aotag + - const: scratch + - const: misc
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml allOf: · line 78
Quoted 10 lines
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml +3
-1- if: properties: compatible: contains: - const: nvidia,tegra234-pmc + enum: + - nvidia,tegra234-pmc + - nvidia,tegra264-pmc then: properties:
This is fine.
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml allOf: · line 81
Quoted 3 lines
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml +0
-2reg-names: - contains: - const: misc
Best regards,
Krzysztof
Jon Hunter
maintainerQuoted 46 lines · Krzysztof Kozlowski
Quoted 26 lines · Jon Hunter
Not all Tegra SoCs or all versions of a particular Tegra SoC may include the AOTAG aperture. This change makes "aotag" as an optional aperture for Tegra234 and Tegra264.
Co-developed-by Prathamesh Shete <[email protected]>Signed-off-by Prathamesh Shete <[email protected]>Signed-off-by Jon Hunter <[email protected]>---
Admittedly I don't know if there is a better way to handle this, but if there is please let me know!.../arm/tegra/nvidia,tegra186-pmc.yaml | 57 ++++++++++++------- 1 file changed, 38 insertions(+), 19 deletions(-)Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml +1
-1@@ -19,17 +19,12 @@ properties: - nvidia,tegra264-pmc reg: - minItems: 4 + minItems: 3 maxItems: 5Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml properties: · line 27
Quoted 10 lines
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml +2
-7reg-names: - minItems: 4 - items: - - const: pmc - - const: wake - - const: aotag - - enum: [ scratch, misc ] - - const: misc + minItems: 3 + maxItems: 5minItems: 3
items:
- const: pmc
- const: wake
- enum: [ aotag, cratch, misc ]
- enum: [ scratch, misc ]
- const: misc
Quoted 1 line
Should work, no?
I was thinking about that, but with the above, and if I am understanding you correctly, it would permit someone to make the following mistake ...
reg-names = "pmc", "wake", "scratch", "scratch", "misc";
Hence, I thought that I need to be more explicit and list out all the combinations that are supported for a given device. Let me know if I am misunderstanding you here.
Quoted 11 lines
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml allOf: · line 54
Quoted 8 lines
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml +0
-2interrupt-controller: true@@ -50,12 +45,12 @@ allOf: const: nvidia,tegra186-pmc then: properties: - reg: - maxItems: 4You need to keep reg here. Each variant needs matching constraints between xxx and xxx-names.
ACK! I will correct this.
Thanks
Jon
Signature · 1 line
nvpublic
Quoted 50 lines · Jon Hunter
Quoted 46 lines · Krzysztof Kozlowski
Quoted 26 lines · Jon Hunter
Not all Tegra SoCs or all versions of a particular Tegra SoC may include the AOTAG aperture. This change makes "aotag" as an optional aperture for Tegra234 and Tegra264.
Co-developed-by Prathamesh Shete <[email protected]>Signed-off-by Prathamesh Shete <[email protected]>Signed-off-by Jon Hunter <[email protected]>---
Admittedly I don't know if there is a better way to handle this, but if there is please let me know!.../arm/tegra/nvidia,tegra186-pmc.yaml | 57 ++++++++++++------- 1 file changed, 38 insertions(+), 19 deletions(-)Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml +1
-1@@ -19,17 +19,12 @@ properties: - nvidia,tegra264-pmc reg: - minItems: 4 + minItems: 3 maxItems: 5Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml properties: · line 27
Quoted 10 lines
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml +2
-7reg-names: - minItems: 4 - items: - - const: pmc - - const: wake - - const: aotag - - enum: [ scratch, misc ] - - const: misc + minItems: 3 + maxItems: 5minItems: 3
items:
- const: pmc
- const: wake
- enum: [ aotag, cratch, misc ]
- enum: [ scratch, misc ]
- const: miscQuoted 1 line
Should work, no?
Quoted 8 lines
I was thinking about that, but with the above, and if I am understanding you correctly, it would permit someone to make the following mistake ...
reg-names = "pmc", "wake", "scratch", "scratch", "misc";
Hence, I thought that I need to be more explicit and list out all the combinations that are supported for a given device. Let me know if I am misunderstanding you here.
It won't be allowed, test it.
Best regards,
Krzysztof
Jon Hunter
maintainerQuoted 54 lines · Krzysztof Kozlowski
Quoted 53 lines · Jon Hunter
Quoted 46 lines · Krzysztof Kozlowski
Quoted 26 lines · Jon Hunter
Not all Tegra SoCs or all versions of a particular Tegra SoC may include the AOTAG aperture. This change makes "aotag" as an optional aperture for Tegra234 and Tegra264.
Co-developed-by Prathamesh Shete <[email protected]>Signed-off-by Prathamesh Shete <[email protected]>Signed-off-by Jon Hunter <[email protected]>---
Admittedly I don't know if there is a better way to handle this, but if there is please let me know!.../arm/tegra/nvidia,tegra186-pmc.yaml | 57 ++++++++++++------- 1 file changed, 38 insertions(+), 19 deletions(-)Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml +1
-1@@ -19,17 +19,12 @@ properties: - nvidia,tegra264-pmc reg: - minItems: 4 + minItems: 3 maxItems: 5Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml properties: · line 27
Quoted 10 lines
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml +2
-7reg-names: - minItems: 4 - items: - - const: pmc - - const: wake - - const: aotag - - enum: [ scratch, misc ] - - const: misc + minItems: 3 + maxItems: 5minItems: 3
items:
- const: pmc
- const: wake
- enum: [ aotag, cratch, misc ]
- enum: [ scratch, misc ]
- const: miscQuoted 1 line
Should work, no?
I was thinking about that, but with the above, and if I am understanding you correctly, it would permit someone to make the following mistake ...
Quoted 7 lines
Quoted 5 lines
reg-names = "pmc", "wake", "scratch", "scratch", "misc";Hence, I thought that I need to be more explicit and list out all the combinations that are supported for a given device. Let me know if I am misunderstanding you here.
It won't be allowed, test it.
So this is what I tried to test this ...
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml +8 -5
@@ -19,15 +19,15 @@ properties: - nvidia,tegra264-pmc reg: - minItems: 4 + minItems: 3 maxItems: 5 reg-names: - minItems: 4 + minItems: 3 items: - const: pmc - const: wake - - const: aotag + - enum: [ aotag, scratch, misc ] - enum: [ scratch, misc ] - const: misc
@@ -51,6 +51,7 @@ allOf: then: properties: reg: + minItems: 4 maxItems: 4 reg-names: maxItems: 4
@@ -73,7 +74,9 @@ allOf: properties: compatible: contains: - const: nvidia,tegra234-pmc + enum: + - nvidia,tegra234-pmc + - nvidia,tegra264-pmc then: properties: reg-names:
@@ -184,7 +187,7 @@ examples: <0x0c370000 0x10000>, <0x0c380000 0x10000>, <0x0c390000 0x10000>; - reg-names = "pmc", "wake", "aotag", "scratch"; + reg-names = "pmc", "wake", "scratch", "scratch"; nvidia,invert-interrupt; sdmmc1_3v3: sdmmc1-3v3 {
The above did not trigger any errors even though I introduced an error in the example. Anything I am missing?
Jon
Signature · 1 line
nvpublic
Quoted 14 lines · Jon Hunter
then:
properties:
reg-names:Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml +1
-1@@ -184,7 +187,7 @@ examples: <0x0c370000 0x10000>, <0x0c380000 0x10000>, <0x0c390000 0x10000>; - reg-names = "pmc", "wake", "aotag", "scratch"; + reg-names = "pmc", "wake", "scratch", "scratch"; nvidia,invert-interrupt; sdmmc1_3v3: sdmmc1-3v3 {
Quoted 2 lines
The above did not trigger any errors even though I introduced an error in the example. Anything I am missing?
You are right - dtschema does not work here. That's a bug, because it should and we already rely on that for many other bindings. You can add "uniqueItems: true" as workaround, but we should fix it in dtschema, so you can go with my approach anyway.
Best regards,
Krzysztof
Jon Hunter
maintainerQuoted 15 lines · Krzysztof Kozlowski
Quoted 14 lines · Jon Hunter
then:
properties:
reg-names:Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml +1
-1@@ -184,7 +187,7 @@ examples: <0x0c370000 0x10000>, <0x0c380000 0x10000>, <0x0c390000 0x10000>; - reg-names = "pmc", "wake", "aotag", "scratch"; + reg-names = "pmc", "wake", "scratch", "scratch"; nvidia,invert-interrupt; sdmmc1_3v3: sdmmc1-3v3 {
Quoted 7 lines
Quoted 2 lines
The above did not trigger any errors even though I introduced an error in the example. Anything I am missing?
You are right - dtschema does not work here. That's a bug, because it should and we already rely on that for many other bindings. You can add "uniqueItems: true" as workaround, but we should fix it in dtschema, so you can go with my approach anyway.
Thanks. Looks like I can't add 'uniqueItems' to reg-names ...
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml: properties:reg-names: Additional properties are not allowed ('uniqueItems' was unexpected)
from schema $id: http://devicetree.org/meta-schemas/string-array.yaml#
Would it be OK to go with your proposal for now without the uniqueItems?
Thanks
Jon
Signature · 1 line
nvpublic
Quoted 25 lines · Jon Hunter
Quoted 15 lines · Krzysztof Kozlowski
Quoted 14 lines · Jon Hunter
then:
properties:
reg-names:Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml +1
-1@@ -184,7 +187,7 @@ examples: <0x0c370000 0x10000>, <0x0c380000 0x10000>, <0x0c390000 0x10000>; - reg-names = "pmc", "wake", "aotag", "scratch"; + reg-names = "pmc", "wake", "scratch", "scratch"; nvidia,invert-interrupt; sdmmc1_3v3: sdmmc1-3v3 {Quoted 7 lines
Quoted 2 lines
The above did not trigger any errors even though I introduced an error in the example. Anything I am missing?
You are right - dtschema does not work here. That's a bug, because it should and we already rely on that for many other bindings. You can add "uniqueItems: true" as workaround, but we should fix it in dtschema, so you can go with my approach anyway.
Quoted 7 lines
Thanks. Looks like I can't add 'uniqueItems' to reg-names ...
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml: properties:reg-names: Additional properties are not allowed ('uniqueItems' was unexpected)
from schema $id: http://devicetree.org/meta-schemas/string-array.yaml#Would it be OK to go with your proposal for now without the uniqueItems?
Yes, that syntax should work anyway.
Best regards,
Krzysztof
Quoted 15 lines · Krzysztof Kozlowski
Quoted 14 lines · Jon Hunter
then:
properties:
reg-names:Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.yaml +1
-1@@ -184,7 +187,7 @@ examples: <0x0c370000 0x10000>, <0x0c380000 0x10000>, <0x0c390000 0x10000>; - reg-names = "pmc", "wake", "aotag", "scratch"; + reg-names = "pmc", "wake", "scratch", "scratch"; nvidia,invert-interrupt; sdmmc1_3v3: sdmmc1-3v3 {
Quoted 7 lines
Quoted 2 lines
The above did not trigger any errors even though I introduced an error in the example. Anything I am missing?
You are right - dtschema does not work here. That's a bug, because it should and we already rely on that for many other bindings. You can add "uniqueItems: true" as workaround, but we should fix it in dtschema, so you can go with my approach anyway.
... and actually there should be no problem, I guess just like me you were limiting schemas with DT_SCHEMA_FILES.
Best regards,
Krzysztof