summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorMax Krummenacher <max.krummenacher@toradex.com>2015-08-24 13:56:17 +0200
committerMax Krummenacher <max.krummenacher@toradex.com>2015-08-24 14:32:22 +0200
commit3718b8f35c4e99b53ee0f695a8daa52fccfacbb1 (patch)
treee53edef6acf76bd5d5a6aa6e341f8cd5165aaec5 /arch
parentff60fe803b1b5e725456dd9fbfa6de90228c368d (diff)
clk-imx6q.c: set eth phy clock dependent on RMII/RGMII
Evaluate the device tree to find out about the used phy mode rather than using a hardcoded value of 125MHz valid for RGMII only.
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-imx/clk-imx6q.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/arch/arm/mach-imx/clk-imx6q.c b/arch/arm/mach-imx/clk-imx6q.c
index f0d80007677c..8669c9224c43 100644
--- a/arch/arm/mach-imx/clk-imx6q.c
+++ b/arch/arm/mach-imx/clk-imx6q.c
@@ -19,6 +19,8 @@
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
+#include <linux/of_net.h>
+#include <linux/phy.h>
#include <dt-bindings/clock/imx6qdl-clock.h>
#include "clk.h"
@@ -129,7 +131,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
{
struct device_node *np;
void __iomem *base;
- int i;
+ int i, phy_mode;
clk[IMX6QDL_CLK_DUMMY] = imx_clk_fixed("dummy", 0);
clk[IMX6QDL_CLK_CKIL] = imx_obtain_fixed_clock("ckil", 0);
@@ -568,8 +570,16 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
imx_clk_prepare_enable(clk[IMX6QDL_CLK_USBPHY2_GATE]);
}
- /*Set enet_ref clock to 125M to supply for RGMII tx_clk */
- clk_set_rate(clk[IMX6QDL_CLK_ENET_REF], 125000000);
+ /*Set enet_ref clock to 125M to supply for RGMII tx_clk or to 50M for RMII */
+ phy_mode = PHY_INTERFACE_MODE_RGMII;
+ np = of_find_node_by_name(NULL, "ethernet");
+ if (of_device_is_available(np))
+ phy_mode = of_get_phy_mode(np);
+ else {
+ phy_mode = PHY_INTERFACE_MODE_RGMII;
+ }
+ of_node_put(np);
+ clk_set_rate(clk[IMX6QDL_CLK_ENET_REF], phy_mode != PHY_INTERFACE_MODE_RMII ? 125000000 : 50000000);
#ifdef CONFIG_MX6_VPU_352M
/*