* [PATCH v3 0/4] Add i.MX95 USB3.0 PHY alternate clock support
@ 2025-11-03 10:08 Xu Yang
2025-11-03 10:08 ` [PATCH v3 1/4] dt-bindings: phy: imx8mq-usb: add alternate reference clock Xu Yang
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Xu Yang @ 2025-11-03 10:08 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, Frank Li, Conor Dooley, 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.
---
Changes in v3:
- collect some Rb and Ab tag
- Link to v2: https://lore.kernel.org/r/20251010-usb-phy-alt-clk-support-v2-0-af4b78bb4ae8@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: 18514fd70ea4ca9de137bb3bceeac1bac4bcad75
change-id: 20250919-usb-phy-alt-clk-support-e54e69ac0780
Best regards,
--
Xu Yang <xu.yang_2@nxp.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 1/4] dt-bindings: phy: imx8mq-usb: add alternate reference clock
2025-11-03 10:08 [PATCH v3 0/4] Add i.MX95 USB3.0 PHY alternate clock support Xu Yang
@ 2025-11-03 10:08 ` Xu Yang
2025-11-03 10:08 ` [PATCH v3 2/4] dt-bindings: clock: nxp,imx95-blk-ctl: add support for USB in HSIO Block Control Xu Yang
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Xu Yang @ 2025-11-03 10:08 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, Frank Li, Conor Dooley, Xu Yang
Beside default 24MHz clock input, there is an optional additional 100Mhz
clock input 'alt' for USB PHY reference clock.
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
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 f9cffbb2df07d6fa352a844071af7cc894652d0c..8a00a6c58edd47872c04bc6d8263895eaa258fbb 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] 6+ messages in thread
* [PATCH v3 2/4] dt-bindings: clock: nxp,imx95-blk-ctl: add support for USB in HSIO Block Control
2025-11-03 10:08 [PATCH v3 0/4] Add i.MX95 USB3.0 PHY alternate clock support Xu Yang
2025-11-03 10:08 ` [PATCH v3 1/4] dt-bindings: phy: imx8mq-usb: add alternate reference clock Xu Yang
@ 2025-11-03 10:08 ` Xu Yang
2025-11-03 10:08 ` [PATCH v3 3/4] phy: fsl-imx8mq-usb: support alternate reference clock Xu Yang
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Xu Yang @ 2025-11-03 10:08 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, Conor Dooley, Frank Li, Xu Yang
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] 6+ messages in thread
* [PATCH v3 3/4] phy: fsl-imx8mq-usb: support alternate reference clock
2025-11-03 10:08 [PATCH v3 0/4] Add i.MX95 USB3.0 PHY alternate clock support Xu Yang
2025-11-03 10:08 ` [PATCH v3 1/4] dt-bindings: phy: imx8mq-usb: add alternate reference clock Xu Yang
2025-11-03 10:08 ` [PATCH v3 2/4] dt-bindings: clock: nxp,imx95-blk-ctl: add support for USB in HSIO Block Control Xu Yang
@ 2025-11-03 10:08 ` Xu Yang
2025-11-03 10:08 ` [PATCH v3 4/4] clk: imx95-blk-ctl: Add one clock mux for HSIO block Xu Yang
2025-11-04 4:11 ` [PATCH v3 0/4] Add i.MX95 USB3.0 PHY alternate clock support Peng Fan
4 siblings, 0 replies; 6+ messages in thread
From: Xu Yang @ 2025-11-03 10:08 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, Frank Li, 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.
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] 6+ messages in thread
* [PATCH v3 4/4] clk: imx95-blk-ctl: Add one clock mux for HSIO block
2025-11-03 10:08 [PATCH v3 0/4] Add i.MX95 USB3.0 PHY alternate clock support Xu Yang
` (2 preceding siblings ...)
2025-11-03 10:08 ` [PATCH v3 3/4] phy: fsl-imx8mq-usb: support alternate reference clock Xu Yang
@ 2025-11-03 10:08 ` Xu Yang
2025-11-04 4:11 ` [PATCH v3 0/4] Add i.MX95 USB3.0 PHY alternate clock support Peng Fan
4 siblings, 0 replies; 6+ messages in thread
From: Xu Yang @ 2025-11-03 10:08 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, Frank Li, 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>
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/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] 6+ messages in thread
* Re: [PATCH v3 0/4] Add i.MX95 USB3.0 PHY alternate clock support
2025-11-03 10:08 [PATCH v3 0/4] Add i.MX95 USB3.0 PHY alternate clock support Xu Yang
` (3 preceding siblings ...)
2025-11-03 10:08 ` [PATCH v3 4/4] clk: imx95-blk-ctl: Add one clock mux for HSIO block Xu Yang
@ 2025-11-04 4:11 ` Peng Fan
4 siblings, 0 replies; 6+ messages in thread
From: Peng Fan @ 2025-11-04 4: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, Frank Li,
Conor Dooley
Hi Xu,
On Mon, Nov 03, 2025 at 06:08:31PM +0800, Xu Yang wrote:
>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.
I gave a recheck on this patchset. Sorry, need to take back my R-b from patch 3.
I think we need to avoid introduce xx-usb-blk-ctl here.
Reuse imx95 hsio-blk-ctl and fix that node.
We only have one HSIO BLK CTRL, PCIE(0xc0) and USB(0x00) both should use it,
but not introduce a new compatible.
Let me give a look on current BLK CTRL for PCIE stuff and extend it to support
USB.
Thanks,
Peng
>
>---
>Changes in v3:
>- collect some Rb and Ab tag
>- Link to v2: https://lore.kernel.org/r/20251010-usb-phy-alt-clk-support-v2-0-af4b78bb4ae8@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: 18514fd70ea4ca9de137bb3bceeac1bac4bcad75
>change-id: 20250919-usb-phy-alt-clk-support-e54e69ac0780
>
>Best regards,
>--
>Xu Yang <xu.yang_2@nxp.com>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-11-04 2:58 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-03 10:08 [PATCH v3 0/4] Add i.MX95 USB3.0 PHY alternate clock support Xu Yang
2025-11-03 10:08 ` [PATCH v3 1/4] dt-bindings: phy: imx8mq-usb: add alternate reference clock Xu Yang
2025-11-03 10:08 ` [PATCH v3 2/4] dt-bindings: clock: nxp,imx95-blk-ctl: add support for USB in HSIO Block Control Xu Yang
2025-11-03 10:08 ` [PATCH v3 3/4] phy: fsl-imx8mq-usb: support alternate reference clock Xu Yang
2025-11-03 10:08 ` [PATCH v3 4/4] clk: imx95-blk-ctl: Add one clock mux for HSIO block Xu Yang
2025-11-04 4:11 ` [PATCH v3 0/4] Add i.MX95 USB3.0 PHY alternate clock support Peng Fan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox