diff options
Diffstat (limited to 'arch/arm/mach-imx/mach-imx6sx.c')
-rw-r--r-- | arch/arm/mach-imx/mach-imx6sx.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/mach-imx6sx.c b/arch/arm/mach-imx/mach-imx6sx.c index 4111c0fa8d09..7a96c6577234 100644 --- a/arch/arm/mach-imx/mach-imx6sx.c +++ b/arch/arm/mach-imx/mach-imx6sx.c | |||
@@ -8,12 +8,62 @@ | |||
8 | 8 | ||
9 | #include <linux/irqchip.h> | 9 | #include <linux/irqchip.h> |
10 | #include <linux/of_platform.h> | 10 | #include <linux/of_platform.h> |
11 | #include <linux/phy.h> | ||
12 | #include <linux/regmap.h> | ||
13 | #include <linux/mfd/syscon.h> | ||
14 | #include <linux/mfd/syscon/imx6q-iomuxc-gpr.h> | ||
11 | #include <asm/mach/arch.h> | 15 | #include <asm/mach/arch.h> |
12 | #include <asm/mach/map.h> | 16 | #include <asm/mach/map.h> |
13 | 17 | ||
14 | #include "common.h" | 18 | #include "common.h" |
15 | #include "cpuidle.h" | 19 | #include "cpuidle.h" |
16 | 20 | ||
21 | static int ar8031_phy_fixup(struct phy_device *dev) | ||
22 | { | ||
23 | u16 val; | ||
24 | |||
25 | /* Set RGMII IO voltage to 1.8V */ | ||
26 | phy_write(dev, 0x1d, 0x1f); | ||
27 | phy_write(dev, 0x1e, 0x8); | ||
28 | |||
29 | /* introduce tx clock delay */ | ||
30 | phy_write(dev, 0x1d, 0x5); | ||
31 | val = phy_read(dev, 0x1e); | ||
32 | val |= 0x0100; | ||
33 | phy_write(dev, 0x1e, val); | ||
34 | |||
35 | return 0; | ||
36 | } | ||
37 | |||
38 | #define PHY_ID_AR8031 0x004dd074 | ||
39 | static void __init imx6sx_enet_phy_init(void) | ||
40 | { | ||
41 | if (IS_BUILTIN(CONFIG_PHYLIB)) | ||
42 | phy_register_fixup_for_uid(PHY_ID_AR8031, 0xffffffff, | ||
43 | ar8031_phy_fixup); | ||
44 | } | ||
45 | |||
46 | static void __init imx6sx_enet_clk_sel(void) | ||
47 | { | ||
48 | struct regmap *gpr; | ||
49 | |||
50 | gpr = syscon_regmap_lookup_by_compatible("fsl,imx6sx-iomuxc-gpr"); | ||
51 | if (!IS_ERR(gpr)) { | ||
52 | regmap_update_bits(gpr, IOMUXC_GPR1, | ||
53 | IMX6SX_GPR1_FEC_CLOCK_MUX_SEL_MASK, 0); | ||
54 | regmap_update_bits(gpr, IOMUXC_GPR1, | ||
55 | IMX6SX_GPR1_FEC_CLOCK_PAD_DIR_MASK, 0); | ||
56 | } else { | ||
57 | pr_err("failed to find fsl,imx6sx-iomux-gpr regmap\n"); | ||
58 | } | ||
59 | } | ||
60 | |||
61 | static inline void imx6sx_enet_init(void) | ||
62 | { | ||
63 | imx6sx_enet_phy_init(); | ||
64 | imx6sx_enet_clk_sel(); | ||
65 | } | ||
66 | |||
17 | static void __init imx6sx_init_machine(void) | 67 | static void __init imx6sx_init_machine(void) |
18 | { | 68 | { |
19 | struct device *parent; | 69 | struct device *parent; |
@@ -24,6 +74,7 @@ static void __init imx6sx_init_machine(void) | |||
24 | 74 | ||
25 | of_platform_populate(NULL, of_default_bus_match_table, NULL, parent); | 75 | of_platform_populate(NULL, of_default_bus_match_table, NULL, parent); |
26 | 76 | ||
77 | imx6sx_enet_init(); | ||
27 | imx_anatop_init(); | 78 | imx_anatop_init(); |
28 | imx6sx_pm_init(); | 79 | imx6sx_pm_init(); |
29 | } | 80 | } |