2023-05-15 07:09:43

by Mike Looijmans

[permalink] [raw]
Subject: [PATCH v2 1/2] dt-bindings: usb: Add microchip USB5807 HUB

The USB5807 is a 7-port USB 3.1 hub that can be configured by I2C.
This driver resets the chip, optionally allows D+/D- lines to be
swapped in the devicetree config, and then sends an ATTACH command to
put the device in operational mode.

Signed-off-by: Mike Looijmans <[email protected]>

---

Changes in v2:
Rename to microchip,usb5807.yaml
Remove reset-gpios description
Add maxItems
Add vddXX-supply properties

.../bindings/usb/microchip,usb5807.yaml | 57 +++++++++++++++++++
1 file changed, 57 insertions(+)
create mode 100644 Documentation/devicetree/bindings/usb/microchip,usb5807.yaml

diff --git a/Documentation/devicetree/bindings/usb/microchip,usb5807.yaml b/Documentation/devicetree/bindings/usb/microchip,usb5807.yaml
new file mode 100644
index 000000000000..ac5f1a959aae
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/microchip,usb5807.yaml
@@ -0,0 +1,57 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/usb/microchip,usb5807.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microchip USB 3.1 SuperSpeed Hub Controller
+
+maintainers:
+ - Mike Looijmans <[email protected]>
+
+properties:
+ compatible:
+ enum:
+ - microchip,usb5807
+
+ reg:
+ maxItems: 1
+
+ reset-gpios:
+ maxItems: 1
+
+ vdd12-supply:
+ description: core power supply (1.2V)
+
+ vdd33-supply:
+ description: main power supply (3.3V)
+
+ swap-dx-lanes:
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+ maxItems: 8
+ description:
+ Specifies the ports which will swap the differential-pair (D+/D-),
+ default is not-swapped.
+
+additionalProperties: false
+
+required:
+ - compatible
+ - reg
+
+examples:
+ - |
+ #include <dt-bindings/gpio/gpio.h>
+
+ i2c {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ usb-hub@2d {
+ compatible = "microchip,usb5807";
+ reg = <0x2d>;
+ reset-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
+ /* Swapped D+/D- on port 0 */
+ swap-dx-lanes = <0>;
+ };
+ };
--
2.17.1


Met vriendelijke groet / kind regards,

Mike Looijmans
System Expert


TOPIC Embedded Products B.V.
Materiaalweg 4, 5681 RJ Best
The Netherlands

T: +31 (0) 499 33 69 69
E: [email protected]
W: http://www.topic.nl

Please consider the environment before printing this e-mail


2023-05-15 10:33:53

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] dt-bindings: usb: Add microchip USB5807 HUB

On Mon, 15 May 2023 08:25:01 +0200, Mike Looijmans wrote:
> The USB5807 is a 7-port USB 3.1 hub that can be configured by I2C.
> This driver resets the chip, optionally allows D+/D- lines to be
> swapped in the devicetree config, and then sends an ATTACH command to
> put the device in operational mode.
>
> Signed-off-by: Mike Looijmans <[email protected]>
>
> ---
>
> Changes in v2:
> Rename to microchip,usb5807.yaml
> Remove reset-gpios description
> Add maxItems
> Add vddXX-supply properties
>
> .../bindings/usb/microchip,usb5807.yaml | 57 +++++++++++++++++++
> 1 file changed, 57 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/usb/microchip,usb5807.yaml
>

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/usb251xb.example.dtb: usb-hub@2d: swap-dx-lanes: size is 32, expected 8
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/usb/usb251xb.yaml

See https://patchwork.ozlabs.org/patch/1781103

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.

2023-05-15 10:52:17

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] dt-bindings: usb: Add microchip USB5807 HUB

On 15/05/2023 08:25, Mike Looijmans wrote:
> The USB5807 is a 7-port USB 3.1 hub that can be configured by I2C.


Thank you for your patch. There is something to discuss/improve.

> +
> + swap-dx-lanes:
> + $ref: /schemas/types.yaml#/definitions/uint32-array
> + maxItems: 8

Missing minItems. Bug in the other binding caused this one to be hidden.

> + description:
> + Specifies the ports which will swap the differential-pair (D+/D-),
> + default is not-swapped.


Best regards,
Krzysztof


2023-05-15 13:37:23

by Mike Looijmans

[permalink] [raw]
Subject: Re: [PATCH v2 1/2] dt-bindings: usb: Add microchip USB5807 HUB

See below (mailserver has a top-post fetish)


Met vriendelijke groet / kind regards,

Mike Looijmans
System Expert


TOPIC Embedded Products B.V.
Materiaalweg 4, 5681 RJ Best
The Netherlands

T: +31 (0) 499 33 69 69
E: [email protected]
W: http://www.topic.nl

Please consider the environment before printing this e-mail
On 15-05-2023 12:38, Krzysztof Kozlowski wrote:
> On 15/05/2023 08:25, Mike Looijmans wrote:
>> The USB5807 is a 7-port USB 3.1 hub that can be configured by I2C.
>
> Thank you for your patch. There is something to discuss/improve.
>
>> +
>> + swap-dx-lanes:
>> + $ref: /schemas/types.yaml#/definitions/uint32-array
>> + maxItems: 8
> Missing minItems. Bug in the other binding caused this one to be hidden.

Will add "minItems: 0" in v3...

I initially based the code and binding on the usb251xb. Later found the
mismatch and fixed it, but somehow forgot that I copied the "int8-array"
too.

>
>> + description:
>> + Specifies the ports which will swap the differential-pair (D+/D-),
>> + default is not-swapped.
>
> Best regards,
> Krzysztof
>

--
Mike Looijmans