public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Add i.MX95 USB3.0 PHY alternate clock support
@ 2025-09-19  7:02 Xu Yang
  2025-09-19  7:02 ` [PATCH 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-09-19  7:02 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 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>
---
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: a4e143636d5def935dd461539b67b61287a8dfef
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 1/4] dt-bindings: phy: imx8mq-usb: add alternate reference clock
  2025-09-19  7:02 [PATCH 0/4] Add i.MX95 USB3.0 PHY alternate clock support Xu Yang
@ 2025-09-19  7:02 ` Xu Yang
  2025-09-19 15:54   ` Frank Li
  2025-09-19  7:02 ` [PATCH 2/4] dt-bindings: clock: nxp,imx95-blk-ctl: add support for USB in HSIO Block Control Xu Yang
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Xu Yang @ 2025-09-19  7:02 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

Except default 24MHz clock, alternate 100MHz reference clock can be used
as USB PHY reference clock too. Add "alt" clock and clock name.

Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
---
 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 22dd91591a09428214afaa4c9c8e37aae9bd8aba..268f86b04ce88cb81d2c06ee507fe0483d713f8f 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 2/4] dt-bindings: clock: nxp,imx95-blk-ctl: add support for USB in HSIO Block Control
  2025-09-19  7:02 [PATCH 0/4] Add i.MX95 USB3.0 PHY alternate clock support Xu Yang
  2025-09-19  7:02 ` [PATCH 1/4] dt-bindings: phy: imx8mq-usb: add alternate reference clock Xu Yang
@ 2025-09-19  7:02 ` Xu Yang
  2025-09-19 15:54   ` Frank Li
  2025-09-19 17:19   ` Conor Dooley
  2025-09-19  7:02 ` [PATCH 3/4] phy: fsl-imx8mq-usb: support alternate reference clock Xu Yang
  2025-09-19  7:03 ` [PATCH 4/4] clk: imx95-blk-ctl: Add one clock mux for HSIO block Xu Yang
  3 siblings, 2 replies; 10+ messages in thread
From: Xu Yang @ 2025-09-19  7:02 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

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

Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
---
 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 3/4] phy: fsl-imx8mq-usb: support alternate reference clock
  2025-09-19  7:02 [PATCH 0/4] Add i.MX95 USB3.0 PHY alternate clock support Xu Yang
  2025-09-19  7:02 ` [PATCH 1/4] dt-bindings: phy: imx8mq-usb: add alternate reference clock Xu Yang
  2025-09-19  7:02 ` [PATCH 2/4] dt-bindings: clock: nxp,imx95-blk-ctl: add support for USB in HSIO Block Control Xu Yang
@ 2025-09-19  7:02 ` Xu Yang
  2025-09-19 15:57   ` Frank Li
  2025-09-19  7:03 ` [PATCH 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-09-19  7:02 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

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.

Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
---
 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 4/4] clk: imx95-blk-ctl: Add one clock mux for HSIO block
  2025-09-19  7:02 [PATCH 0/4] Add i.MX95 USB3.0 PHY alternate clock support Xu Yang
                   ` (2 preceding siblings ...)
  2025-09-19  7:02 ` [PATCH 3/4] phy: fsl-imx8mq-usb: support alternate reference clock Xu Yang
@ 2025-09-19  7:03 ` Xu Yang
  2025-10-10 10:12   ` Peng Fan
  3 siblings, 1 reply; 10+ messages in thread
From: Xu Yang @ 2025-09-19  7:03 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.

Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
---
 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 7e88877a624518cc679cfb3bf673418207a1bc74..a87af0dff46fe6583f59d8584e1208c1d8f24417 100644
--- a/drivers/clk/imx/clk-imx95-blk-ctl.c
+++ b/drivers/clk/imx/clk-imx95-blk-ctl.c
@@ -301,6 +301,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",
@@ -520,6 +538,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 1/4] dt-bindings: phy: imx8mq-usb: add alternate reference clock
  2025-09-19  7:02 ` [PATCH 1/4] dt-bindings: phy: imx8mq-usb: add alternate reference clock Xu Yang
