Skip to contentSkip to conversation

phy: bcm63xx-usbh: Add BCM63xx USBH driver

PATCH Superseded Álvaro Fernández Rojas 3 participants 7 messages Jul 15, 2020 – Jul 16, 2020

Subsystems (2)

v6 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v6 cover phy: bcm63xx-usbh: Add BCM63xx USBH driver

v6: introduce changes suggested by Rob and Vinod:
- Remove BMIPS_GENERIC default from kconfig.
- Print registered message as debug.
- Add another if case to device tree binding for SoCs with just 1 clock.
- Ignored "additionalProperties: false" suggestion since it triggers a warning. This has been reported, but I haven't received any answer yet.
v5: use devm_reset_control_get_exclusive.
v4: fix dt-bindings documentation and improve device mode config.
v3: introduce changes suggested by Florian:
- Add support for device mode.
v2: introduce changes suggested by Florian:
- phy-cells changed to 1.
- Drop OF dependency (use device_get_match_data).
- Drop __initconst from variant tables.
- Use devm_clk_get_optional.

Álvaro Fernández Rojas (2):
dt-bindings: phy: add bcm63xx-usbh bindings
phy: bcm63xx-usbh: Add BCM63xx USBH driver

 .../bindings/phy/brcm,bcm63xx-usbh-phy.yaml   |  97 ++++
 drivers/phy/broadcom/Kconfig                  |   8 +
 drivers/phy/broadcom/Makefile                 |   1 +
 drivers/phy/broadcom/phy-bcm63xx-usbh.c       | 457 ++++++++++++++++++
 4 files changed, 563 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/brcm,bcm63xx-usbh-phy.yaml
 create mode 100644 drivers/phy/broadcom/phy-bcm63xx-usbh.c
Signature · 1 line
2.27.0
#1 lore raw

PATCH v6 1/2 dt-bindings: phy: add bcm63xx-usbh bindings

Document BCM63xx USBH PHY bindings.

---
v6: introduce changes suggested by Rob:
- Add another if case to device tree binding for SoCs with just 1 clock.
- Ignored "additionalProperties: false" suggestion since it triggers a warning. This has been reported, but I haven't received any answer yet.
v5: no changes.
v4: conditionally require 1/2 clocks and fix clock/reset values.
v3: no changes.
v2: phy-cells changed to 1.

 .../bindings/phy/brcm,bcm63xx-usbh-phy.yaml   | 97 +++++++++++++++++++
 1 file changed, 97 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/brcm,bcm63xx-usbh-phy.yaml
Documentation/devicetree/bindings/phy/brcm,bcm63xx-usbh-phy.yaml new file +97 -0
new file mode 100644
index 000000000000..8ab0ab3154ed
@@ -0,0 +1,97 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/phy/brcm,bcm63xx-usbh-phy.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: BCM63xx USBH PHY
+
+maintainers:
+  - Álvaro Fernández Rojas <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - brcm,bcm6318-usbh-phy
+      - brcm,bcm6328-usbh-phy
+      - brcm,bcm6358-usbh-phy
+      - brcm,bcm6362-usbh-phy
+      - brcm,bcm6368-usbh-phy
+      - brcm,bcm63268-usbh-phy
+
+  reg:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+  "#phy-cells":
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - resets
+  - "#phy-cells"
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          enum:
+            - brcm,bcm6328-usbh-phy
+            - brcm,bcm6358-usbh-phy
+            - brcm,bcm6362-usbh-phy
+            - brcm,bcm6368-usbh-phy
+    then:
+      properties:
+        clocks:
+          maxItems: 1
+        clock-names:
+          items:
+            - const: usbh
+      required:
+        - clocks
+        - clock-names
+  - if:
+      properties:
+        compatible:
+          enum:
+            - brcm,bcm6318-usbh-phy
+            - brcm,bcm63268-usbh-phy
+    then:
+      properties:
+        clocks:
+          maxItems: 2
+        clock-names:
+          items:
+            - const: usbh
+            - const: usb_ref
+      required:
+        - clocks
+        - clock-names
+  - if:
+      properties:
+        compatible:
+          enum:
+            - brcm,bcm6318-usbh-phy
+            - brcm,bcm6328-usbh-phy
+            - brcm,bcm6362-usbh-phy
+            - brcm,bcm63268-usbh-phy
+    then:
+      properties:
+        power-domains:
+          maxItems: 1
+      required:
+        - power-domains
+
+examples:
+  - |
+    usbh: usb-phy@10001700 {
+      compatible = "brcm,bcm6368-usbh-phy";
+      reg = <0x10001700 0x38>;
+      clocks = <&periph_clk 15>;
+      clock-names = "usbh";
+      resets = <&periph_rst 12>;
+      #phy-cells = <1>;
+    };
Signature · 1 line
2.27.0
maintainer
#2 lore raw

Re: [PATCH v6 1/2] dt-bindings: phy: add bcm63xx-usbh bindings

Quoted 9 lines · Álvaro Fernández Rojas

Document BCM63xx USBH PHY bindings.

