ARM: imx6plus: enable internal routing of clk_enet_ref where possible
Subsystems (4)
PATCH 1/1 ARM: imx6plus: enable internal routing of clk_enet_ref where possible
On imx6, the ethernet reference clock (clk_enet_ref) can be generated by either the imx6, or an external source (e.g. an oscillator or the PHY). When generated by the imx6, the clock source (from ANATOP) must be routed to the input of clk_enet_ref via two pads on the SoC, typically via a dedicated track on the PCB.
On an imx6 plus however, there is a new setting which enables this clock to be routed internally on the SoC, from its ANATOP clock source, straight to clk_enet_ref, without having to go through the SoC pads.
Board designs where the clock is generated by the imx6 should not be affected by routing the clock internally. Therefore on a plus, we can enable internal routing by default.
To: Shawn Guo <[email protected]>
--- arch/arm/mach-imx/mach-imx6q.c | 18 ++++++++++++++++++ include/linux/mfd/syscon/imx6q-iomuxc-gpr.h | 1 + 2 files changed, 19 insertions(+)
Tree: next-20200613
arch/arm/mach-imx/mach-imx6q.c +18 -0
@@ -203,6 +203,24 @@ static void __init imx6q_1588_init(void)else pr_err ("failed to find fsl,imx6q-iomuxc-gpr regmap\n" ); +/* +* On imx6 plus, enet_ref from ANATOP/CCM can be internally routed to +* be the PTP clock source, instead of having to be routed through +* pads. +* Board designs which route the ANATOP/CCM clock through pads are +* unaffected when routing happens internally. So on these designs, +* route internally by default. +*/ +if (clksel ==IMX6Q_GPR1_ENET_CLK_SEL_ANATOP &&cpu_is_imx6q () && +imx_get_soc_revision () >=IMX_CHIP_REVISION_2_0 ) { +if (!IS_ERR (gpr)) +regmap_update_bits (gpr,IOMUXC_GPR5 , +IMX6Q_GPR5_ENET_TXCLK_SEL , +IMX6Q_GPR5_ENET_TXCLK_SEL ); +else +pr_err ("failed to find fsl,imx6q-iomuxc-gpr regmap\n" ); + } +clk_put (enet_ref); put_ptp_clk:clk_put (ptp_clk);
include/linux/mfd/syscon/imx6q-iomuxc-gpr.h +1 -0
@@ -240,6 +240,7 @@#define IMX6Q_GPR4_IPU_RD_CACHE_CTL BIT(0)#define IMX6Q_GPR5_L2_CLK_STOP BIT(8) +#define IMX6Q_GPR5_ENET_TXCLK_SEL BIT(9)#define IMX6Q_GPR5_SATA_SW_PD BIT(10)#define IMX6Q_GPR5_SATA_SW_RST BIT(11)
Signature · 7 lines
2.17.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Hi Fugang,
Can you take a look at this patch? Thanks!
Shawn
Quoted 74 lines · Sven Van Asbroeck
On imx6, the ethernet reference clock (
clk_enet_ref) can be generated by either the imx6, or an external source (e.g. an oscillator or the PHY). When generated by the imx6, the clock source (from ANATOP) must be routed to the input ofclk_enet_refvia two pads on the SoC, typically via a dedicated track on the PCB.On an imx6 plus however, there is a new setting which enables this clock to be routed internally on the SoC, from its ANATOP clock source, straight to
clk_enet_ref, without having to go through the SoC pads.Board designs where the clock is generated by the imx6 should not be affected by routing the clock internally. Therefore on a plus, we can enable internal routing by default.
To: Shawn Guo <[email protected]>
Cc Sascha Hauer <[email protected]>Cc Pengutronix Kernel Team <[email protected]>Cc Fabio Estevam <[email protected]>Cc NXP Linux Team <[email protected]>Signed-off-by Sven Van Asbroeck <[email protected]>--- arch/arm/mach-imx/mach-imx6q.c | 18 ++++++++++++++++++ include/linux/mfd/syscon/imx6q-iomuxc-gpr.h | 1 + 2 files changed, 19 insertions(+)Tree: next-20200613
arch/arm/mach-imx/mach-imx6q.c +18
-0@@ -203,6 +203,24 @@ static void __init imx6q_1588_init(void)else pr_err ("failed to find fsl,imx6q-iomuxc-gpr regmap\n" ); +/* +* On imx6 plus, enet_ref from ANATOP/CCM can be internally routed to +* be the PTP clock source, instead of having to be routed through +* pads. +* Board designs which route the ANATOP/CCM clock through pads are +* unaffected when routing happens internally. So on these designs, +* route internally by default. +*/ +if (clksel ==IMX6Q_GPR1_ENET_CLK_SEL_ANATOP &&cpu_is_imx6q () && +imx_get_soc_revision () >=IMX_CHIP_REVISION_2_0 ) { +if (!IS_ERR (gpr)) +regmap_update_bits (gpr,IOMUXC_GPR5 , +IMX6Q_GPR5_ENET_TXCLK_SEL , +IMX6Q_GPR5_ENET_TXCLK_SEL ); +else +pr_err ("failed to find fsl,imx6q-iomuxc-gpr regmap\n" ); + } +clk_put (enet_ref); put_ptp_clk:clk_put (ptp_clk);include/linux/mfd/syscon/imx6q-iomuxc-gpr.h +1
-0@@ -240,6 +240,7 @@#define IMX6Q_GPR4_IPU_RD_CACHE_CTL BIT(0)#define IMX6Q_GPR5_L2_CLK_STOP BIT(8) +#define IMX6Q_GPR5_ENET_TXCLK_SEL BIT(9)#define IMX6Q_GPR5_SATA_SW_PD BIT(10)#define IMX6Q_GPR5_SATA_SW_RST BIT(11)Signature · 1 line
2.17.1
Fabio Estevam
reviewerHi Sven,
arch/arm/mach-imx/mach-imx6q.c static void __init imx6q_1588_init(void) · line 215
Quoted 10 lines · Sven Van Asbroeck
arch/arm/mach-imx/mach-imx6q.c +10
-0+/* +* On imx6 plus, enet_ref from ANATOP/CCM can be internally routed to +* be the PTP clock source, instead of having to be routed through +* pads. +* Board designs which route the ANATOP/CCM clock through pads are +* unaffected when routing happens internally. So on these designs, +* route internally by default. +*/ +if (clksel ==IMX6Q_GPR1_ENET_CLK_SEL_ANATOP &&cpu_is_imx6q () && +imx_get_soc_revision () >=IMX_CHIP_REVISION_2_0 ) {
You should limit this to imx6 quad plus only, so you would better check against "fsl,imx6qp".
Hi Fabio,
Quoted 3 lines · Fabio Estevam
You should limit this to imx6 quad plus only, so you would better check against "fsl,imx6qp".
Excellent suggestion, thank you ! I tried to determine if running on a plus by using the method from imx6q_init_machine(). But yes, checking for "fsl,imx6qp" sounds much more elegant.
Andy Duan
Reviewed-byFrom: Shawn Guo <[email protected]> Sent: Tuesday, June 23, 2020 7:54 PM
Quoted 4 lines
Hi Fugang,
Can you take a look at this patch? Thanks!
The patch looks good.
Quoted 87 lines
Shawn
Quoted 23 lines · Sven Van Asbroeck
On imx6, the ethernet reference clock (
clk_enet_ref) can be generated by either the imx6, or an external source (e.g. an oscillator or the PHY). When generated by the imx6, the clock source (from ANATOP) must be routed to the input ofclk_enet_refvia two pads on the SoC, typically via a dedicated track on the PCB.On an imx6 plus however, there is a new setting which enables this clock to be routed internally on the SoC, from its ANATOP clock source, straight to
clk_enet_ref, without having to go through the SoC pads.Board designs where the clock is generated by the imx6 should not be affected by routing the clock internally. Therefore on a plus, we can enable internal routing by default.
To: Shawn Guo <[email protected]>
Cc Sascha Hauer <[email protected]>Cc Pengutronix Kernel Team <[email protected]>Cc Fabio Estevam <[email protected]>Cc NXP Linux Team <[email protected]>Signed-off-by Sven Van Asbroeck <[email protected]>Quoted 2 lines
--- arch/arm/mach-imx/mach-imx6q.c | 18++++++++++++++++++
Quoted 11 lines
include/linux/mfd/syscon/imx6q-iomuxc-gpr.h | 1 + 2 files changed, 19 insertions(+)Tree: next-20200613
(quoted diff) +0
-0
b/arch/arm/mach-imx/mach-imx6q.cindex85c084a716ab..4d22567bb650100644arch/arm/mach-imx/mach-imx6q.c static void __init imx6q_1588_init(void) · line 207
Quoted 5 lines
arch/arm/mach-imx/mach-imx6q.c +2
-0@@ -203,6 +203,24 @@ static void __init imx6q_1588_init(void)else pr_err ("failed to find fsl,imx6q-iomuxc-gpr regmap\n" ); +/* +* On imx6 plus, enet_ref from ANATOP/CCM can be internally routed to
arch/arm/mach-imx/mach-imx6q.c static void __init imx6q_1588_init(void)
Quoted 3 lines
arch/arm/mach-imx/mach-imx6q.c +3
-0+* be the PTP clock source, instead of having to be routed through +* pads. +* Board designs which route the ANATOP/CCM clock through pads are
arch/arm/mach-imx/mach-imx6q.c static void __init imx6q_1588_init(void)
Quoted 4 lines
arch/arm/mach-imx/mach-imx6q.c +4
-0+* unaffected when routing happens internally. So on these designs, +* route internally by default. +*/ + if (clksel == IMX6Q_GPR1_ENET_CLK_SEL_ANATOP &&
cpu_is_imx6q()&&arch/arm/mach-imx/mach-imx6q.c static void __init imx6q_1588_init(void) · line 215
Quoted 1 line
arch/arm/mach-imx/mach-imx6q.c +1
-0+ imx_get_soc_revision() >=
IMX_CHIP_REVISION_2_0) {arch/arm/mach-imx/mach-imx6q.c static void __init imx6q_1588_init(void) · line 223
Quoted 3 lines
arch/arm/mach-imx/mach-imx6q.c +3
-0+if (!IS_ERR (gpr)) + regmap_update_bits(gpr, IOMUXC_GPR5, +
IMX6Q_GPR5_ENET_TXCLK_SEL,arch/arm/mach-imx/mach-imx6q.c static void __init imx6q_1588_init(void) · line 223
Quoted 1 line
arch/arm/mach-imx/mach-imx6q.c +1
-0+
IMX6Q_GPR5_ENET_TXCLK_SEL);arch/arm/mach-imx/mach-imx6q.c static void __init imx6q_1588_init(void) · line 221
Quoted 2 lines
arch/arm/mach-imx/mach-imx6q.c +2
-0+else + pr_err("failed to find fsl,imx6q-iomuxc-gprregmap\n");
Quoted 21 lines
arch/arm/mach-imx/mach-imx6q.c +2
-0+ } +clk_put (enet_ref); put_ptp_clk:clk_put (ptp_clk);include/linux/mfd/syscon/imx6q-iomuxc-gpr.h +1
-1@@ -240,6 +240,7 @@#define IMX6Q_GPR4_IPU_RD_CACHE_CTL BIT(0)#define IMX6Q_GPR5_L2_CLK_STOP BIT(8) +#define IMX6Q_GPR5_ENET_TXCLK_SEL BIT(9)#define IMX6Q_GPR5_SATA_SW_PD BIT(10)#define IMX6Q_GPR5_SATA_SW_RST BIT(11) --2.17.1
Hi Andy,
Quoted 3 lines · Andy Duan
The patch looks good.
Reviewed-by Fugang Duan <[email protected]>
Thank you !
To check we're on a plus, the patch uses:cpu_is_imx6q() && imx_get_soc_revision() >= IMX_CHIP_REVISION_2_0
Fabio Estevam suggested that perhaps checking of_machine_is_compatible("fsl,imx6qp") might be preferable. What is your opinion on this?
From: Sven Van Asbroeck <[email protected]> Sent: Wednesday, June 24, 2020 10:56 AM
Quoted 7 lines
Hi Andy,
Quoted 3 lines · Andy Duan
The patch looks good.
Reviewed-by Fugang Duan <[email protected]>
Quoted 8 lines
Thank you !
To check we're on a plus, the patch uses:
cpu_is_imx6q()&&imx_get_soc_revision()>=IMX_CHIP_REVISION_2_0Fabio Estevam suggested that perhaps checking
of_machine_is_compatible("fsl,imx6qp")might be preferable. What is your opinion on this?
Yes, I also think of_machine_is_compatible() is much better. Thanks.