[PATCH v1 01/13] dt-bindings: power: mediatek: Document mediatek,bus-protection

AngeloGioacchino Del Regno posted 13 patches 3 months, 2 weeks ago
[PATCH v1 01/13] dt-bindings: power: mediatek: Document mediatek,bus-protection
Posted by AngeloGioacchino Del Regno 3 months, 2 weeks ago
Add a new mediatek,bus-protection property in the main power
controller node and deprecate the old mediatek,infracfg,
mediatek,infracfg-nao and mediatek,smi properties located in
the children.

This is done in order to both simplify the power controller
nodes and in preparation for adding support for new generation
SoCs like MT8196/MT6991 and other variants, which will need
to set protection on new busses.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 .../power/mediatek,power-controller.yaml      | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml b/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml
index 9c7cc632abee..2530c873bb3c 100644
--- a/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml
+++ b/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml
@@ -44,6 +44,18 @@ properties:
   '#size-cells':
     const: 0
 
+  mediatek,bus-protection:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    description:
+      A number of phandles to external blocks to set and clear the required
+      bits to enable or disable bus protection, necessary to avoid any bus
+      faults while enabling or disabling a power domain.
+      For example, this may hold phandles to INFRACFG and SMI.
+    minItems: 1
+    maxItems: 3
+    items:
+      maxItems: 1
+
 patternProperties:
   "^power-domain@[0-9a-f]+$":
     $ref: "#/$defs/power-domain-node"
@@ -123,14 +135,17 @@ $defs:
       mediatek,infracfg:
         $ref: /schemas/types.yaml#/definitions/phandle
         description: phandle to the device containing the INFRACFG register range.
+        deprecated: true
 
       mediatek,infracfg-nao:
         $ref: /schemas/types.yaml#/definitions/phandle
         description: phandle to the device containing the INFRACFG-NAO register range.
+        deprecated: true
 
       mediatek,smi:
         $ref: /schemas/types.yaml#/definitions/phandle
         description: phandle to the device containing the SMI register range.
+        deprecated: true
 
     required:
       - reg
@@ -138,6 +153,31 @@ $defs:
 required:
   - compatible
 
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - mediatek,mt8183-power-controller
+    then:
+      properties:
+        mediatek,bus-protection:
+          minItems: 2
+          maxItems: 2
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - mediatek,mt8365-power-controller
+    then:
+      properties:
+        mediatek,bus-protection:
+          minItems: 3
+          maxItems: 3
+
 additionalProperties: false
 
 examples:
-- 
2.49.0
Re: [PATCH v1 01/13] dt-bindings: power: mediatek: Document mediatek,bus-protection
Posted by Rob Herring 3 months, 1 week ago
On Mon, Jun 23, 2025 at 02:01:42PM +0200, AngeloGioacchino Del Regno wrote:
> Add a new mediatek,bus-protection property in the main power
> controller node and deprecate the old mediatek,infracfg,
> mediatek,infracfg-nao and mediatek,smi properties located in
> the children.
> 
> This is done in order to both simplify the power controller
> nodes and in preparation for adding support for new generation
> SoCs like MT8196/MT6991 and other variants, which will need
> to set protection on new busses.

Protection like access controls? We have the access-controller binding 
for that.

