From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=119.15.109.137 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796080949; b=xnirZtRB5KDpLa1MYtSlgdtRY2wKoSHkOk4CB4JzpEUqfIQlwAV4/YSxmRvIQ4xrH4KS z1bRsnyINtW5ISBoUwC2IDu8jvpemNMOLRDNSmwgCnyGuUi1bdQQxe20bP/uRUerGkwey qGm4J1LeyPBrY1fYubrfnFPufUh1hXIf7xoJ/pKEV0v/YBiUqx66iAS8w3a8L33a0eTZs wOv/8W77z3F/JmNx1mutrvS1ymC+q78UnzxaPZ7uB6nbdDCxhy09lbvDnF7tDNYc4b3U2 TmUmcDUXs098ylnVmGo6sNyWsNFFvUUnYSafVt1Gc2hw7GVrajn+H/VmHAv4jtWYfkQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796080949; h=DMARC-Filter:Received:DKIM-Signature:Message-ID:Subject:From:To:Cc: Date:In-Reply-To:References:Autocrypt:Content-Type: Content-Transfer-Encoding:User-Agent:MIME-Version; bh=MVvHd96zDIGPBll45puxntrsxHDWx6HaqCRYXxM4hV8=; b=fvmUlpJeWf1ZxcMHHuJOWpeVr/rzz/raAXGI6OJZ3LdBo4gikp81eQ+LC4DjZ/dH4qym AB0gYv+zVuTWrdAfMStN3yk8Ytao2s7jbmlp2fWjsSxyVt2qdXFBeF6PulEt70SlWT/8n qfWZpkiYR3fheQie63XXly3K30baMUL+ZsNVsN8Nfyt7cd2Z+wH0YogQmpONTkoMQ6iZO 9zqKw0ypfw7pYwh1l14l2i2Aly3FTBKHkfnp3xCUwVOtHeugqenhQLnl1E1ZyBlDrTt+1 KCF/Xmxby9WJ/hOmE/UIsOhqToWOJYPnifiI8D/SJ21gBam42UqHjRrEl94K3u0LHug== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=d-silva.org; spf=pass smtp.mailfrom=d-silva.org; dkim=pass header.d=d-silva.org header.i=@d-silva.org header.a=rsa-sha256 header.s=2025a header.b="CGKMw/Ub"; arc=none smtp.remote-ip=119.15.109.137 Received: from www.nmnhosting.com (watt.d-silva.org [119.15.109.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 80FD9606A31A; Mon, 30 Nov 2026 23:22:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 80FD9606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=d-silva.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=d-silva.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=d-silva.org header.i=@d-silva.org header.a=rsa-sha256 header.s=2025a header.b=CGKMw/Ub Received: from hawking.lan (ntp.lan [10.0.1.1]) by www.nmnhosting.com (Postfix) with ESMTPSA id B73244015C; Tue, 1 Dec 2026 10:22:23 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=d-silva.org; s=2025a; t=1796080943; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=MVvHd96zDIGPBll45puxntrsxHDWx6HaqCRYXxM4hV8=; b=CGKMw/UbfTl/C4PH4mGZ9KpkSCtdH+nRxXjyTprnnRWyFhhG7pl8+c30aZY9ZvxyhBXdZD 9gGMFfMbzLRk1szkH9U0RIHPeRhgaSO9BR2swpnu3jQR+4UptMeNFA/ZHyrfKDRsMYsvcX KGLS0upbmIkTzWzzt2J0ecCkKgDfoFoOqXRa/6ZS1HzBzCv+3eg6f5QBKRTfP7QElZAsnf Z1Vx9x8Sy/l7kAzaz+UmtwO80GnjioZ4G7ScTYvMxNI3z+YCdFf9f0JQMdapb2LC9Eloy8 J3k/Vxdzy80Fwhv47fJLVeBIPnIK2X/1HXsMK8Whc4KSdb5j8NCrVo1BMq59Ew== Message-ID: Subject: Re: [PATCH v2 2/2] phy: sun4i-usb: clear SIDDQ before the PHY reset on A733 From: Alastair D'Silva To: Vinicius Pedrosa , Vinod Koul Cc: Neil Armstrong , Manivannan Sadhasivam , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Andre Przywara , Xu Rao , linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Date: Tue, 01 Dec 2026 10:22:23 +1100 In-Reply-To: <20261116105544.669029-3-vinicius.eduardo.pedrosa@gmail.com> References: <20261116105544.669029-1-vinicius.eduardo.pedrosa@gmail.com> <20261116105544.669029-3-vinicius.eduardo.pedrosa@gmail.com> Autocrypt: addr=alastair@d-silva.org; prefer-encrypt=mutual; keydata=mQINBGactvoBEADBFM2HqfQUUM4j40ZQPyYzmnM8S6zrycO0ipDDPMs7nZMzyzGzOdqfS VB/tuYvZOOKVWzJuWJ5aT/YyHx54r3L+D5hTkEG0sXPVJky3yTS9sbHEMSLBHb8TVVuhPVPuieV4g Nkqg5POMTidk8xAw50WpV++tUlewXVSciehnuCQPXhXMP7FcCh4uO8LdN7E8m7ir1LafKTFfoWPah KVT8NGG9r+ucrFcN5F+VnHxTDaI68yRPkNdtUWmp22wIX1KwDCtKFrndYO4p5Hv2hlDKomsuIIHHn muQGRwuh0xpf0nVJNF8ETZHMzxQLfo3e/HvxBFOTkwY9w7CuuQFZchbhS0I3PfmGT0+jiNcdfqjDC fPPB5uhy+DkR6wO72vuwFYUrpU2mdliDSdKEtWBHulnXMJjpBOXetfIwhI8G2dTVg59lN5i9DvJZc 7y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4ThEBpJ4H2Tn mPNRYYcR0u2mNy1EJII04w== Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.56.2-9 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 On Mon, 2026-11-16 at 07:55 -0300, Vinicius Pedrosa wrote: > sun4i_usb_phy_init() deasserts the PHY reset first and clears SIDDQ in > the PMU HCI_PHY_CTL register afterwards. The order comes from the H3 > support and the reason for it isn't documented. >=20 > On a Cubie A7Z (A733), the Wi-Fi module on USB1 sometimes came up > at full speed on the OHCI companion and failed enumeration with -62. > This happened in 3 of 40 warm boots with a separate local PHY tuning > change applied. >=20 > With that tuning disabled, the current order failed once in 31 warm > boots. Clearing SIDDQ before releasing reset had no failures in 60 > warm boots in the same interleaved run, or in 10 cold boots. > Why the order matters is not understood. >=20 > The vendor BSP clears SIDDQ while the PHY is still in reset, in its > common host path. >=20 > Add a config flag for the early clear and set it only for the A733, > whose config is otherwise the D1 one. The other SoCs keep the current > order: the manuals don't specify one and they weren't tested. >=20 > Signed-off-by: Vinicius Pedrosa > --- > =C2=A0drivers/phy/allwinner/phy-sun4i-usb.c | 35 +++++++++++++++++++++++-= --- > =C2=A01 file changed, 30 insertions(+), 5 deletions(-) >=20 > diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinne= r/phy-sun4i-usb.c > index e2fbf8ccf99e..c918085a9281 100644 > --- a/drivers/phy/allwinner/phy-sun4i-usb.c > +++ b/drivers/phy/allwinner/phy-sun4i-usb.c > @@ -105,6 +105,7 @@ struct sun4i_usb_phy_cfg { > =C2=A0 bool phy0_dual_route; > =C2=A0 bool needs_phy2_siddq; > =C2=A0 bool siddq_in_base; > + bool siddq_before_reset; > =C2=A0 bool poll_vbusen; > =C2=A0 int missing_phys; > =C2=A0}; > @@ -253,6 +254,19 @@ static void sun4i_usb_phy_passby(struct sun4i_usb_ph= y *phy, int enable) > =C2=A0 writel(reg_value, phy->pmu); > =C2=A0} > =C2=A0 > +static void sun4i_usb_phy_clear_hci_phy_ctl(struct sun4i_usb_phy *phy) > +{ > + struct sun4i_usb_phy_data *data =3D to_sun4i_usb_phy_data(phy); > + u32 val; > + > + if (!phy->pmu || !data->cfg->hci_phy_ctl_clear) > + return; > + > + val =3D readl(phy->pmu + REG_HCI_PHY_CTL); > + val &=3D ~data->cfg->hci_phy_ctl_clear; > + writel(val, phy->pmu + REG_HCI_PHY_CTL); > +} > + > =C2=A0static int sun4i_usb_phy_init(struct phy *_phy) > =C2=A0{ > =C2=A0 struct sun4i_usb_phy *phy =3D phy_get_drvdata(_phy); > @@ -270,6 +284,10 @@ static int sun4i_usb_phy_init(struct phy *_phy) > =C2=A0 return ret; > =C2=A0 } > =C2=A0 > + /* Some SoCs want SIDDQ cleared while the PHY is still in reset. */ > + if (data->cfg->siddq_before_reset) > + sun4i_usb_phy_clear_hci_phy_ctl(phy); > + > =C2=A0 ret =3D reset_control_deassert(phy->reset); > =C2=A0 if (ret) { > =C2=A0 clk_disable_unprepare(phy->clk2); > @@ -321,11 +339,8 @@ static int sun4i_usb_phy_init(struct phy *_phy) > =C2=A0 clk_disable_unprepare(phy->clk2); > =C2=A0 } > =C2=A0 > - if (phy->pmu && data->cfg->hci_phy_ctl_clear) { > - val =3D readl(phy->pmu + REG_HCI_PHY_CTL); > - val &=3D ~data->cfg->hci_phy_ctl_clear; > - writel(val, phy->pmu + REG_HCI_PHY_CTL); > - } > + if (!data->cfg->siddq_before_reset) > + sun4i_usb_phy_clear_hci_phy_ctl(phy); > =C2=A0 > =C2=A0 if (data->cfg->siddq_in_base) { > =C2=A0 if (phy->index =3D=3D 0) { > @@ -1013,6 +1028,15 @@ static const struct sun4i_usb_phy_cfg sun50i_h616_= cfg =3D { > =C2=A0 .siddq_in_base =3D true, > =C2=A0}; > =C2=A0 > +static const struct sun4i_usb_phy_cfg sun60i_a733_cfg =3D { > + .phyctl_offset =3D REG_PHYCTL_A33, > + .dedicated_clocks =3D true, > + .hci_phy_ctl_clear =3D PHY_CTL_SIDDQ, > + .phy0_dual_route =3D true, > + .siddq_in_base =3D true, > + .siddq_before_reset =3D true, > +}; > + > =C2=A0static const struct of_device_id sun4i_usb_phy_of_match[] =3D { > =C2=A0 { .compatible =3D "allwinner,sun4i-a10-usb-phy", .data =3D &sun4i_= a10_cfg }, > =C2=A0 { .compatible =3D "allwinner,sun5i-a13-usb-phy", .data =3D &sun5i_= a13_cfg }, > @@ -1029,6 +1053,7 @@ static const struct of_device_id sun4i_usb_phy_of_m= atch[] =3D { > =C2=A0 =C2=A0 .data =3D &sun50i_a64_cfg}, > =C2=A0 { .compatible =3D "allwinner,sun50i-h6-usb-phy", .data =3D &sun50i= _h6_cfg }, > =C2=A0 { .compatible =3D "allwinner,sun50i-h616-usb-phy", .data =3D &sun5= 0i_h616_cfg }, > + { .compatible =3D "allwinner,sun60i-a733-usb-phy", .data =3D &sun60i_a7= 33_cfg }, > =C2=A0 { .compatible =3D "allwinner,suniv-f1c100s-usb-phy", > =C2=A0 =C2=A0 .data =3D &suniv_f1c100s_cfg }, > =C2=A0 { }, Tested on an Orange Pi 4 Pro enumerating the onboard USB 2.0 hub, a USB dri= ve chained off one of the ports, and confirmed the partition table was read by the ker= nel. Reviewed-by: Alastair D'Silva Tested-by: Alastair D'Silva --=20 Alastair D'Silva