Skip to contentSkip to conversation

phy: bcm63xx-usbh: Add BCM63xx USBH driver

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

Subsystems (2)

v3 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

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

Add BCM63xx USBH PHY driver for BMIPS.

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   |  72 +++
 drivers/phy/broadcom/Kconfig                  |   9 +
 drivers/phy/broadcom/Makefile                 |   1 +
 drivers/phy/broadcom/phy-bcm63xx-usbh.c       | 456 ++++++++++++++++++
 4 files changed, 538 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 v3 1/2 dt-bindings: phy: add bcm63xx-usbh bindings

Document BCM63xx USBH PHY bindings.

---
v3: no changes
v2: phy-cells changed to 1.

 .../bindings/phy/brcm,bcm63xx-usbh-phy.yaml   | 72 +++++++++++++++++++
 1 file changed, 72 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/phy/brcm,bcm63xx-usbh-phy.yaml
Documentation/devicetree/bindings/phy/brcm,bcm63xx-usbh-phy.yaml new file +72 -0
new file mode 100644
index 000000000000..9ef2c1f8aa00
@@ -0,0 +1,72 @@
+# 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
+
+  clocks:
+    maxItems: 2
+
+  clock-names:
+    items:
+      - const: usbh
+      - const: usb_ref
+
+  resets:
+    maxItems: 1
+
+  "#phy-cells":
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - resets
+  - "#phy-cells"
+
+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 BCM6368_CLK_USBH>;
+      clock-names = "usbh";
+      resets = <&periph_rst BCM6368_RST_USBH>;
+      #phy-cells = <1>;
+    };
Signature · 1 line
2.27.0
Reviewed-by on v3 1/2
#2 lore raw

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

Quoted 3 lines · Álvaro Fernández Rojas

Document BCM63xx USBH PHY bindings.

Since the USB PHY supports both roles (host and device) on a large number of SoCs, I would just remove "H" from the subject/binding/name accordingly. With that:

Signature · 1 line
Florian
#3 lore raw

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

Quoted 5 lines · Florian Fainelli
Quoted 2 lines · Álvaro Fernández Rojas

Document BCM63xx USBH PHY bindings.

Quoted 7 lines
Quoted 1 line

Since the USB PHY supports both roles (host and device) on a large number of SoCs, I would just remove "H" from the subject/binding/name accordingly. With that:

Well, the register is indeed named USBH, so the name can stay as-is, this is fine, thanks!

Signature · 1 line
Florian
#4 lore raw

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

In reply to Álvaro Fernández Rojas

Add BCM63xx USBH PHY driver for BMIPS.

---
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            |   9 +
 drivers/phy/broadcom/Makefile           |   1 +
 drivers/phy/broadcom/phy-bcm63xx-usbh.c | 456 ++++++++++++++++++++++++
 3 files changed, 466 insertions(+)
 create mode 100644 drivers/phy/broadcom/phy-bcm63xx-usbh.c
drivers/phy/broadcom/Kconfig +9 -0
index b29f11c19155..a7889df8c541 100644
@@ -2,6 +2,15 @@
 #
 # Phy drivers for Broadcom platforms
 #
+config PHY_BCM63XX_USBH
+	tristate "BCM63xx USBH PHY driver"
+	depends on BMIPS_GENERIC || COMPILE_TEST
+	select GENERIC_PHY
+	default BMIPS_GENERIC
+	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 +456 -0

456 lines not on this page · raw message

Signature · 1 line
2.27.0
#5 lore raw

Hi Álvaro,

Quoted 17 lines · Álvaro Fernández Rojas

Add BCM63xx USBH PHY driver for BMIPS.

---
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            |   9 +
 drivers/phy/broadcom/Makefile           |   1 +
 drivers/phy/broadcom/phy-bcm63xx-usbh.c | 456 ++++++++++++++++++++++++
 3 files changed, 466 insertions(+)
 create mode 100644 drivers/phy/broadcom/phy-bcm63xx-usbh.c

[...]

Quoted 6 lines
drivers/phy/broadcom/phy-bcm63xx-usbh.c new file +0 -0
new file mode 100644
index 000000000000..584807205166
@@ -0,0 +1,456 @@

[...]

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

Quoted 1 line
drivers/phy/broadcom/phy-bcm63xx-usbh.c new file +1 -0
+	usbh->reset = devm_reset_control_get(dev, NULL);

Please use devm_reset_control_get_exclusive() instead when requesting exclusive reset controls.

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

Quoted 5 lines
drivers/phy/broadcom/phy-bcm63xx-usbh.c new file +5 -0
+	if (IS_ERR(usbh->reset)) {
+		if (PTR_ERR(usbh->reset) != -EPROBE_DEFER)
+			dev_err(dev, "failed to get reset\n");
+		return PTR_ERR(usbh->reset);
+	}

regards
Philipp