diff options
author | Max Krummenacher <max.krummenacher@toradex.com> | 2015-08-24 13:56:17 +0200 |
---|---|---|
committer | Max Krummenacher <max.krummenacher@toradex.com> | 2015-12-26 14:42:45 +0100 |
commit | 97f5120f2330550d500231b7bf27e7433fd31508 (patch) | |
tree | f6d889e6484411ecc3f0c123921bb4bd8d0d477b /arch | |
parent | ee4c5c4da3b32f65528a2d523ca4bce574dee3c5 (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.c | 16 |
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 bc3feecda24b..66609417eb8d 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" @@ -346,7 +348,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); @@ -886,8 +888,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 /* |