@ 2025-09-19 15:54   ` Frank Li
  0 siblings, 0 replies; 10+ messages in thread
From: Frank Li @ 2025-09-19 15:54 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, Sep 19, 2025 at 03:02:57PM +0800, Xu Yang wrote:
> Except default 24MHz clock, alternate 100MHz reference clock can be used
> as USB PHY reference clock too. Add "alt" clock and clock name.

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

Frank

"Need emphase two clk inputs for this IP".
>
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> ---
>  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 22dd91591a09428214afaa4c9c8e37aae9bd8aba..268f86b04ce88cb81d2c06ee507fe0483d713f8f 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 2/4] dt-bindings: clock: nxp,imx95-blk-ctl: add support for USB in HSIO Block Control
  2025-09-19  7:02 ` [PATCH 2/4] dt-bindings: clock: nxp,imx95-blk-ctl: add support for USB in HSIO Block Control Xu Yang
@ 2025-09-19 15:54   ` Frank Li
  2025-09-19 17:19   ` Conor Dooley
  1 sibling, 0 replies; 10+ messages in thread
From: Frank Li @ 2025-09-19 15:54 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, Sep 19, 2025 at 03:02:58PM +0800, Xu Yang wrote:
> Add compatible string "nxp,imx95-hsio-usb-blk-ctl" to support USB
> setting in HSIO Block Control.
>
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>

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

> ---
>  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	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/4] phy: fsl-imx8mq-usb: support alternate reference clock
  2025-09-19  7:02 ` [PATCH 3/4] phy: fsl-imx8mq-usb: support alternate reference clock Xu Yang
@ 2025-09-19 15:57   ` Frank Li
  0 siblings, 0 replies; 10+ messages in thread
From: Frank Li @ 2025-09-19 15:57 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, Sep 19, 2025 at 03:02:59PM +0800, Xu Yang wrote:
> 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.
>
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>

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

> ---
>  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	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/4] dt-bindings: clock: nxp,imx95-blk-ctl: add support for USB in HSIO Block Control
  2025-09-19  7:02 ` [PATCH 2/4] dt-bindings: clock: nxp,imx95-blk-ctl: add support for USB in HSIO Block Control Xu Yang
  2025-09-19 15:54   ` Frank Li
@ 2025-09-19 17:19   ` Conor Dooley
  1 sibling, 0 replies; 10+ messages in thread
From: Conor Dooley @ 2025-09-19 17:19 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: 52 bytes --]

Acked-by: Conor Dooley <conor.dooley@microchip.com>

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

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

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

> Subject: [PATCH 4/4] clk: imx95-blk-ctl: Add one clock mux for HSIO
> block
> 
> 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.
> 
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>

Reviewed-by: Peng Fan <peng.fan@nxp.com>

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

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

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-19  7:02 [PATCH 0/4] Add i.MX95 USB3.0 PHY alternate clock support Xu Yang
2025-09-19  7:02 ` [PATCH 1/4] dt-bindings: phy: imx8mq-usb: add alternate reference clock Xu Yang
2025-09-19 15:54   ` Frank Li
2025-09-19  7:02 ` [PATCH 2/4] dt-bindings: clock: nxp,imx95-blk-ctl: add support for USB in HSIO Block Control Xu Yang
2025-09-19 15:54   ` Frank Li
2025-09-19 17:19   ` Conor Dooley
2025-09-19  7:02 ` [PATCH 3/4] phy: fsl-imx8mq-usb: support alternate reference clock Xu Yang
2025-09-19 15:57   ` Frank Li
2025-09-19  7:03 ` [PATCH 4/4] clk: imx95-blk-ctl: Add one clock mux for HSIO block Xu Yang
2025-10-10 10:12   ` Peng Fan

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