From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.177 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796024590; b=ykxvEm3WvBcf8Z7Mwma9HuEuCR0vUizfpcVMm98DF5SdbvoSw7jdpn8bcCp4BZyAZN4d GdF5UcoaGNNU+sy+vIjdJ7xj4FmNw6d+vqJEILSRzB8e0qfpNfWwQE5u/mMlgVwocOPyH ZcAHoJ3Cap007u9wLVdKGQ2gz/r4VBEiZwrzxrrDaAkt/D+ifoN1bIXZt+fPB6x9DgrK6 hz/wjYY40OWWKmFRorb/h2uhgXowIJDJUpKSpjB6bvrYm2UWfJ/zGC8u35s5Q8G/OJAGN QE9ieDnsbY+EH42uGQrzJCRyTY94wdcljMy/EPGQmd+HolKkIwvu5LCqMicygW9nd2w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796024590; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Date:From:To:Cc: Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; bh=5KPcu4SgoPstkbY789IZ9O4SzG4NkOFlubHWP20egoI=; b=wr7JX5rMWf60L5bNwVpPt3dy64cm8tj8ED+mmCEADI8CsJFKWCXlBR44xsTF+aaWgaCy Vo+a66WXCudvjyRSBoCCwD2rPqiTw1F340oSKXCBvhiWYr7T9BrJn9HgGde2FHwFC/qiT Fu8hFGnbhQaniIRfOgFQQZNSPiVjIFVGMMOYbUhlX6mDHM/ghMPV75+tq7J/WiayIabdw RRndiZsun00JgbQbicqCL1+/CGJHe8eAc1RWLrpr6q5mYZR+gyaACL3FfL3NH7j5gjnMY HiLrUlpwefilTp3dKRfzpVfh/7+d3gY4uWp7AnjGT5dzS2H9RDl0WGXo8ibM5hFzjzg== 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=nm2w9swG; arc=none smtp.remote-ip=209.85.210.177 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (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 3BE51606A320 for ; Mon, 30 Nov 2026 07:43:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3BE51606A320 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 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=nm2w9swG Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-8ca6a12efd9so3730366b3a.1 for ; Sun, 29 Nov 2026 23:43:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796024588; x=1796629388; darn=vger.kernel.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=5KPcu4SgoPstkbY789IZ9O4SzG4NkOFlubHWP20egoI=; b=nm2w9swGsBFBZOHfgy0uBYq6VOajI8Z7cX8qa5LbsPoQNVRHCUAOrKcvZ3+q8vOTy1 iRv4CQysxq9JU/wxMMZg18ZxFK6zAA15NCZPEqp/JSdHe2CZ5+fvyUKQw4LUceNWgnXL 3vVVhpkMK3xCIxS00DY6qoI/6Kwy26RPWQ6JDYFydEk0widKCrHg5+xkxbXMNJbvmDrP 52WpXu8GcFYisGOwwg/s86scCNiqfYuYGh7yDAPKFqUF2VYpC7gvssLeQvxGApGOuHK5 SOsE1LKzaWGHcrIaUbG9lYdSyATEwRceW7xU+Yhh4fcwte3X6v5MWcAJlRlMZ/g3eviB 6fzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796024588; x=1796629388; 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=5KPcu4SgoPstkbY789IZ9O4SzG4NkOFlubHWP20egoI=; b=KXhN+iqgabdHlyaINKN+RArUh6LMgptCvcDhNWcEyrTvbL3dV40hefIAqaDRqZjq0I n0I2cOCP89V0j5bHmLVF135AWtjuiK2mDflF/ILhCdrL0jg1JQvYuSnpmR/2zCdUyi6O Jb4QUsmARZs/cJ49evM0YEgljMCcQspSMV4J+GAyFYbt2jheh61KMw8C57YjXxJ3qKdl M01nnzDW1mtqcT6NQdbJA068B9C9n+hrvtc/+o6VnRLXqsuA0cdAZaaTcyqyAmrho7B1 ySWtCAt42Igpry6XzGIoG2P2GQMk9J1zYicuXi+vK+R8jezS9ULICvvZg8PEfcmmsOoU Cyog== X-Gm-Message-State: APuU4Z8TvcousstM8b0juuQtupgMYDasRrD1QKk4DaHabkiHCHWMdE9a +5s/ygAlHnRDla8DKFCNgfRNgOazVqsM3uD+X3Fo0Ei83hDsxZc/Zc2P X-Gm-Gg: AZFdTZdcVTxlDjwekXCsnv+95bV8kg/OA0hnjjNF4L7OU0Ej8nkfDalEXGGEbnINnYp vu3TPdK+u0Mmx7ugHqDWCCksM6BgV5pCD1f+ngt4yBySHmEs9+nCHiS+B3kn809JnLXT2AnHto3 z3leh7bCaNMv5qcKXm4i4X6hecn/0VOaQ4HO6MbbJAcv4YFx+BS/sNrTxIj+8Nm7rqifclKGEY1 VFmJ/as3dDKjwSRuJcdXDhPPxZeXdtxQx56BhrN2Jm9s5Hd0NvkRXUEhZmHFkYsCIlFMiTxuQAa T9/A6E5FZVJeoH16oCLR3WenPhB3M4pj8YjVBCUnQiA21F2+bY+hD5KkPhGLi3qhstc0xIryC/3 rTif+wSH5wtUKkEfRudZED11M7wPf2Vz/X3Kkoq6Y4EdUnNiJjb+Va1SRSOSpVccv7B+gvA2nuT z97ReU0YL0feyGHVMQHzzO21bR3KDC1xHCjysiyA4G4HHobUUh94FcOMogbd5qTHaD+X3MYuDIj SFKEAIyiVljzwo1bzQ37ZVVWECW424Een38bvjr6sv7b2D6XAIgDwFeSRsuulxd2C7qHIQd69we acKBI6Bw6pJmfsvxru139WhORss= X-Received: by 2002:a05:6a00:80c:b0:8c2:5120:4218 with SMTP id d2e1a72fcca58-8c8792b5de6mr30090106b3a.7.1796024588508; Sun, 29 Nov 2026 23:43:08 -0800 (PST) Received: from localhost ([2001:19f0:8000:4ce8:5400:7ff:fe0e:e6b2]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8c87285c14fsm17135473b3a.15.2026.11.29.23.43.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2026 23:43:08 -0800 (PST) Date: Mon, 30 Nov 2026 15:42:54 +0800 From: Inochi Amaoto To: Damien Le Moal , 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 , Krzysztof =?utf-8?Q?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 Subject: Re: [PATCH v6 8/8] ata: ahci_imx: Use bulk PHY APIs for calibration PHYs Message-ID: References: <20261130063607.294823-1-inochiama@gmail.com> <20261130063607.294823-9-inochiama@gmail.com> <173fe224-6ec9-4f40-b63c-b2d88887901f@kernel.org> X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <173fe224-6ec9-4f40-b63c-b2d88887901f@kernel.org> On Mon, Nov 30, 2026 at 04:14:10PM +0900, Damien Le Moal wrote: > 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? > I checked the document and assumed it is OK as the document has no words on the requirement that the calibration PHYs should be init fully one by one. In fact, I already said it is untested as I do not have a borad in the cover letter. Regards, Inochi > 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