devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] Add i.MX95 USB3.0 PHY alternate clock support
@ 2025-10-10 11:01 Xu Yang
  2025-10-10 11:01 ` [PATCH v2 1/4] dt-bindings: phy: imx8mq-usb: add alternate reference clock Xu Yang
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Xu Yang @ 2025-10-10 11:01 UTC (permalink / raw)
  To: Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Li Jun, Abel Vesa,
	Peng Fan, Michael Turquette, Stephen Boyd
  Cc: linux-phy, devicetree, imx, linux-arm-kernel, linux-kernel,
	linux-clk, Xu Yang, Conor Dooley, Frank Li

The i.MX95 USB3.0 PHY supports XTAL 24MHz clock by default as reference
clock and 100MHz clock as alternate reference clock. If the default
reference clock brings USB performance degradation in bad condition, such
as the working temperature is too low or too high, switch to alternate
clock may overcome the degradation. This will add alternate clock support
to enhance the function of USB3.0 PHY.

Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
---
Changes in v2:
- improve patch #1 commit message
- collect Rb tag
- Link to v1: https://lore.kernel.org/r/20250919-usb-phy-alt-clk-support-v1-0-57c2a13eea1c@nxp.com

---
Xu Yang (4):
      dt-bindings: phy: imx8mq-usb: add alternate reference clock
      dt-bindings: clock: nxp,imx95-blk-ctl: add support for USB in HSIO Block Control
      phy: fsl-imx8mq-usb: support alternate reference clock
      clk: imx95-blk-ctl: Add one clock mux for HSIO block

 .../bindings/clock/nxp,imx95-blk-ctl.yaml          |  1 +
 .../bindings/phy/fsl,imx8mq-usb-phy.yaml           |  7 ++++++-
 drivers/clk/imx/clk-imx95-blk-ctl.c                | 19 ++++++++++++++++++
 drivers/phy/freescale/phy-fsl-imx8mq-usb.c         | 23 ++++++++++++++++++++--
 4 files changed, 47 insertions(+), 3 deletions(-)
---
base-commit: a2f12b1cbec103a836e3ddfde57084661591e4f3
change-id: 20250919-usb-phy-alt-clk-support-e54e69ac0780

Best regards,
-- 
Xu Yang <xu.yang_2@nxp.com>


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

* [PATCH v2 1/4] dt-bindings: phy: imx8mq-usb: add alternate reference clock
  2025-10-10 11:01 [PATCH v2 0/4] Add i.MX95 USB3.0 PHY alternate clock support Xu Yang
@ 2025-10-10 11:01 ` Xu Yang
  2025-10-10 14:11   ` Frank Li
  2025-10-10 14:31   ` Conor Dooley
  2025-10-10 11:01 ` [PATCH v2 2/4] dt-bindings: clock: nxp,imx95-blk-ctl: add support for USB in HSIO Block Control Xu Yang
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 10+ messages in thread
From: Xu Yang @ 2025-10-10 11:01 UTC (permalink / raw)
  To: Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Li Jun, Abel Vesa,
	Peng Fan, Michael Turquette, Stephen Boyd
  Cc: linux-phy, devicetree, imx, linux-arm-kernel, linux-kernel,
	linux-clk, Xu Yang

Beside default 24MHz clock input, there is an optional additional 100Mhz
clock input 'alt' for USB PHY reference clock.

Signed-off-by: Xu Yang <xu.yang_2@nxp.com>

---
Changes in v2:
 - improve commit message
---
 Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml b/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml
index 6a47e08e0e97b286538798190225ca2966a7ab34..081deb502e21308970a9495528bd745b9085f2f0 100644
--- a/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml
+++ b/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml
@@ -27,11 +27,16 @@ properties:
     const: 0
 
   clocks:
-    maxItems: 1
+    minItems: 1
+    items:
+      - description: PHY configuration clock
+      - description: Alternate PHY reference clock
 
   clock-names:
+    minItems: 1
     items:
       - const: phy
+      - const: alt
 
   power-domains:
     maxItems: 1

-- 
2.34.1


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

* [PATCH v2 2/4] dt-bindings: clock: nxp,imx95-blk-ctl: add support for USB in HSIO Block Control
  2025-10-10 11:01 [PATCH v2 0/4] Add i.MX95 USB3.0 PHY alternate clock support Xu Yang
  2025-10-10 11:01 ` [PATCH v2 1/4] dt-bindings: phy: imx8mq-usb: add alternate reference clock Xu Yang