---
v6: introduce changes suggested by Rob:
- Add another if case to device tree binding for SoCs with just 1 clock.
- Ignored "additionalProperties: false" suggestion since it triggers a warning. This has been reported, but I haven't received any answer yet.

Ask your question here or I have to go look for it...

Looks like it is for 'clocks' though. The main schema has to define all the properties for 'additionalProperties: false'. More below...

Quoted 57 lines

v5: no changes.
v4: conditionally require 1/2 clocks and fix clock/reset values.
v3: no changes.
v2: phy-cells changed to 1.

 .../bindings/phy/brcm,bcm63xx-usbh-phy.yaml   | 97 +++++++++++++++++++
 1 file changed, 97 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/brcm,bcm63xx-usbh-phy.yaml
Documentation/devicetree/bindings/phy/brcm,bcm63xx-usbh-phy.yaml new file +42 -0
new file mode 100644
index 000000000000..8ab0ab3154ed
@@ -0,0 +1,97 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/phy/brcm,bcm63xx-usbh-phy.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: BCM63xx USBH PHY
+
+maintainers:
+  - Álvaro Fernández Rojas <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - brcm,bcm6318-usbh-phy
+      - brcm,bcm6328-usbh-phy
+      - brcm,bcm6358-usbh-phy
+      - brcm,bcm6362-usbh-phy
+      - brcm,bcm6368-usbh-phy
+      - brcm,bcm63268-usbh-phy
+
+  reg:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+  "#phy-cells":
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - resets
+  - "#phy-cells"
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          enum:
+            - brcm,bcm6328-usbh-phy

Documentation/devicetree/bindings/phy/brcm,bcm63xx-usbh-phy.yaml line 52

Quoted 10 lines
Documentation/devicetree/bindings/phy/brcm,bcm63xx-usbh-phy.yaml new file +10 -0
+            - brcm,bcm6358-usbh-phy
+            - brcm,bcm6362-usbh-phy
+            - brcm,bcm6368-usbh-phy
+    then:
+      properties:
+        clocks:
+          maxItems: 1
+        clock-names:
+          items:
+            - const: usbh

With the below changes, this can be:

then:
properties:
clocks:
maxItems: 1
clock-names:
maxItems: 1
else:
properties:
clocks:
minItems: 2
clock-names:
minItems: 2

Documentation/devicetree/bindings/phy/brcm,bcm63xx-usbh-phy.yaml line 55

Quoted 3 lines
Documentation/devicetree/bindings/phy/brcm,bcm63xx-usbh-phy.yaml new file +3 -0
+      required:
+        - clocks
+        - clock-names

Looks like these are always required and can be at the top level.

Quoted 4 lines
Documentation/devicetree/bindings/phy/brcm,bcm63xx-usbh-phy.yaml new file +4 -0
+  - if:
+      properties:
+        compatible:
+          enum:

Documentation/devicetree/bindings/phy/brcm,bcm63xx-usbh-phy.yaml line 69

Quoted 10 lines
Documentation/devicetree/bindings/phy/brcm,bcm63xx-usbh-phy.yaml new file +10 -0
+            - brcm,bcm6318-usbh-phy
+            - brcm,bcm63268-usbh-phy
+    then:
+      properties:
+        clocks:
+          maxItems: 2
+        clock-names:
+          items:
+            - const: usbh
+            - const: usb_ref

Move this to the main schema with {minItems: 1, maxItems: 2} for both.

Quoted 5 lines
Documentation/devicetree/bindings/phy/brcm,bcm63xx-usbh-phy.yaml new file +5 -0
+      required:
+        - clocks
+        - clock-names
+  - if:
+      properties:

Documentation/devicetree/bindings/phy/brcm,bcm63xx-usbh-phy.yaml line 84

Quoted 10 lines
Documentation/devicetree/bindings/phy/brcm,bcm63xx-usbh-phy.yaml new file +10 -0
+        compatible:
+          enum:
+            - brcm,bcm6318-usbh-phy
+            - brcm,bcm6328-usbh-phy
+            - brcm,bcm6362-usbh-phy
+            - brcm,bcm63268-usbh-phy
+    then:
+      properties:
+        power-domains:
+          maxItems: 1

This can be in the main section.

Documentation/devicetree/bindings/phy/brcm,bcm63xx-usbh-phy.yaml line 86

Quoted 2 lines
Documentation/devicetree/bindings/phy/brcm,bcm63xx-usbh-phy.yaml new file +2 -0
+      required:
+        - power-domains

And then add to disallow power-domains:

else:
properties:
power-domains: false

Quoted 14 lines
Documentation/devicetree/bindings/phy/brcm,bcm63xx-usbh-phy.yaml new file +11 -0
+
+examples:
+  - |
+    usbh: usb-phy@10001700 {
+      compatible = "brcm,bcm6368-usbh-phy";
+      reg = <0x10001700 0x38>;
+      clocks = <&periph_clk 15>;
+      clock-names = "usbh";
+      resets = <&periph_rst 12>;
+      #phy-cells = <1>;
+    };
Signature · 1 line
2.27.0
#3 lore raw

PATCH v6 2/2 phy: bcm63xx-usbh: Add BCM63xx USBH driver

In reply to Álvaro Fernández Rojas

Add BCM63xx USBH PHY driver for BMIPS.

---
v6: introduce changes suggested by Vinod:
- Remove BMIPS_GENERIC default from kconfig.
- Print registered message as debug.
v5: use devm_reset_control_get_exclusive.
v4: several improvements:
- Use devm_platform_ioremap_resource.
- Code cleanups.
- Improve device mode config:
- Move USBH_SWAP_CONTROL device mode value to variant variable.
- Set USBH_UTMI_CONTROL1 register value (variant variable).
v3: introduce changes suggested by Florian:
- Add support for device mode.
v2: introduce changes suggested by Florian:
- Drop OF dependency (use device_get_match_data).
- Drop __initconst from variant tables.
- Use devm_clk_get_optional.

 drivers/phy/broadcom/Kconfig            |   8 +
 drivers/phy/broadcom/Makefile           |   1 +
 drivers/phy/broadcom/phy-bcm63xx-usbh.c | 457 ++++++++++++++++++++++++
 3 files changed, 466 insertions(+)
 create mode 100644 drivers/phy/broadcom/phy-bcm63xx-usbh.c
drivers/phy/broadcom/Kconfig +8 -0
index b29f11c19155..a1f1a9c90d0d 100644
@@ -2,6 +2,14 @@
 #
 # Phy drivers for Broadcom platforms
 #
+config PHY_BCM63XX_USBH
+	tristate "BCM63xx USBH PHY driver"
+	depends on BMIPS_GENERIC || COMPILE_TEST
+	select GENERIC_PHY
+	help
+	  Enable this to support the BCM63xx USBH PHY driver.
+	  If unsure, say N.
+
 config PHY_CYGNUS_PCIE
 	tristate "Broadcom Cygnus PCIe PHY driver"
 	depends on OF && (ARCH_BCM_CYGNUS || COMPILE_TEST)
drivers/phy/broadcom/Makefile +1 -0
index c78de546135c..7024127f86ad 100644
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_PHY_BCM63XX_USBH)		+= phy-bcm63xx-usbh.o
 obj-$(CONFIG_PHY_CYGNUS_PCIE)		+= phy-bcm-cygnus-pcie.o
 obj-$(CONFIG_BCM_KONA_USB2_PHY)		+= phy-bcm-kona-usb2.o
 obj-$(CONFIG_PHY_BCM_NS_USB2)		+= phy-bcm-ns-usb2.o
drivers/phy/broadcom/phy-bcm63xx-usbh.c new file +457 -0

457 lines not on this page · raw message

Signature · 1 line
2.27.0
Nacked-by on v6 2/2 NAK
#4 lore raw

drivers/phy/broadcom/phy-bcm63xx-usbh.c line 457

Quoted 9 lines · Álvaro Fernández Rojas

Add BCM63xx USBH PHY driver for BMIPS.

---
...

drivers/phy/broadcom/phy-bcm63xx-usbh.c new file +4 -0
+MODULE_DESCRIPTION("BCM63xx USBH PHY driver");
+MODULE_AUTHOR("Álvaro Fernández Rojas <[email protected]>");
+MODULE_AUTHOR("Simon Arlott <[email protected]>");
+MODULE_LICENSE("GPL");

I'm not the author of this.

Signature · 1 line
Simon Arlott
#5 lore raw

Hello Simon,

This is based on your work:
https://github.com/nomis/linux/commit/c4c55b603a78e2732044a833e248c1a1087e7053
https://github.com/nomis/linux/commit/f153a58b9e6f88e72c3ef34dc076118f8b3ade5b

You never sent it, but I took it from your Github. Nevertheless, I can remove you from these patches.

Best regards,
Álvaro.

Quoted 18 lines · Simon Arlott

drivers/phy/broadcom/phy-bcm63xx-usbh.c line 457

Quoted 8 lines · Álvaro Fernández Rojas

Add BCM63xx USBH PHY driver for BMIPS.

---
...

drivers/phy/broadcom/phy-bcm63xx-usbh.c new file +4 -0
+MODULE_DESCRIPTION("BCM63xx USBH PHY driver");
+MODULE_AUTHOR("Álvaro Fernández Rojas <[email protected]>");
+MODULE_AUTHOR("Simon Arlott <[email protected]>");
+MODULE_LICENSE("GPL");

I'm not the author of this.

Signature · 1 line
Simon Arlott
#6 lore raw
Quoted 5 lines · Álvaro Fernández Rojas

Hello Simon,

This is based on your work:
https://github.com/nomis/linux/commit/c4c55b603a78e2732044a833e248c1a1087e7053
https://github.com/nomis/linux/commit/f153a58b9e6f88e72c3ef34dc076118f8b3ade5b

Ok, it has been a long time and I couldn't find a branch with those in locally.

Please remove my *email address* from the source code and MODULE_AUTHOR text.

Historical signed-off-by lines can be updated to:

Signature · 1 line
Simon Arlott