From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 7A8E3606A6A3 for ; Wed, 25 Nov 2026 22:48:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=KaYf6Ypy; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=vNqhx78c DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=cXYPsDrryi5iDD3LdQ73nb0O82dc+yKwM8kITiJThcQ=; b=KaYf6Ypy3RawbWCuSxaEJvSsVU IyxaIMF2vXQZF78nDHEDanUAWWCznYWz2LnmV8xpHX4BsL/9YwlfoiugdHg3PfyhZxOnw5yvtfkdP 1ZdI15SIlcP3quQOocXFco2nuGphOfAcPRJJefvEgXk3QLkAAUnA7bq0QWjvvePlOnhXo4yHGP8ZS +CjPA+SdCa3+xq478As9bEvLy46iX6gMJRPY/FPKm5CVImDc4J2ahmYR2lF31exITMJKKgjE8PZFK PASXezmi8fVbUcE6/xAbjOrPM8TY1yLxuhrvUIFukXPVk/lV+JU7y2VCW3fKzzxQ3L+x9FGIPCH7Z F1MIOvSA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xWLnG-0000000BVws-0Kc9; Wed, 25 Nov 2026 22:48:51 +0000 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xWLnD-0000000BVvo-1syF for linux-phy@lists.infradead.org; Wed, 25 Nov 2026 22:48:48 +0000 Received: by mail-pj1-x1032.google.com with SMTP id 98e67ed59e1d1-3b3a914e4c8so3505264a91.0 for ; Wed, 25 Nov 2026 14:48:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795646926; x=1796251726; darn=lists.infradead.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=YDsDCXLkXL3cNo22jNaL7+utbyOJuM3+sdQzz79cB1A=; b=vNqhx78clFbIQEkfxFArm3Po1vm7EOucH7hMJioWZoTl5Yd3oi/j7cYhYrrjld6VgZ 553iFu+fmWIlHpZA319nUe12YTzKQ2gfp4oqFo+JhyRDCZ4myVYqAAtSrNvBT37b41+8 0igjaRNZAtONgp7V9ZbT8Y/Ej9nvxhfuI8jOVIaMaJIhpJ1BbQV7JEP8lboTmCuqOBf/ CuA+pGqJo5LLdES3hmYNEut+mkK49/vU4WRJ4CZVs2lyOs+R1KJgCK8BKMqb8vTo/5m/ Lfi0VeKIkshooOoesCFTB/Bw0ln7B13KAHtHHJGh/QuU8j9RDKX/0C8C63RGnn7lj2oo lH3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795646926; x=1796251726; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=YDsDCXLkXL3cNo22jNaL7+ut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uMypvO1KN05xev/1t7SJKW6Vg4NBb6z443RQvfQ0aiauWvneOG9KmAQvWY cgtmT16LvGHP7R0Y4Z9FWakB4PrqDQcZ8Rd5ptpxO8EtXjGVrrIAWFu5yUt4GymXX+DzDCahW64 XiWM+p4HXwRJlhvLC0a5Ykk1x+8= X-Received: by 2002:a17:90b:134e:b0:3ac:9a5e:9ce7 with SMTP id 98e67ed59e1d1-3b41c96764dmr18868042a91.49.1795646925992; Wed, 25 Nov 2026 14:48:45 -0800 (PST) Received: from localhost ([2001:19f0:8000:4ce8:5400:7ff:fe0e:e6b2]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b4afeaaa84sm13819382a91.10.2026.11.25.14.48.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Nov 2026 14:48:45 -0800 (PST) Date: Thu, 26 Nov 2026 06:48:37 +0800 From: Inochi Amaoto To: Niklas Cassel , Inochi Amaoto Cc: Andy Shevchenko , Jonathan Corbet , Shuah Khan , Randy Dunlap , Damien Le Moal , Frank Li , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Aksh Garg , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Bjorn Helgaas , Vinod Koul , Neil Armstrong , Rhys Tumelty , Manikandan K Pillai , "vladimir.oltean@nxp.com" , Qiang Yu , Hans Zhang <18255117159@163.com>, Yao Zi , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, linux-phy@lists.infradead.org, Yixun Lan , Longbin Li Subject: Re: [PATCH v5 8/8] ata: ahci_imx: Use bulk PHY APIs for calibration PHYs Message-ID: References: <20261125043639.249525-1-inochiama@gmail.com> <20261125043639.249525-9-inochiama@gmail.com> X-Archived-By: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261125_144847_500600_F4A314C5 X-CRM114-Status: GOOD ( 36.34 ) X-Spam-Score: -2.1 (--) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-phy" X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Wed, Nov 25, 2026 at 04:56:16PM +0100, Niklas Cassel wrote: > Hello Inochi, > > On Wed, Nov 25, 2026 at 12:36:39PM +0800, Inochi Amaoto wrote: > > The i.MX8QM SATA PHY relies on the first two HSIO lanes for shared > > impedance calibration. Store these calibration PHYs in a bulk array > > and acquire them by name with devm_phy_bulk_get(). > > > > Initialize both calibration PHYs before powering them on in lane order, > > then keep the SATA PHY initialization, mode selection and power-on > > separate. Use the bulk helpers to release the calibration PHYs after > > SATA startup and to unwind failures without repeating power-off after > > a failed bulk power-on. > > > > Signed-off-by: Inochi Amaoto > > --- > > drivers/ata/ahci_imx.c | 57 ++++++++++++++++-------------------------- > > 1 file changed, 21 insertions(+), 36 deletions(-) > > > > diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c > > index 6aaa18e29abc..18faa033e44f 100644 > > --- a/drivers/ata/ahci_imx.c > > +++ b/drivers/ata/ahci_imx.c > > @@ -25,6 +25,8 @@ > > > > #define DRV_NAME "ahci-imx" > > > > +#define NUM_CALIPHY 2 > > + > > enum { > > /* Timer 1-ms Register */ > > IMX_TIMER1MS = 0x00e0, > > @@ -66,8 +68,7 @@ struct imx_ahci_priv { > > struct clk *ahb_clk; > > struct regmap *gpr; > > struct phy *sata_phy; > > - struct phy *cali_phy0; > > - struct phy *cali_phy1; > > + struct phy_bulk_data cali_phys[NUM_CALIPHY]; > > bool no_device; > > bool first_time; > > u32 phy_params; > > @@ -428,30 +429,20 @@ static int imx8_sata_enable(struct ahci_host_priv *hpriv) > > * Initialize the first two lane PHYs here, although only the > > * third lane PHY is used by SATA. > > */ > > - ret = phy_init(imxpriv->cali_phy0); > > + ret = phy_bulk_init(NUM_CALIPHY, imxpriv->cali_phys); > > if (ret) { > > dev_err(dev, "cali PHY init failed\n"); > > return ret; > > } > > - ret = phy_power_on(imxpriv->cali_phy0); > > + ret = phy_bulk_power_on(NUM_CALIPHY, imxpriv->cali_phys); > > if (ret) { > > dev_err(dev, "cali PHY power on failed\n"); > > - goto err_cali_phy0_exit; > > - } > > - ret = phy_init(imxpriv->cali_phy1); > > - if (ret) { > > - dev_err(dev, "cali PHY1 init failed\n"); > > - goto err_cali_phy0_off; > > - } > > - ret = phy_power_on(imxpriv->cali_phy1); > > - if (ret) { > > - dev_err(dev, "cali PHY1 power on failed\n"); > > - goto err_cali_phy1_exit; > > + goto err_cali_phy_exit; > > This changes the order the calibration PHYs are brought up in. > > The commit message describes the new order: > > "Initialize both calibration PHYs before powering them on in lane > order" > > but doesn't say that it differs from the current sequence. Could the > commit message mention the change, and why it is safe for the shared > calibration? > According to the document, there is no initialization order requirement mentioned, so I thought it will be safe to change that since the document shows that the calibration is independent in section 19.3.3.5. > The cover letter mentions that the PHY timing requirements were checked > against the documentation. Has the new sequence also been tested on > i.MX8QM hardware? > I does not check it on real hardware, the only thing I find is the document. > > > } > > ret = phy_init(imxpriv->sata_phy); > > if (ret) { > > dev_err(dev, "sata PHY init failed\n"); > > - goto err_cali_phy1_off; > > + goto err_cali_phy_off; > > } > > ret = phy_set_mode(imxpriv->sata_phy, PHY_MODE_SATA); > > if (ret) { > > @@ -465,10 +456,8 @@ static int imx8_sata_enable(struct ahci_host_priv *hpriv) > > } > > > > /* The cali_phy# can be turned off after SATA PHY is initialized. */ > > - phy_power_off(imxpriv->cali_phy1); > > - phy_exit(imxpriv->cali_phy1); > > - phy_power_off(imxpriv->cali_phy0); > > - phy_exit(imxpriv->cali_phy0); > > + phy_bulk_power_off(NUM_CALIPHY, imxpriv->cali_phys); > > + phy_bulk_exit(NUM_CALIPHY, imxpriv->cali_phys); > > > > /* RxWaterMark setting */ > > val = readl(hpriv->mmio + IMX8QM_SATA_AHCI_PTC); > > @@ -480,14 +469,10 @@ static int imx8_sata_enable(struct ahci_host_priv *hpriv) > > > > err_sata_phy_exit: > > phy_exit(imxpriv->sata_phy); > > -err_cali_phy1_off: > > - phy_power_off(imxpriv->cali_phy1); > > -err_cali_phy1_exit: > > - phy_exit(imxpriv->cali_phy1); > > -err_cali_phy0_off: > > - phy_power_off(imxpriv->cali_phy0); > > -err_cali_phy0_exit: > > - phy_exit(imxpriv->cali_phy0); > > +err_cali_phy_off: > > + phy_bulk_power_off(NUM_CALIPHY, imxpriv->cali_phys); > > +err_cali_phy_exit: > > + phy_bulk_exit(NUM_CALIPHY, imxpriv->cali_phys); > > > > return ret; > > } > > @@ -839,19 +824,19 @@ static const struct scsi_host_template ahci_platform_sht = { > > > > static int imx8_sata_probe(struct device *dev, struct imx_ahci_priv *imxpriv) > > { > > + int ret; > > + > > imxpriv->sata_phy = devm_phy_get(dev, "sata-phy"); > > if (IS_ERR(imxpriv->sata_phy)) > > return dev_err_probe(dev, PTR_ERR(imxpriv->sata_phy), > > "Failed to get sata_phy\n"); > > > > - imxpriv->cali_phy0 = devm_phy_get(dev, "cali-phy0"); > > - if (IS_ERR(imxpriv->cali_phy0)) > > - return dev_err_probe(dev, PTR_ERR(imxpriv->cali_phy0), > > - "Failed to get cali_phy0\n"); > > - imxpriv->cali_phy1 = devm_phy_get(dev, "cali-phy1"); > > - if (IS_ERR(imxpriv->cali_phy1)) > > - return dev_err_probe(dev, PTR_ERR(imxpriv->cali_phy1), > > - "Failed to get cali_phy1\n"); > > + imxpriv->cali_phys[0].id = "cali-phy0"; > > + imxpriv->cali_phys[1].id = "cali-phy1"; > > + > > + ret = devm_phy_bulk_get(dev, NUM_CALIPHY, imxpriv->cali_phys); > > + if (ret) > > + return dev_err_probe(dev, ret, "Failed to get cali_phy\n"); > > phy_bulk_get() already reports which PHY failed: > > drivers/phy/phy-core.c:phy_bulk_get() { > ... > for (i = 0; i < num_phys; i++) { > phys[i].phy = phy_get(dev, phys[i].id); > > ret = PTR_ERR_OR_ZERO(phys[i].phy); > if (ret) { > phys[i].phy = NULL; > > dev_err_probe(dev, ret, "Failed to get phy: (%s)\n", > phys[i].id); > goto err; > } > } > ... > } > > so a missing cali-phy1 entry in phy-names now prints two errors, and the > second one doesn't name the PHY. > > A plain "return ret;" should be enough here. > > Thanks, I will fix it. Regards, Inochi -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy