2021-02-26 11:47:47

by Rafał Miłecki

[permalink] [raw]
Subject: [PATCH 1/3] dt-bindings: phy: convert Broadcom NS USB 2.0 to the json-schema

From: Rafał Miłecki <[email protected]>

Minor example fixes:
1. Include bcm-nsp.h
2. Add address to the node name

Signed-off-by: Rafał Miłecki <[email protected]>
---
This has been verified using dt_binding_check
---
.../bindings/phy/bcm-ns-usb2-phy.txt | 21 -------
.../bindings/phy/brcm,ns-usb2-phy.yaml | 55 +++++++++++++++++++
2 files changed, 55 insertions(+), 21 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/phy/bcm-ns-usb2-phy.txt
create mode 100644 Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml

diff --git a/Documentation/devicetree/bindings/phy/bcm-ns-usb2-phy.txt b/Documentation/devicetree/bindings/phy/bcm-ns-usb2-phy.txt
deleted file mode 100644
index a7aee9ea8926..000000000000
--- a/Documentation/devicetree/bindings/phy/bcm-ns-usb2-phy.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-Driver for Broadcom Northstar USB 2.0 PHY
-
-Required properties:
-- compatible: brcm,ns-usb2-phy
-- reg: iomem address range of DMU (Device Management Unit)
-- reg-names: "dmu", the only needed & supported reg right now
-- clocks: USB PHY reference clock
-- clock-names: "phy-ref-clk", the only needed & supported clock right now
-
-To initialize USB 2.0 PHY driver needs to setup PLL correctly. To do this it
-requires passing phandle to the USB PHY reference clock.
-
-Example:
- usb2-phy {
- compatible = "brcm,ns-usb2-phy";
- reg = <0x1800c000 0x1000>;
- reg-names = "dmu";
- #phy-cells = <0>;
- clocks = <&genpll BCM_NSP_GENPLL_USB_PHY_REF_CLK>;
- clock-names = "phy-ref-clk";
- };
diff --git a/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml b/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml
new file mode 100644
index 000000000000..b8b683ce8fa9
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml
@@ -0,0 +1,55 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/phy/brcm,ns-usb2-phy.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom Northstar USB 2.0 PHY
+
+description: Broadcom's USB 2.0 PHY integrated into Northstar family SoCs
+
+maintainers:
+ - Rafał Miłecki <[email protected]>
+
+properties:
+ compatible:
+ const: brcm,ns-usb2-phy
+
+ reg:
+ maxItems: 1
+ description: DMU (Device Management Unit) address range
+
+ reg-names:
+ const: dmu
+
+ clocks:
+ maxItems: 1
+ description: USB PHY reference clock
+
+ clock-names:
+ const: phy-ref-clk
+
+ "#phy-cells":
+ const: 0
+
+required:
+ - reg
+ - reg-names
+ - clocks
+ - clock-names
+ - "#phy-cells"
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/clock/bcm-nsp.h>
+
+ usb2-phy@1800c000 {
+ compatible = "brcm,ns-usb2-phy";
+ reg = <0x1800c000 0x1000>;
+ reg-names = "dmu";
+ clocks = <&genpll BCM_NSP_GENPLL_USB_PHY_REF_CLK>;
+ clock-names = "phy-ref-clk";
+ #phy-cells = <0>;
+ };
--
2.26.2


2021-02-26 11:48:28

by Rafał Miłecki

[permalink] [raw]
Subject: [PATCH 2/3] dt-bindings: phy: brcm,ns-usb2-phy: bind single CRU reg

From: Rafał Miłecki <[email protected]>

The old binding was using whole DMU space. It was an overkill. DMU is a
big block which contains e.g. CRU which contains e.g. PLLs, PHY, pinctrl
and thermal blocks.

Rework the binding to directly use a single CRU register that controls
USB 2.0 PHY. It's still required to reference CRU generic clkset
register so add a syscon for that.

For a full DMU & CRU description see arch/arm/boot/dts/bcm5301x.dtsi .

The old binding is deprecated now.

Signed-off-by: Rafał Miłecki <[email protected]>
---
This has been verified using dt_binding_check

I'd really like to get Rob's ack to make sure I don't do anything stupid

It's a reworked version of my abonded 2019 patch:
[PATCH V2 1/2] dt-bindings: bcm-ns-usb2-phy: rework binding to use CRU syscon
https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]/
---
.../bindings/phy/brcm,ns-usb2-phy.yaml | 46 +++++++++++++++----
1 file changed, 36 insertions(+), 10 deletions(-)

diff --git a/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml b/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml
index b8b683ce8fa9..8e056d4d205a 100644
--- a/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml
+++ b/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml
@@ -16,11 +16,20 @@ properties:
const: brcm,ns-usb2-phy

reg:
- maxItems: 1
- description: DMU (Device Management Unit) address range
+ anyOf:
+ - maxItems: 1
+ description: PHY control register
+ - maxItems: 1
+ description: DMU (Device Management Unit) address range
+ deprecated: true

reg-names:
const: dmu
+ deprecated: true
+
+ brcm,syscon-clkset:
+ description: phandle to syscon for clkset register
+ $ref: /schemas/types.yaml#/definitions/phandle

clocks:
maxItems: 1
@@ -34,22 +43,39 @@ properties:

required:
- reg
- - reg-names
- clocks
- clock-names
- "#phy-cells"

+oneOf:
+ - required:
+ - brcm,syscon-clkset
+ - required:
+ - reg-names
+
additionalProperties: false

examples:
- |
#include <dt-bindings/clock/bcm-nsp.h>

