All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Joey Lu" <a0987203069@gmail.com>
Cc: neil.armstrong@linaro.org, devicetree@vger.kernel.org,
	olteanv@gmail.com, linux-phy@lists.infradead.org,
	vkoul@kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v3 1/3] dt-bindings: phy: nuvoton,ma35d1-usb2-phy: extend for dual-port and OTG
Date: Wed, 08 Jul 2026 10:49:00 +0000	[thread overview]
Message-ID: <20260708104900.D616E1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260708103606.1462960-2-a0987203069@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The DT binding introduces multi-port support, but the corresponding driver lacks implementation, leading to silent hardware malfunction.
- [Medium] The `#phy-cells` property uses an enum constraint instead of a strict const constraint, violating subsystem guidelines.
--

--- Patch [1]: [PATCH v3 1/3] dt-bindings: phy: nuvoton,ma35d1-usb2-phy: extend for dual-port and OTG ---
commit 7f72a8cc4b64e1dfcf4efba1cd67bf9eafd31d72
Author: Joey Lu <a0987203069@gmail.com>

dt-bindings: phy: nuvoton,ma35d1-usb2-phy: extend for dual-port and OTG

This commit updates the nuvoton,ma35d1-usb2-phy device tree binding to
support dual USB PHY ports (PHY0 and PHY1). It relaxes #phy-cells from const: 0
to enum: [0, 1] to allow port selection while preserving backward
compatibility. It also adds new optional properties for resistor calibration
and over-current polarity.

> diff --git a/Documentation/devicetree/bindings/phy/nuvoton,ma35d1-usb2-phy.yaml b/Documentation/devicetree/bindings/phy/nuvoton,ma35d1-usb2-phy.yaml
> index fff858c909a06..191d1b2272ec5 100644
> --- a/Documentation/devicetree/bindings/phy/nuvoton,ma35d1-usb2-phy.yaml
> +++ b/Documentation/devicetree/bindings/phy/nuvoton,ma35d1-usb2-phy.yaml
[ ... ]
> @@ -15,7 +27,12 @@ properties:
>        - nuvoton,ma35d1-usb2-phy
>  
>    "#phy-cells":
> -    const: 0
> +    enum: [0, 1]

[Severity: High]
Does the driver currently support this new #phy-cells = <1> configuration?

Looking at ma35_usb_phy_probe() in drivers/phy/nuvoton/phy-ma35d1-usb2.c, the 
provider registers using of_phy_simple_xlate:

    provider = devm_of_phy_provider_register(&pdev->dev, of_phy_simple_xlate);

Because of_phy_simple_xlate ignores cell arguments, any valid DT request for
PHY1 will silently map to the single initialized PHY.

Furthermore, ma35_usb_phy_power_on() strictly hardcodes registers for PHY0:

    regmap_update_bits(p_phy->sysreg, MA35_SYS_REG_USBPMISCR, 0x7, (PHY0POR | PHY0SUSPEND));

Will this cause a consumer attempting to control PHY1 to inadvertently reset and
power on PHY0 instead?

[Severity: Medium]
Is it acceptable to use an enum constraint for a cell-count property?

According to the subsystem/dt-bindings.md global review guidelines, each
cell-count property must have a strict const constraint matching the hardware.
Since the hardware physically has two ports, shouldn't #phy-cells be defined
as const: 1 to accurately model the hardware's capabilities?

> +    description:
> +      When 0, the node exposes PHY0 only and consumers reference it
> +      with no cell argument. When 1, the single cell selects the port,
> +      with 0 for the OTG port (USB0, shared with DWC2 gadget controller)
> +      and 1 for the host-only port (USB1).
[ ... ]
> @@ -39,7 +78,7 @@ examples:
>  
>      usb_phy: usb-phy {
>          compatible = "nuvoton,ma35d1-usb2-phy";
> -        clocks = <&clk USBD_GATE>;
> +        clocks = <&clk HUSBH0_GATE>;
>          nuvoton,sys = <&sys>;
>          #phy-cells = <0>;

[Severity: Medium]
With the hardware supporting multiple ports, should the example be updated to
demonstrate the correct multi-port configuration (#phy-cells = <1>;) instead
of propagating the legacy configuration?

>      };

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260708103606.1462960-1-a0987203069@gmail.com?part=1

-- 
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy

WARNING: multiple messages have this Message-ID (diff)
From: sashiko-bot@kernel.org
To: "Joey Lu" <a0987203069@gmail.com>
Cc: neil.armstrong@linaro.org, devicetree@vger.kernel.org,
	olteanv@gmail.com, linux-phy@lists.infradead.org,
	vkoul@kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v3 1/3] dt-bindings: phy: nuvoton,ma35d1-usb2-phy: extend for dual-port and OTG
Date: Wed, 08 Jul 2026 10:49:00 +0000	[thread overview]
Message-ID: <20260708104900.D616E1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260708103606.1462960-2-a0987203069@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The DT binding introduces multi-port support, but the corresponding driver lacks implementation, leading to silent hardware malfunction.
- [Medium] The `#phy-cells` property uses an enum constraint instead of a strict const constraint, violating subsystem guidelines.
--

