From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796355822; b=rInu11Wrw2AGRYuGgVvBZt0j4EE6pHDs1tkTBgpj6OHG/EPMV2S9MYhKqlu5R7Csv1Gz 92nbuHGjFzN9xs/pd1n3GHDPdOl6BrtmBe7SC0pCevUTejNKv0DcGExbxokwYTndM1JOV 1c2j7CTnSzY8cwzOrtW48jZ1XoQQedvqSWEll1g8vip4IpfRQRo1lXTYFUA4DaSXkKxPo Fe4woQed7azJ3LgdxflpyU77W3WYiuHxLfbSwsKhDf733LZ6AuNYVFNT7N0zwL5HqJ576 9C8ZRQs4qZ6NEGwn/0IRkiCefySg8pge1nVR4bFm2LRC9LfyGLVjdwH0DwZ6Onyddrw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796355822; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=n3KUm/8BMiZl+6pKj4ql9YJ2TlkJsrgTjbPoI27WCL0=; b=zsyp++oaoIMGQukq0mTB9zIhVwz9PgJ4QeXOcTQ0NhRPHlpxRgM6NzLipIw9cOyLbnsz xF0h92wu147fdAVfMdDFE/6SeH0kn9J10lkM8MpF09hwVZwxLtFEjfPrJarHZCIkAiuDG DVNFsYZAAZ7f0jc9jYE23/smujiDmVC+X96fS8JzPSK2+aXRb4s741p1K4of1W430KxLt S7+Dkr0abzgPgas7ZoUwF6LbAz/w+6AVKR655CcFxsDC+YJAaSuH2Kti7JQ0OgRgcDZ65 lM8I7GLuVdhujjbfSj0N2Kpk/NfDxTekSOe1HYZoAeLc5CnBxCmEgqY7Ah9IES7pDgg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=WWeh7xq6; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 308B1606A322; Fri, 4 Dec 2026 03:43:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=WWeh7xq6 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63C4C1F000CE; Fri, 4 Dec 2026 03:43:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796355821; bh=n3KUm/8BMiZl+6pKj4ql9YJ2TlkJsrgTjbPoI27WCL0=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=WWeh7xq6mhaTNrDprlSefoZ++445AgIOdK9iS6piR+hDV+eva8+aqwlHKwsr5PacO pKTtX1votPP5ffVwaFSv/tz0+FnaXTWuoO9phV2InKg8rSvMCaUmVu9Gsl5kOFzkj9 eZS9vrt4QQ9xi8hOO4vy8l26OgiF7GwJwUwIgaZ8= Date: Thu, 3 Dec 2026 22:52:26 +0100 From: Greg Kroah-Hartman To: Elson Serrao Cc: Bjorn Andersson , Conor Dooley , Konrad Dybcio , Krzysztof Kozlowski , Rob Herring , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Chen , Konrad Dybcio , Gopikrishna Garmidi Subject: Re: [PATCH v10 3/7] usb: misc: qcom_eud: add per-path High-Speed PHY control Message-ID: <2026120309-papyrus-dipper-1f68@gregkh> References: <20261123182847.143892-1-elson.serrao@oss.qualcomm.com> <20261123182847.143892-4-elson.serrao@oss.qualcomm.com> X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261123182847.143892-4-elson.serrao@oss.qualcomm.com> On Mon, Nov 23, 2026 at 10:28:43AM -0800, 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 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. > > 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 for proper operation. > > Reviewed-by: Peter Chen > Reviewed-by: Konrad Dybcio > Tested-by: Gopikrishna Garmidi > Signed-off-by: Elson Serrao > --- > Documentation/ABI/testing/sysfs-driver-eud | 3 +- > drivers/usb/misc/qcom_eud.c | 129 ++++++++++++++++++++- > 2 files changed, 130 insertions(+), 2 deletions(-) > > diff --git a/Documentation/ABI/testing/sysfs-driver-eud b/Documentation/ABI/testing/sysfs-driver-eud > index fb927a003596..f20b82b5a38a 100644 > --- a/Documentation/ABI/testing/sysfs-driver-eud > +++ b/Documentation/ABI/testing/sysfs-driver-eud > @@ -20,7 +20,8 @@ Description: > primary - Primary USB port > secondary - Secondary USB port > > - Writing any other value returns -EINVAL. > + Writing any other value returns -EINVAL. Writing a port > + not supported on the current platform returns -EOPNOTSUPP. > > The attribute is writable only while EUD is disabled. > Writing it while EUD is enabled returns -EBUSY. Reading > diff --git a/drivers/usb/misc/qcom_eud.c b/drivers/usb/misc/qcom_eud.c > index 3e4647acd5aa..037b074318a5 100644 > --- a/drivers/usb/misc/qcom_eud.c > +++ b/drivers/usb/misc/qcom_eud.c > @@ -11,6 +11,8 @@ > #include > #include > #include > +#include > +#include > #include > #include > #include > @@ -40,26 +42,84 @@ static const char * const eud_port_names[] = { > "secondary", > }; > > +struct eud_path { > + struct eud_chip *chip; > + struct phy *phy; > + u8 num; > +}; > + > struct eud_chip { > struct device *dev; > struct usb_role_switch *role_sw; > void __iomem *base; > + struct eud_path *paths[EUD_MAX_PORTS]; > phys_addr_t mode_mgr; > unsigned int int_status; > int irq; > bool enabled; > bool usb_attached; > + bool phy_enabled; > u8 port_idx; > }; > > +static int eud_phy_enable(struct eud_chip *chip) > +{ > + struct phy *phy; > + int ret; > + > + if (chip->phy_enabled) > + return 0; > + > + phy = chip->paths[chip->port_idx]->phy; > + > + ret = phy_init(phy); > + if (ret) { > + dev_err(chip->dev, "Failed to initialize USB2 PHY for port %u: %d\n", > + chip->port_idx, ret); > + return ret; > + } > + > + ret = phy_power_on(phy); > + if (ret) { > + dev_err(chip->dev, "Failed to power on USB2 PHY for port %u: %d\n", > + chip->port_idx, ret); > + phy_exit(phy); > + return ret; > + } > + > + chip->phy_enabled = true; > + > + return 0; > +} > + > +static void eud_phy_disable(struct eud_chip *chip) > +{ > + struct phy *phy; > + > + if (!chip->phy_enabled) > + return; > + > + phy = chip->paths[chip->port_idx]->phy; > + > + phy_power_off(phy); > + phy_exit(phy); > + chip->phy_enabled = false; > +} > + > static int enable_eud(struct eud_chip *priv) > { > int ret; > > - ret = qcom_scm_io_writel(priv->mode_mgr + EUD_REG_EUD_EN2, 1); > + ret = eud_phy_enable(priv); > if (ret) > return ret; > > + ret = qcom_scm_io_writel(priv->mode_mgr + EUD_REG_EUD_EN2, 1); > + if (ret) { > + eud_phy_disable(priv); > + return ret; > + } > + > writel(EUD_ENABLE, priv->base + EUD_REG_CSR_EUD_EN); > writel(EUD_INT_VBUS | EUD_INT_SAFE_MODE, > priv->base + EUD_REG_INT1_EN_MASK); > @@ -76,6 +136,8 @@ static int disable_eud(struct eud_chip *priv) > return ret; > > writel(0, priv->base + EUD_REG_CSR_EUD_EN); > + eud_phy_disable(priv); > + > return 0; > } > > @@ -131,6 +193,10 @@ static ssize_t port_store(struct device *dev, struct device_attribute *attr, > if (port < 0) > return port; > > + /* Check if the corresponding path is available */ > + if (!chip->paths[port]) > + return -EOPNOTSUPP; > + > /* Port selection must be done before enabling EUD */ > if (chip->enabled) > return -EBUSY; > @@ -228,8 +294,54 @@ static void eud_role_switch_release(void *data) > usb_role_switch_put(chip->role_sw); > } > > +static int eud_init_path(struct eud_chip *chip, struct device_node *np) > +{ > + struct device_node *controller_node; > + struct eud_path *path; > + u32 path_num; > + int ret; > + > + ret = of_property_read_u32(np, "reg", &path_num); > + if (ret) { > + /* Legacy DT uses 'ports' node without 'reg' property; treat as path 0 */ > + if (of_node_name_eq(np, "ports")) > + path_num = 0; > + else > + return dev_err_probe(chip->dev, ret, "unexpected child node '%s'\n", > + np->name); > + } > + > + if (path_num >= EUD_MAX_PORTS) > + return dev_err_probe(chip->dev, -EINVAL, "invalid path number: %u (max %d)\n", > + path_num, EUD_MAX_PORTS - 1); > + > + path = devm_kzalloc(chip->dev, sizeof(*path), GFP_KERNEL); > + if (!path) > + return -ENOMEM; > + > + path->chip = chip; > + path->num = path_num; > + > + controller_node = of_graph_get_remote_node(np, 0, -1); > + if (!controller_node) > + return dev_err_probe(chip->dev, -ENODEV, > + "failed to get controller node for path %u\n", path_num); > + > + path->phy = devm_of_phy_get_by_index(chip->dev, controller_node, 0); > + of_node_put(controller_node); > + > + 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 eud_chip *chip; > struct resource *res; > int ret; > @@ -258,7 +370,22 @@ static int eud_probe(struct platform_device *pdev) > return -ENODEV; > chip->mode_mgr = res->start; > > + for_each_child_of_node_scoped(np, child) { > + ret = eud_init_path(chip, child); > + if (ret) > + return ret; > + } > + > + /* Primary path is mandatory. Secondary is optional */ > + if (!chip->paths[0]) > + return dev_err_probe(chip->dev, -ENODEV, "primary path not found\n"); > + > chip->port_idx = readl(chip->base + EUD_REG_PORT_SEL) & EUD_PORT_SEL_MASK; > + if (!chip->paths[chip->port_idx]) { > + dev_info(chip->dev, "secondary path not available, falling back to primary\n"); > + chip->port_idx = 0; > + writel(chip->port_idx, chip->base + EUD_REG_PORT_SEL); > + } > > chip->irq = platform_get_irq(pdev, 0); > if (chip->irq < 0) > -- > 2.34.1 > > This patch doesn't apply to my usb-testing branch. Can you rebase and resend? thanks, greg k-h