Re: [PATCH v5 3/5] phy: snps-eusb2: Set phy type to EUSB2

Sebastian Reichel <[email protected]> Wed, 5 Aug 2026 02:43:26 +0200
Newsgroups org.kernel.vger.linux-usb,org.infradead.lists.linux-phy,org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel
Message-ID <anKG8g7QdAKkYJDH@venus>
Hi,

On Tue, Aug 04, 2026 at 10:28:53PM +0000, Thinh Nguyen wrote:
> On Sun, Jul 26, 2026, Krishna Kurapati wrote:
> > On 7/25/2026 3:21 AM, Sebastian Reichel wrote:
> > > On Thu, Jul 23, 2026 at 04:09:06PM +0530, Krishna Kurapati wrote:
> > > > USB controllers like DWC3 are agnostic of the kind of phy (USB2/eUSB2)
> > > > connected to it. Set the phy type to EUSB2 to let the controller know
> > > > the phy type when queried during its probe.
> > > > 
> > > > Signed-off-by: Krishna Kurapati <[email protected]>
> > > > ---
> > > >   drivers/phy/phy-snps-eusb2.c | 4 ++++
> > > >   1 file changed, 4 insertions(+)
> > > > 
> > > > diff --git a/drivers/phy/phy-snps-eusb2.c b/drivers/phy/phy-snps-eusb2.c
> > > > index f90bf7e95463..e139b17bcda5 100644
> > > > --- a/drivers/phy/phy-snps-eusb2.c
> > > > +++ b/drivers/phy/phy-snps-eusb2.c
> > > > @@ -13,6 +13,8 @@
> > > >   #include <linux/regulator/consumer.h>
> > > >   #include <linux/reset.h>
> > > > +#include <dt-bindings/phy/phy.h>
> > > > +
> > > >   #define EXYNOS_USB_PHY_HS_PHY_CTRL_RST	(0x0)
> > > >   #define USB_PHY_RST_MASK		GENMASK(1, 0)
> > > >   #define UTMI_PORT_RST_MASK		GENMASK(5, 4)
> > > > @@ -597,6 +599,8 @@ static int snps_eusb2_hsphy_probe(struct platform_device *pdev)
> > > >   		return PTR_ERR(generic_phy);
> > > >   	}
> > > > +	phy_set_type(generic_phy, PHY_TYPE_EUSB2);
> > > 
> > > Isn't there a potential race condition if it's handled in this way?
> > > 
> > > 1. phy-snps-eusb2 probe: PHY is registered
> > > 2. dwc3 probes
> > > 3. phy-snps-eusb2 probe: PHY type is set
> > > 
> > 
> > How about we do this get_type call after dwc3_probe call during
> > dwc3_qcom_probe. That way we can ensure phy is up for sure since core init
> > has to happen as part of dwc3_probe.
> 
> There should be no race here. The phy_set_type() is called before the
> phy is registered. dwc3-qcom would get -EPROBE_DEFER if it probes before
> the phy is registered.

Indeed, it was me being stupid. I blame the heat :)

Greetings,

-- Sebastian
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAmpyhysACgkQ2O7X88g7
+ppYFg/9FOy4dS3z38lF7xVBpJaJQCBs6P4YrVrHM76r5DgrcoqrPbL2bhsEa2X9
drQ6MVLNMTbUFblSmGPrhqc+j2pOnaREhsuvY3oV3uly0V3a98FoZGN/1jw/CPb3
xPeriVcMIsIGYgoUwFYDBBO+Nvg8esnHOl4KtjyqVxaOFdAN8qt0hLfknAtM6iYk
ibfblNSnTIql1bo7A/W9CrzWHa8jDPR9awAtZRBKij1hOXf6HkVBrhomZLb7IIdY
T3G14//GbWUWBhJsv0Ehzn3GV2Teh4TOT63xcKuM9D7R3r9pUy5K5+3UO3S/xKc4
YnCYyWVWYgqCnblXzg8gl6P+V7iM5fNhxu1Ah3JDWX7xl7YjfoqUd8cPx/zGjmNf
jvS98X/M8a/xaQBFVnkRXqhE5B4/YoVN60CcyVL+1QmI8pOmfKcdY0jjsOPp72e1
1FeXYzSeYRwP7gGrIoAsk8Cct6C5GJ/1dAkVnX7UV0MpFDSYE4uHuMmPNSpamXWl
Yi5mSdDnsAo5YtpxSRrz/S4YXda3pqRyue/hrtyHnmMdAdllHGak9TQOw5Bk1iJp
5Z+ksKnrzG5SUuDyCoGmPLh6bpcrOyQlc1vdBgScfRhjFW/7PxYZXrvdh06xdT0v
hYvCxGHPoSm2rw7YTlUhYXGX9/q3G5bxNk9U0ar5hDFpQ/7Tp48=
=pTrD
-----END PGP SIGNATURE-----