From: Damien Le Moal <dlemoal@kernel.org>
To: "Inochi Amaoto" <inochiama@gmail.com>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Jonathan Corbet" <corbet@lwn.net>,
"Shuah Khan" <skhan@linuxfoundation.org>,
"Randy Dunlap" <rdunlap@infradead.org>,
"Niklas Cassel" <cassel@kernel.org>,
"Frank Li" <Frank.Li@nxp.com>,
"Sascha Hauer" <s.hauer@pengutronix.de>,
"Pengutronix Kernel Team" <kernel@pengutronix.de>,
"Fabio Estevam" <festevam@gmail.com>,
"Aksh Garg" <a-garg7@ti.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Vinod Koul" <vkoul@kernel.org>,
"Neil Armstrong" <neil.armstrong@linaro.org>,
"Vladimir Oltean" <olteanv@gmail.com>,
"Rhys Tumelty" <rhys@tumelty.co.uk>,
"Qiang Yu" <qiang.yu@oss.qualcomm.com>,
"Manikandan K Pillai" <mpillai@cadence.com>,
"vladimir.oltean@nxp.com" <vladimir.oltean@nxp.com>,
"Hans Zhang" <18255117159@163.com>, "Yao Zi" <me@ziyao.cc>
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 <dlan@gentoo.org>,
Longbin Li <looong.bin@gmail.com>
Subject: Re: [PATCH v6 8/8] ata: ahci_imx: Use bulk PHY APIs for calibration PHYs
Date: Mon, 30 Nov 2026 16:14:10 +0900 [thread overview]
Message-ID: <173fe224-6ec9-4f40-b63c-b2d88887901f@kernel.org> (raw)
In-Reply-To: <20261130063607.294823-9-inochiama@gmail.com>
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 <inochiama@gmail.com>
> Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
> ---
> 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
next prev parent reply other threads:[~2026-11-30 7:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 6:35 [PATCH v6 0/8] phy: core: Add phy bulk helpers support Inochi Amaoto
2026-11-30 6:36 ` [PATCH v6 1/8] phy: core: Add common helper to add phy phandle device link Inochi Amaoto
2026-11-30 6:36 ` [PATCH v6 2/8] phy: core: Add common helper for get phy phandle by index Inochi Amaoto
2026-11-30 6:36 ` [PATCH v6 3/8] phy: core: Make phy_put() ignore NULL and error pointers Inochi Amaoto
2026-11-30 6:36 ` [PATCH v6 4/8] phy: core: Add phy bulk data helper functions Inochi Amaoto
2026-11-30 6:36 ` [PATCH v6 5/8] phy: core: Add managed " Inochi Amaoto
2026-11-30 6:36 ` [PATCH v6 6/8] doc: phy: Document some bulk " Inochi Amaoto
2026-11-30 6:36 ` [PATCH v6 7/8] PCI: cadence: Use phy bulk data api to simplify the logic Inochi Amaoto
2026-11-30 6:36 ` [PATCH v6 8/8] ata: ahci_imx: Use bulk PHY APIs for calibration PHYs Inochi Amaoto
2026-11-30 7:14 ` Damien Le Moal [this message]
2026-11-30 7:42 ` Inochi Amaoto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=173fe224-6ec9-4f40-b63c-b2d88887901f@kernel.org \
--to=dlemoal@kernel.org \
--cc=18255117159@163.com \
--cc=Frank.Li@nxp.com \
--cc=a-garg7@ti.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=cassel@kernel.org \
--cc=corbet@lwn.net \
--cc=dlan@gentoo.org \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=inochiama@gmail.com \
--cc=kernel@pengutronix.de \
--cc=kwilczynski@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=looong.bin@gmail.com \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=me@ziyao.cc \
--cc=mpillai@cadence.com \
--cc=neil.armstrong@linaro.org \
--cc=olteanv@gmail.com \
--cc=qiang.yu@oss.qualcomm.com \
--cc=rdunlap@infradead.org \
--cc=rhys@tumelty.co.uk \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=skhan@linuxfoundation.org \
--cc=vkoul@kernel.org \
--cc=vladimir.oltean@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox