diff mbox series

[v2,1/4] ARM: imx7d: add enet2 clk sel

Message ID 20200714051140.8090-1-s.trumtrar@pengutronix.de
State New
Headers show
Series [v2,1/4] ARM: imx7d: add enet2 clk sel | expand

Commit Message

Steffen Trumtrar July 14, 2020, 5:11 a.m. UTC
Add clock source init for the second ethernet port.
This changes the clock direction and clock selection in a way that the
ethernet phy reference clock is routed as an output.

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 arch/arm/mach-imx/mach-imx7d.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Shawn Guo Aug. 17, 2020, 7:24 a.m. UTC | #1
On Tue, Jul 14, 2020 at 07:11:37AM +0200, Steffen Trumtrar wrote:
> Add clock source init for the second ethernet port.
> This changes the clock direction and clock selection in a way that the
> ethernet phy reference clock is routed as an output.
> 
> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> ---
>  arch/arm/mach-imx/mach-imx7d.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/arch/arm/mach-imx/mach-imx7d.c b/arch/arm/mach-imx/mach-imx7d.c
> index 879c35929a13..7a203f660721 100644
> --- a/arch/arm/mach-imx/mach-imx7d.c
> +++ b/arch/arm/mach-imx/mach-imx7d.c
> @@ -65,6 +65,9 @@ static void __init imx7d_enet_clk_sel(void)
>  	if (!IS_ERR(gpr)) {
>  		regmap_update_bits(gpr, IOMUXC_GPR1, IMX7D_GPR1_ENET_TX_CLK_SEL_MASK, 0);
>  		regmap_update_bits(gpr, IOMUXC_GPR1, IMX7D_GPR1_ENET_CLK_DIR_MASK, 0);
> +		regmap_update_bits(gpr, IOMUXC_GPR1, IMX7D_GPR1_ENET2_TX_CLK_SEL_MASK, 0);
> +		regmap_update_bits(gpr, IOMUXC_GPR1, IMX7D_GPR1_ENET2_CLK_DIR_MASK,
> +				   IMX7D_GPR1_ENET2_CLK_DIR_MASK);

I would like to see such code get removed from machine code rather than
added.  Can we deal with these IOMUXC_GPR bits in some driver code?

Shawn

>  	} else {
>  		pr_err("failed to find fsl,imx7d-iomux-gpr regmap\n");
>  	}
> -- 
> 2.27.0
>
Steffen Trumtrar Aug. 24, 2020, 9:46 a.m. UTC | #2
Hi!

Shawn Guo <shawnguo@kernel.org> writes:

> On Tue, Jul 14, 2020 at 07:11:37AM +0200, Steffen Trumtrar 
> wrote:
>> Add clock source init for the second ethernet port.
>> This changes the clock direction and clock selection in a way 
>> that the
>> ethernet phy reference clock is routed as an output.
>>
>> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
>> ---
>>  arch/arm/mach-imx/mach-imx7d.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/arch/arm/mach-imx/mach-imx7d.c 
>> b/arch/arm/mach-imx/mach-imx7d.c
>> index 879c35929a13..7a203f660721 100644
>> --- a/arch/arm/mach-imx/mach-imx7d.c
>> +++ b/arch/arm/mach-imx/mach-imx7d.c
>> @@ -65,6 +65,9 @@ static void __init imx7d_enet_clk_sel(void)
>>  	if (!IS_ERR(gpr)) {
>>  		regmap_update_bits(gpr, IOMUXC_GPR1, 
>>  IMX7D_GPR1_ENET_TX_CLK_SEL_MASK, 0);
>>  		regmap_update_bits(gpr, IOMUXC_GPR1, 
>>  IMX7D_GPR1_ENET_CLK_DIR_MASK, 0);
>> +		regmap_update_bits(gpr, IOMUXC_GPR1, 
>> IMX7D_GPR1_ENET2_TX_CLK_SEL_MASK, 0);
>> +		regmap_update_bits(gpr, IOMUXC_GPR1, 
>> IMX7D_GPR1_ENET2_CLK_DIR_MASK,
>> +				   IMX7D_GPR1_ENET2_CLK_DIR_MASK);
>
> I would like to see such code get removed from machine code 
> rather than
> added.  Can we deal with these IOMUXC_GPR bits in some driver 
> code?
>

My comment got lost in the v2:

   I know, that this is not a "good solution", but I don't know 
   how we can
   handle this in a better way. Open for suggestions.

Of course, putting it in the machine code is suboptimal. If anyone 
has a good idea where the 4 gpr1 calls should go without producing 
a massive complexity overhead, please share.


Best regards,
Steffen

--
Pengutronix e.K.                | Dipl.-Inform. Steffen Trumtrar |
Steuerwalder Str. 21            | https://www.pengutronix.de/    |
31137 Hildesheim, Germany       | Phone: +49-5121-206917-0       |
Amtsgericht Hildesheim, HRA 2686| Fax:   +49-5121-206917-5555    |
diff mbox series

Patch

diff --git a/arch/arm/mach-imx/mach-imx7d.c b/arch/arm/mach-imx/mach-imx7d.c
index 879c35929a13..7a203f660721 100644
--- a/arch/arm/mach-imx/mach-imx7d.c
+++ b/arch/arm/mach-imx/mach-imx7d.c
@@ -65,6 +65,9 @@  static void __init imx7d_enet_clk_sel(void)
 	if (!IS_ERR(gpr)) {
 		regmap_update_bits(gpr, IOMUXC_GPR1, IMX7D_GPR1_ENET_TX_CLK_SEL_MASK, 0);
 		regmap_update_bits(gpr, IOMUXC_GPR1, IMX7D_GPR1_ENET_CLK_DIR_MASK, 0);
+		regmap_update_bits(gpr, IOMUXC_GPR1, IMX7D_GPR1_ENET2_TX_CLK_SEL_MASK, 0);
+		regmap_update_bits(gpr, IOMUXC_GPR1, IMX7D_GPR1_ENET2_CLK_DIR_MASK,
+				   IMX7D_GPR1_ENET2_CLK_DIR_MASK);
 	} else {
 		pr_err("failed to find fsl,imx7d-iomux-gpr regmap\n");
 	}