linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 1/3] dt-bindings: phy: brcm, brcmstb-usb-phy: convert to the json-schema
@ 2020-12-21  5:23 Rafał Miłecki
  2020-12-21  5:23 ` [PATCH V2 2/3] dt-bindings: phy: brcm, brcmstb-usb-phy: add BCM4908 binding Rafał Miłecki
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Rafał Miłecki @ 2020-12-21  5:23 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Vinod Koul, Rob Herring
  Cc: devicetree, Florian Fainelli, Al Cooper, linux-kernel,
	bcm-kernel-feedback-list, Rafał Miłecki,
	linux-arm-kernel

From: Rafał Miłecki <rafal@milecki.pl>

Changes that require mentioning:
1. interrupt-names
   Name "wakeup" was changed to the "wake". It matches example and what
   Linux driver looks for in the first place
2. brcm,ipp and brcm,ioc
   Both were described as booleans with 0 / 1 values. In examples they
   were integers and Linux driver checks for int as well.
   I made both uint32 but that probably should be refactored later.
3. Added minimal description

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
V2: Add Al as maintainer
---
 .../bindings/phy/brcm,brcmstb-usb-phy.txt     |  86 --------
 .../bindings/phy/brcm,brcmstb-usb-phy.yaml    | 196 ++++++++++++++++++
 2 files changed, 196 insertions(+), 86 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.txt
 create mode 100644 Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.yaml

diff --git a/Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.txt b/Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.txt
deleted file mode 100644
index 698aacbdcfc4..000000000000
--- a/Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.txt
+++ /dev/null
@@ -1,86 +0,0 @@
-Broadcom STB USB PHY
-
-Required properties:
-- compatible: should be one of
-	"brcm,brcmstb-usb-phy"
-	"brcm,bcm7216-usb-phy"
-	"brcm,bcm7211-usb-phy"
-
-- reg and reg-names properties requirements are specific to the
-  compatible string.
-  "brcm,brcmstb-usb-phy":
-    - reg: 1 or 2 offset and length pairs. One for the base CTRL registers
-           and an optional pair for systems with USB 3.x support
-    - reg-names: not specified
-  "brcm,bcm7216-usb-phy":
-    - reg: 3 offset and length pairs for CTRL, XHCI_EC and XHCI_GBL
-           registers
-    - reg-names: "ctrl", "xhci_ec", "xhci_gbl"
-  "brcm,bcm7211-usb-phy":
-    - reg: 5 offset and length pairs for CTRL, XHCI_EC, XHCI_GBL,
-           USB_PHY and USB_MDIO registers and an optional pair
-	   for the BDC registers
-    - reg-names: "ctrl", "xhci_ec", "xhci_gbl", "usb_phy", "usb_mdio", "bdc_ec"
-
-- #phy-cells: Shall be 1 as it expects one argument for setting
-	      the type of the PHY. Possible values are:
-	      - PHY_TYPE_USB2 for USB1.1/2.0 PHY
-	      - PHY_TYPE_USB3 for USB3.x PHY
-
-Optional Properties:
-- clocks : clock phandles.
-- clock-names: String, clock name.
-- interrupts: wakeup interrupt
-- interrupt-names: "wakeup"
-- brcm,ipp: Boolean, Invert Port Power.
-  Possible values are: 0 (Don't invert), 1 (Invert)
-- brcm,ioc: Boolean, Invert Over Current detection.
-  Possible values are: 0 (Don't invert), 1 (Invert)
-- dr_mode: String, PHY Device mode.
-  Possible values are: "host", "peripheral ", "drd" or "typec-pd"
-  If this property is not defined, the phy will default to "host" mode.
-- brcm,syscon-piarbctl: phandle to syscon for handling config registers
-NOTE: one or both of the following two properties must be set
-- brcm,has-xhci: Boolean indicating the phy has an XHCI phy.
-- brcm,has-eohci: Boolean indicating the phy has an EHCI/OHCI phy.
-
-
-Example:
-
-usbphy_0: usb-phy@f0470200 {
-	reg = <0xf0470200 0xb8>,
-		<0xf0471940 0x6c0>;
-	compatible = "brcm,brcmstb-usb-phy";
-	#phy-cells = <1>;
-	dr_mode = "host"
-	brcm,ioc = <1>;
-	brcm,ipp = <1>;
-	brcm,has-xhci;
-	brcm,has-eohci;
-	clocks = <&usb20>, <&usb30>;
-	clock-names = "sw_usb", "sw_usb3";
-};
-
-usb-phy@29f0200 {
-	reg = <0x29f0200 0x200>,
-		<0x29c0880 0x30>,
-		<0x29cc100 0x534>,
-		<0x2808000 0x24>,
-		<0x2980080 0x8>;
-	reg-names = "ctrl",
-		"xhci_ec",
-		"xhci_gbl",
-		"usb_phy",
-		"usb_mdio";
-	brcm,ioc = <0x0>;
-	brcm,ipp = <0x0>;
-	compatible = "brcm,bcm7211-usb-phy";
-	interrupts = <0x30>;
-	interrupt-parent = <&vpu_intr1_nosec_intc>;
-	interrupt-names = "wake";
-	#phy-cells = <0x1>;
-	brcm,has-xhci;
-	syscon-piarbctl = <&syscon_piarbctl>;
-	clocks = <&scmi_clk 256>;
-	clock-names = "sw_usb";
-};
diff --git a/Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.yaml b/Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.yaml
new file mode 100644
index 000000000000..1dad1e3df1a5
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.yaml
@@ -0,0 +1,196 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/brcm,brcmstb-usb-phy.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom STB USB PHY
+
+description: Broadcom's PHY that handles EHCI/OHCI and/or XHCI
+
+maintainers:
+  - Al Cooper <alcooperx@gmail.com>
+  - Rafał Miłecki <rafal@milecki.pl>
+
+properties:
+  compatible:
+    enum:
+      - brcm,bcm7211-usb-phy
+      - brcm,bcm7216-usb-phy
+      - brcm,brcmstb-usb-phy
+
+  clocks:
+    minItems: 1
+    maxItems: 2
+
+  clock-names:
+    minItems: 1
+    maxItems: 2
+    items:
+      - const: sw_usb
+      - const: sw_usb3
+
+  interrupts:
+    description: wakeup interrupt
+
+  interrupt-names:
+    const: wake
+
+  brcm,ipp:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Invert Port Power
+    minimum: 0
+    maximum: 1
+
+  brcm,ioc:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Invert Over Current detection
+    minimum: 0
+    maximum: 1
+
+  dr_mode:
+    description: PHY Device mode. If this property is not defined, the PHY will
+      default to "host" mode.
+    enum:
+      - host
+      - peripheral
+      - drd
+      - typec-pd
+
+  brcm,syscon-piarbctl:
+    description: phandle to syscon for handling config registers
+    $ref: /schemas/types.yaml#/definitions/phandle
+
+  brcm,has-xhci:
+    description: Indicates the PHY has an XHCI PHY.
+    type: boolean
+
+  brcm,has-eohci:
+    description: Indicates the PHY has an EHCI/OHCI PHY.
+    type: boolean
+
+  "#phy-cells":
+    description: |
+      Cell allows setting the type of the PHY. Possible values are:
+      - PHY_TYPE_USB2 for USB1.1/2.0 PHY
+      - PHY_TYPE_USB3 for USB3.x PHY
+    const: 1
+
+required:
+  - reg
+  - "#phy-cells"
+
+anyOf:
+  - required:
+      - brcm,has-xhci
+  - required:
+      - brcm,has-eohci
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: brcm,brcmstb-usb-phy
+    then:
+      properties:
+        reg:
+          minItems: 1
+          maxItems: 2
+          items:
+            - description: the base CTRL register
+            - description: XHCI EC register
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: brcm,bcm7211-usb-phy
+    then:
+      properties:
+        reg:
+          minItems: 5
+          maxItems: 6
+          items:
+            - description: the base CTRL register
+            - description: XHCI EC register
+            - description: XHCI GBL register
+            - description: USB PHY register
+            - description: USB MDIO register
+            - description: BDC register
+        reg-names:
+          minItems: 5
+          maxItems: 6
+          items:
+            - const: ctrl
+            - const: xhci_ec
+            - const: xhci_gbl
+            - const: usb_phy
+            - const: usb_mdio
+            - const: bdc_ec
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: brcm,bcm7216-usb-phy
+    then:
+      properties:
+        reg:
+          minItems: 3
+          maxItems: 3
+          items:
+            - description: the base CTRL register
+            - description: XHCI EC register
+            - description: XHCI GBL register
+        reg-names:
+          minItems: 3
+          maxItems: 3
+          items:
+            - const: ctrl
+            - const: xhci_ec
+            - const: xhci_gbl
+
+additionalProperties: true
+
+examples:
+  - |
+    #include <dt-bindings/phy/phy.h>
+
+    usb-phy@f0470200 {
+        compatible = "brcm,brcmstb-usb-phy";
+        reg = <0xf0470200 0xb8>,
+              <0xf0471940 0x6c0>;
+        #phy-cells = <1>;
+        dr_mode = "host";
+        brcm,ioc = <1>;
+        brcm,ipp = <1>;
+        brcm,has-xhci;
+        brcm,has-eohci;
+        clocks = <&usb20>, <&usb30>;
+        clock-names = "sw_usb", "sw_usb3";
+    };
+  - |
+    #include <dt-bindings/phy/phy.h>
+
+    usb-phy@29f0200 {
+        compatible = "brcm,bcm7211-usb-phy";
+        reg = <0x29f0200 0x200>,
+              <0x29c0880 0x30>,
+              <0x29cc100 0x534>,
+              <0x2808000 0x24>,
+              <0x2980080 0x8>;
+        reg-names = "ctrl",
+            "xhci_ec",
+            "xhci_gbl",
+            "usb_phy",
+            "usb_mdio";
+        brcm,ioc = <0x0>;
+        brcm,ipp = <0x0>;
+        interrupts = <0x30>;
+        interrupt-parent = <&vpu_intr1_nosec_intc>;
+        interrupt-names = "wake";
+        #phy-cells = <0x1>;
+        brcm,has-xhci;
+        syscon-piarbctl = <&syscon_piarbctl>;
+        clocks = <&scmi_clk 256>;
+        clock-names = "sw_usb";
+    };
-- 
2.26.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH V2 2/3] dt-bindings: phy: brcm, brcmstb-usb-phy: add BCM4908 binding
  2020-12-21  5:23 [PATCH V2 1/3] dt-bindings: phy: brcm, brcmstb-usb-phy: convert to the json-schema Rafał Miłecki
@ 2020-12-21  5:23 ` Rafał Miłecki
  2021-01-03 16:24   ` Rob Herring
  2020-12-21  5:23 ` [PATCH V2 3/3] phy: phy-brcm-usb: support PHY on the BCM4908 Rafał Miłecki
  2021-01-03 16:23 ` [PATCH V2 1/3] dt-bindings: phy: brcm,brcmstb-usb-phy: convert to the json-schema Rob Herring
  2 siblings, 1 reply; 6+ messages in thread
From: Rafał Miłecki @ 2020-12-21  5:23 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Vinod Koul, Rob Herring
  Cc: devicetree, Florian Fainelli, Al Cooper, linux-kernel,
	bcm-kernel-feedback-list, Rafał Miłecki,
	linux-arm-kernel

From: Rafał Miłecki <rafal@milecki.pl>

BCM4908 uses the same PHY and may require just a slightly different
programming.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
---
 .../devicetree/bindings/phy/brcm,brcmstb-usb-phy.yaml        | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.yaml b/Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.yaml
index 1dad1e3df1a5..2bdcb649808b 100644
--- a/Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.yaml
+++ b/Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.yaml
@@ -15,6 +15,7 @@ maintainers:
 properties:
   compatible:
     enum:
+      - brcm,bcm4908-usb-phy
       - brcm,bcm7211-usb-phy
       - brcm,bcm7216-usb-phy
       - brcm,brcmstb-usb-phy
@@ -91,7 +92,9 @@ allOf:
       properties:
         compatible:
           contains:
-            const: brcm,brcmstb-usb-phy
+            enum:
+              - const: brcm,bcm4908-usb-phy
+              - const: brcm,brcmstb-usb-phy
     then:
       properties:
         reg:
-- 
2.26.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH V2 3/3] phy: phy-brcm-usb: support PHY on the BCM4908
  2020-12-21  5:23 [PATCH V2 1/3] dt-bindings: phy: brcm, brcmstb-usb-phy: convert to the json-schema Rafał Miłecki
  2020-12-21  5:23 ` [PATCH V2 2/3] dt-bindings: phy: brcm, brcmstb-usb-phy: add BCM4908 binding Rafał Miłecki
