]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ARM: imx: fix vf610 enet module clock selection
authorShawn Guo <shawn.guo@freescale.com>
Wed, 10 Jul 2013 06:05:44 +0000 (14:05 +0800)
committerJason Liu <r64343@freescale.com>
Wed, 30 Oct 2013 01:53:43 +0000 (09:53 +0800)
The fec/enet driver calculates MDC rate with the formula below.

  ref_freq / ((MII_SPEED + 1) x 2)

The ref_freq here is the fec internal module clock, which is missing
from clk-vf610 clock driver right now.  And clk-vf610 driver mistakenly
supplies RMII clock (50 MHz) as the source to fec.  This results in the
situation that fec driver gets ref_freq as 50 MHz, while physically it
runs at 66 MHz (fec module clock physically sources from ipg which runs
at 66 MHz).  That's why software expects MDC runs at 2.5 MHz, while the
measurement tells it runs at 3.3 MHz.  And this causes the PHY KSZ8041
keeps swithing between Full and Half mode as below.

  libphy: 400d0000.etherne:00 - Link is Up - 100/Full
  libphy: 400d0000.etherne:00 - Link is Up - 100/Half
  libphy: 400d0000.etherne:00 - Link is Up - 100/Full
  libphy: 400d0000.etherne:00 - Link is Up - 100/Half
  libphy: 400d0000.etherne:00 - Link is Up - 100/Full
  libphy: 400d0000.etherne:00 - Link is Up - 100/Half

Add the missing module clock for ENET0 and ENET1, and correct the clock
supplying in device tree to fix above issue.

Thanks to Alison Wang <b18965@freescale.com> for debugging the issue.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
arch/arm/boot/dts/vf610.dtsi
arch/arm/mach-imx/clk-vf610.c
include/dt-bindings/clock/vf610-clock.h

index 659d845b86008e0703b09df2d80b86fc1f146eb8..0c783afd4e7c0720b12debcc4c89ec524e8c97bd 100644 (file)
                                compatible = "fsl,mvf600-fec";
                                reg = <0x400d0000 0x1000>;
                                interrupts = <0 78 0x04>;
-                               clocks = <&clks VF610_CLK_ENET>,
-                                       <&clks VF610_CLK_ENET>,
+                               clocks = <&clks VF610_CLK_ENET0>,
+                                       <&clks VF610_CLK_ENET0>,
                                        <&clks VF610_CLK_ENET>;
                                clock-names = "ipg", "ahb", "ptp";
                                status = "disabled";
                                compatible = "fsl,mvf600-fec";
                                reg = <0x400d1000 0x1000>;
                                interrupts = <0 79 0x04>;
-                               clocks = <&clks VF610_CLK_ENET>,
-                                       <&clks VF610_CLK_ENET>,
+                               clocks = <&clks VF610_CLK_ENET1>,
+                                       <&clks VF610_CLK_ENET1>,
                                        <&clks VF610_CLK_ENET>;
                                clock-names = "ipg", "ahb", "ptp";
                                status = "disabled";
index d617c0b7c8095f23c3273c86aadd5421ad0d29d0..b169a396d93bfcf193c83d7329a6fdc290101425 100644 (file)
@@ -183,6 +183,8 @@ static void __init vf610_clocks_init(struct device_node *ccm_node)
        clk[VF610_CLK_ENET_TS_SEL] = imx_clk_mux("enet_ts_sel", CCM_CSCMR2, 0, 3, enet_ts_sels, 7);
        clk[VF610_CLK_ENET] = imx_clk_gate("enet", "enet_sel", CCM_CSCDR1, 24);
        clk[VF610_CLK_ENET_TS] = imx_clk_gate("enet_ts", "enet_ts_sel", CCM_CSCDR1, 23);
+       clk[VF610_CLK_ENET0] = imx_clk_gate2("enet0", "ipg_bus", CCM_CCGR9, CCM_CCGRx_CGn(0));
+       clk[VF610_CLK_ENET1] = imx_clk_gate2("enet1", "ipg_bus", CCM_CCGR9, CCM_CCGRx_CGn(1));
 
        clk[VF610_CLK_PIT] = imx_clk_gate2("pit", "ipg_bus", CCM_CCGR1, CCM_CCGRx_CGn(7));
 
index 15e997fa78f24d9822defea3d2eb097b088580e7..daa42278fef7e0f146e4ad558616f8c38b8e95e6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2013 Freescale Semiconductor, Inc.
+ * Copyright (C) 2013 Freescale Semiconductor, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #define VF610_CLK_GPU_SEL              145
 #define VF610_CLK_GPU_EN               146
 #define VF610_CLK_GPU2D                        147
-#define VF610_CLK_END                  148
+#define VF610_CLK_ENET0                        148
+#define VF610_CLK_ENET1                        149
+#define VF610_CLK_END                  150
 
 #endif /* __DT_BINDINGS_CLOCK_VF610_H */