@ 2025-10-10 11:01 ` Xu Yang
  2025-10-10 11:01 ` [PATCH v2 3/4] phy: fsl-imx8mq-usb: support alternate reference clock Xu Yang
  2025-10-10 11:01 ` [PATCH v2 4/4] clk: imx95-blk-ctl: Add one clock mux for HSIO block Xu Yang
  3 siblings, 0 replies; 10+ messages in thread
From: Xu Yang @ 2025-10-10 11:01 UTC (permalink / raw)
  To: Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Li Jun, Abel Vesa,
	Peng Fan, Michael Turquette, Stephen Boyd
  Cc: linux-phy, devicetree, imx, linux-arm-kernel, linux-kernel,
	linux-clk, Xu Yang, Conor Dooley, Frank Li

Add compatible string "nxp,imx95-hsio-usb-blk-ctl" to support USB
setting in HSIO Block Control.

Acked-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Xu Yang <xu.yang_2@nxp.com>

---
Changes in v2:
 - add Rb and Ab tag
---
 Documentation/devicetree/bindings/clock/nxp,imx95-blk-ctl.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/clock/nxp,imx95-blk-ctl.yaml b/Documentation/devicetree/bindings/clock/nxp,imx95-blk-ctl.yaml
index 27403b4c52d6219d31649d75539af93edae0f17d..aa452fb438a9cd5b9a8ad3eff6249abffe576a01 100644
--- a/Documentation/devicetree/bindings/clock/nxp,imx95-blk-ctl.yaml
+++ b/Documentation/devicetree/bindings/clock/nxp,imx95-blk-ctl.yaml
@@ -18,6 +18,7 @@ properties:
           - nxp,imx95-camera-csr
           - nxp,imx95-display-csr
           - nxp,imx95-hsio-blk-ctl
+          - nxp,imx95-hsio-usb-blk-ctl
           - nxp,imx95-lvds-csr
           - nxp,imx95-netcmix-blk-ctrl
           - nxp,imx95-vpu-csr

-- 
2.34.1


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

* [PATCH v2 3/4] phy: fsl-imx8mq-usb: support alternate reference clock
  2025-10-10 11:01 [PATCH v2 0/4] Add i.MX95 USB3.0 PHY alternate clock support Xu Yang
  2025-10-10 11:01 ` [PATCH v2 1/4] dt-bindings: phy: imx8mq-usb: add alternate reference clock Xu Yang
  2025-10-10 11:01 ` [PATCH v2 2/4] dt-bindings: clock: nxp,imx95-blk-ctl: add support for USB in HSIO Block Control Xu Yang
@ 2025-10-10 11:01 ` Xu Yang
  2025-10-13  5:58   ` Alexander Stein
  2025-10-10 11:01 ` [PATCH v2 4/4] clk: imx95-blk-ctl: Add one clock mux for HSIO block Xu Yang
  3 siblings, 1 reply; 10+ messages in thread
From: Xu Yang @ 2025-10-10 11:01 UTC (permalink / raw)
  To: Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Li Jun, Abel Vesa,
	Peng Fan, Michael Turquette, Stephen Boyd
  Cc: linux-phy, devicetree, imx, linux-arm-kernel, linux-kernel,
	linux-clk, Xu Yang, Frank Li

This phy supports both 24MHz and 100MHz clock inputs. By default it's
using XTAL 24MHz and the 100MHz clock is a alternate reference clock.
Add supports to use alternate reference clock in case 24MHz clock
can't work well.

Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Xu Yang <xu.yang_2@nxp.com>

---
Changes in v2:
 - add Rb tag
---
 drivers/phy/freescale/phy-fsl-imx8mq-usb.c | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c
index b94f242420fc733cd75abef8ba1cd4f59ac18eb5..ad8a55012e42f2c15496955d00c6d5fd85c5beb2 100644
--- a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c
+++ b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c
@@ -16,6 +16,7 @@
 #define PHY_CTRL0_REF_SSP_EN		BIT(2)
 #define PHY_CTRL0_FSEL_MASK		GENMASK(10, 5)
 #define PHY_CTRL0_FSEL_24M		0x2a
+#define PHY_CTRL0_FSEL_100M		0x27
 
 #define PHY_CTRL1			0x4
 #define PHY_CTRL1_RESET			BIT(0)
@@ -108,6 +109,7 @@ struct tca_blk {
 struct imx8mq_usb_phy {
 	struct phy *phy;
 	struct clk *clk;
+	struct clk *alt_clk;
 	void __iomem *base;
 	struct regulator *vbus;
 	struct tca_blk *tca;
@@ -582,7 +584,8 @@ static int imx8mp_usb_phy_init(struct phy *phy)
 	/* USB3.0 PHY signal fsel for 24M ref */
 	value = readl(imx_phy->base + PHY_CTRL0);
 	value &= ~PHY_CTRL0_FSEL_MASK;
-	value |= FIELD_PREP(PHY_CTRL0_FSEL_MASK, PHY_CTRL0_FSEL_24M);
+	value |= FIELD_PREP(PHY_CTRL0_FSEL_MASK, imx_phy->alt_clk ?
+			    PHY_CTRL0_FSEL_100M : PHY_CTRL0_FSEL_24M);
 	writel(value, imx_phy->base + PHY_CTRL0);
 
 	/* Disable alt_clk_en and use internal MPLL clocks */
@@ -626,13 +629,24 @@ static int imx8mq_phy_power_on(struct phy *phy)
 	if (ret)
 		return ret;
 
-	return clk_prepare_enable(imx_phy->clk);
+	ret = clk_prepare_enable(imx_phy->clk);
+	if (ret)
+		return ret;
+
+	ret = clk_prepare_enable(imx_phy->alt_clk);
+	if (ret) {
+		clk_disable_unprepare(imx_phy->clk);
+		return ret;
+	}
+
+	return ret;
 }
 
 static int imx8mq_phy_power_off(struct phy *phy)
 {
 	struct imx8mq_usb_phy *imx_phy = phy_get_drvdata(phy);
 
+	clk_disable_unprepare(imx_phy->alt_clk);
 	clk_disable_unprepare(imx_phy->clk);
 	regulator_disable(imx_phy->vbus);
 
@@ -681,6 +695,11 @@ static int imx8mq_usb_phy_probe(struct platform_device *pdev)
 		return PTR_ERR(imx_phy->clk);
 	}
 
+	imx_phy->alt_clk = devm_clk_get_optional(dev, "alt");
+	if (IS_ERR(imx_phy->alt_clk))
+		return dev_err_probe(dev, PTR_ERR(imx_phy->alt_clk),
+				    "Failed to get alt clk\n");
+
 	imx_phy->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(imx_phy->base))
 		return PTR_ERR(imx_phy->base);

-- 
2.34.1


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

* [PATCH v2 4/4] clk: imx95-blk-ctl: Add one clock mux for HSIO block
  2025-10-10 11:01 [PATCH v2 0/4] Add i.MX95 USB3.0 PHY alternate clock support Xu Yang
                   ` (2 preceding siblings ...)
  2025-10-10 11:01 ` [PATCH v2 3/4] phy: fsl-imx8mq-usb: support alternate reference clock Xu Yang
@ 2025-10-10 11:01 ` Xu Yang
  2025-10-10 14:12   ` Frank Li
  3 siblings, 1 reply; 10+ messages in thread
From: Xu Yang @ 2025-10-10 11:01 UTC (permalink / raw)
  To: Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Li Jun, Abel Vesa,
	Peng Fan, Michael Turquette, Stephen Boyd
  Cc: linux-phy, devicetree, imx, linux-arm-kernel, linux-kernel,
	linux-clk, Xu Yang

The GPR_REG0 register has an USB_PHY_REF_CLK_SEL (bit 6) to select USB 3.0
PHY reference clock.

USB_PHY_REF_CLK_SEL:
bit[6]   - 0b 24 MHz external oscillator
         - 1b 100 MHz high performance PLL

Add a clock multiplexer to support USB3.0 PHY clock selection.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Xu Yang <xu.yang_2@nxp.com>

---
Changes in v2:
 - add Rb tag
---
 drivers/clk/imx/clk-imx95-blk-ctl.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/clk/imx/clk-imx95-blk-ctl.c b/drivers/clk/imx/clk-imx95-blk-ctl.c
index 56bed44719954d6a644606914b61dad672cd82cf..c078b2ee28e81155ca3a93d26c2e757c8ddc91be 100644
--- a/drivers/clk/imx/clk-imx95-blk-ctl.c
+++ b/drivers/clk/imx/clk-imx95-blk-ctl.c
@@ -302,6 +302,24 @@ static const struct imx95_blk_ctl_dev_data hsio_blk_ctl_dev_data = {
 	.clk_reg_offset = 0,
 };
 
+static const struct imx95_blk_ctl_clk_dev_data hsio_usb_blk_ctl_clk_dev_data[] = {
+	[0] = {
+		.name = "usb_phy_ref_clk_sel",
+		.parent_names = (const char *[]){"osc24m", "hsiopll"},
+		.num_parents = 2,
+		.reg = 0,
+		.bit_idx = 6,
+		.bit_width = 1,
+		.type = CLK_MUX,
+		.flags = CLK_SET_RATE_NO_REPARENT | CLK_SET_RATE_PARENT,
+	}
+};
+
+static const struct imx95_blk_ctl_dev_data hsio_usb_blk_ctl_dev_data = {
+	.num_clks = 1,
+	.clk_dev_data = hsio_usb_blk_ctl_clk_dev_data,
+};
+
 static const struct imx95_blk_ctl_clk_dev_data imx94_lvds_clk_dev_data[] = {
 	[IMX94_CLK_DISPMIX_LVDS_CLK_GATE] = {
 		.name = "lvds_clk_gate",
@@ -519,6 +537,7 @@ static const struct of_device_id imx95_bc_of_match[] = {
 	{ .compatible = "nxp,imx95-display-csr", .data = &imx95_dispmix_csr_dev_data },
 	{ .compatible = "nxp,imx95-lvds-csr", .data = &imx95_lvds_csr_dev_data },
 	{ .compatible = "nxp,imx95-hsio-blk-ctl", .data = &hsio_blk_ctl_dev_data },
+	{ .compatible = "nxp,imx95-hsio-usb-blk-ctl", .data = &hsio_usb_blk_ctl_dev_data },
 	{ .compatible = "nxp,imx95-vpu-csr", .data = &vpublk_dev_data },
 	{ .compatible = "nxp,imx95-netcmix-blk-ctrl", .data = &netcmix_dev_data},
 	{ /* Sentinel */ },

-- 
2.34.1


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

* Re: [PATCH v2 1/4] dt-bindings: phy: imx8mq-usb: add alternate reference clock
  2025-10-10 11:01 ` [PATCH v2 1/4] dt-bindings: phy: imx8mq-usb: add alternate reference clock Xu Yang
@ 2025-10-10 14:11   ` Frank Li
  2025-10-10 14:31   ` Conor Dooley
  1 sibling, 0 replies; 10+ messages in thread
From: Frank Li @ 2025-10-10 14:11 UTC (permalink / raw)
  To: Xu Yang
  Cc: Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Li Jun, Abel Vesa,
	Peng Fan, Michael Turquette, Stephen Boyd, linux-phy, devicetree,
	imx, linux-arm-kernel, linux-kernel, linux-clk

On Fri, Oct 10, 2025 at 07:01:10PM +0800, Xu Yang wrote:
> Beside default 24MHz clock input, there is an optional additional 100Mhz
> clock input 'alt' for USB PHY reference clock.
>
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>
> ---
> Changes in v2:
>  - improve commit message
> ---
>  Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml b/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml
> index 6a47e08e0e97b286538798190225ca2966a7ab34..081deb502e21308970a9495528bd745b9085f2f0 100644
> --- a/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml
> +++ b/Documentation/devicetree/bindings/phy/fsl,imx8mq-usb-phy.yaml
> @@ -27,11 +27,16 @@ properties:
>      const: 0
>
>    clocks:
> -    maxItems: 1
> +    minItems: 1
> +    items:
> +      - description: PHY configuration clock
> +      - description: Alternate PHY reference clock
>
>    clock-names:
> +    minItems: 1
>      items:
>        - const: phy
> +      - const: alt
>
>    power-domains:
>      maxItems: 1
>
> --
> 2.34.1
>

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

* Re: [PATCH v2 4/4] clk: imx95-blk-ctl: Add one clock mux for HSIO block
  2025-10-10 11:01 ` [PATCH v2 4/4] clk: imx95-blk-ctl: Add one clock mux for HSIO block Xu Yang
@ 2025-10-10 14:12   ` Frank Li
  0 siblings, 0 replies; 10+ messages in thread
From: Frank Li @ 2025-10-10 14:12 UTC (permalink / raw)
  To: Xu Yang
  Cc: Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Li Jun, Abel Vesa,
	Peng Fan, Michael Turquette, Stephen Boyd, linux-phy, devicetree,
	imx, linux-arm-kernel, linux-kernel, linux-clk

On Fri, Oct 10, 2025 at 07:01:13PM +0800, Xu Yang wrote:
> The GPR_REG0 register has an USB_PHY_REF_CLK_SEL (bit 6) to select USB 3.0
> PHY reference clock.
>
> USB_PHY_REF_CLK_SEL:
> bit[6]   - 0b 24 MHz external oscillator
>          - 1b 100 MHz high performance PLL
>
> Add a clock multiplexer to support USB3.0 PHY clock selection.
>
> Reviewed-by: Peng Fan <peng.fan@nxp.com>
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>

Reviewed-by: Frank Li <Frank.Li@nxp.com>

>
> ---
> Changes in v2:
>  - add Rb tag
> ---
>  drivers/clk/imx/clk-imx95-blk-ctl.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
>
> diff --git a/drivers/clk/imx/clk-imx95-blk-ctl.c b/drivers/clk/imx/clk-imx95-blk-ctl.c
> index 56bed44719954d6a644606914b61dad672cd82cf..c078b2ee28e81155ca3a93d26c2e757c8ddc91be 100644
> --- a/drivers/clk/imx/clk-imx95-blk-ctl.c
> +++ b/drivers/clk/imx/clk-imx95-blk-ctl.c
> @@ -302,6 +302,24 @@ static const struct imx95_blk_ctl_dev_data hsio_blk_ctl_dev_data = {
>  	.clk_reg_offset = 0,
>  };
>
> +static const struct imx95_blk_ctl_clk_dev_data hsio_usb_blk_ctl_clk_dev_data[] = {
> +	[0] = {
> +		.name = "usb_phy_ref_clk_sel",
> +		.parent_names = (const char *[]){"osc24m", "hsiopll"},
> +		.num_parents = 2,
> +		.reg = 0,
> +		.bit_idx = 6,
> +		.bit_width = 1,
> +		.type = CLK_MUX,
> +		.flags = CLK_SET_RATE_NO_REPARENT | CLK_SET_RATE_PARENT,
> +	}
> +};
> +
> +static const struct imx95_blk_ctl_dev_data hsio_usb_blk_ctl_dev_data = {
> +	.num_clks = 1,
> +	.clk_dev_data = hsio_usb_blk_ctl_clk_dev_data,
> +};
> +
>  static const struct imx95_blk_ctl_clk_dev_data imx94_lvds_clk_dev_data[] = {
>  	[IMX94_CLK_DISPMIX_LVDS_CLK_GATE] = {
>  		.name = "lvds_clk_gate",
> @@ -519,6 +537,7 @@ static const struct of_device_id imx95_bc_of_match[] = {
>  	{ .compatible = "nxp,imx95-display-csr", .data = &imx95_dispmix_csr_dev_data },
>  	{ .compatible = "nxp,imx95-lvds-csr", .data = &imx95_lvds_csr_dev_data },
>  	{ .compatible = "nxp,imx95-hsio-blk-ctl", .data = &hsio_blk_ctl_dev_data },
> +	{ .compatible = "nxp,imx95-hsio-usb-blk-ctl", .data = &hsio_usb_blk_ctl_dev_data },
>  	{ .compatible = "nxp,imx95-vpu-csr", .data = &vpublk_dev_data },
>  	{ .compatible = "nxp,imx95-netcmix-blk-ctrl", .data = &netcmix_dev_data},
>  	{ /* Sentinel */ },
>
> --
> 2.34.1
>

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

* Re: [PATCH v2 1/4] dt-bindings: phy: imx8mq-usb: add alternate reference clock
  2025-10-10 11:01 ` [PATCH v2 1/4] dt-bindings: phy: imx8mq-usb: add alternate reference clock Xu Yang
  2025-10-10 14:11   ` Frank Li
@ 2025-10-10 14:31   ` Conor Dooley
  1 sibling, 0 replies; 10+ messages in thread
From: Conor Dooley @ 2025-10-10 14:31 UTC (permalink / raw)
  To: Xu Yang
  Cc: Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Li Jun, Abel Vesa,
	Peng Fan, Michael Turquette, Stephen Boyd, linux-phy, devicetree,
	imx, linux-arm-kernel, linux-kernel, linux-clk

[-- Attachment #1: Type: text/plain, Size: 78 bytes --]

Acked-by: Conor Dooley <conor.dooley@microchip.com>
--
pw-bot: not-applicable

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH v2 3/4] phy: fsl-imx8mq-usb: support alternate reference clock
  2025-10-10 11:01 ` [PATCH v2 3/4] phy: fsl-imx8mq-usb: support alternate reference clock Xu Yang
@ 2025-10-13  5:58   ` Alexander Stein
  2025-10-14 10:20     ` Xu Yang
  0 siblings, 1 reply; 10+ messages in thread
From: Alexander Stein @ 2025-10-13  5:58 UTC (permalink / raw)
  To: Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Li Jun, Abel Vesa,
	Peng Fan, Michael Turquette, Stephen Boyd, linux-arm-kernel
  Cc: linux-phy, devicetree, imx, linux-arm-kernel, linux-kernel,
	linux-clk, Xu Yang, Frank Li, Xu Yang

Am Freitag, 10. Oktober 2025, 13:01:12 CEST schrieb Xu Yang:
> This phy supports both 24MHz and 100MHz clock inputs. By default it's
> using XTAL 24MHz and the 100MHz clock is a alternate reference clock.
> Add supports to use alternate reference clock in case 24MHz clock
> can't work well.

This driver supports imx8mx and imx8mp as well. Do these SoC also support
the alternative clock?

Best regards
Alexander

> 
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> 
> ---
> Changes in v2:
>  - add Rb tag
> ---
>  drivers/phy/freescale/phy-fsl-imx8mq-usb.c | 23 +++++++++++++++++++++--
>  1 file changed, 21 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c
> index b94f242420fc733cd75abef8ba1cd4f59ac18eb5..ad8a55012e42f2c15496955d00c6d5fd85c5beb2 100644
> --- a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c
> +++ b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c
> @@ -16,6 +16,7 @@
>  #define PHY_CTRL0_REF_SSP_EN		BIT(2)
>  #define PHY_CTRL0_FSEL_MASK		GENMASK(10, 5)
>  #define PHY_CTRL0_FSEL_24M		0x2a
> +#define PHY_CTRL0_FSEL_100M		0x27
>  
>  #define PHY_CTRL1			0x4
>  #define PHY_CTRL1_RESET			BIT(0)
> @@ -108,6 +109,7 @@ struct tca_blk {
>  struct imx8mq_usb_phy {
>  	struct phy *phy;
>  	struct clk *clk;
> +	struct clk *alt_clk;
>  	void __iomem *base;
>  	struct regulator *vbus;
>  	struct tca_blk *tca;
> @@ -582,7 +584,8 @@ static int imx8mp_usb_phy_init(struct phy *phy)
>  	/* USB3.0 PHY signal fsel for 24M ref */
>  	value = readl(imx_phy->base + PHY_CTRL0);
>  	value &= ~PHY_CTRL0_FSEL_MASK;
> -	value |= FIELD_PREP(PHY_CTRL0_FSEL_MASK, PHY_CTRL0_FSEL_24M);
> +	value |= FIELD_PREP(PHY_CTRL0_FSEL_MASK, imx_phy->alt_clk ?
> +			    PHY_CTRL0_FSEL_100M : PHY_CTRL0_FSEL_24M);
>  	writel(value, imx_phy->base + PHY_CTRL0);
>  
>  	/* Disable alt_clk_en and use internal MPLL clocks */
> @@ -626,13 +629,24 @@ static int imx8mq_phy_power_on(struct phy *phy)
>  	if (ret)
>  		return ret;
>  
> -	return clk_prepare_enable(imx_phy->clk);
> +	ret = clk_prepare_enable(imx_phy->clk);
> +	if (ret)
> +		return ret;
> +
> +	ret = clk_prepare_enable(imx_phy->alt_clk);
> +	if (ret) {
> +		clk_disable_unprepare(imx_phy->clk);
> +		return ret;
> +	}
> +
> +	return ret;
>  }
>  
>  static int imx8mq_phy_power_off(struct phy *phy)
>  {
>  	struct imx8mq_usb_phy *imx_phy = phy_get_drvdata(phy);
>  
> +	clk_disable_unprepare(imx_phy->alt_clk);
>  	clk_disable_unprepare(imx_phy->clk);
>  	regulator_disable(imx_phy->vbus);
>  
> @@ -681,6 +695,11 @@ static int imx8mq_usb_phy_probe(struct platform_device *pdev)
>  		return PTR_ERR(imx_phy->clk);
>  	}
>  
> +	imx_phy->alt_clk = devm_clk_get_optional(dev, "alt");
> +	if (IS_ERR(imx_phy->alt_clk))
> +		return dev_err_probe(dev, PTR_ERR(imx_phy->alt_clk),
> +				    "Failed to get alt clk\n");
> +
>  	imx_phy->base = devm_platform_ioremap_resource(pdev, 0);
>  	if (IS_ERR(imx_phy->base))
>  		return PTR_ERR(imx_phy->base);
> 
> 





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

* Re: [PATCH v2 3/4] phy: fsl-imx8mq-usb: support alternate reference clock
  2025-10-13  5:58   ` Alexander Stein
@ 2025-10-14 10:20     ` Xu Yang
  0 siblings, 0 replies; 10+ messages in thread
From: Xu Yang @ 2025-10-14 10:20 UTC (permalink / raw)
  To: Alexander Stein
  Cc: Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Li Jun, Abel Vesa,
	Peng Fan, Michael Turquette, Stephen Boyd, linux-arm-kernel,
	linux-phy, devicetree, imx, linux-kernel, linux-clk, Frank Li

On Mon, Oct 13, 2025 at 07:58:12AM +0200, Alexander Stein wrote:
> Am Freitag, 10. Oktober 2025, 13:01:12 CEST schrieb Xu Yang:
> > This phy supports both 24MHz and 100MHz clock inputs. By default it's
> > using XTAL 24MHz and the 100MHz clock is a alternate reference clock.
> > Add supports to use alternate reference clock in case 24MHz clock
> > can't work well.
> 
> This driver supports imx8mx and imx8mp as well. Do these SoC also support
> the alternative clock?

imx8mp support the alternative clock too. Note that for imx8mp,
GPR_REG0.USB_PHY_REF_CLK_SEL needs also to be set if alternative clock is
necessary. However, it's not implemented for now. 

Thanks,
Xu Yang

> 
> Best regards
> Alexander
> 

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

end of thread, other threads:[~2025-10-14 10:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-10 11:01 [PATCH v2 0/4] Add i.MX95 USB3.0 PHY alternate clock support Xu Yang
2025-10-10 11:01 ` [PATCH v2 1/4] dt-bindings: phy: imx8mq-usb: add alternate reference clock Xu Yang
2025-10-10 14:11   ` Frank Li
2025-10-10 14:31   ` Conor Dooley
2025-10-10 11:01 ` [PATCH v2 2/4] dt-bindings: clock: nxp,imx95-blk-ctl: add support for USB in HSIO Block Control Xu Yang
2025-10-10 11:01 ` [PATCH v2 3/4] phy: fsl-imx8mq-usb: support alternate reference clock Xu Yang
2025-10-13  5:58   ` Alexander Stein
2025-10-14 10:20     ` Xu Yang
2025-10-10 11:01 ` [PATCH v2 4/4] clk: imx95-blk-ctl: Add one clock mux for HSIO block Xu Yang
2025-10-10 14:12   ` Frank Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).