@ 2020-12-21  5:23 ` Rafał Miłecki
  2021-01-03 16:23 ` [PATCH V2 1/3] dt-bindings: phy: brcm,brcmstb-usb-phy: convert to the json-schema Rob Herring
  2 siblings, 0 replies; 6+ messages in thread
From: Rafał Miłecki @ 2020-12-21  5:23 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Vinod Koul, Rob Herring
  Cc: devicetree, Florian Fainelli, Al Cooper, linux-kernel,
	bcm-kernel-feedback-list, Rafał Miłecki,
	linux-arm-kernel

From: Rafał Miłecki <rafal@milecki.pl>

BCM4908 seems to have slightly different registers but works when
programmed just like the STB one.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
V2: Update Kconfig as well
---
 drivers/phy/broadcom/Kconfig        | 3 ++-
 drivers/phy/broadcom/phy-brcm-usb.c | 4 ++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/broadcom/Kconfig b/drivers/phy/broadcom/Kconfig
index a1f1a9c90d0d..09256339bd04 100644
--- a/drivers/phy/broadcom/Kconfig
+++ b/drivers/phy/broadcom/Kconfig
@@ -91,10 +91,11 @@ config PHY_BRCM_SATA
 
 config PHY_BRCM_USB
 	tristate "Broadcom STB USB PHY driver"
