2 * Copyright (C) 2015 Freescale Semiconductor, Inc.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
8 #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>
12 #include <linux/of_platform.h>
13 #include <linux/phy.h>
14 #include <linux/regmap.h>
15 #include <asm/mach/arch.h>
16 #include <asm/mach/map.h>
20 static void __init
imx6ul_enet_clk_init(void)
24 gpr
= syscon_regmap_lookup_by_compatible("fsl,imx6ul-iomuxc-gpr");
26 regmap_update_bits(gpr
, IOMUXC_GPR1
, IMX6UL_GPR1_ENET_CLK_DIR
,
27 IMX6UL_GPR1_ENET_CLK_OUTPUT
);
29 pr_err("failed to find fsl,imx6ul-iomux-gpr regmap\n");
33 static int ksz8081_phy_fixup(struct phy_device
*dev
)
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);
46 static void __init
imx6ul_enet_phy_init(void)
48 if (IS_BUILTIN(CONFIG_PHYLIB
))
49 phy_register_fixup_for_uid(PHY_ID_KSZ8081
, 0xffffffff,
53 static inline void imx6ul_enet_init(void)
55 imx6ul_enet_clk_init();
56 imx6ul_enet_phy_init();
59 static void __init
imx6ul_init_machine(void)
61 struct device
*parent
;
63 parent
= imx_soc_device_init();
65 pr_warn("failed to initialize soc device\n");
67 of_platform_populate(NULL
, of_default_bus_match_table
, NULL
, NULL
);
72 static void __init
imx6ul_init_irq(void)
74 imx_init_revision_from_anatop();
79 static const char *imx6ul_dt_compat
[] __initconst
= {
84 DT_MACHINE_START(IMX6UL
, "Freescale i.MX6 Ultralite (Device Tree)")
85 .init_irq
= imx6ul_init_irq
,
86 .init_machine
= imx6ul_init_machine
,
87 .dt_compat
= imx6ul_dt_compat
,