Skip to content

Commit 709bc06

Browse files
Fugang DuanShawn Guo
authored andcommitted
ARM: imx6ul: add fec MAC refrence clock and phy fixup init
Add FEC MAC refrence clock init. Add phy fixup init for i.MX6ul 14x14 evk board that installs KSZ8081 phy. For the phy, there needs extra phy fixup for MII and RMII mode. Signed-off-by: Fugang Duan <b38611@freescale.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
1 parent 9f55eb9 commit 709bc06

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

‎arch/arm/mach-imx/mach-imx6ul.c‎

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,54 @@
66
* published by the Free Software Foundation.
77
*/
88
#include <linux/irqchip.h>
9+
#include <linux/mfd/syscon.h>
10+
#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
11+
#include <linux/micrel_phy.h>
912
#include <linux/of_platform.h>
13+
#include <linux/phy.h>
14+
#include <linux/regmap.h>
1015
#include <asm/mach/arch.h>
1116
#include <asm/mach/map.h>
1217

1318
#include "common.h"
1419

20+
static void __init imx6ul_enet_clk_init(void)
21+
{
22+
struct regmap *gpr;
23+
24+
gpr = syscon_regmap_lookup_by_compatible("fsl,imx6ul-iomuxc-gpr");
25+
if (!IS_ERR(gpr))
26+
regmap_update_bits(gpr, IOMUXC_GPR1, IMX6UL_GPR1_ENET_CLK_DIR,
27+
IMX6UL_GPR1_ENET_CLK_OUTPUT);
28+
else
29+
pr_err("failed to find fsl,imx6ul-iomux-gpr regmap\n");
30+
31+
}
32+
33+
static int ksz8081_phy_fixup(struct phy_device *dev)
34+
{
35+
if (dev && dev->interface == PHY_INTERFACE_MODE_MII) {
36+
phy_write(dev, 0x1f, 0x8110);
37+
phy_write(dev, 0x16, 0x201);
38+
} else if (dev && dev->interface == PHY_INTERFACE_MODE_RMII) {
39+
phy_write(dev, 0x1f, 0x8190);
40+
phy_write(dev, 0x16, 0x202);
41+
}
42+
43+
return 0;
44+
}
45+
46+
static void __init imx6ul_enet_phy_init(void)
47+
{
48+
phy_register_fixup_for_uid(PHY_ID_KSZ8081, 0xffffffff, ksz8081_phy_fixup);
49+
}
50+
51+
static inline void imx6ul_enet_init(void)
52+
{
53+
imx6ul_enet_clk_init();
54+
imx6ul_enet_phy_init();
55+
}
56+
1557
static void __init imx6ul_init_machine(void)
1658
{
1759
struct device *parent;
@@ -21,6 +63,7 @@ static void __init imx6ul_init_machine(void)
2163
pr_warn("failed to initialize soc device\n");
2264

2365
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
66+
imx6ul_enet_init();
2467
imx_anatop_init();
2568
}
2669

0 commit comments

Comments
 (0)