- usb2-phy@1800c000 {
- compatible = "brcm,ns-usb2-phy";
- reg = <0x1800c000 0x1000>;
- reg-names = "dmu";
- clocks = <&genpll BCM_NSP_GENPLL_USB_PHY_REF_CLK>;
- clock-names = "phy-ref-clk";
- #phy-cells = <0>;
+ cru-bus@1800c100 {
+ compatible = "simple-bus";
+ ranges = <0 0x1800c100 0x1a4>;
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ usb2-phy@64 {
+ compatible = "brcm,ns-usb2-phy";
+ reg = <0x64 0x4>;
+ brcm,syscon-clkset = <&clkset>;
+ clocks = <&genpll BCM_NSP_GENPLL_USB_PHY_REF_CLK>;
+ clock-names = "phy-ref-clk";
+ #phy-cells = <0>;
+ };
+
+ clkset: syscon@80 {
+ compatible = "brcm,cru-clkset", "syscon";
+ reg = <0x80 0x4>;
+ };
};
--
2.26.2

2021-02-26 11:49:39

by Rafał Miłecki

[permalink] [raw]
Subject: [PATCH 3/3] phy: bcm-ns-usb2: support updated single CRU reg DT binding

From: Rafał Miłecki <[email protected]>

Updated DT binding maps a single CRU register that is directly used for
the PHY control. Accessing common CRU reg is handled using syscon &
regmap.

The old binding has been deprecated and stays as a fallback method.

Signed-off-by: Rafał Miłecki <[email protected]>
---
It's a reworked version of my abonded 2019 patch:
[PATCH V2 2/2] phy: bcm-ns-usb2: support updated DT binding with the CRU syscon
https://lore.kernel.org/patchwork/patch/1029863/
---
drivers/phy/broadcom/phy-bcm-ns-usb2.c | 52 +++++++++++++++++++++-----
1 file changed, 43 insertions(+), 9 deletions(-)

diff --git a/drivers/phy/broadcom/phy-bcm-ns-usb2.c b/drivers/phy/broadcom/phy-bcm-ns-usb2.c
index 4b015b8a71c3..98d32729a45d 100644
--- a/drivers/phy/broadcom/phy-bcm-ns-usb2.c
+++ b/drivers/phy/broadcom/phy-bcm-ns-usb2.c
@@ -9,17 +9,23 @@
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/err.h>
+#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/of_address.h>
#include <linux/of_platform.h>
#include <linux/phy/phy.h>
#include <linux/platform_device.h>
+#include <linux/regmap.h>
#include <linux/slab.h>

struct bcm_ns_usb2 {
struct device *dev;
struct clk *ref_clk;
struct phy *phy;
+ struct regmap *clkset;
+ void __iomem *base;
+
+ /* Deprecated binding */
void __iomem *dmu;
};

@@ -27,7 +33,6 @@ static int bcm_ns_usb2_phy_init(struct phy *phy)
{
struct bcm_ns_usb2 *usb2 = phy_get_drvdata(phy);
struct device *dev = usb2->dev;
- void __iomem *dmu = usb2->dmu;
u32 ref_clk_rate, usb2ctl, usb_pll_ndiv, usb_pll_pdiv;
int err = 0;

@@ -44,7 +49,10 @@ static int bcm_ns_usb2_phy_init(struct phy *phy)
goto err_clk_off;
}

- usb2ctl = readl(dmu + BCMA_DMU_CRU_USB2_CONTROL);
+ if (usb2->base)
+ usb2ctl = readl(usb2->base);
+ else
+ usb2ctl = readl(usb2->dmu + BCMA_DMU_CRU_USB2_CONTROL);

if (usb2ctl & BCMA_DMU_CRU_USB2_CONTROL_USB_PLL_PDIV_MASK) {
usb_pll_pdiv = usb2ctl;
@@ -58,15 +66,24 @@ static int bcm_ns_usb2_phy_init(struct phy *phy)
usb_pll_ndiv = (1920000000 * usb_pll_pdiv) / ref_clk_rate;

/* Unlock DMU PLL settings with some magic value */
- writel(0x0000ea68, dmu + BCMA_DMU_CRU_CLKSET_KEY);
+ if (usb2->clkset)
+ regmap_write(usb2->clkset, 0, 0x0000ea68);
+ else
+ writel(0x0000ea68, usb2->dmu + BCMA_DMU_CRU_CLKSET_KEY);

/* Write USB 2.0 PLL control setting */
usb2ctl &= ~BCMA_DMU_CRU_USB2_CONTROL_USB_PLL_NDIV_MASK;
usb2ctl |= usb_pll_ndiv << BCMA_DMU_CRU_USB2_CONTROL_USB_PLL_NDIV_SHIFT;
- writel(usb2ctl, dmu + BCMA_DMU_CRU_USB2_CONTROL);
+ if (usb2->base)
+ writel(usb2ctl, usb2->base);
+ else
+ writel(usb2ctl, usb2->dmu + BCMA_DMU_CRU_USB2_CONTROL);

/* Lock DMU PLL settings */
- writel(0x00000000, dmu + BCMA_DMU_CRU_CLKSET_KEY);
+ if (usb2->clkset)
+ regmap_write(usb2->clkset, 0, 0x00000000);
+ else
+ writel(0x00000000, usb2->dmu + BCMA_DMU_CRU_CLKSET_KEY);

err_clk_off:
clk_disable_unprepare(usb2->ref_clk);
@@ -90,10 +107,27 @@ static int bcm_ns_usb2_probe(struct platform_device *pdev)
return -ENOMEM;
usb2->dev = dev;

- usb2->dmu = devm_platform_ioremap_resource_byname(pdev, "dmu");
- if (IS_ERR(usb2->dmu)) {
- dev_err(dev, "Failed to map DMU regs\n");
- return PTR_ERR(usb2->dmu);
+ if (of_find_property(dev->of_node, "brcm,syscon-clkset", NULL)) {
+ usb2->base = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(usb2->base)) {
+ dev_err(dev, "Failed to map control reg\n");
+ return PTR_ERR(usb2->base);
+ }
+
+ usb2->clkset = syscon_regmap_lookup_by_phandle(dev->of_node,
+ "brcm,syscon-clkset");
+ if (IS_ERR(usb2->clkset)) {
+ dev_err(dev, "Failed to lookup clkset regmap\n");
+ return PTR_ERR(usb2->clkset);
+ }
+ } else {
+ usb2->dmu = devm_platform_ioremap_resource_byname(pdev, "dmu");
+ if (IS_ERR(usb2->dmu)) {
+ dev_err(dev, "Failed to map DMU regs\n");
+ return PTR_ERR(usb2->dmu);
+ }
+
+ dev_warn(dev, "using deprecated DT binding\n");
}

usb2->ref_clk = devm_clk_get(dev, "phy-ref-clk");
--
2.26.2

2021-03-05 17:26:21

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 1/3] dt-bindings: phy: convert Broadcom NS USB 2.0 to the json-schema

Cc linux-phy@

On 26.02.2021 12:44, Rafał Miłecki wrote:
> From: Rafał Miłecki <[email protected]>
>
> Minor example fixes:
> 1. Include bcm-nsp.h
> 2. Add address to the node name
>
> Signed-off-by: Rafał Miłecki <[email protected]>
> ---
> This has been verified using dt_binding_check
> ---
> .../bindings/phy/bcm-ns-usb2-phy.txt | 21 -------
> .../bindings/phy/brcm,ns-usb2-phy.yaml | 55 +++++++++++++++++++
> 2 files changed, 55 insertions(+), 21 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/phy/bcm-ns-usb2-phy.txt
> create mode 100644 Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml
>
> diff --git a/Documentation/devicetree/bindings/phy/bcm-ns-usb2-phy.txt b/Documentation/devicetree/bindings/phy/bcm-ns-usb2-phy.txt
> deleted file mode 100644
> index a7aee9ea8926..000000000000
> --- a/Documentation/devicetree/bindings/phy/bcm-ns-usb2-phy.txt
> +++ /dev/null
> @@ -1,21 +0,0 @@
> -Driver for Broadcom Northstar USB 2.0 PHY
> -
> -Required properties:
> -- compatible: brcm,ns-usb2-phy
> -- reg: iomem address range of DMU (Device Management Unit)
> -- reg-names: "dmu", the only needed & supported reg right now
> -- clocks: USB PHY reference clock
> -- clock-names: "phy-ref-clk", the only needed & supported clock right now
> -
> -To initialize USB 2.0 PHY driver needs to setup PLL correctly. To do this it
> -requires passing phandle to the USB PHY reference clock.
> -
> -Example:
> - usb2-phy {
> - compatible = "brcm,ns-usb2-phy";
> - reg = <0x1800c000 0x1000>;
> - reg-names = "dmu";
> - #phy-cells = <0>;
> - clocks = <&genpll BCM_NSP_GENPLL_USB_PHY_REF_CLK>;
> - clock-names = "phy-ref-clk";
> - };
> diff --git a/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml b/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml
> new file mode 100644
> index 000000000000..b8b683ce8fa9
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml
> @@ -0,0 +1,55 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/phy/brcm,ns-usb2-phy.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Broadcom Northstar USB 2.0 PHY
> +
> +description: Broadcom's USB 2.0 PHY integrated into Northstar family SoCs
> +
> +maintainers:
> + - Rafał Miłecki <[email protected]>
> +
> +properties:
> + compatible:
> + const: brcm,ns-usb2-phy
> +
> + reg:
> + maxItems: 1
> + description: DMU (Device Management Unit) address range
> +
> + reg-names:
> + const: dmu
> +
> + clocks:
> + maxItems: 1
> + description: USB PHY reference clock
> +
> + clock-names:
> + const: phy-ref-clk
> +
> + "#phy-cells":
> + const: 0
> +
> +required:
> + - reg
> + - reg-names
> + - clocks
> + - clock-names
> + - "#phy-cells"
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/clock/bcm-nsp.h>
> +
> + usb2-phy@1800c000 {
> + compatible = "brcm,ns-usb2-phy";
> + reg = <0x1800c000 0x1000>;
> + reg-names = "dmu";
> + clocks = <&genpll BCM_NSP_GENPLL_USB_PHY_REF_CLK>;
> + clock-names = "phy-ref-clk";
> + #phy-cells = <0>;
> + };
>

2021-03-05 17:27:25

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 3/3] phy: bcm-ns-usb2: support updated single CRU reg DT binding

