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 3E910606A32A for ; Mon, 30 Nov 2026 07:14:40 +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=2gIxz0Sf; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=K9ltaCPH 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:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID: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=gC8kcvs3GGcOGXJ2M/xyUcfiw47xQFm4yFgXkEMbw0s=; b=2gIxz0SfayDC/uQaO85VegNule +V70LncWCGebRt2x0oyT/QlFPnZUNwN5RR35A1oPxAyk8AtR4M1D1mNrPgr8V8oVhF7OliTsyu9wV xuC1kVLXttf2qCVMnH3vWP1SERkkb0GJx0Rk706ZdTuA9ubNkQkAhPPG4ecuxu44avLdRiMckIL1T c3J4l5Eq/McibqY6tjr55/tdEbbIdG8moUOhOWee7ymssSrY9P4fDuaEgX2ei3MDnCB93oJpzvzMN J8q0s9/sHPzFoYM9qZQTaHScfhbzllNKVjVZZggoMUg0JZ8oOeTzJCpZ3N6kADu7TKPP/6biSIhdf 2nZ/uX9A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXvax-00000003Xg4-3yU4; Mon, 30 Nov 2026 07:14:39 +0000 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXvac-00000003XY8-0X9P; Mon, 30 Nov 2026 07:14:19 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 5E9F961D19; Mon, 30 Nov 2026 07:14:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A42451F0089A; Mon, 30 Nov 2026 07:14:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796022856; bh=mGKB+yTX4WvvPg6uHwtEEje3ZgmebIAD34nfymmFhc0=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=K9ltaCPHcBMQ3Vy1rZQ6U5ie/cq2toidBr0b7SZWYsHRuR3Igo3pKJJgUmGWBlM8e aAq71PENhlru3jxOqg0/FjNOcUEgbXTwfBjg2szp/FVY7RJiECtIXVE/iTWpl6GZB+ 8OGdZlKd3oBbZsT9Z0ito99c1Q6V7aKjFsbn2uHHLVBfcfNY8V1rX2NS+JspnpLv5k ClyDP9Gm3wKIwGAg0qJQxgGy+Y7DPUiZUW+eotvDsMi9RIpeGxRNtFD44+HygRvL6H D7fNME85J1Y4zUHtJuu8AdL/4+qZ3wSi0+Wai39kA11b+J/jShnFn9Kki3IB63CcYT Ba2oIxMD3sRFA== Message-ID: <173fe224-6ec9-4f40-b63c-b2d88887901f@kernel.org> Date: Mon, 30 Nov 2026 16:14:10 +0900 X-Archived-By: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 8/8] ata: ahci_imx: Use bulk PHY APIs for calibration PHYs To: Inochi Amaoto , Andy Shevchenko , Jonathan Corbet , Shuah Khan , Randy Dunlap , Niklas Cassel , Frank Li , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Aksh Garg , Lorenzo Pieralisi , =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Bjorn Helgaas , Vinod Koul , Neil Armstrong , Vladimir Oltean , Rhys Tumelty , Qiang Yu , Manikandan K Pillai , "vladimir.oltean@nxp.com" , Hans Zhang <18255117159@163.com>, Yao Zi Cc: 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 References: <20261130063607.294823-1-inochiama@gmail.com> <20261130063607.294823-9-inochiama@gmail.com> From: Damien Le Moal Content-Language: en-US Organization: Western Digital Research In-Reply-To: <20261130063607.294823-9-inochiama@gmail.com> 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=-15.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 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 11/30/26 15:36, Inochi Amaoto wrote: > Currently 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(). > Then process it in the lane id order in the imx8_sata_enable(). > > The document of this controller shows that the PHY will enter > calibration mode only after it is deasserted. And this deassert > is performed in the PHYs' power_on() callback. As the init() > callback only enabled the clocks of the calibration PHY. It > should be safe to use bulk api to init all the calibration PHYs "should be safe" ? Did you actually test this or are you assuming it is ok and works? If you actually tested this, then please reword. Other that this, this looks good to me. > before powering on them, as the bulk api can preserve the power > on order. > > Signed-off-by: Inochi Amaoto > Reviewed-by: Vladimir Oltean > --- > drivers/ata/ahci_imx.c | 54 +++++++++++++----------------------------- > 1 file changed, 17 insertions(+), 37 deletions(-) > > diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c > index 6aaa18e29abc..3f7856eb4f08 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; > } > 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; > } > @@ -844,15 +829,10 @@ static int imx8_sata_probe(struct device *dev, struct imx_ahci_priv *imxpriv) > 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"); > - return 0; > + imxpriv->cali_phys[0].id = "cali-phy0"; > + imxpriv->cali_phys[1].id = "cali-phy1"; > + > + return devm_phy_bulk_get(dev, NUM_CALIPHY, imxpriv->cali_phys); > } > > static int imx_ahci_probe(struct platform_device *pdev) -- Damien Le Moal Western Digital Research -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy