From: Xu Yang <xu.yang_2@nxp.com>
To: vkoul@kernel.org, kishon@kernel.org, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org, shawnguo@kernel.org,
s.hauer@pengutronix.de, kernel@pengutronix.de,
festevam@gmail.com
Cc: jun.li@nxp.com, alexander.stein@ew.tq-group.com,
linux-phy@lists.infradead.org, devicetree@vger.kernel.org,
imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 3/3] phy: fsl-imx8mq-usb: add i.MX95 tuning support
Date: Tue, 29 Apr 2025 11:30:09 +0800 [thread overview]
Message-ID: <20250429033009.2388291-3-xu.yang_2@nxp.com> (raw)
In-Reply-To: <20250429033009.2388291-1-xu.yang_2@nxp.com>
The i.MX8MP and i.MX95 USB3 PHY have different tuning parameter for same
tuning field, this will add i.MX95 tuning support.
Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
---
Changes in v2:
- new patch
---
drivers/phy/freescale/phy-fsl-imx8mq-usb.c | 41 ++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c
index 6c564b608539..59b9b4704b03 100644
--- a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c
+++ b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c
@@ -293,6 +293,13 @@ static u32 phy_tx_vref_tune_from_property(s32 percent)
return DIV_ROUND_CLOSEST(percent + 6, 2);
}
+static u32 imx95_phy_tx_vref_tune_from_property(s32 percent)
+{
+ percent = clamp(percent, -1000, 875);
+
+ return DIV_ROUND_CLOSEST(percent + 1000, 125);
+}
+
static u32 phy_tx_rise_tune_from_property(s32 percent)
{
switch (percent) {
@@ -307,6 +314,20 @@ static u32 phy_tx_rise_tune_from_property(s32 percent)
}
}
+static u32 imx95_phy_tx_rise_tune_from_property(s32 percent)
+{
+ switch (percent) {
+ case -10:
+ return 3;
+ case 15:
+ return 1;
+ case 20:
+ return 0;
+ default:
+ return 2;
+ }
+}
+
static u32 phy_tx_preemp_amp_tune_from_property(u32 microamp)
{
microamp = min(microamp, 1800U);
@@ -353,6 +374,13 @@ static u32 phy_comp_dis_tune_from_property(s32 percent)
}
}
+static u32 imx95_phy_comp_dis_tune_from_property(s32 percent)
+{
+ percent = clamp(percent, -60, 45);
+
+ return DIV_ROUND_CLOSEST(percent + 60, 15);
+}
+
static u32 phy_pcs_tx_swing_full_from_property(u32 percent)
{
percent = min(percent, 100U);
@@ -363,10 +391,17 @@ static u32 phy_pcs_tx_swing_full_from_property(u32 percent)
static void imx8m_get_phy_tuning_data(struct imx8mq_usb_phy *imx_phy)
{
struct device *dev = imx_phy->phy->dev.parent;
+ bool is_imx95 = false;
+
+ if (device_is_compatible(dev, "fsl,imx95-usb-phy"))
+ is_imx95 = true;
if (device_property_read_u32(dev, "fsl,phy-tx-vref-tune-percent",
&imx_phy->tx_vref_tune))
imx_phy->tx_vref_tune = PHY_TUNE_DEFAULT;
+ else if (is_imx95)
+ imx_phy->tx_vref_tune =
+ imx95_phy_tx_vref_tune_from_property(imx_phy->tx_vref_tune);
else
imx_phy->tx_vref_tune =
phy_tx_vref_tune_from_property(imx_phy->tx_vref_tune);
@@ -374,6 +409,9 @@ static void imx8m_get_phy_tuning_data(struct imx8mq_usb_phy *imx_phy)
if (device_property_read_u32(dev, "fsl,phy-tx-rise-tune-percent",
&imx_phy->tx_rise_tune))
imx_phy->tx_rise_tune = PHY_TUNE_DEFAULT;
+ else if (is_imx95)
+ imx_phy->tx_rise_tune =
+ imx95_phy_tx_rise_tune_from_property(imx_phy->tx_rise_tune);
else
imx_phy->tx_rise_tune =
phy_tx_rise_tune_from_property(imx_phy->tx_rise_tune);
@@ -395,6 +433,9 @@ static void imx8m_get_phy_tuning_data(struct imx8mq_usb_phy *imx_phy)
if (device_property_read_u32(dev, "fsl,phy-comp-dis-tune-percent",
&imx_phy->comp_dis_tune))
imx_phy->comp_dis_tune = PHY_TUNE_DEFAULT;
+ else if (is_imx95)
+ imx_phy->comp_dis_tune =
+ imx95_phy_comp_dis_tune_from_property(imx_phy->comp_dis_tune);
else
imx_phy->comp_dis_tune =
phy_comp_dis_tune_from_property(imx_phy->comp_dis_tune);
--
2.34.1
next prev parent reply other threads:[~2025-04-29 3:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-29 3:30 [PATCH v2 1/3] dt-bindings: phy: imx8mq-usb: improve some tuning properties Xu Yang
2025-04-29 3:30 ` [PATCH v2 2/3] phy: fsl-imx8mq-usb: improve some tuning parameters Xu Yang
2025-04-29 3:30 ` Xu Yang [this message]
2025-04-29 5:55 ` [PATCH v2 1/3] dt-bindings: phy: imx8mq-usb: improve some tuning properties Frank Li
2025-04-29 6:26 ` Xu Yang
2025-04-29 12:10 ` Frank Li
2025-04-29 9:30 ` Xu Yang
2025-04-29 13:10 ` Krzysztof Kozlowski
2025-04-29 15:10 ` Conor Dooley
2025-04-30 5:57 ` Xu Yang
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=20250429033009.2388291-3-xu.yang_2@nxp.com \
--to=xu.yang_2@nxp.com \
--cc=alexander.stein@ew.tq-group.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=jun.li@nxp.com \
--cc=kernel@pengutronix.de \
--cc=kishon@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-phy@lists.infradead.org \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=vkoul@kernel.org \
/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