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 66541606A320 for ; Mon, 30 Nov 2026 06:37:48 +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=TpJahN1E; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=GGliyvz9 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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From: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=cDdzq1dNgzXcrzyqsDLCIFvNh7o/NUj0LiF3TDbKfP0=; b=TpJahN1Eq10Q3CR9EPyTUX5cTK Mg5uvFTiMBFcSzX5SrVRcewTrK1RlkTlfE3tFYfwnzoJHCmD4xe9EyaCoG172MNuQH5ZvuRlNuZNa fZ3yRNezut6uemB5FjUGq9JJVc1xsXbmqXl7TTZ1DALHT8O1/ezCFf0qWOQ4B5MtkoE2m+8noPOhb IJwu9rBuXzuX2C1XRr53ooIXN2d1zAcwFwpiZ7UmZbmjsL1t5qofHLE954NtVIFDEUEy7ZGor2vQD nBSCcW1g64+Kk9/Vxr91jPjNslRSDGVx1Zs0YWKQipbtHLRhaRNzGo6X29ry66GpfoFZb9gGB0LZe xa7SnWxg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXv1H-00000003S3L-4AzR; Mon, 30 Nov 2026 06:37:48 +0000 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xXv0V-00000003Rf5-0EhM for linux-phy@lists.infradead.org; Mon, 30 Nov 2026 06:37:00 +0000 Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-3b405d8f1cfso4837900a91.3 for ; Sun, 29 Nov 2026 22:36:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796020618; x=1796625418; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=hTiPLnuhm9c+sQTiXQOQx7ZKb4J6MdJg30zjhBmPJWM=; b=GGliyvz9u4rzU4AQGK96tmD8zVm8UVLaxB6r7Izn2SveZ7qTH2OVUjX/su5H5xnSbg mZuu/qZbxJ+4eO0jc/GrEa60nwGlQ0BinqT4/izzp+zWeThpB+d++gcYJ9ZKbsa1/aob M4ZMZETu1JJbL3W7SkTXC61M4AVOWVnnJ1vpj3dGHFULWEpfvG214GBeuNQ8b5w9qdUC sT0zhD+zrLPhX2upmO+tM0yxmrF3pR7VR6jgwoM4rVg9KWTJyba9cSemiA6GzgXLu4y8 E7XpSrZaCoXC93Y4XEYl+oKye+MFLvGQJk1bIDZzJuT7rCQ++yzxLphmAzEXIsYauH4A jbkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796020618; x=1796625418; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=hTiPLnuhm9c+sQTiXQOQx7ZKb4J6MdJg30zjhBmPJWM=; b=o1znuZVv0WFdDQobV8T6k/FUddGrv4JmKeaI5mF0iKxzMYC13F7yEgjmkzKtxnIOjn QEjQfahtdRfyNX584wYUrn+eR6EiUe/u5DLt83Z1+ndGJtQj4FdDLqHgXIrH4azQWD3h LS9Qactl68dY1uwWm9pK9MZzhgkAVdNUXW2oUVC4/sRei7y9UCKrbSEqy2TU+u83LAgs Zu7JIIlgv4V7YEU38a/q9NqZO6LAmsJxDksL+tAlAkVCs4bW2JtKID5HOB01tqMpiN64 eNEZp76gpV0x5it9TV5CVkaA7v546H0OMW1lypZ43qGqic3qb+IPH5WAtlFJ8ZK6IWzc vHbQ== X-Forwarded-Encrypted: i=1; AL+hErH0Ma8MFF0pXQhevt5zXRE/rXqtVp3+BYMLKncg/VfUf46CbbYr2+AabAjKkTUuo2uoUa7ZF+qqzfg=@lists.infradead.org X-Gm-Message-State: APuU4Z8+F0tAcEA8ymVHbPpELXHqzaRj7w/4U75LBlKV3oz5fiYIl22p 5FBEWH4Yn96T0PGvsxivig5YMfqPxK65Cw0SMnqQoJTRvDs6Egm/Z/3f X-Gm-Gg: AZFdTZeiJ8PExG7VacMmm7dxS2jQJeoTf6Yf5rkeZT9IYYHX1Yb9pioCsFf5z1oFVow M0Vxhg4qd2M2A+IXTuo971jpzbfYnhAfPOVRnmknx2yvFuqRy8sBd7ZjRrXfF67vVBh0Y751z4c wx5nROtToAVbwIORDCx5j7hQVDuI84SxVdF6tWxEU9gys+5IS43CKry9xsyU4hU47BUIHY7SkoN pnOpfLY5/ts/i1w24/ZCB+skCXSwptAdH0YANumvJDCD70ei+bhkN96bd5Chh4M2PF6Lv+9UlNV UupYo2zYEYUoH9ct1wffHW2LsyovccohvIrrz0mieUpPooH05sgObzKLrixqV4Jxw6RKN0SyWFL lP09totYipn4N446TBF4sabcpFIT2Z17fhomySlz8m5uaXGuNLBj+ya3yPvFYvuPBYdpnWqVz6J YP3Ft3Y/oOg52ZBVsM7hivmJMpkpjSrqUFz8yuwhE6BNjM4v8tuDBbr0hiS+tlERap0NOFq/juE Qr1881IT8yrR0G8vBCDmrGZWExZgFbAUFLOg3M36iZJgDUK0CFGa8YiuZFB2MeZcye+DTAQ9W/X iB35FJrmfHxHyORDkZSGyQhs6dw= X-Received: by 2002:a17:90b:5109:b0:39e:6a7e:ee18 with SMTP id 98e67ed59e1d1-3b41c9157acmr31814233a91.36.1796020618200; Sun, 29 Nov 2026 22:36:58 -0800 (PST) Received: from localhost ([2001:19f0:8000:4ce8:5400:7ff:fe0e:e6b2]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b41ad48786sm50581729a91.9.2026.11.29.22.36.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2026 22:36:57 -0800 (PST) From: Inochi Amaoto To: Andy Shevchenko , Jonathan Corbet , Shuah Khan , Randy Dunlap , Damien Le Moal , Niklas Cassel , Frank Li , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Aksh Garg , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Bjorn Helgaas , Vinod Koul , Neil Armstrong , Vladimir Oltean , Rhys Tumelty , Inochi Amaoto , 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: [PATCH v6 8/8] ata: ahci_imx: Use bulk PHY APIs for calibration PHYs Date: Mon, 30 Nov 2026 14:36:07 +0800 Message-ID: <20261130063607.294823-9-inochiama@gmail.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261130063607.294823-1-inochiama@gmail.com> References: <20261130063607.294823-1-inochiama@gmail.com> X-Archived-By: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261129_223659_137400_06857AC6 X-CRM114-Status: GOOD ( 16.48 ) X-Spam-Score: -2.1 (--) 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=-13.8 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,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,USER_AGENT_GIT 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 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 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) -- 2.56.1 -- linux-phy mailing list linux-phy@lists.infradead.org https://lists.infradead.org/mailman/listinfo/linux-phy