From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
To: Elson Serrao <elson.serrao@oss.qualcomm.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Souradeep Chowdhury <quic_schowdhu@quicinc.com>
Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/9] usb: misc: qcom_eud: add per-path High-Speed PHY control
Date: Wed, 4 Feb 2026 14:21:52 +0100 [thread overview]
Message-ID: <9f81c07a-c1c6-4888-975d-528a6181caea@oss.qualcomm.com> (raw)
In-Reply-To: <20260126233830.2193816-4-elson.serrao@oss.qualcomm.com>
On 1/27/26 12:38 AM, Elson Serrao wrote:
> EUD hardware can support multiple High-Speed USB paths, each routed
> through its own PHY. The active path is selected in hardware via the
> EUD_PORT_SEL register. As a High-Speed hub, EUD requires access to the
> High-Speed PHY associated with the active UTMI path. To support this
> multi-path capability, the driver must manage PHY resources on a per-path
> basis, ensuring that the PHY for the currently selected path is properly
> initialized and powered.
>
> This patch restructures the driver to implement per-path PHY management.
> The driver now powers the appropriate PHY based on the selected and
> enabled UTMI path, ensuring correct operation when EUD is enabled.
>
> Supporting this requires describing the available UTMI paths and their
> corresponding PHYs in Device Tree. This updates DT requirements and is
> not backward compatible with older DTs that lacked this description.
> Historically, EUD appeared to work on single-path systems because the
> USB controller kept the PHY initialized. However, EUD is designed to
> operate independently of the USB controller and therefore requires
> explicit PHY control.
>
> Signed-off-by: Elson Serrao <elson.serrao@oss.qualcomm.com>
> ---
[...]
> +static int eud_phy_enable(struct eud_chip *chip)
> +{
> + struct eud_path *path;
> + struct phy *phy;
> + int ret;
> +
> + if (chip->phy_enabled)
> + return 0;
> +
> + path = chip->paths[chip->port_idx];
> + if (!path || !path->phy) {
I think neither are possible - path is != NULL since we can't enter into
this function without failing the check in _store and !path->phy would error
out in probe()->eud_init_path()
[...]
> +static void eud_phy_disable(struct eud_chip *chip)
> +{
> + struct eud_path *path;
> + struct phy *phy;
> +
> + if (!chip->phy_enabled)
> + return;
> +
> + path = chip->paths[chip->port_idx];
> + if (!path || !path->phy)
Likewise
[...]
> +static int eud_init_path(struct eud_chip *chip, struct device_node *np)
> +{
> + struct eud_path *path;
> + u32 path_num;
> + int ret;
> +
> + ret = of_property_read_u32(np, "reg", &path_num);
> + if (ret) {
> + dev_err(chip->dev, "Missing 'reg' property in path node\n");
> + return ret;
You can use return dev_err_probe like you did a little below
> + }
> +
> + if (path_num >= EUD_MAX_PORTS) {
> + dev_err(chip->dev, "Invalid path number: %u (max %d)\n",
> + path_num, EUD_MAX_PORTS - 1);
> + return -EINVAL;
> + }
> +
> + path = devm_kzalloc(chip->dev, sizeof(*path), GFP_KERNEL);
> + if (!path)
> + return -ENOMEM;
> +
> + path->chip = chip;
> + path->num = path_num;
> +
> + path->phy = devm_of_phy_get(chip->dev, np, NULL);
> + if (IS_ERR(path->phy))
> + return dev_err_probe(chip->dev, PTR_ERR(path->phy),
> + "Failed to get PHY for path %d\n", path_num);
> +
> + chip->paths[path_num] = path;
> +
> + return 0;
> +}
> +
> static int eud_probe(struct platform_device *pdev)
> {
> + struct device_node *np = pdev->dev.of_node;
> + struct device_node *child;
> struct eud_chip *chip;
> struct resource *res;
> int ret;
> @@ -252,6 +368,18 @@ static int eud_probe(struct platform_device *pdev)
> if (ret)
> return ret;
>
> + for_each_child_of_node(np, child) {
With for_each_child_of_node_scoped(), you can dispose of the manual
_put()
> + ret = eud_init_path(chip, child);
> + if (ret) {
> + of_node_put(child);
> + return ret;
> + }
> + }
> +
> + /* Primary path is mandatory. Secondary is optional */
> + if (!chip->paths[0])
> + return -ENODEV;
I'm going to assume we don't have any funny chips that violate this :)
Konrad
next prev parent reply other threads:[~2026-02-04 13:21 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-26 23:38 [PATCH v2 0/9] Improve Qualcomm EUD driver and platform support Elson Serrao
2026-01-26 23:38 ` [PATCH v2 1/9] dt-bindings: soc: qcom: eud: Restructure to model multi-path hardware Elson Serrao
2026-02-03 13:35 ` Konrad Dybcio
2026-02-04 14:01 ` Konrad Dybcio
2026-02-06 14:55 ` Rob Herring
2026-02-10 4:32 ` Elson Serrao
2026-02-10 7:24 ` Krzysztof Kozlowski
2026-01-26 23:38 ` [PATCH v2 2/9] usb: misc: qcom_eud: add sysfs attribute for port selection Elson Serrao
2026-01-27 13:31 ` Konrad Dybcio
2026-01-26 23:38 ` [PATCH v2 3/9] usb: misc: qcom_eud: add per-path High-Speed PHY control Elson Serrao
2026-02-04 13:21 ` Konrad Dybcio [this message]
2026-02-09 17:23 ` Elson Serrao
2026-01-26 23:38 ` [PATCH v2 4/9] usb: misc: qcom_eud: add per-path role switch support Elson Serrao
2026-01-26 23:38 ` [PATCH v2 5/9] usb: misc: qcom_eud: improve enable_store API Elson Serrao
2026-02-04 13:24 ` Konrad Dybcio
2026-01-26 23:38 ` [PATCH v2 6/9] usb: misc: qcom_eud: add host mode coordination Elson Serrao
2026-02-04 13:29 ` Konrad Dybcio
2026-02-09 17:37 ` Elson Serrao
2026-02-10 10:00 ` Konrad Dybcio
2026-01-26 23:38 ` [PATCH v2 7/9] usb: misc: qcom_eud: fix virtual attach/detach event handling Elson Serrao
2026-02-04 13:32 ` Konrad Dybcio
2026-01-26 23:38 ` [PATCH v2 8/9] arm64: dts: qcom: kodiak: Align EUD node with binding Elson Serrao
2026-01-26 23:38 ` [PATCH v2 9/9] arm64: dts: qcom: qcs6490-rb3gen2: Enable EUD debug functionality Elson Serrao
2026-02-03 13:38 ` Konrad Dybcio
2026-02-09 17:06 ` Elson Serrao
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=9f81c07a-c1c6-4888-975d-528a6181caea@oss.qualcomm.com \
--to=konrad.dybcio@oss.qualcomm.com \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=elson.serrao@oss.qualcomm.com \
--cc=gregkh@linuxfoundation.org \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=quic_schowdhu@quicinc.com \
--cc=robh@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®