mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3] phy: fsl-imx8mq-usb: Clear the PCS_TX_SWING_FULL field before using it
@ 2025-12-19 16:09 Stefano Radaelli
  2025-12-19 16:12 ` Fabio Estevam
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stefano Radaelli @ 2025-12-19 16:09 UTC (permalink / raw)
  To: vkoul, neil.armstrong, shawnguo, s.hauer, kernel, festevam,
	j.zink, linux-kernel
  Cc: xu.yang_2, jun.li, Frank.Li, haibo.chen, linux-phy, imx,
	Stefano Radaelli, Leonid Segal, Pierluigi Passaro

Clear the PCS_TX_SWING_FULL field mask before setting the new value
in PHY_CTRL5 register. Without clearing the mask first, the OR operation
could leave previously set bits, resulting in incorrect register
configuration.

Fixes: 63c85ad0cd81 ("phy: fsl-imx8mp-usb: add support for phy tuning")
Suggested-by: Leonid Segal <leonids@variscite.com>
Acked-by: Pierluigi Passaro <pierluigi.p@variscite.com>
Signed-off-by: Stefano Radaelli <stefano.r@variscite.com>
Reviewed-by: Xu Yang <xu.yang_2@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
---
v3:
- Fixed commit message line wrapping (75 chars)
v2:
- Improved commit subject as suggested by Fabio Estevam

 drivers/phy/freescale/phy-fsl-imx8mq-usb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c
index ad8a55012e42..9458b6e5fcf4 100644
--- a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c
+++ b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c
@@ -504,6 +504,7 @@ static void imx8m_phy_tune(struct imx8mq_usb_phy *imx_phy)
 
 	if (imx_phy->pcs_tx_swing_full != PHY_TUNE_DEFAULT) {
 		value = readl(imx_phy->base + PHY_CTRL5);
+		value &= ~PHY_CTRL5_PCS_TX_SWING_FULL_MASK;
 		value |= FIELD_PREP(PHY_CTRL5_PCS_TX_SWING_FULL_MASK,
 				   imx_phy->pcs_tx_swing_full);
 		writel(value, imx_phy->base + PHY_CTRL5);

base-commit: ea1013c1539270e372fc99854bc6e4d94eaeff66
-- 
2.47.3


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] phy: fsl-imx8mq-usb: Clear the PCS_TX_SWING_FULL field before using it
  2025-12-19 16:09 [PATCH v3] phy: fsl-imx8mq-usb: Clear the PCS_TX_SWING_FULL field before using it Stefano Radaelli
@ 2025-12-19 16:12 ` Fabio Estevam
  2025-12-19 17:55 ` Ahmad Fatoum
  2025-12-23 17:33 ` Vinod Koul
  2 siblings, 0 replies; 4+ messages in thread
From: Fabio Estevam @ 2025-12-19 16:12 UTC (permalink / raw)
  To: Stefano Radaelli
  Cc: vkoul, neil.armstrong, shawnguo, s.hauer, kernel, j.zink,
	linux-kernel, xu.yang_2, jun.li, Frank.Li, haibo.chen, linux-phy,
	imx, Stefano Radaelli, Leonid Segal, Pierluigi Passaro

On Fri, Dec 19, 2025 at 1:09 PM Stefano Radaelli
<stefano.radaelli21@gmail.com> wrote:
>
> Clear the PCS_TX_SWING_FULL field mask before setting the new value
> in PHY_CTRL5 register. Without clearing the mask first, the OR operation
> could leave previously set bits, resulting in incorrect register
> configuration.
>
> Fixes: 63c85ad0cd81 ("phy: fsl-imx8mp-usb: add support for phy tuning")
> Suggested-by: Leonid Segal <leonids@variscite.com>
> Acked-by: Pierluigi Passaro <pierluigi.p@variscite.com>
> Signed-off-by: Stefano Radaelli <stefano.r@variscite.com>
> Reviewed-by: Xu Yang <xu.yang_2@nxp.com>
> Reviewed-by: Frank Li <Frank.Li@nxp.com>

