[RFC,v3,5/5] dt-bindings: phy: hisi-inno-usb2: add compatible of hisilicon,hi3798mv200-usb2-phy

Message ID 20240220-inno-phy-v3-5-893cdf8633b4@outlook.com
State New
Headers
Series phy: hisi-inno-phy: add support for hi3798mv200-usb2-phy |

Commit Message

Yang Xiwen via B4 Relay Feb. 19, 2024, 9:28 p.m. UTC
  From: Yang Xiwen <forbidden405@outlook.com>

It is accessed by direct MMIO, making "ranges" property mandatory for
it. Also there is an extra clock for the phy.

Signed-off-by: Yang Xiwen <forbidden405@outlook.com>
---
 .../bindings/phy/hisilicon,inno-usb2-phy.yaml      | 32 ++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)
  

Comments

Krzysztof Kozlowski Feb. 19, 2024, 9:35 p.m. UTC | #1
On 19/02/2024 22:28, Yang Xiwen via B4 Relay wrote:
> From: Yang Xiwen <forbidden405@outlook.com>
> 
> It is accessed by direct MMIO, making "ranges" property mandatory for
> it. Also there is an extra clock for the phy.
> 
> Signed-off-by: Yang Xiwen <forbidden405@outlook.com>
> ---
>  .../bindings/phy/hisilicon,inno-usb2-phy.yaml      | 32 ++++++++++++++++++++--
>  1 file changed, 30 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/phy/hisilicon,inno-usb2-phy.yaml b/Documentation/devicetree/bindings/phy/hisilicon,inno-usb2-phy.yaml
> index 1b57e0396209..969fd3fb7537 100644
> --- a/Documentation/devicetree/bindings/phy/hisilicon,inno-usb2-phy.yaml
> +++ b/Documentation/devicetree/bindings/phy/hisilicon,inno-usb2-phy.yaml
> @@ -15,6 +15,7 @@ properties:
>        - enum:
>            - hisilicon,hi3798cv200-usb2-phy
>            - hisilicon,hi3798mv100-usb2-phy
> +          - hisilicon,hi3798mv200-usb2-phy
>        - const: hisilicon,inno-usb2-phy

Bindings come before user, not after (see DT submitting patches).
Anyway, your driver and commit msg say hi3798mv200 has different
programming model, so these devices are not compatible.

Best regards,
Krzysztof
  
Krzysztof Kozlowski Feb. 20, 2024, 8:18 a.m. UTC | #2
On 19/02/2024 22:28, Yang Xiwen via B4 Relay wrote:
>  
>    resets:
> -    maxItems: 1
> +    minItems: 1
> +    maxItems: 2
> +
> +  reset-names:
> +    items:
> +      - const: port
> +      - const: test

Why old device now gets two resets? You need to constrain it per variant.

Best regards,
Krzysztof
  
Yang Xiwen Feb. 20, 2024, 9:25 a.m. UTC | #3
On 2/20/2024 4:18 PM, Krzysztof Kozlowski wrote:
> On 19/02/2024 22:28, Yang Xiwen via B4 Relay wrote:
>>   
>>     resets:
>> -    maxItems: 1
>> +    minItems: 1
>> +    maxItems: 2
>> +
>> +  reset-names:
>> +    items:
>> +      - const: port
>> +      - const: test
> Why old device now gets two resets? You need to constrain it per variant.
I only make reset-names mandatory for mv200. For other models, this 
property is not allowed. I'll add constraint for resets too in next version.
>
> Best regards,
> Krzysztof
>
  

Patch

diff --git a/Documentation/devicetree/bindings/phy/hisilicon,inno-usb2-phy.yaml b/Documentation/devicetree/bindings/phy/hisilicon,inno-usb2-phy.yaml
index 1b57e0396209..969fd3fb7537 100644
--- a/Documentation/devicetree/bindings/phy/hisilicon,inno-usb2-phy.yaml
+++ b/Documentation/devicetree/bindings/phy/hisilicon,inno-usb2-phy.yaml
@@ -15,6 +15,7 @@  properties:
       - enum:
           - hisilicon,hi3798cv200-usb2-phy
           - hisilicon,hi3798mv100-usb2-phy
+          - hisilicon,hi3798mv200-usb2-phy
       - const: hisilicon,inno-usb2-phy
 
   reg:
@@ -23,18 +24,27 @@  properties:
       peripheral controller, e.g. PERI_USB0 for USB 2.0 PHY01 on Hi3798CV200 SoC,
       or direct MMIO address space.
 
+  ranges:
+    maxItems: 1
+
   '#address-cells':
     const: 1
 
   '#size-cells':
-    const: 0
+    enum: [0, 1]
 
   clocks:
     maxItems: 1
     description: reference clock
 
   resets:
-    maxItems: 1
+    minItems: 1
+    maxItems: 2
+
+  reset-names:
+    items:
+      - const: port
+      - const: test
 
 patternProperties:
   'phy@[0-9a-f]+':
@@ -54,6 +64,9 @@  patternProperties:
       resets:
         maxItems: 1
 
+      phy_type:
+        const: utmi
+
     required:
       - reg
       - '#phy-cells'
@@ -67,6 +80,21 @@  required:
   - '#size-cells'
   - resets
 
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: hisilicon,hi3798mv200-usb2-phy
+    then:
+      required:
+        - ranges
+        - reset-names
+    else:
+      properties:
+        ranges: false
+        reset-names: false
+
 additionalProperties: false
 
 examples: