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 252A6606A31C for ; Mon, 30 Nov 2026 07:43:28 +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=nJa9bzMH; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=hOoYcN4K DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=5KPcu4SgoPstkbY789IZ9O4SzG4NkOFlubHWP20egoI=; b=nJa9bzMHEfYaldcIjdC2l61f1k 2ToxC5cTGTnAUGAoN+822se5jfU5kRT8qdigXwIa+eyNRoUaqFr6T0byggdPjaZSKUb4m197s4m+0 0QsAGHxpUOZT4HDJ74s4CTfPF7P8Di7SeBaCIqWghK+8a5AYpXKF7+Zwfhml00FUbpUhnd7YX0N/2 CHh7UQHYMak2VpNlY/7D1EMJVit+yUbsJzDug3tm7zqjElUqhXdeW62C1hraw/JS+umtfihb5MRq2 kmPtkI+njr1KrIHFSv61W5RfuXBAE+EdmvZEdEeMDIiwUnM4bR6uJjZvXRGoGDGmY8FLHLjlfSzHL r0b55+tA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXw2e-00000003cq2-33Gc; Mon, 30 Nov 2026 07:43:16 +0000 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXw2Y-00000003cnd-25wx for linux-arm-kernel@lists.infradead.org; Mon, 30 Nov 2026 07:43:14 +0000 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-8b29b83fdf1so5188067b3a.2 for ; Sun, 29 Nov 2026 23:43:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796024588; x=1796629388; 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=5KPcu4SgoPstkbY789IZ9O4SzG4NkOFlubHWP20egoI=; b=hOoYcN4Kq4w1xUPapugcaBPIzQWRTbwpXYsazukhe+gcArpPTxNfz1jjf/mwr8UoGM JUTJKNTmrR4jOvoc0BzGaui6XlDkFuEuMC+0M1jk/HxdXTzD3NJxWal8pyk26E78e2KP nlq6nmLti46PJyJ8QplBqToi1jJPla963pHdU8Oc35TQzNalfMldqGnl/Z8EfUnAkkOM owEtsLT9NpXjzVzG7dlCD4OsvgNG6FKId/5wvZc5chSTNx0jGu27jV8NhRUgSw5UAkuB fUx8tnRCq2YZbAB1EauvskBdcvEx1KGsiiF8TGE7ka55vxfxlXNRS4BvSeadnIfZ7ONE fXmg== 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=GxGD+Bs5YWz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PDXjq1RsCFgYhPntshWLwKn lw0pfjLTS/W8w1YFrFjwbL7n4MBrFkD4kSgZyD+Hj81+fTUukbB9uXdPffcmAN1g5szQQsedhrl gegtzCyuxD3IM/MWtPg/3UNJvuA= 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-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <173fe224-6ec9-4f40-b63c-b2d88887901f@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261129_234311_011530_E007DA8E X-CRM114-Status: GOOD ( 34.42 ) X-Spam-Score: -2.1 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 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