From patchwork Mon Nov 16 10:55:44 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinicius Pedrosa X-Patchwork-Id: 4136 Return-Path: X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mxe881.netcup.net (Postfix) with ESMTPS id D31E61C58E9 for ; Mon, 16 Nov 2026 11:56:21 +0100 (CET) Authentication-Results: mxe881; dkim=pass header.d=gmail.com; spf=pass (sender IP is 172.105.105.114) smtp.mailfrom=linux-sunxi+bounces-27734-noreply=patchwork.local@lists.linux.dev smtp.helo=tor.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 172.105.105.114 as permitted sender) client-ip=172.105.105.114; envelope-from=linux-sunxi+bounces-27734-noreply=patchwork.local@lists.linux.dev; helo=tor.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id AB9BC2DE77 for ; Mon, 16 Nov 2026 10:56:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794826578; b=26dhStquzC6lqk1XqUXeHWAQLyqmsCAmJzWvNdcCgFYexbiSJXwBKWW33FQgtFA+ribB pWgCkonbYz6Vdb9cUIh7eOxfCFrdWc09zqM6fWQDvngu2nJ93xrZGtyuMohvsFChFPqJ1 blITmD6YV1kEMnSJQht4rLaA8kvTzkocKCZ4c2E+moEIq0XAum0LG8KDvLsOk2+wwloRi 2Q2T+jxErhR28PVVcnoqkEFBZorHiFIsIc3ClFW06rdMJ+UgHyyKhnyPVzmLvqOTocYPr WHOskItTOgefT847S0EXm/UrQcgh0a0JqbLXtdyxzg5/tOZR+Lui/vvG/F9LVOqarNg== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794826578; h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature: X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State: X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:Date:Message-ID: X-Mailer:In-Reply-To:References:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version:Content-Transfer-Encoding; bh=mXHs4M+7tfkoIg4sYbiMPquQrDZ3R0cBJAsjaurMG7I=; b=qqvFxJVTH49JhLtNXcdAy4q5vT45Zy7H7gPmc8Cz1BsfYOxfQsb2xU9IUSW+QPpIysqR U/vTOrG71NH6CIyRy5vSa+vX5rELBxKHk+T611R57b4LFwTG+9p/JBSccnx4EjcGc6vqp FV1CbKvLLENcys8nZ8LnJpGA54xMkvCmd91Y5FfC/ihJaUHA4s1zFetvW1MxPmLgz9CzL fyC21mMrNsoyNqOrb4s+fF6DydDKEWZInK3C3hwbksXClRKxuPwsxCVMCClS0MxH9fbhr OF2bKVTvGo1kgzi+f21XPl1ADqwOHA+FlH0jkMkM3OWgp76E/WbjvCGtfwiBUe+hkhg== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=OzglBkNs; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9B479606A32A; Mon, 16 Nov 2026 10:56:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=OzglBkNs X-Original-To: linux-sunxi@lists.linux.dev Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.172 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794826578; b=hUP4ww826kwjI1eJzV/I3lnHZ32dMV6/SYzKMnv/MdPjR94Wp4zkeypcRAlCyA7hGTZw ZVwlVfvqc3sXYz7+AEhOyzgKpxZcBKTWBxN4rlc3GZ0FLsPH8kHFUnuhMx9s+fhx1uSRw SufPdrKE2mVRqHRIkvo7Vb7PTnnvqyqHT8gZx1C6E42C4jIN23Na/kH4aDcrpVZ2Z31JL MLm0BgXRxDjies/PmJKxWIRd8cCKZGlBl0vAjWzp24kWDTr/TdNUItU0BRNnfGamn0+Zx HY56NM26+P1BS89HqX+ronSEhj09cJW17cyR1mImFE3zHLMDp0fPlSCZmNuAehraFwg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794826578; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=mXHs4M+7tfkoIg4sYbiMPquQrDZ3R0cBJAsjaurMG7I=; b=en/H87wShEmHaGm0vtjoiIWJmm7Wwi4NkNiNPm710Ecpp72Dsjmm3ybevB8Yt2FXKbIM F7ALAVQ2cyEiRUkHwAJ5tKWcNZypkMGYCP17oJ456WYQF6eFwntZXymkGFhoT9SF4PCuO HxRiuJfPGZy8FAFfLYo7JcQR/iqSnn0GgebRtTpT6PQ/5NxiMx8CdgNXtsC12n+IJ1xKa fwtcNMU8Sb4LRkOCS8qNF3GL9Q5EJ+07dqXx6nh98/mq1GGtqx4Hh/Ek9H3GQpZcrTCpR kCrwgoR4uID6xZT2ra87n8WozZEeqvOmDXBKj0noDLrm+vaZY7MW1zKopLLX56LJ7WA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=OzglBkNs; arc=none smtp.remote-ip=209.85.128.172 Received: from mail-yw1-f172.google.com (mail-yw1-f172.google.com [209.85.128.172]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 31AFE606A329 for ; Mon, 16 Nov 2026 10:56:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 31AFE606A329 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 Received: by mail-yw1-f172.google.com with SMTP id 00721157ae682-8b4d543b6b6so3874707b3.3 for ; Mon, 16 Nov 2026 02:56:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794826577; x=1795431377; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=mXHs4M+7tfkoIg4sYbiMPquQrDZ3R0cBJAsjaurMG7I=; b=OzglBkNs2geMRctFYRD4GcN6pl9itztevwhvJ2969jCq6h9gAaP76mmj0pbns8370O LE81zNEo5VtEaUz+6PGVGbmmnsEHnjniz2sudOH7CxVstU62rhIW+PrOaDws/nJc09qv zVFMjD95q2Lb7Vj2x/uXT2Of6xKflnHKBeuQFfUjxY2MLl4C41AC+i6uYSXCAm4iG/FC bHGO36rEBM56wqDwiHoZLlG+C8jvhJDNnR1KSEMEhV4tleeKx0CRWS65qoFhVQRG8TDp PX7y7XPp3kO0rceirNMqKNrylmyYwn+Fp3fM/xWNbAsBmsXjG9Gx4GMwbX1RQItUyz9u Sxfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794826577; x=1795431377; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=mXHs4M+7tfkoIg4sYbiMPquQrDZ3R0cBJAsjaurMG7I=; b=ljVwrCzUOMkXXHw9SyTbzDB7sQV8zUM+VOmESHsGK2l+1gDmiGb5SRL/Y0ImqV3VxB 7Cw1t2kbfBZq1niojm7FYqcd5Oh8PrHNORYHzySrmhCjHnks/UYYDHLU5YXrCpm/muWE Sm4x4YHr2KLAJ/5QMQwNEDXghCRTX0g+WoEfLL3wtoAl9FBNYybEuoaOJzL8ER+dvdhh 5HNnhPh0iqY+7L1uLFQaM1Bpa6CyDXYJW36EyuQeqKiqoXX+j0mxaxEKV2SKKWSV3zYa ilGmKku8EYIZDFZGxEGfU+WPPxSTEaC1ANYR98pp1pljEY5hWsgi5238DJB2Dew55sHN tQRg== X-Forwarded-Encrypted: i=1; AL+hErHXQdMCnJv3Def5nr78r0Vmr7Y4m6Ec7jQSJUQXEqwKOY4srZ/a08MiDiAfgfkEm6as8W0tPnUTyDxlug==@lists.linux.dev X-Gm-Message-State: APuU4Z9bCSCgOCKSP64zt4LyXyp8JW6SWfcfEzJt/27urpPpvNRxb26d A/VpC2I3jVIm3q9IWA7KGmrqyroVfUJiRkcB9Rqsl/yZogrTnEavjFYx X-Gm-Gg: AZFdTZfo4lXUMlZoVWdXwWt8roDQlR9+WzGN9jSvslvDuPBi/oHSd14ZFSxJVYKDTT5 8yLz+hVd+6wxup63xkS53Vt1HD1KBYUbw46QeUdnyuj7J/GR5FDMXDTU5axpof2b+MUwOgMoM7t cFlCnrluRhpe+BjsicyzI3jSdVb9LZ235hunYlQr+z/F5uQ4N6b0beXBSt4FpEhX0q4wHP0vODG K4+6I9tdzo3SKoTbXkm7KFEBnHR0fi8a7Tk9eYChjAfrOfG2VSc3l/RLjWtws5vLeHlcw4Na0Iu DWzu+THSj8eux0WToMFwsXILCEjTyBI0ji2TSezkgR1cdiFR6k/kdjEwgUGBeZdp7P4dDyJQMuS D+zzXxzL22uhVnOQZfSbmtBADApzLt0BNCF50TFnf9NB05sbkNM6gzKpNQxXcqTCgnd/t1h1Spl cHiYhX9Qu3BpsVv9vItYs14QCkczUo5Ns33lwuFv9knr2joXOK4/f010xT18U4PR2CtM0cGS7uf ypBR988BQThSr7zFk4Z0vtoUWn8FJj8FGf688iwxGS7tPqzQkoxgMOKdZolz8yWXo5NRlhuEMVw d87ayxicNUKCrWRdnJp7+lRRfaVdGljcVXrWAD1pS/QqUPm+g7/5B1O+HbXacwmwaItmuczx+3O dq2Xc6HdYQf22aj37oua3qZiPWf4cMbn84jP5 X-Received: by 2002:a05:690c:fcd:b0:8b4:cc58:7901 with SMTP id 00721157ae682-8b4cc5882e4mr22480827b3.8.1794826577207; Mon, 16 Nov 2026 02:56:17 -0800 (PST) Received: from MaquinaLab.. ([2804:1b2:aa41:8a69:2b8b:32cb:351d:f30d]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8b4aa7f1a0dsm82274987b3.1.2026.11.16.02.56.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 02:56:16 -0800 (PST) From: Vinicius Pedrosa To: 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 Subject: [PATCH v2 2/2] phy: sun4i-usb: clear SIDDQ before the PHY reset on A733 Date: Mon, 16 Nov 2026 07:55:44 -0300 Message-ID: <20261116105544.669029-3-vinicius.eduardo.pedrosa@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261116105544.669029-1-vinicius.eduardo.pedrosa@gmail.com> References: <20261116105544.669029-1-vinicius.eduardo.pedrosa@gmail.com> X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-Rspamd-Server: rspamd-worker-8404 X-Spamd-Result: default: False [-0.69 / 15.00]; BAYES_HAM(-5.50)[100.00%]; RBL_SENDERSCORE(2.00)[172.105.105.114:from]; SUSPICIOUS_RECIPS(1.50)[]; DMARC_POLICY_SOFTFAIL(1.00)[gmail.com : SPF not aligned (relaxed), No valid DKIM,none]; R_MISSING_CHARSET(0.50)[]; MAILLIST(-0.18)[generic]; MIME_GOOD(-0.10)[text/plain]; BAD_REP_POLICIES(0.10)[]; HAS_LIST_UNSUB(-0.01)[]; FROM_HAS_DN(0.00)[]; FORGED_SENDER_MAILLIST(0.00)[]; TAGGED_RCPT(0.00)[dt]; DBL_BLOCKED_OPENRESOLVER(0.00)[tor.lore.kernel.org:helo,tor.lore.kernel.org:rdns]; FREEMAIL_CC(0.00)[linaro.org,kernel.org,gmail.com,sholland.org,arm.com,uniontech.com,lists.infradead.org,vger.kernel.org,lists.linux.dev]; RCPT_COUNT_TWELVE(0.00)[16]; MID_RHS_MATCH_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[viniciuseduardopedrosa@gmail.com,linux-sunxi@lists.linux.dev]; ARC_ALLOW(0.00)[subspace.kernel.org:s=arc20261015:i=2]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(0.00)[+ip4:172.105.105.114:c]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[100.77.114.92:received]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[172.105.105.114:from]; RCVD_COUNT_FIVE(0.00)[6]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_TRACE(0.00)[0:+]; TAGGED_FROM(0.00)[bounces-27734-noreply=patchwork.local]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; ASN(0.00)[asn:63949, ipnet:172.105.96.0/20, country:SG]; RCVD_TLS_LAST(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[] X-Rspamd-Queue-Id: D31E61C58E9 X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: INBOX 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. 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. 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. The vendor BSP clears SIDDQ while the PHY is still in reset, in its common host path. 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. Signed-off-by: Vinicius Pedrosa --- drivers/phy/allwinner/phy-sun4i-usb.c | 35 +++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/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 { bool phy0_dual_route; bool needs_phy2_siddq; bool siddq_in_base; + bool siddq_before_reset; bool poll_vbusen; int missing_phys; }; @@ -253,6 +254,19 @@ static void sun4i_usb_phy_passby(struct sun4i_usb_phy *phy, int enable) writel(reg_value, phy->pmu); } +static void sun4i_usb_phy_clear_hci_phy_ctl(struct sun4i_usb_phy *phy) +{ + struct sun4i_usb_phy_data *data = to_sun4i_usb_phy_data(phy); + u32 val; + + if (!phy->pmu || !data->cfg->hci_phy_ctl_clear) + return; + + val = readl(phy->pmu + REG_HCI_PHY_CTL); + val &= ~data->cfg->hci_phy_ctl_clear; + writel(val, phy->pmu + REG_HCI_PHY_CTL); +} + static int sun4i_usb_phy_init(struct phy *_phy) { struct sun4i_usb_phy *phy = phy_get_drvdata(_phy); @@ -270,6 +284,10 @@ static int sun4i_usb_phy_init(struct phy *_phy) return ret; } + /* 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); + ret = reset_control_deassert(phy->reset); if (ret) { clk_disable_unprepare(phy->clk2); @@ -321,11 +339,8 @@ static int sun4i_usb_phy_init(struct phy *_phy) clk_disable_unprepare(phy->clk2); } - if (phy->pmu && data->cfg->hci_phy_ctl_clear) { - val = readl(phy->pmu + REG_HCI_PHY_CTL); - val &= ~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); if (data->cfg->siddq_in_base) { if (phy->index == 0) { @@ -1013,6 +1028,15 @@ static const struct sun4i_usb_phy_cfg sun50i_h616_cfg = { .siddq_in_base = true, }; +static const struct sun4i_usb_phy_cfg sun60i_a733_cfg = { + .phyctl_offset = REG_PHYCTL_A33, + .dedicated_clocks = true, + .hci_phy_ctl_clear = PHY_CTL_SIDDQ, + .phy0_dual_route = true, + .siddq_in_base = true, + .siddq_before_reset = true, +}; + static const struct of_device_id sun4i_usb_phy_of_match[] = { { .compatible = "allwinner,sun4i-a10-usb-phy", .data = &sun4i_a10_cfg }, { .compatible = "allwinner,sun5i-a13-usb-phy", .data = &sun5i_a13_cfg }, @@ -1029,6 +1053,7 @@ static const struct of_device_id sun4i_usb_phy_of_match[] = { .data = &sun50i_a64_cfg}, { .compatible = "allwinner,sun50i-h6-usb-phy", .data = &sun50i_h6_cfg }, { .compatible = "allwinner,sun50i-h616-usb-phy", .data = &sun50i_h616_cfg }, + { .compatible = "allwinner,sun60i-a733-usb-phy", .data = &sun60i_a733_cfg }, { .compatible = "allwinner,suniv-f1c100s-usb-phy", .data = &suniv_f1c100s_cfg }, { },