-	depends on ARCH_BRCMSTB || COMPILE_TEST
+	depends on ARCH_BCM4908 || ARCH_BRCMSTB || COMPILE_TEST
 	depends on OF
 	select GENERIC_PHY
 	select SOC_BRCMSTB
+	default ARCH_BCM4908
 	default ARCH_BRCMSTB
 	help
 	  Enable this to support the Broadcom STB USB PHY.
diff --git a/drivers/phy/broadcom/phy-brcm-usb.c b/drivers/phy/broadcom/phy-brcm-usb.c
index 99fbc7e4138b..63f922a5f29b 100644
--- a/drivers/phy/broadcom/phy-brcm-usb.c
+++ b/drivers/phy/broadcom/phy-brcm-usb.c
@@ -285,6 +285,10 @@ static const struct match_chip_info chip_info_7445 = {
 };
 
 static const struct of_device_id brcm_usb_dt_ids[] = {
+	{
+		.compatible = "brcm,bcm4908-usb-phy",
+		.data = &chip_info_7445,
+	},
 	{
 		.compatible = "brcm,bcm7216-usb-phy",
 		.data = &chip_info_7216,
-- 
2.26.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH V2 1/3] dt-bindings: phy: brcm,brcmstb-usb-phy: convert to the json-schema
  2020-12-21  5:23 [PATCH V2 1/3] dt-bindings: phy: brcm, brcmstb-usb-phy: convert to the json-schema Rafał Miłecki
  2020-12-21  5:23 ` [PATCH V2 2/3] dt-bindings: phy: brcm, brcmstb-usb-phy: add BCM4908 binding Rafał Miłecki
  2020-12-21  5:23 ` [PATCH V2 3/3] phy: phy-brcm-usb: support PHY on the BCM4908 Rafał Miłecki
@ 2021-01-03 16:23 ` Rob Herring
  2021-01-03 16:37   ` [PATCH V2 1/3] dt-bindings: phy: brcm, brcmstb-usb-phy: " Rafał Miłecki
  2 siblings, 1 reply; 6+ messages in thread
From: Rob Herring @ 2021-01-03 16:23 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: devicetree, Florian Fainelli, Al Cooper, linux-kernel,
	Kishon Vijay Abraham I, Vinod Koul, bcm-kernel-feedback-list,
	Rafał Miłecki, linux-arm-kernel

On Mon, Dec 21, 2020 at 06:23:37AM +0100, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
> 
> Changes that require mentioning:
> 1. interrupt-names
>    Name "wakeup" was changed to the "wake". It matches example and what
>    Linux driver looks for in the first place
> 2. brcm,ipp and brcm,ioc
>    Both were described as booleans with 0 / 1 values. In examples they
>    were integers and Linux driver checks for int as well.
>    I made both uint32 but that probably should be refactored later.

Why? You're stuck with that now.

> 3. Added minimal description
> 
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> ---
> V2: Add Al as maintainer
> ---
>  .../bindings/phy/brcm,brcmstb-usb-phy.txt     |  86 --------
>  .../bindings/phy/brcm,brcmstb-usb-phy.yaml    | 196 ++++++++++++++++++
>  2 files changed, 196 insertions(+), 86 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.txt
>  create mode 100644 Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.yaml
> 
> diff --git a/Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.txt b/Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.txt
> deleted file mode 100644
> index 698aacbdcfc4..000000000000
> --- a/Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.txt
> +++ /dev/null
> @@ -1,86 +0,0 @@
> -Broadcom STB USB PHY
> -
> -Required properties:
> -- compatible: should be one of
> -	"brcm,brcmstb-usb-phy"
> -	"brcm,bcm7216-usb-phy"
> -	"brcm,bcm7211-usb-phy"
> -
> -- reg and reg-names properties requirements are specific to the
> -  compatible string.
> -  "brcm,brcmstb-usb-phy":
> -    - reg: 1 or 2 offset and length pairs. One for the base CTRL registers
> -           and an optional pair for systems with USB 3.x support
> -    - reg-names: not specified
> -  "brcm,bcm7216-usb-phy":
> -    - reg: 3 offset and length pairs for CTRL, XHCI_EC and XHCI_GBL
> -           registers
> -    - reg-names: "ctrl", "xhci_ec", "xhci_gbl"
> -  "brcm,bcm7211-usb-phy":
> -    - reg: 5 offset and length pairs for CTRL, XHCI_EC, XHCI_GBL,
> -           USB_PHY and USB_MDIO registers and an optional pair
> -	   for the BDC registers
> -    - reg-names: "ctrl", "xhci_ec", "xhci_gbl", "usb_phy", "usb_mdio", "bdc_ec"
> -
> -- #phy-cells: Shall be 1 as it expects one argument for setting
> -	      the type of the PHY. Possible values are:
> -	      - PHY_TYPE_USB2 for USB1.1/2.0 PHY
> -	      - PHY_TYPE_USB3 for USB3.x PHY
> -
> -Optional Properties:
> -- clocks : clock phandles.
> -- clock-names: String, clock name.
> -- interrupts: wakeup interrupt
> -- interrupt-names: "wakeup"
> -- brcm,ipp: Boolean, Invert Port Power.
> -  Possible values are: 0 (Don't invert), 1 (Invert)
> -- brcm,ioc: Boolean, Invert Over Current detection.
> -  Possible values are: 0 (Don't invert), 1 (Invert)
> -- dr_mode: String, PHY Device mode.
> -  Possible values are: "host", "peripheral ", "drd" or "typec-pd"
> -  If this property is not defined, the phy will default to "host" mode.
> -- brcm,syscon-piarbctl: phandle to syscon for handling config registers
> -NOTE: one or both of the following two properties must be set
> -- brcm,has-xhci: Boolean indicating the phy has an XHCI phy.
> -- brcm,has-eohci: Boolean indicating the phy has an EHCI/OHCI phy.
> -
> -
> -Example:
> -
> -usbphy_0: usb-phy@f0470200 {
> -	reg = <0xf0470200 0xb8>,
> -		<0xf0471940 0x6c0>;
> -	compatible = "brcm,brcmstb-usb-phy";
> -	#phy-cells = <1>;
> -	dr_mode = "host"
> -	brcm,ioc = <1>;
> -	brcm,ipp = <1>;
> -	brcm,has-xhci;
> -	brcm,has-eohci;
> -	clocks = <&usb20>, <&usb30>;
> -	clock-names = "sw_usb", "sw_usb3";
> -};
> -
> -usb-phy@29f0200 {
> -	reg = <0x29f0200 0x200>,
> -		<0x29c0880 0x30>,
> -		<0x29cc100 0x534>,
> -		<0x2808000 0x24>,
> -		<0x2980080 0x8>;
> -	reg-names = "ctrl",
> -		"xhci_ec",
> -		"xhci_gbl",
> -		"usb_phy",
> -		"usb_mdio";
> -	brcm,ioc = <0x0>;
> -	brcm,ipp = <0x0>;
> -	compatible = "brcm,bcm7211-usb-phy";
> -	interrupts = <0x30>;
> -	interrupt-parent = <&vpu_intr1_nosec_intc>;
> -	interrupt-names = "wake";
> -	#phy-cells = <0x1>;
> -	brcm,has-xhci;
> -	syscon-piarbctl = <&syscon_piarbctl>;
> -	clocks = <&scmi_clk 256>;
> -	clock-names = "sw_usb";
> -};
> diff --git a/Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.yaml b/Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.yaml
> new file mode 100644
> index 000000000000..1dad1e3df1a5
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/phy/brcm,brcmstb-usb-phy.yaml
> @@ -0,0 +1,196 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/phy/brcm,brcmstb-usb-phy.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Broadcom STB USB PHY
> +
> +description: Broadcom's PHY that handles EHCI/OHCI and/or XHCI
> +
> +maintainers:
> +  - Al Cooper <alcooperx@gmail.com>
> +  - Rafał Miłecki <rafal@milecki.pl>
> +
> +properties:
> +  compatible:
> +    enum:
> +      - brcm,bcm7211-usb-phy
> +      - brcm,bcm7216-usb-phy
> +      - brcm,brcmstb-usb-phy
> +
> +  clocks:
> +    minItems: 1
> +    maxItems: 2
> +
> +  clock-names:
> +    minItems: 1
> +    maxItems: 2
> +    items:
> +      - const: sw_usb
> +      - const: sw_usb3
> +
> +  interrupts:
> +    description: wakeup interrupt
> +
> +  interrupt-names:
> +    const: wake
> +
> +  brcm,ipp:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description: Invert Port Power
> +    minimum: 0
> +    maximum: 1
> +
> +  brcm,ioc:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description: Invert Over Current detection
> +    minimum: 0
> +    maximum: 1
> +
> +  dr_mode:
> +    description: PHY Device mode. If this property is not defined, the PHY will
> +      default to "host" mode.
> +    enum:
> +      - host
> +      - peripheral
> +      - drd
> +      - typec-pd
> +
> +  brcm,syscon-piarbctl:
> +    description: phandle to syscon for handling config registers
> +    $ref: /schemas/types.yaml#/definitions/phandle
> +
> +  brcm,has-xhci:
> +    description: Indicates the PHY has an XHCI PHY.
> +    type: boolean
> +
> +  brcm,has-eohci:
> +    description: Indicates the PHY has an EHCI/OHCI PHY.
> +    type: boolean
> +
> +  "#phy-cells":
> +    description: |
> +      Cell allows setting the type of the PHY. Possible values are:
> +      - PHY_TYPE_USB2 for USB1.1/2.0 PHY
> +      - PHY_TYPE_USB3 for USB3.x PHY
> +    const: 1
> +
> +required:
> +  - reg
> +  - "#phy-cells"
> +
> +anyOf:
> +  - required:
> +      - brcm,has-xhci
> +  - required:
> +      - brcm,has-eohci
> +
> +allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: brcm,brcmstb-usb-phy
> +    then:
> +      properties:
> +        reg:
> +          minItems: 1
> +          maxItems: 2
> +          items:
> +            - description: the base CTRL register
> +            - description: XHCI EC register
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: brcm,bcm7211-usb-phy
> +    then:
> +      properties:
> +        reg:
> +          minItems: 5
> +          maxItems: 6
> +          items:
> +            - description: the base CTRL register
> +            - description: XHCI EC register
> +            - description: XHCI GBL register
> +            - description: USB PHY register
> +            - description: USB MDIO register
> +            - description: BDC register
> +        reg-names:
> +          minItems: 5
> +          maxItems: 6
> +          items:
> +            - const: ctrl
> +            - const: xhci_ec
> +            - const: xhci_gbl
> +            - const: usb_phy
> +            - const: usb_mdio
> +            - const: bdc_ec
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: brcm,bcm7216-usb-phy
> +    then:
> +      properties:
> +        reg:
> +          minItems: 3
> +          maxItems: 3
> +          items:
> +            - description: the base CTRL register
> +            - description: XHCI EC register
> +            - description: XHCI GBL register
> +        reg-names:
> +          minItems: 3
> +          maxItems: 3
> +          items:
> +            - const: ctrl
> +            - const: xhci_ec
> +            - const: xhci_gbl

Given the names are always the same, you can define them in the main 
section and then the if/then schemas just need minItems/maxItems.

> +
> +additionalProperties: true

Define reg/reg-names in the main section and make this false.

> +
> +examples:
> +  - |
> +    #include <dt-bindings/phy/phy.h>
> +
> +    usb-phy@f0470200 {
> +        compatible = "brcm,brcmstb-usb-phy";
> +        reg = <0xf0470200 0xb8>,
> +              <0xf0471940 0x6c0>;
> +        #phy-cells = <1>;
> +        dr_mode = "host";
> +        brcm,ioc = <1>;
> +        brcm,ipp = <1>;
> +        brcm,has-xhci;
> +        brcm,has-eohci;
> +        clocks = <&usb20>, <&usb30>;
> +        clock-names = "sw_usb", "sw_usb3";
> +    };
> +  - |
> +    #include <dt-bindings/phy/phy.h>
> +
> +    usb-phy@29f0200 {
> +        compatible = "brcm,bcm7211-usb-phy";
> +        reg = <0x29f0200 0x200>,
> +              <0x29c0880 0x30>,
> +              <0x29cc100 0x534>,
> +              <0x2808000 0x24>,
> +              <0x2980080 0x8>;
> +        reg-names = "ctrl",
> +            "xhci_ec",
> +            "xhci_gbl",
> +            "usb_phy",
> +            "usb_mdio";
> +        brcm,ioc = <0x0>;
> +        brcm,ipp = <0x0>;
> +        interrupts = <0x30>;
> +        interrupt-parent = <&vpu_intr1_nosec_intc>;
> +        interrupt-names = "wake";
> +        #phy-cells = <0x1>;
> +        brcm,has-xhci;
> +        syscon-piarbctl = <&syscon_piarbctl>;
> +        clocks = <&scmi_clk 256>;
> +        clock-names = "sw_usb";
> +    };
> -- 
> 2.26.2
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH V2 2/3] dt-bindings: phy: brcm, brcmstb-usb-phy: add BCM4908 binding
  2020-12-21  5:23 ` [PATCH V2 2/3] dt-bindings: phy: brcm, brcmstb-usb-phy: add BCM4908 binding Rafał Miłecki
@ 2021-01-03 16:24   ` Rob Herring
  0 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2021-01-03 16:24 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: devicetree, Florian Fainelli, Al Cooper, linux-kernel,
	Kishon Vijay Abraham I, Vinod Koul, Rob Herring,
	bcm-kernel-feedback-list, Rafał Miłecki,
	linux-arm-kernel

On Mon, 21 Dec 2020 06:23:38 +0100, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
> 
> BCM4908 uses the same PHY and may require just a slightly different
> programming.
> 
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> Acked-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
>  .../devicetree/bindings/phy/brcm,brcmstb-usb-phy.yaml        | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 

Acked-by: Rob Herring <robh@kernel.org>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH V2 1/3] dt-bindings: phy: brcm, brcmstb-usb-phy: convert to the json-schema
  2021-01-03 16:23 ` [PATCH V2 1/3] dt-bindings: phy: brcm,brcmstb-usb-phy: convert to the json-schema Rob Herring
@ 2021-01-03 16:37   ` Rafał Miłecki
  0 siblings, 0 replies; 6+ messages in thread
From: Rafał Miłecki @ 2021-01-03 16:37 UTC (permalink / raw)
  To: Rob Herring
  Cc: devicetree, Florian Fainelli, Al Cooper, linux-kernel,
	Kishon Vijay Abraham I, Vinod Koul, bcm-kernel-feedback-list,
	Rafał Miłecki, linux-arm-kernel

On 03.01.2021 17:23, Rob Herring wrote:
> On Mon, Dec 21, 2020 at 06:23:37AM +0100, Rafał Miłecki wrote:
>> From: Rafał Miłecki <rafal@milecki.pl>
>>
>> Changes that require mentioning:
>> 1. interrupt-names
>>     Name "wakeup" was changed to the "wake". It matches example and what
>>     Linux driver looks for in the first place
>> 2. brcm,ipp and brcm,ioc
>>     Both were described as booleans with 0 / 1 values. In examples they
>>     were integers and Linux driver checks for int as well.
>>     I made both uint32 but that probably should be refactored later.
> 
> Why? You're stuck with that now.

"Why?" refactor later? I thought it makes more sense for boolean-like
settings to use boolean type. Just a slightly cleaner approach.

If we care to, I believe I can do that without breaking backward
compatibility. A simple value length check:
length 1: treat 0 as false, treat 1 as true
length 0: treat property existence as true

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-01-03 16:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-21  5:23 [PATCH V2 1/3] dt-bindings: phy: brcm, brcmstb-usb-phy: convert to the json-schema Rafał Miłecki
2020-12-21  5:23 ` [PATCH V2 2/3] dt-bindings: phy: brcm, brcmstb-usb-phy: add BCM4908 binding Rafał Miłecki
2021-01-03 16:24   ` Rob Herring
2020-12-21  5:23 ` [PATCH V2 3/3] phy: phy-brcm-usb: support PHY on the BCM4908 Rafał Miłecki
2021-01-03 16:23 ` [PATCH V2 1/3] dt-bindings: phy: brcm,brcmstb-usb-phy: convert to the json-schema Rob Herring
2021-01-03 16:37   ` [PATCH V2 1/3] dt-bindings: phy: brcm, brcmstb-usb-phy: " Rafał Miłecki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).