Cc linux-phy@

On 26.02.2021 12:45, Rafał Miłecki wrote:
> From: Rafał Miłecki <[email protected]>
>
> Updated DT binding maps a single CRU register that is directly used for
> the PHY control. Accessing common CRU reg is handled using syscon &
> regmap.
>
> The old binding has been deprecated and stays as a fallback method.
>
> Signed-off-by: Rafał Miłecki <[email protected]>
> ---
> It's a reworked version of my abonded 2019 patch:
> [PATCH V2 2/2] phy: bcm-ns-usb2: support updated DT binding with the CRU syscon
> https://lore.kernel.org/patchwork/patch/1029863/
> ---
> drivers/phy/broadcom/phy-bcm-ns-usb2.c | 52 +++++++++++++++++++++-----
> 1 file changed, 43 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/phy/broadcom/phy-bcm-ns-usb2.c b/drivers/phy/broadcom/phy-bcm-ns-usb2.c
> index 4b015b8a71c3..98d32729a45d 100644
> --- a/drivers/phy/broadcom/phy-bcm-ns-usb2.c
> +++ b/drivers/phy/broadcom/phy-bcm-ns-usb2.c
> @@ -9,17 +9,23 @@
> #include <linux/clk.h>
> #include <linux/delay.h>
> #include <linux/err.h>
> +#include <linux/mfd/syscon.h>
> #include <linux/module.h>
> #include <linux/of_address.h>
> #include <linux/of_platform.h>
> #include <linux/phy/phy.h>
> #include <linux/platform_device.h>
> +#include <linux/regmap.h>
> #include <linux/slab.h>
>
> struct bcm_ns_usb2 {
> struct device *dev;
> struct clk *ref_clk;
> struct phy *phy;
> + struct regmap *clkset;
> + void __iomem *base;
> +
> + /* Deprecated binding */
> void __iomem *dmu;
> };
>
> @@ -27,7 +33,6 @@ static int bcm_ns_usb2_phy_init(struct phy *phy)
> {
> struct bcm_ns_usb2 *usb2 = phy_get_drvdata(phy);
> struct device *dev = usb2->dev;
> - void __iomem *dmu = usb2->dmu;
> u32 ref_clk_rate, usb2ctl, usb_pll_ndiv, usb_pll_pdiv;
> int err = 0;
>
> @@ -44,7 +49,10 @@ static int bcm_ns_usb2_phy_init(struct phy *phy)
> goto err_clk_off;
> }
>
> - usb2ctl = readl(dmu + BCMA_DMU_CRU_USB2_CONTROL);
> + if (usb2->base)
> + usb2ctl = readl(usb2->base);
> + else
> + usb2ctl = readl(usb2->dmu + BCMA_DMU_CRU_USB2_CONTROL);
>
> if (usb2ctl & BCMA_DMU_CRU_USB2_CONTROL_USB_PLL_PDIV_MASK) {
> usb_pll_pdiv = usb2ctl;
> @@ -58,15 +66,24 @@ static int bcm_ns_usb2_phy_init(struct phy *phy)
> usb_pll_ndiv = (1920000000 * usb_pll_pdiv) / ref_clk_rate;
>
> /* Unlock DMU PLL settings with some magic value */
> - writel(0x0000ea68, dmu + BCMA_DMU_CRU_CLKSET_KEY);
> + if (usb2->clkset)
> + regmap_write(usb2->clkset, 0, 0x0000ea68);
> + else
> + writel(0x0000ea68, usb2->dmu + BCMA_DMU_CRU_CLKSET_KEY);
>
> /* Write USB 2.0 PLL control setting */
> usb2ctl &= ~BCMA_DMU_CRU_USB2_CONTROL_USB_PLL_NDIV_MASK;
> usb2ctl |= usb_pll_ndiv << BCMA_DMU_CRU_USB2_CONTROL_USB_PLL_NDIV_SHIFT;
> - writel(usb2ctl, dmu + BCMA_DMU_CRU_USB2_CONTROL);
> + if (usb2->base)
> + writel(usb2ctl, usb2->base);
> + else
> + writel(usb2ctl, usb2->dmu + BCMA_DMU_CRU_USB2_CONTROL);
>
> /* Lock DMU PLL settings */
> - writel(0x00000000, dmu + BCMA_DMU_CRU_CLKSET_KEY);
> + if (usb2->clkset)
> + regmap_write(usb2->clkset, 0, 0x00000000);
> + else
> + writel(0x00000000, usb2->dmu + BCMA_DMU_CRU_CLKSET_KEY);
>
> err_clk_off:
> clk_disable_unprepare(usb2->ref_clk);
> @@ -90,10 +107,27 @@ static int bcm_ns_usb2_probe(struct platform_device *pdev)
> return -ENOMEM;
> usb2->dev = dev;
>
> - usb2->dmu = devm_platform_ioremap_resource_byname(pdev, "dmu");
> - if (IS_ERR(usb2->dmu)) {
> - dev_err(dev, "Failed to map DMU regs\n");
> - return PTR_ERR(usb2->dmu);
> + if (of_find_property(dev->of_node, "brcm,syscon-clkset", NULL)) {
> + usb2->base = devm_platform_ioremap_resource(pdev, 0);
> + if (IS_ERR(usb2->base)) {
> + dev_err(dev, "Failed to map control reg\n");
> + return PTR_ERR(usb2->base);
> + }
> +
> + usb2->clkset = syscon_regmap_lookup_by_phandle(dev->of_node,
> + "brcm,syscon-clkset");
> + if (IS_ERR(usb2->clkset)) {
> + dev_err(dev, "Failed to lookup clkset regmap\n");
> + return PTR_ERR(usb2->clkset);
> + }
> + } else {
> + usb2->dmu = devm_platform_ioremap_resource_byname(pdev, "dmu");
> + if (IS_ERR(usb2->dmu)) {
> + dev_err(dev, "Failed to map DMU regs\n");
> + return PTR_ERR(usb2->dmu);
> + }
> +
> + dev_warn(dev, "using deprecated DT binding\n");
> }
>
> usb2->ref_clk = devm_clk_get(dev, "phy-ref-clk");
>

2021-03-05 17:29:10

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 2/3] dt-bindings: phy: brcm,ns-usb2-phy: bind single CRU reg

Cc linux-phy@

On 26.02.2021 12:45, Rafał Miłecki wrote:
> From: Rafał Miłecki <[email protected]>
>
> The old binding was using whole DMU space. It was an overkill. DMU is a
> big block which contains e.g. CRU which contains e.g. PLLs, PHY, pinctrl
> and thermal blocks.
>
> Rework the binding to directly use a single CRU register that controls
> USB 2.0 PHY. It's still required to reference CRU generic clkset
> register so add a syscon for that.
>
> For a full DMU & CRU description see arch/arm/boot/dts/bcm5301x.dtsi .
>
> The old binding is deprecated now.
>
> Signed-off-by: Rafał Miłecki <[email protected]>
> ---
> This has been verified using dt_binding_check
>
> I'd really like to get Rob's ack to make sure I don't do anything stupid
>
> It's a reworked version of my abonded 2019 patch:
> [PATCH V2 1/2] dt-bindings: bcm-ns-usb2-phy: rework binding to use CRU syscon
> https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]/
> ---
> .../bindings/phy/brcm,ns-usb2-phy.yaml | 46 +++++++++++++++----
> 1 file changed, 36 insertions(+), 10 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml b/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml
> index b8b683ce8fa9..8e056d4d205a 100644
> --- a/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml
> +++ b/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml
> @@ -16,11 +16,20 @@ properties:
> const: brcm,ns-usb2-phy
>
> reg:
> - maxItems: 1
> - description: DMU (Device Management Unit) address range
> + anyOf:
> + - maxItems: 1
> + description: PHY control register
> + - maxItems: 1
> + description: DMU (Device Management Unit) address range
> + deprecated: true
>
> reg-names:
> const: dmu
> + deprecated: true
> +
> + brcm,syscon-clkset:
> + description: phandle to syscon for clkset register
> + $ref: /schemas/types.yaml#/definitions/phandle
>
> clocks:
> maxItems: 1
> @@ -34,22 +43,39 @@ properties:
>
> required:
> - reg
> - - reg-names
> - clocks
> - clock-names
> - "#phy-cells"
>
> +oneOf:
> + - required:
> + - brcm,syscon-clkset
> + - required:
> + - reg-names
> +
> additionalProperties: false
>
> examples:
> - |
> #include <dt-bindings/clock/bcm-nsp.h>
>
> - usb2-phy@1800c000 {
> - compatible = "brcm,ns-usb2-phy";
> - reg = <0x1800c000 0x1000>;
> - reg-names = "dmu";
> - clocks = <&genpll BCM_NSP_GENPLL_USB_PHY_REF_CLK>;
> - clock-names = "phy-ref-clk";
> - #phy-cells = <0>;
> + cru-bus@1800c100 {
> + compatible = "simple-bus";
> + ranges = <0 0x1800c100 0x1a4>;
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + usb2-phy@64 {
> + compatible = "brcm,ns-usb2-phy";
> + reg = <0x64 0x4>;
> + brcm,syscon-clkset = <&clkset>;
> + clocks = <&genpll BCM_NSP_GENPLL_USB_PHY_REF_CLK>;
> + clock-names = "phy-ref-clk";
> + #phy-cells = <0>;
> + };
> +
> + clkset: syscon@80 {
> + compatible = "brcm,cru-clkset", "syscon";
> + reg = <0x80 0x4>;
> + };
> };
>

2021-03-05 21:50:33

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 1/3] dt-bindings: phy: convert Broadcom NS USB 2.0 to the json-schema

Cc linux-phy@ again (after fixing recipients limit)

On 26.02.2021 12:44, Rafał Miłecki wrote:
> From: Rafał Miłecki <[email protected]>
>
> Minor example fixes:
> 1. Include bcm-nsp.h
> 2. Add address to the node name
>
> Signed-off-by: Rafał Miłecki <[email protected]>
> ---
> This has been verified using dt_binding_check
> ---
> .../bindings/phy/bcm-ns-usb2-phy.txt | 21 -------
> .../bindings/phy/brcm,ns-usb2-phy.yaml | 55 +++++++++++++++++++
> 2 files changed, 55 insertions(+), 21 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/phy/bcm-ns-usb2-phy.txt
> create mode 100644 Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml
>
> diff --git a/Documentation/devicetree/bindings/phy/bcm-ns-usb2-phy.txt b/Documentation/devicetree/bindings/phy/bcm-ns-usb2-phy.txt
> deleted file mode 100644
> index a7aee9ea8926..000000000000
> --- a/Documentation/devicetree/bindings/phy/bcm-ns-usb2-phy.txt
> +++ /dev/null
> @@ -1,21 +0,0 @@
> -Driver for Broadcom Northstar USB 2.0 PHY
> -
> -Required properties:
> -- compatible: brcm,ns-usb2-phy
> -- reg: iomem address range of DMU (Device Management Unit)
> -- reg-names: "dmu", the only needed & supported reg right now
> -- clocks: USB PHY reference clock
> -- clock-names: "phy-ref-clk", the only needed & supported clock right now
> -
> -To initialize USB 2.0 PHY driver needs to setup PLL correctly. To do this it
> -requires passing phandle to the USB PHY reference clock.
> -
> -Example:
> - usb2-phy {
> - compatible = "brcm,ns-usb2-phy";
> - reg = <0x1800c000 0x1000>;
> - reg-names = "dmu";
> - #phy-cells = <0>;
> - clocks = <&genpll BCM_NSP_GENPLL_USB_PHY_REF_CLK>;
> - clock-names = "phy-ref-clk";
> - };
> diff --git a/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml b/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml
> new file mode 100644
> index 000000000000..b8b683ce8fa9
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml
> @@ -0,0 +1,55 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/phy/brcm,ns-usb2-phy.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Broadcom Northstar USB 2.0 PHY
> +
> +description: Broadcom's USB 2.0 PHY integrated into Northstar family SoCs
> +
> +maintainers:
> + - Rafał Miłecki <[email protected]>
> +
> +properties:
> + compatible:
> + const: brcm,ns-usb2-phy
> +
> + reg:
> + maxItems: 1
> + description: DMU (Device Management Unit) address range
> +
> + reg-names:
> + const: dmu
> +
> + clocks:
> + maxItems: 1
> + description: USB PHY reference clock
> +
> + clock-names:
> + const: phy-ref-clk
> +
> + "#phy-cells":
> + const: 0
> +
> +required:
> + - reg
> + - reg-names
> + - clocks
> + - clock-names
> + - "#phy-cells"
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/clock/bcm-nsp.h>
> +
> + usb2-phy@1800c000 {
> + compatible = "brcm,ns-usb2-phy";
> + reg = <0x1800c000 0x1000>;
> + reg-names = "dmu";
> + clocks = <&genpll BCM_NSP_GENPLL_USB_PHY_REF_CLK>;
> + clock-names = "phy-ref-clk";
> + #phy-cells = <0>;
> + };
>

2021-03-05 21:52:05

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 2/3] dt-bindings: phy: brcm,ns-usb2-phy: bind single CRU reg

Cc linux-phy@ again (after fixing recipients ML limit)

On 26.02.2021 12:45, Rafał Miłecki wrote:
> From: Rafał Miłecki <[email protected]>
>
> The old binding was using whole DMU space. It was an overkill. DMU is a
> big block which contains e.g. CRU which contains e.g. PLLs, PHY, pinctrl
> and thermal blocks.
>
> Rework the binding to directly use a single CRU register that controls
> USB 2.0 PHY. It's still required to reference CRU generic clkset
> register so add a syscon for that.
>
> For a full DMU & CRU description see arch/arm/boot/dts/bcm5301x.dtsi .
>
> The old binding is deprecated now.
>
> Signed-off-by: Rafał Miłecki <[email protected]>
> ---
> This has been verified using dt_binding_check
>
> I'd really like to get Rob's ack to make sure I don't do anything stupid
>
> It's a reworked version of my abonded 2019 patch:
> [PATCH V2 1/2] dt-bindings: bcm-ns-usb2-phy: rework binding to use CRU syscon
> https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]/
> ---
> .../bindings/phy/brcm,ns-usb2-phy.yaml | 46 +++++++++++++++----
> 1 file changed, 36 insertions(+), 10 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml b/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml
> index b8b683ce8fa9..8e056d4d205a 100644
> --- a/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml
> +++ b/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml
> @@ -16,11 +16,20 @@ properties:
> const: brcm,ns-usb2-phy
>
> reg:
> - maxItems: 1
> - description: DMU (Device Management Unit) address range
> + anyOf:
> + - maxItems: 1
> + description: PHY control register
> + - maxItems: 1
> + description: DMU (Device Management Unit) address range
> + deprecated: true
>
> reg-names:
> const: dmu
> + deprecated: true
> +
> + brcm,syscon-clkset:
> + description: phandle to syscon for clkset register
> + $ref: /schemas/types.yaml#/definitions/phandle
>
> clocks:
> maxItems: 1
> @@ -34,22 +43,39 @@ properties:
>
> required:
> - reg
> - - reg-names
> - clocks
> - clock-names
> - "#phy-cells"
>
> +oneOf:
> + - required:
> + - brcm,syscon-clkset
> + - required:
> + - reg-names
> +
> additionalProperties: false
>
> examples:
> - |
> #include <dt-bindings/clock/bcm-nsp.h>
>
> - usb2-phy@1800c000 {
> - compatible = "brcm,ns-usb2-phy";
> - reg = <0x1800c000 0x1000>;
> - reg-names = "dmu";
> - clocks = <&genpll BCM_NSP_GENPLL_USB_PHY_REF_CLK>;
> - clock-names = "phy-ref-clk";
> - #phy-cells = <0>;
> + cru-bus@1800c100 {
> + compatible = "simple-bus";
> + ranges = <0 0x1800c100 0x1a4>;
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + usb2-phy@64 {
> + compatible = "brcm,ns-usb2-phy";
> + reg = <0x64 0x4>;
> + brcm,syscon-clkset = <&clkset>;
> + clocks = <&genpll BCM_NSP_GENPLL_USB_PHY_REF_CLK>;
> + clock-names = "phy-ref-clk";
> + #phy-cells = <0>;
> + };
> +
> + clkset: syscon@80 {
> + compatible = "brcm,cru-clkset", "syscon";
> + reg = <0x80 0x4>;
> + };
> };
>

2021-03-05 21:53:16

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 3/3] phy: bcm-ns-usb2: support updated single CRU reg DT binding

Cc linux-phy@ again (after fixing recipients ML limit)

On 26.02.2021 12:45, Rafał Miłecki wrote:
> From: Rafał Miłecki <[email protected]>
>
> Updated DT binding maps a single CRU register that is directly used for
> the PHY control. Accessing common CRU reg is handled using syscon &
> regmap.
>
> The old binding has been deprecated and stays as a fallback method.
>
> Signed-off-by: Rafał Miłecki <[email protected]>
> ---
> It's a reworked version of my abonded 2019 patch:
> [PATCH V2 2/2] phy: bcm-ns-usb2: support updated DT binding with the CRU syscon
> https://lore.kernel.org/patchwork/patch/1029863/
> ---
> drivers/phy/broadcom/phy-bcm-ns-usb2.c | 52 +++++++++++++++++++++-----
> 1 file changed, 43 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/phy/broadcom/phy-bcm-ns-usb2.c b/drivers/phy/broadcom/phy-bcm-ns-usb2.c
> index 4b015b8a71c3..98d32729a45d 100644
> --- a/drivers/phy/broadcom/phy-bcm-ns-usb2.c
> +++ b/drivers/phy/broadcom/phy-bcm-ns-usb2.c
> @@ -9,17 +9,23 @@
> #include <linux/clk.h>
> #include <linux/delay.h>
> #include <linux/err.h>
> +#include <linux/mfd/syscon.h>
> #include <linux/module.h>
> #include <linux/of_address.h>
> #include <linux/of_platform.h>
> #include <linux/phy/phy.h>
> #include <linux/platform_device.h>
> +#include <linux/regmap.h>
> #include <linux/slab.h>
>
> struct bcm_ns_usb2 {
> struct device *dev;
> struct clk *ref_clk;
> struct phy *phy;
> + struct regmap *clkset;
> + void __iomem *base;
> +
> + /* Deprecated binding */
> void __iomem *dmu;
> };
>
> @@ -27,7 +33,6 @@ static int bcm_ns_usb2_phy_init(struct phy *phy)
> {
> struct bcm_ns_usb2 *usb2 = phy_get_drvdata(phy);
> struct device *dev = usb2->dev;
> - void __iomem *dmu = usb2->dmu;
> u32 ref_clk_rate, usb2ctl, usb_pll_ndiv, usb_pll_pdiv;
> int err = 0;
>
> @@ -44,7 +49,10 @@ static int bcm_ns_usb2_phy_init(struct phy *phy)
> goto err_clk_off;
> }
>
> - usb2ctl = readl(dmu + BCMA_DMU_CRU_USB2_CONTROL);
> + if (usb2->base)
> + usb2ctl = readl(usb2->base);
> + else
> + usb2ctl = readl(usb2->dmu + BCMA_DMU_CRU_USB2_CONTROL);
>
> if (usb2ctl & BCMA_DMU_CRU_USB2_CONTROL_USB_PLL_PDIV_MASK) {
> usb_pll_pdiv = usb2ctl;
> @@ -58,15 +66,24 @@ static int bcm_ns_usb2_phy_init(struct phy *phy)
> usb_pll_ndiv = (1920000000 * usb_pll_pdiv) / ref_clk_rate;
>
> /* Unlock DMU PLL settings with some magic value */
> - writel(0x0000ea68, dmu + BCMA_DMU_CRU_CLKSET_KEY);
> + if (usb2->clkset)
> + regmap_write(usb2->clkset, 0, 0x0000ea68);
> + else
> + writel(0x0000ea68, usb2->dmu + BCMA_DMU_CRU_CLKSET_KEY);
>
> /* Write USB 2.0 PLL control setting */
> usb2ctl &= ~BCMA_DMU_CRU_USB2_CONTROL_USB_PLL_NDIV_MASK;
> usb2ctl |= usb_pll_ndiv << BCMA_DMU_CRU_USB2_CONTROL_USB_PLL_NDIV_SHIFT;
> - writel(usb2ctl, dmu + BCMA_DMU_CRU_USB2_CONTROL);
> + if (usb2->base)
> + writel(usb2ctl, usb2->base);
> + else
> + writel(usb2ctl, usb2->dmu + BCMA_DMU_CRU_USB2_CONTROL);
>
> /* Lock DMU PLL settings */
> - writel(0x00000000, dmu + BCMA_DMU_CRU_CLKSET_KEY);
> + if (usb2->clkset)
> + regmap_write(usb2->clkset, 0, 0x00000000);
> + else
> + writel(0x00000000, usb2->dmu + BCMA_DMU_CRU_CLKSET_KEY);
>
> err_clk_off:
> clk_disable_unprepare(usb2->ref_clk);
> @@ -90,10 +107,27 @@ static int bcm_ns_usb2_probe(struct platform_device *pdev)
> return -ENOMEM;
> usb2->dev = dev;
>
> - usb2->dmu = devm_platform_ioremap_resource_byname(pdev, "dmu");
> - if (IS_ERR(usb2->dmu)) {
> - dev_err(dev, "Failed to map DMU regs\n");
> - return PTR_ERR(usb2->dmu);
> + if (of_find_property(dev->of_node, "brcm,syscon-clkset", NULL)) {
> + usb2->base = devm_platform_ioremap_resource(pdev, 0);
> + if (IS_ERR(usb2->base)) {
> + dev_err(dev, "Failed to map control reg\n");
> + return PTR_ERR(usb2->base);
> + }
> +
> + usb2->clkset = syscon_regmap_lookup_by_phandle(dev->of_node,
> + "brcm,syscon-clkset");
> + if (IS_ERR(usb2->clkset)) {
> + dev_err(dev, "Failed to lookup clkset regmap\n");
> + return PTR_ERR(usb2->clkset);
> + }
> + } else {
> + usb2->dmu = devm_platform_ioremap_resource_byname(pdev, "dmu");
> + if (IS_ERR(usb2->dmu)) {
> + dev_err(dev, "Failed to map DMU regs\n");
> + return PTR_ERR(usb2->dmu);
> + }
> +
> + dev_warn(dev, "using deprecated DT binding\n");
> }
>
> usb2->ref_clk = devm_clk_get(dev, "phy-ref-clk");
>

2021-03-06 21:30:21

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH 1/3] dt-bindings: phy: convert Broadcom NS USB 2.0 to the json-schema

On Fri, 26 Feb 2021 12:44:59 +0100, Rafał Miłecki wrote:
> From: Rafał Miłecki <[email protected]>
>
> Minor example fixes:
> 1. Include bcm-nsp.h
> 2. Add address to the node name
>
> Signed-off-by: Rafał Miłecki <[email protected]>
> ---
> This has been verified using dt_binding_check
> ---
> .../bindings/phy/bcm-ns-usb2-phy.txt | 21 -------
> .../bindings/phy/brcm,ns-usb2-phy.yaml | 55 +++++++++++++++++++
> 2 files changed, 55 insertions(+), 21 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/phy/bcm-ns-usb2-phy.txt
> create mode 100644 Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml
>

Reviewed-by: Rob Herring <[email protected]>

2021-03-08 08:37:54

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH 2/3] dt-bindings: phy: brcm,ns-usb2-phy: bind single CRU reg

On Fri, Feb 26, 2021 at 12:45:00PM +0100, Rafał Miłecki wrote:
> From: Rafał Miłecki <[email protected]>
>
> The old binding was using whole DMU space. It was an overkill. DMU is a
> big block which contains e.g. CRU which contains e.g. PLLs, PHY, pinctrl
> and thermal blocks.
>
> Rework the binding to directly use a single CRU register that controls
> USB 2.0 PHY. It's still required to reference CRU generic clkset
> register so add a syscon for that.
>
> For a full DMU & CRU description see arch/arm/boot/dts/bcm5301x.dtsi .
>
> The old binding is deprecated now.
>
> Signed-off-by: Rafał Miłecki <[email protected]>
> ---
> This has been verified using dt_binding_check
>
> I'd really like to get Rob's ack to make sure I don't do anything stupid
>
> It's a reworked version of my abonded 2019 patch:
> [PATCH V2 1/2] dt-bindings: bcm-ns-usb2-phy: rework binding to use CRU syscon
> https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]/
> ---
> .../bindings/phy/brcm,ns-usb2-phy.yaml | 46 +++++++++++++++----
> 1 file changed, 36 insertions(+), 10 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml b/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml
> index b8b683ce8fa9..8e056d4d205a 100644
> --- a/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml
> +++ b/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml
> @@ -16,11 +16,20 @@ properties:
> const: brcm,ns-usb2-phy
>
> reg:
> - maxItems: 1
> - description: DMU (Device Management Unit) address range
> + anyOf:
> + - maxItems: 1
> + description: PHY control register
> + - maxItems: 1
> + description: DMU (Device Management Unit) address range
> + deprecated: true
>
> reg-names:
> const: dmu
> + deprecated: true
> +
> + brcm,syscon-clkset:
> + description: phandle to syscon for clkset register
> + $ref: /schemas/types.yaml#/definitions/phandle

Don't really need this as it's just a compatible node of the parent
node.

>
> clocks:
> maxItems: 1
> @@ -34,22 +43,39 @@ properties:
>
> required:
> - reg
> - - reg-names
> - clocks
> - clock-names
> - "#phy-cells"
>
> +oneOf:
> + - required:
> + - brcm,syscon-clkset
> + - required:
> + - reg-names
> +
> additionalProperties: false
>
> examples:
> - |
> #include <dt-bindings/clock/bcm-nsp.h>
>
> - usb2-phy@1800c000 {
> - compatible = "brcm,ns-usb2-phy";
> - reg = <0x1800c000 0x1000>;
> - reg-names = "dmu";
> - clocks = <&genpll BCM_NSP_GENPLL_USB_PHY_REF_CLK>;
> - clock-names = "phy-ref-clk";
> - #phy-cells = <0>;
> + cru-bus@1800c100 {
> + compatible = "simple-bus";

A specific compatible is needed for this block.

> + ranges = <0 0x1800c100 0x1a4>;
> + #address-cells = <1>;
> + #size-cells = <1>;
> +
> + usb2-phy@64 {
> + compatible = "brcm,ns-usb2-phy";
> + reg = <0x64 0x4>;
> + brcm,syscon-clkset = <&clkset>;
> + clocks = <&genpll BCM_NSP_GENPLL_USB_PHY_REF_CLK>;
> + clock-names = "phy-ref-clk";
> + #phy-cells = <0>;
> + };
> +
> + clkset: syscon@80 {
> + compatible = "brcm,cru-clkset", "syscon";
> + reg = <0x80 0x4>;
> + };

Is this going to expand to 0x1a4/4 child nodes? The problem with one
node per register is I don't know when it ends and you have to
constantly update your DT.

Rob

2021-03-09 14:52:20

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 2/3] dt-bindings: phy: brcm,ns-usb2-phy: bind single CRU reg

On 06.03.2021 22:52, Rob Herring wrote:
> On Fri, Feb 26, 2021 at 12:45:00PM +0100, Rafał Miłecki wrote:
>> From: Rafał Miłecki <[email protected]>
>>
>> The old binding was using whole DMU space. It was an overkill. DMU is a
>> big block which contains e.g. CRU which contains e.g. PLLs, PHY, pinctrl
>> and thermal blocks.
>>
>> Rework the binding to directly use a single CRU register that controls
>> USB 2.0 PHY. It's still required to reference CRU generic clkset
>> register so add a syscon for that.
>>
>> For a full DMU & CRU description see arch/arm/boot/dts/bcm5301x.dtsi .
>>
>> The old binding is deprecated now.
>>
>> Signed-off-by: Rafał Miłecki <[email protected]>
>> ---
>> This has been verified using dt_binding_check
>>
>> I'd really like to get Rob's ack to make sure I don't do anything stupid
>>
>> It's a reworked version of my abonded 2019 patch:
>> [PATCH V2 1/2] dt-bindings: bcm-ns-usb2-phy: rework binding to use CRU syscon
>> https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]/
>> ---
>> .../bindings/phy/brcm,ns-usb2-phy.yaml | 46 +++++++++++++++----
>> 1 file changed, 36 insertions(+), 10 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml b/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml
>> index b8b683ce8fa9..8e056d4d205a 100644
>> --- a/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml
>> +++ b/Documentation/devicetree/bindings/phy/brcm,ns-usb2-phy.yaml
>> @@ -16,11 +16,20 @@ properties:
>> const: brcm,ns-usb2-phy
>>
>> reg:
>> - maxItems: 1
>> - description: DMU (Device Management Unit) address range
>> + anyOf:
>> + - maxItems: 1
>> + description: PHY control register
>> + - maxItems: 1
>> + description: DMU (Device Management Unit) address range
>> + deprecated: true
>>
>> reg-names:
>> const: dmu
>> + deprecated: true
>> +
>> + brcm,syscon-clkset:
>> + description: phandle to syscon for clkset register
>> + $ref: /schemas/types.yaml#/definitions/phandle
>
> Don't really need this as it's just a compatible node of the parent
> node.

Thanks


>>
>> clocks:
>> maxItems: 1
>> @@ -34,22 +43,39 @@ properties:
>>
>> required:
>> - reg
>> - - reg-names
>> - clocks
>> - clock-names
>> - "#phy-cells"
>>
>> +oneOf:
>> + - required:
>> + - brcm,syscon-clkset
>> + - required:
>> + - reg-names
>> +
>> additionalProperties: false
>>
>> examples:
>> - |
>> #include <dt-bindings/clock/bcm-nsp.h>
>>
>> - usb2-phy@1800c000 {
>> - compatible = "brcm,ns-usb2-phy";
>> - reg = <0x1800c000 0x1000>;
>> - reg-names = "dmu";
>> - clocks = <&genpll BCM_NSP_GENPLL_USB_PHY_REF_CLK>;
>> - clock-names = "phy-ref-clk";
>> - #phy-cells = <0>;
>> + cru-bus@1800c100 {
>> + compatible = "simple-bus";
>
> A specific compatible is needed for this block.

I've just sent independently following patch:
[PATCH robh next] dt-bindings: bus: add Broadcom CRU


>> + ranges = <0 0x1800c100 0x1a4>;
>> + #address-cells = <1>;
>> + #size-cells = <1>;
>> +
>> + usb2-phy@64 {
>> + compatible = "brcm,ns-usb2-phy";
>> + reg = <0x64 0x4>;
>> + brcm,syscon-clkset = <&clkset>;
>> + clocks = <&genpll BCM_NSP_GENPLL_USB_PHY_REF_CLK>;
>> + clock-names = "phy-ref-clk";
>> + #phy-cells = <0>;
>> + };
>> +
>> + clkset: syscon@80 {
>> + compatible = "brcm,cru-clkset", "syscon";
>> + reg = <0x80 0x4>;
>> + };
>
> Is this going to expand to 0x1a4/4 child nodes? The problem with one
> node per register is I don't know when it ends and you have to
> constantly update your DT.

I'm sorry, I don't fully understand that expanding question.

Most of CRU subblocks are standalone devices occupying multiple
registers. The last one is thermal@1800c2c0. That "brcm,cru-clkset"
seems to be an exception in the CRU space. clkset is a single
register so it should never become reg = <0x80 0x8>;

The finally documented CRU is expected to look like:

cru-bus@1800c100 {
compatible = "brcm,cru", "simple-bus";
reg = <0x1800c100 0x1d0>;
ranges = <0 0x1800c100 0x1d0>;
#address-cells = <1>;
#size-cells = <1>;

lcpll0@0 {
compatible = "brcm,nsp-lcpll0";
reg = <0x0 0x14>;
(...)
};

genpll@40 {
compatible = "brcm,nsp-genpll";
reg = <0x40 0x24>;
(...)
};

usb2-phy@64 {
compatible = "brcm,ns-usb2-phy";
reg = <0x64 0x4>;
brcm,syscon-clkset = <&clkset>;
clocks = <&genpll BCM_NSP_GENPLL_USB_PHY_REF_CLK>;
clock-names = "phy-ref-clk";
#phy-cells = <0>;
};

clkset: syscon@80 {
compatible = "brcm,cru-clkset", "syscon";
reg = <0x80 0x4>;
};

pin-controller@c0 {
compatible = "brcm,bcm4708-pinmux";
reg = <0xc0 0x24>;
(...)
};

thermal@1c0 {
compatible = "brcm,ns-thermal";
reg = <0x1c0 0x10>;
(...)
};
};