> 
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  .../power/mediatek,power-controller.yaml      | 40 +++++++++++++++++++
>  1 file changed, 40 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml b/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml
> index 9c7cc632abee..2530c873bb3c 100644
> --- a/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml
> +++ b/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml
> @@ -44,6 +44,18 @@ properties:
>    '#size-cells':
>      const: 0
>  
> +  mediatek,bus-protection:
> +    $ref: /schemas/types.yaml#/definitions/phandle-array
> +    description:
> +      A number of phandles to external blocks to set and clear the required
> +      bits to enable or disable bus protection, necessary to avoid any bus
> +      faults while enabling or disabling a power domain.
> +      For example, this may hold phandles to INFRACFG and SMI.
> +    minItems: 1
> +    maxItems: 3
> +    items:
> +      maxItems: 1
> +
>  patternProperties:
>    "^power-domain@[0-9a-f]+$":
>      $ref: "#/$defs/power-domain-node"
> @@ -123,14 +135,17 @@ $defs:
>        mediatek,infracfg:
>          $ref: /schemas/types.yaml#/definitions/phandle
>          description: phandle to the device containing the INFRACFG register range.
> +        deprecated: true
>  
>        mediatek,infracfg-nao:
>          $ref: /schemas/types.yaml#/definitions/phandle
>          description: phandle to the device containing the INFRACFG-NAO register range.
> +        deprecated: true
>  
>        mediatek,smi:
>          $ref: /schemas/types.yaml#/definitions/phandle
>          description: phandle to the device containing the SMI register range.
> +        deprecated: true
>  
>      required:
>        - reg
> @@ -138,6 +153,31 @@ $defs:
>  required:
>    - compatible
>  
> +allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - mediatek,mt8183-power-controller
> +    then:
> +      properties:
> +        mediatek,bus-protection:
> +          minItems: 2
> +          maxItems: 2
> +
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - mediatek,mt8365-power-controller
> +    then:
> +      properties:
> +        mediatek,bus-protection:
> +          minItems: 3
> +          maxItems: 3
> +
>  additionalProperties: false
>  
>  examples:
> -- 
> 2.49.0
>
Re: [PATCH v1 01/13] dt-bindings: power: mediatek: Document mediatek,bus-protection
Posted by AngeloGioacchino Del Regno 3 months, 1 week ago
Il 27/06/25 22:15, Rob Herring ha scritto:
> On Mon, Jun 23, 2025 at 02:01:42PM +0200, AngeloGioacchino Del Regno wrote:
>> Add a new mediatek,bus-protection property in the main power
>> controller node and deprecate the old mediatek,infracfg,
>> mediatek,infracfg-nao and mediatek,smi properties located in
>> the children.
>>
>> This is done in order to both simplify the power controller
>> nodes and in preparation for adding support for new generation
>> SoCs like MT8196/MT6991 and other variants, which will need
>> to set protection on new busses.
> 
> Protection like access controls? We have the access-controller binding
> for that.
> 

I was not aware of that - but that's *so* cool.

 From a very (very, very) fast look, it looks like that fits this case perfectly.
I'll check if that's right and will come up with a v2 for that.

Thanks a lot!
Angelo

>>
>> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>> ---
>>   .../power/mediatek,power-controller.yaml      | 40 +++++++++++++++++++
>>   1 file changed, 40 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml b/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml
>> index 9c7cc632abee..2530c873bb3c 100644
>> --- a/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml
>> +++ b/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml
>> @@ -44,6 +44,18 @@ properties:
>>     '#size-cells':
>>       const: 0
>>   
>> +  mediatek,bus-protection:
>> +    $ref: /schemas/types.yaml#/definitions/phandle-array
>> +    description:
>> +      A number of phandles to external blocks to set and clear the required
>> +      bits to enable or disable bus protection, necessary to avoid any bus
>> +      faults while enabling or disabling a power domain.
>> +      For example, this may hold phandles to INFRACFG and SMI.
>> +    minItems: 1
>> +    maxItems: 3
>> +    items:
>> +      maxItems: 1
>> +
>>   patternProperties:
>>     "^power-domain@[0-9a-f]+$":
>>       $ref: "#/$defs/power-domain-node"
>> @@ -123,14 +135,17 @@ $defs:
>>         mediatek,infracfg:
>>           $ref: /schemas/types.yaml#/definitions/phandle
>>           description: phandle to the device containing the INFRACFG register range.
>> +        deprecated: true
>>   
>>         mediatek,infracfg-nao:
>>           $ref: /schemas/types.yaml#/definitions/phandle
>>           description: phandle to the device containing the INFRACFG-NAO register range.
>> +        deprecated: true
>>   
>>         mediatek,smi:
>>           $ref: /schemas/types.yaml#/definitions/phandle
>>           description: phandle to the device containing the SMI register range.
>> +        deprecated: true
>>   
>>       required:
>>         - reg
>> @@ -138,6 +153,31 @@ $defs:
>>   required:
>>     - compatible
>>   
>> +allOf:
>> +  - if:
>> +      properties:
>> +        compatible:
>> +          contains:
>> +            enum:
>> +              - mediatek,mt8183-power-controller
>> +    then:
>> +      properties:
>> +        mediatek,bus-protection:
>> +          minItems: 2
>> +          maxItems: 2
>> +
>> +  - if:
>> +      properties:
>> +        compatible:
>> +          contains:
>> +            enum:
>> +              - mediatek,mt8365-power-controller
>> +    then:
>> +      properties:
>> +        mediatek,bus-protection:
>> +          minItems: 3
>> +          maxItems: 3
>> +
>>   additionalProperties: false
>>   
>>   examples:
>> -- 
>> 2.49.0
>>