Reviewed-by: Fabio Estevam <festevam@gmail.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] phy: fsl-imx8mq-usb: Clear the PCS_TX_SWING_FULL field before using it
  2025-12-19 16:09 [PATCH v3] phy: fsl-imx8mq-usb: Clear the PCS_TX_SWING_FULL field before using it Stefano Radaelli
  2025-12-19 16:12 ` Fabio Estevam
@ 2025-12-19 17:55 ` Ahmad Fatoum
  2025-12-23 17:33 ` Vinod Koul
  2 siblings, 0 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2025-12-19 17:55 UTC (permalink / raw)
  To: Stefano Radaelli, vkoul, neil.armstrong, shawnguo, s.hauer,
	kernel, festevam, linux-kernel
  Cc: imx, Pierluigi Passaro, xu.yang_2, Frank.Li, haibo.chen,
	linux-phy, Stefano Radaelli, Leonid Segal, jun.li

On 12/19/25 5:09 PM, Stefano Radaelli wrote:
> Clear the PCS_TX_SWING_FULL field mask before setting the new value
> in PHY_CTRL5 register. Without clearing the mask first, the OR operation
> could leave previously set bits, resulting in incorrect register
> configuration.
> 
> Fixes: 63c85ad0cd81 ("phy: fsl-imx8mp-usb: add support for phy tuning")
> Suggested-by: Leonid Segal <leonids@variscite.com>
> Acked-by: Pierluigi Passaro <pierluigi.p@variscite.com>
> Signed-off-by: Stefano Radaelli <stefano.r@variscite.com>
> Reviewed-by: Xu Yang <xu.yang_2@nxp.com>
> Reviewed-by: Frank Li <Frank.Li@nxp.com>

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

> ---
> v3:
> - Fixed commit message line wrapping (75 chars)
> v2:
> - Improved commit subject as suggested by Fabio Estevam
> 
>  drivers/phy/freescale/phy-fsl-imx8mq-usb.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c
> index ad8a55012e42..9458b6e5fcf4 100644
> --- a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c
> +++ b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c
> @@ -504,6 +504,7 @@ static void imx8m_phy_tune(struct imx8mq_usb_phy *imx_phy)
>  
>  	if (imx_phy->pcs_tx_swing_full != PHY_TUNE_DEFAULT) {
>  		value = readl(imx_phy->base + PHY_CTRL5);
> +		value &= ~PHY_CTRL5_PCS_TX_SWING_FULL_MASK;
>  		value |= FIELD_PREP(PHY_CTRL5_PCS_TX_SWING_FULL_MASK,
>  				   imx_phy->pcs_tx_swing_full);
>  		writel(value, imx_phy->base + PHY_CTRL5);
> 
> base-commit: ea1013c1539270e372fc99854bc6e4d94eaeff66

-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] phy: fsl-imx8mq-usb: Clear the PCS_TX_SWING_FULL field before using it
  2025-12-19 16:09 [PATCH v3] phy: fsl-imx8mq-usb: Clear the PCS_TX_SWING_FULL field before using it Stefano Radaelli
  2025-12-19 16:12 ` Fabio Estevam
  2025-12-19 17:55 ` Ahmad Fatoum
@ 2025-12-23 17:33 ` Vinod Koul
  2 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2025-12-23 17:33 UTC (permalink / raw)
  To: neil.armstrong, shawnguo, s.hauer, kernel, festevam, j.zink,
	linux-kernel, Stefano Radaelli
  Cc: xu.yang_2, jun.li, Frank.Li, haibo.chen, linux-phy, imx,
	Stefano Radaelli, Leonid Segal, Pierluigi Passaro


On Fri, 19 Dec 2025 17:09:12 +0100, Stefano Radaelli wrote:
> Clear the PCS_TX_SWING_FULL field mask before setting the new value
> in PHY_CTRL5 register. Without clearing the mask first, the OR operation
> could leave previously set bits, resulting in incorrect register
> configuration.
> 
> 

Applied, thanks!

[1/1] phy: fsl-imx8mq-usb: Clear the PCS_TX_SWING_FULL field before using it
      commit: 8becf9179a4b45104a1701010ed666b55bf4b3a6

Best regards,
-- 
~Vinod



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-12-23 17:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-19 16:09 [PATCH v3] phy: fsl-imx8mq-usb: Clear the PCS_TX_SWING_FULL field before using it Stefano Radaelli
2025-12-19 16:12 ` Fabio Estevam
2025-12-19 17:55 ` Ahmad Fatoum
2025-12-23 17:33 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®