From nobody Wed Apr 1 09:43:47 2026 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AD2F0334692 for ; Mon, 30 Mar 2026 15:02:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774882978; cv=none; b=g4vXVgI3ktsICcF/GthUmv1r+edlM6rLnhonZ+TX73Nuqld0q+RvN2c8Q6pGJxTZ0Rqg9jijAcXc6E+h4zNJWMdtEIQOiwWPP2xdr93EiqZ499LrQRZ9HG4H8glMPwjTe2P9sRDWImtHGWQ2r5q5ennHwyL+l3nC9aUhrrvnqQk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774882978; c=relaxed/simple; bh=mYXIm1WLt8UpzUiZmsLBr44Fjyc4CuwjsMIhWi+IAuI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=dwOesRw4x/T4VJKgV5bSXQ90rHnQYITYyK23GNeY2UyNwoNr28RGEE1Dg2G72m0zHNA2U6akiYJvZWvA3mvBDRSV41Zh6513G6hr0vv2z/W4iU1zFKD7CeAWCaXSM3IvdvcemFmtr+G7MklRw+ft5V7sg91vOcXSfbn3nss1Lfs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=M+wzTzLJ; arc=none smtp.client-ip=209.85.128.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="M+wzTzLJ" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-4853e1ce427so57603365e9.3 for ; Mon, 30 Mar 2026 08:02:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774882975; x=1775487775; darn=vger.kernel.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=IefxdwdaNENTe3ijrHdpPLezHBD/mzIOjWzh1r0qkT8=; b=M+wzTzLJDUcIHwuwWo2OB/1VQWgS31Ny/QOuzZJVgpsnO6iINGDzHAs1LJkTAz6EOv 0JDnpKceNG9isCwBmzkqJQTcqvl9WJeJIc/W1lTcN9lK8fA9tfFIkGNFwkfRiqi2xgcd 7hARSWb4w/VGZXvazzcC+x4n8mkMJ81X1JwzMTqxsIDPgyXsqXj9Vkoakatp5NTgZIFm GWIZ9utuk7wGGUuva4j5mVKHEXMvp0VSPa7z/yHrNXBqMBSjlEdjivOtnBzebeFCU9sy xHvw2xN2phZBLj7+k35/JBRf1wLZcfwuLtWcX/H18onTDy/RaN5xZkA4L3BjrupBNMP6 y/aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774882975; x=1775487775; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=IefxdwdaNENTe3ijrHdpPLezHBD/mzIOjWzh1r0qkT8=; b=Shy11+XeiNNrSXUJMKjd3DbrgdVbgxRn1mmQWJjmaeO+T7byW90xla0ic/RmFheb68 gAHRDARSQj7ayrN/msSBkosELo5uLTNTWeii+xsf0bIcAdrIFQnvjN9Y+5jYxzMTDG0c JVVD+qRsRapvE5bSr452AuOZAwfR85oPA1ZhIR+lDZpEQoehkU7nuxwUsFI/gWWvcdrk ZIIfrzN55BYp38I5LvAHsBOmorlIE7L0Ri+1DHqpTnk393JL3/JlqhWD7mJu3DNzPayA jCfyWnpAV0yvDEZvUojL7hX0xno+ntlPlZH6gsS3hQewNuN0HdHyjmg+FvVZIfW3lU7y ah4w== X-Forwarded-Encrypted: i=1; AJvYcCXv5i0t/yHVf3aXALos+IfKVNxdJMyeAz85rcd8qo6q6PWFe/sgntqLs/WZdHPRoHSH0BqAOwPgqbjnIwk=@vger.kernel.org X-Gm-Message-State: AOJu0YzMj7/K2ZQgXTja5plEaYBHGq3RKL497utRsXfk7Dl/sfGAxUX8 JyiaysGMGUkcAX0fQfWOLuTfMJhtJNTQvvEhM6v6vKrjQ9VLh5xNFyYL X-Gm-Gg: ATEYQzxvBFDqe/xVeBtgAC9sSOFi6ibgIwA6P4nVOoaJI88fuVqT7l1JMNh4blwxYCg 7nRAaFmXiVdoy8HSjdvI0dRs7yVbjmk0sepdB7C/KXjueyIL5nYmtrL7bKKfDZNmS07ER3Uxj66 UAY1carHTpd1KOOZRwBwK3dDsTW5WIQSbeb+DYoqELsBZ3YtXEPm/XN4RgESJqwZqYswPn6wPs2 UF0SKCH+vLpivVZutfzIAMtTATVaGNCSqqeHo2s7yl6uYSvuuwf6qOy/Et+biVMGuId3yqQVtF/ CLE+vo4cqAc/4zkjNKdUGO9QazCa1H0CZI4tHtrFRk/CdOJNCBF+6G6DA681/0tWGuis188Ysrr /X4FnkzChA+qoxGAZdxRzuC1XnIfftXxO1v4mQxScrsavozUOy0R+eq7Ecu9dlNZXbY6iDX72sz 1yPnRGMHGxJgYlDsMLLAhx15RgNy0MmS0QCf9A35yC747ecWr+caNK X-Received: by 2002:a05:600c:4e15:b0:485:2ce2:4c8a with SMTP id 5b1f17b1804b1-48727d67a21mr205698365e9.1.1774882974762; Mon, 30 Mar 2026 08:02:54 -0700 (PDT) Received: from [192.168.0.253] (5D59A51C.catv.pool.telekom.hu. [93.89.165.28]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-43cf2471ee2sm18711796f8f.29.2026.03.30.08.02.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Mar 2026 08:02:53 -0700 (PDT) From: Gabor Juhos Date: Mon, 30 Mar 2026 17:02:42 +0200 Subject: [PATCH] usb: core: avoid double use of 'usb3-phy' Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260330-usb-avoid-usb3-phy-double-use-v1-1-d2113aecb535@gmail.com> X-B4-Tracking: v=1; b=H4sIAAAAAAAC/x3MQQ5AMBBA0avIrE1SHVFcRSzQwSSi0oYQcXdl9 9/m3xDYCweokxs8HxLErRFZmsAwd+vEKDYatNKFIl3hHnrsDif2K8JtvtC6vV84mtFwXpVkSBk aID42z6Oc/79pn+cFd3WL428AAAA= X-Change-ID: 20260329-usb-avoid-usb3-phy-double-use-7e498373073c To: Greg Kroah-Hartman , Stanley Chang Cc: Andrew Lunn , Gregory Clement , Sebastian Hesselbarth , Miquel Raynal , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Gabor Juhos X-Mailer: b4 0.14.2 Commit 53a2d95df836 ("usb: core: add phy notify connect and disconnect") causes double use of the 'usb3-phy' in certain cases. Since that commit, if a generic PHY named 'usb3-phy' is specified in the device tree, that is getting added to the 'phy_roothub' list of the secondary HCD by the usb_phy_roothub_alloc_usb3_phy() function. However, that PHY is getting added also to the primary HCD's 'phy_roothub' list by usb_phy_roothub_alloc() if there is no generic PHY specified with 'usb2-phy' name. This causes that the usb_add_hcd() function executes each phy operations twice on the 'usb3-phy'. Once when the primary HCD is added, then once again when the secondary HCD is added. The issue affects the Marvell Armada 3700 platform at least, where a custom name is used for the USB2 PHY: $ git grep 'phy-names.*usb3' arch/arm64/boot/dts/marvell/armada-37xx.dtsi= | tr '\t' ' ' arch/arm64/boot/dts/marvell/armada-37xx.dtsi: phy-names =3D "usb3-phy"= , "usb2-utmi-otg-phy"; Extend the usb_phy_roothub_alloc_usb3_phy() function to skip adding the 'usb3-phy' to the 'phy_roothub' list of the secondary HCD when 'usb2-phy' is not specified in the device tree to avoid the double use. Fixes: 53a2d95df836 ("usb: core: add phy notify connect and disconnect") Signed-off-by: Gabor Juhos --- drivers/usb/core/phy.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/phy.c b/drivers/usb/core/phy.c index 4bba1c2757406a35bf19eb7984a2807212374d18..4d966cc9cdc9510147041df7875= ad9e48a9ea3af 100644 --- a/drivers/usb/core/phy.c +++ b/drivers/usb/core/phy.c @@ -114,7 +114,7 @@ EXPORT_SYMBOL_GPL(usb_phy_roothub_alloc); struct usb_phy_roothub *usb_phy_roothub_alloc_usb3_phy(struct device *dev) { struct usb_phy_roothub *phy_roothub; - int num_phys; + int num_phys, usb2_phy_index; =20 if (!IS_ENABLED(CONFIG_GENERIC_PHY)) return NULL; @@ -124,6 +124,16 @@ struct usb_phy_roothub *usb_phy_roothub_alloc_usb3_phy= (struct device *dev) if (num_phys <=3D 0) return NULL; =20 + /* + * If 'usb2-phy' is not present, usb_phy_roothub_alloc() added + * all PHYs to the primary HCD's phy_roothub already, so skip + * adding 'usb3-phy' here to avoid double use of that. + */ + usb2_phy_index =3D of_property_match_string(dev->of_node, "phy-names", + "usb2-phy"); + if (usb2_phy_index < 0) + return NULL; + phy_roothub =3D devm_kzalloc(dev, sizeof(*phy_roothub), GFP_KERNEL); if (!phy_roothub) return ERR_PTR(-ENOMEM); --- base-commit: f50200dd44125e445a6164e88c217472fa79cdbc change-id: 20260329-usb-avoid-usb3-phy-double-use-7e498373073c Best regards, --=20 Gabor Juhos