From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.178 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796024590; b=wSksoRDKE6ReL7KiCMQn9OAmXvK3X/Xpy3TLwttQSSJEyUgE7p0jAiC0vg1UL6vsOU35 eFMvfK7Sq1GKXaW55jWW8mB/HTjQGKVZQckY5NmEdzq5wJNg3faw1veLeNfl9qRntXviO siIbfj4S9laptJB5586fX6zgE6Xj7ugTJonnFXl3dmRq+p9JVcW5NB+4yU61ZfGhCs8vu 7mlusz4yD58FhHEmJJofmWrkRHJ78kOtT386rpShcdDhRg7psCgbPdwbzH3x5UXV3gzmo lrM7GdVOTeF10oSJDf82RS4X7HTtJusxaIMS2QS2eRb5hwuJsZOhusbjGK4Acxr42jw== 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-Forwarded-Encrypted: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=25v4/Q8lC+fq02UCWte0fNQqw10Ik7a42+uL2aDbYVHdtTX7EdjS6ks0O0SQO9xON3uc gSWG67uGZeCS3VhR8ObI2DuY9pHlp45ADBtQ6+cnMIRjjXwwr5RvqyzATiGzPN9ocVXWS wiT98coUpspyDrd60xy6FksUOzUQeK9SXldpw6kUQgIXACdN2LsHXVXLTy8a9vJPaqXwq xyzW1C+fe7z9wokgpj+vYfLK65YXzD886Tq/inaFuHxTVioYEH5pS6S/rGLhhzButDNcu ts5PCt/3c6Jlt2DBvhU0zNMgSYVB0zNlm2/94JdYePiYBZDBfXpfe9QsUW3svhG8Sxg== 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.178 Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) (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 4102B606A325 for ; Mon, 30 Nov 2026 07:43:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4102B606A325 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-f178.google.com with SMTP id d2e1a72fcca58-8b3577deeb0so4485909b3a.3 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=EBg3gPXfdXXoYG5yoUiHazX6MR983beAw9hxjIJt7jVGXn84xv4K+46JRnUwDjIMUV aOhY4g0g+52bqvfMGUscLN6vqJd4cXMDb2cdMJOBQQz0FtFUsJE6YPtDKJcOarpYyyax raxU16z4LImUD6cUAcwDbnuSxvNGFUPhLyRDmZn0zQQLsRh3CcVStw3hjpRUjUpLUrww epQ2bjB7uiv1/c9Cp0VmHlT0nc2d4+xUxA+FASzp0LnnybS3dYjSzLtCvkSTlZF+W7Gd 0uOJ94gbO4S6pcigMJRUTFd7u8k0EA/9FcnTGhkWvrcLbk1jc4XSI08OmHgvG95xNPlV F4Ag== X-Forwarded-Encrypted: i=1; AL+hErFCtuL5FESISDbHCtfcF274noo3OS9ufmkWUieedQYY2XwFuTgEbg7RWL/2uM5BvrcsZgiN4Gbovww=@vger.kernel.org X-Gm-Message-State: APuU4Z9C7vE8Na5Lph0sv32Fo5ub8QNeiSZTfIOv9aL9EKHvfeif/aCD smmHNJt8Sr0s3DdIJgPdq5MeKLAeKg43Q6FjqERMGaC1VvU4o3wPJL+F X-Gm-Gg: AZFdTZerC7gFM+bLCBTNIlfOjER/tJVeLBUinC1NemUKgE4V4PcmKuIq8p43r7L2ECP gu0W/r66PkWER/OJPqKUE8glY+7DUKw5/4ywSzVcl3RakkDC/q+fhMt/Sh343kEn78pGHfQH1r2 znoXAqh9JRFrOWHqNq5HPNZ0L6K/6PURK/oUMgHiRTsm34AdcXnyorBbbo+BRPgFNaVL2te937A fe80Pf/kHuGLlpvUDRS+GYikwc8jnzQv/hlhGNKmILLyhPCE586A83n+Zlp7YCB1W2RbF+VFSnU SMe0l3x8JdA4Lxen+7jO8AGgn+6QDWjfY79/xj8FLdaGFUskDLjG89VxTUTkokBWpDVYORTNFaV mt+CcF/MZ4TCWoX3zIkgV2j1+R1P/FCmrN8q8hUo0jsjp6JpUBpRGyxo3aNDhQVo1fD5/HAdD2S hVh25I4jeaB49082OladrdX9flycMvhRmANL0van3a8iFiITi0W1OtV4RKsTYF7C606e96dM5Hd g9Tpp/VjqTu+DFZvN6QHrt8lfJuZa4cs50HxKDL7OJxFsV/zjq/mpJzpcMuY8bXSZNDJ0LyFgG4 sjT6JBO2HgtpSrWeaItGEx7MBEU= 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-ide@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