--- Patch [1]: [PATCH v3 1/3] dt-bindings: phy: nuvoton,ma35d1-usb2-phy: extend for dual-port and OTG ---
commit 7f72a8cc4b64e1dfcf4efba1cd67bf9eafd31d72
Author: Joey Lu <a0987203069@gmail.com>

dt-bindings: phy: nuvoton,ma35d1-usb2-phy: extend for dual-port and OTG

This commit updates the nuvoton,ma35d1-usb2-phy device tree binding to
support dual USB PHY ports (PHY0 and PHY1). It relaxes #phy-cells from const: 0
to enum: [0, 1] to allow port selection while preserving backward
compatibility. It also adds new optional properties for resistor calibration
and over-current polarity.

> diff --git a/Documentation/devicetree/bindings/phy/nuvoton,ma35d1-usb2-phy.yaml b/Documentation/devicetree/bindings/phy/nuvoton,ma35d1-usb2-phy.yaml
> index fff858c909a06..191d1b2272ec5 100644
> --- a/Documentation/devicetree/bindings/phy/nuvoton,ma35d1-usb2-phy.yaml
> +++ b/Documentation/devicetree/bindings/phy/nuvoton,ma35d1-usb2-phy.yaml
[ ... ]
> @@ -15,7 +27,12 @@ properties:
>        - nuvoton,ma35d1-usb2-phy
>  
>    "#phy-cells":
> -    const: 0
> +    enum: [0, 1]

[Severity: High]
Does the driver currently support this new #phy-cells = <1> configuration?

Looking at ma35_usb_phy_probe() in drivers/phy/nuvoton/phy-ma35d1-usb2.c, the 
provider registers using of_phy_simple_xlate:

    provider = devm_of_phy_provider_register(&pdev->dev, of_phy_simple_xlate);

Because of_phy_simple_xlate ignores cell arguments, any valid DT request for
PHY1 will silently map to the single initialized PHY.

Furthermore, ma35_usb_phy_power_on() strictly hardcodes registers for PHY0:

    regmap_update_bits(p_phy->sysreg, MA35_SYS_REG_USBPMISCR, 0x7, (PHY0POR | PHY0SUSPEND));

Will this cause a consumer attempting to control PHY1 to inadvertently reset and
power on PHY0 instead?

[Severity: Medium]
Is it acceptable to use an enum constraint for a cell-count property?

According to the subsystem/dt-bindings.md global review guidelines, each
cell-count property must have a strict const constraint matching the hardware.
Since the hardware physically has two ports, shouldn't #phy-cells be defined
as const: 1 to accurately model the hardware's capabilities?

> +    description:
> +      When 0, the node exposes PHY0 only and consumers reference it
> +      with no cell argument. When 1, the single cell selects the port,
> +      with 0 for the OTG port (USB0, shared with DWC2 gadget controller)
> +      and 1 for the host-only port (USB1).
[ ... ]
> @@ -39,7 +78,7 @@ examples:
>  
>      usb_phy: usb-phy {
>          compatible = "nuvoton,ma35d1-usb2-phy";
> -        clocks = <&clk USBD_GATE>;
> +        clocks = <&clk HUSBH0_GATE>;
>          nuvoton,sys = <&sys>;
>          #phy-cells = <0>;

[Severity: Medium]
With the hardware supporting multiple ports, should the example be updated to
demonstrate the correct multi-port configuration (#phy-cells = <1>;) instead
of propagating the legacy configuration?

>      };

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260708103606.1462960-1-a0987203069@gmail.com?part=1

  reply	other threads:[~2026-07-08 10:49 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-08 10:36 [PATCH v3 0/3] phy: nuvoton: extend MA35D1 USB2 PHY driver for dual-port OTG support Joey Lu
2026-07-08 10:36 ` Joey Lu
2026-07-08 10:36 ` [PATCH v3 1/3] dt-bindings: phy: nuvoton,ma35d1-usb2-phy: extend for dual-port and OTG Joey Lu
2026-07-08 10:36   ` Joey Lu
2026-07-08 10:49   ` sashiko-bot [this message]
2026-07-08 10:49     ` sashiko-bot
2026-07-10  8:54   ` Krzysztof Kozlowski
2026-07-10  8:54     ` Krzysztof Kozlowski
2026-07-14  1:26     ` Joey Lu
2026-07-14  1:26       ` Joey Lu
2026-07-08 10:36 ` [PATCH v3 2/3] arm64: dts: nuvoton: ma35d1: add USB controllers and dual-port PHY node Joey Lu
2026-07-08 10:36   ` Joey Lu
2026-07-08 10:48   ` sashiko-bot
2026-07-08 10:48     ` sashiko-bot
2026-07-08 10:36 ` [PATCH v3 3/3] phy: nuvoton: phy-ma35d1-usb2: extend to dual-port with OTG support Joey Lu
2026-07-08 10:36   ` Joey Lu
2026-07-08 10:49   ` sashiko-bot
2026-07-08 10:49     ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260708104900.D616E1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=a0987203069@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=neil.armstrong@linaro.org \
    --cc=olteanv@gmail.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.