Add fec1 and fec2 support for i.MX7d sdb board
Subsystems (5)
v3 cover Add fec1 and fec2 support for i.MX7d sdb board
The patch series is to add fec support for i.MX7d sdb board. Since i.MX7d fec ip is the same as i.MX6SX, so there have no change for driver itself.
Patch#1: add new iomux-gpr file to define iomux-gpr register and field for i.MX7d. Patch#2: i.MX7d sdb board install bcm54220 phy, i.MX7d arm2 board install AR8031 phy.
For the two phys, there needs extra phy setting, so package the setting to fixup.
Patch#3~4: Add fec dts node and pinmux setting in dts file.
Since the patch series drop i.MX7d pinfunc patch, and also depend on the pinfunc patch. So pls apply the patch series after Adrian's patch: http://article.gmane.org/gmane.linux.kernel.gpio/10398/match=
Change:
V3:
* Drop patch "ARM: dts: imx: pinfunc: add GPIO1 pin define for i.MX7d" that was also submitted by
Adrian: http://article.gmane.org/gmane.linux.kernel.gpio/10398/match=
* Modify some slice as Shawn's comments.
V2:
* Remove patch#1 in V1 patch series. Move the sigle BCM54220 PHY ID define to machine file.
* The current BCM54220 switch phy still use generic phy driver since broadcom phy driver don't support the switch phy, there need effort to add the switch phy support. Once broadcom phy driver will support the bcm54220 switch phy, we can add the special config to imx_v6_v7_defconfig.
Fugang Duan (4):
ARM: imx7d: add imx7d iomux-gpr field define
ARM: imx: add enet init for i.MX7D platform
ARM: dts: imx7d: add fec1 and fec2 support for i.MX7d soc
ARM: dts: imx7d-sdb: add fec1 and fec2 support
arch/arm/boot/dts/imx7d-sdb.dts | 76 +++++++++++++++++++++++++++++- arch/arm/boot/dts/imx7d.dtsi | 36 ++++++++++++++ arch/arm/mach-imx/mach-imx7d.c | 74 +++++++++++++++++++++++++++++ include/linux/mfd/syscon/imx7-iomuxc-gpr.h | 47 ++++++++++++++++++ 4 files changed, 232 insertions(+), 1 deletion(-) create mode 100644 include/linux/mfd/syscon/imx7-iomuxc-gpr.h
Signature · 1 line
1.9.1
PATCH v3 1/4 ARM: imx7d: add imx7d iomux-gpr field define
Add imx7d iomux-gpr field define.
--- include/linux/mfd/syscon/imx7-iomuxc-gpr.h | 47 ++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+)
include/linux/mfd/syscon/imx7-iomuxc-gpr.h new file +47 -0
@@ -0,0 +1,47 @@ +/* +* Copyright (C) 2015 Freescale Semiconductor, Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef __LINUX_IMX7_IOMUXC_GPR_H +#define __LINUX_IMX7_IOMUXC_GPR_H + +#define IOMUXC_GPR0 0x00 +#define IOMUXC_GPR1 0x04 +#define IOMUXC_GPR2 0x08 +#define IOMUXC_GPR3 0x0c +#define IOMUXC_GPR4 0x10 +#define IOMUXC_GPR5 0x14 +#define IOMUXC_GPR6 0x18 +#define IOMUXC_GPR7 0x1c +#define IOMUXC_GPR8 0x20 +#define IOMUXC_GPR9 0x24 +#define IOMUXC_GPR10 0x28 +#define IOMUXC_GPR11 0x2c +#define IOMUXC_GPR12 0x30 +#define IOMUXC_GPR13 0x34 +#define IOMUXC_GPR14 0x38 +#define IOMUXC_GPR15 0x3c +#define IOMUXC_GPR16 0x40 +#define IOMUXC_GPR17 0x44 +#define IOMUXC_GPR18 0x48 +#define IOMUXC_GPR19 0x4c +#define IOMUXC_GPR20 0x50 +#define IOMUXC_GPR21 0x54 +#define IOMUXC_GPR22 0x58 + +/* For imx7d iomux gpr register field define */ +#define IMX7D_GPR1_IRQ_MASK (0x1 << 12) +#define IMX7D_GPR1_ENET1_TX_CLK_SEL_MASK (0x1 << 13) +#define IMX7D_GPR1_ENET2_TX_CLK_SEL_MASK (0x1 << 14) +#define IMX7D_GPR1_ENET_TX_CLK_SEL_MASK (0x3 << 13) +#define IMX7D_GPR1_ENET1_CLK_DIR_MASK (0x1 << 17) +#define IMX7D_GPR1_ENET2_CLK_DIR_MASK (0x1 << 18) +#define IMX7D_GPR1_ENET_CLK_DIR_MASK (0x3 << 17) + +#define IMX7D_GPR5_CSI_MUX_CONTROL_MIPI (0x1 << 4) + +#endif /* __LINUX_IMX7_IOMUXC_GPR_H */
Signature · 1 line
1.9.1
PATCH v3 2/4 ARM: imx: add enet init for i.MX7D platform
In reply to Fugang DuanAdd enet phy fixup, clock source init for i.MX7D platform.
--- arch/arm/mach-imx/mach-imx7d.c | 74 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+)
arch/arm/mach-imx/mach-imx7d.c +74 -0
@@ -6,12 +6,85 @@* published by the Free Software Foundation. */ #include <linux/irqchip.h> +#include <linux/mfd/syscon.h> +#include <linux/mfd/syscon/imx7-iomuxc-gpr.h> #include <linux/of_platform.h> +#include <linux/phy.h> +#include <linux/regmap.h> +#include <asm/mach/arch.h> #include <asm/mach/map.h> #include "common.h" +static int ar8031_phy_fixup (struct phy_device *dev) +{ +u16 val; + +/* Set RGMII IO voltage to 1.8V */ +phy_write (dev,0x1d ,0x1f ); +phy_write (dev,0x1e ,0x8 ); + +/* disable phy AR8031 SmartEEE function. */ +phy_write (dev,0xd ,0x3 ); +phy_write (dev,0xe ,0x805d ); +phy_write (dev,0xd ,0x4003 ); + val =phy_read (dev,0xe ); + val &= ~(0x1 <<8 ); +phy_write (dev,0xe , val); + +/* introduce tx clock delay */ +phy_write (dev,0x1d ,0x5 ); + val =phy_read (dev,0x1e ); + val |=0x0100 ; +phy_write (dev,0x1e , val); + +return 0 ; +} + +static int bcm54220_phy_fixup (struct phy_device *dev) +{ +/* enable RXC skew select RGMII copper mode */ +phy_write (dev,0x1e ,0x21 ); +phy_write (dev,0x1f ,0x7ea8 ); +phy_write (dev,0x1e ,0x2f ); +phy_write (dev,0x1f ,0x71b7 ); + +return 0 ; +} + +#define PHY_ID_AR8031 0x004dd074 +#define PHY_ID_BCM54220 0x600d8589 + +static void __init imx7d_enet_phy_init (void ) +{ +if (IS_BUILTIN (CONFIG_PHYLIB )) { +phy_register_fixup_for_uid (PHY_ID_AR8031 ,0xffffffff , + ar8031_phy_fixup); +phy_register_fixup_for_uid (PHY_ID_BCM54220 ,0xffffffff , + bcm54220_phy_fixup); + } +} + +static void __init imx7d_enet_clk_sel (void ) +{ +struct regmap *gpr; + + gpr =syscon_regmap_lookup_by_compatible ("fsl,imx7d-iomuxc-gpr" ); +if (!IS_ERR (gpr)) { +regmap_update_bits (gpr,IOMUXC_GPR1 ,IMX7D_GPR1_ENET_TX_CLK_SEL_MASK ,0 ); +regmap_update_bits (gpr,IOMUXC_GPR1 ,IMX7D_GPR1_ENET_CLK_DIR_MASK ,0 ); + }else { +pr_err ("failed to find fsl,imx7d-iomux-gpr regmap\n" ); + } +} + +static inline void imx7d_enet_init (void ) +{ +imx7d_enet_phy_init (); +imx7d_enet_clk_sel (); +} +static void __init imx7d_init_machine (void ) {struct device *parent;
@@ -22,6 +95,7 @@ static void __init imx7d_init_machine(void)of_platform_populate (NULL , of_default_bus_match_table,NULL ,NULL );imx_anatop_init (); +imx7d_enet_init (); }static void __init imx7d_init_irq (void )
Signature · 1 line
1.9.1
PATCH v3 3/4 ARM: dts: imx7d: add fec1 and fec2 support for i.MX7d soc
In reply to Fugang DuanAdd fec1 and fec2 nodes for i.MX7d soc.
--- arch/arm/boot/dts/imx7d.dtsi | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
arch/arm/boot/dts/imx7d.dtsi +36 -0
@@ -729,6 +729,42 @@ bus-width = <4>; status = "disabled"; }; + + fec1: ethernet at 30be0000 { + compatible = "fsl,imx7d-fec", "fsl,imx6sx-fec"; + reg = <0x30be0000 0x10000>; + interrupts = <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clks IMX7D_ENET_AXI_ROOT_CLK>, + <&clks IMX7D_ENET_AXI_ROOT_CLK>, + <&clks IMX7D_ENET1_TIME_ROOT_CLK>, + <&clks IMX7D_PLL_ENET_MAIN_125M_CLK>, + <&clks IMX7D_ENET_PHY_REF_ROOT_CLK>; + clock-names = "ipg", "ahb", "ptp", + "enet_clk_ref", "enet_out"; + fsl,num-tx-queues=<3>; + fsl,num-rx-queues=<3>; + status = "disabled"; + }; + + fec2: ethernet at 30bf0000 { + compatible = "fsl,imx7d-fec", "fsl,imx6sx-fec"; + reg = <0x30bf0000 0x10000>; + interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clks IMX7D_ENET_AXI_ROOT_CLK>, + <&clks IMX7D_ENET_AXI_ROOT_CLK>, + <&clks IMX7D_ENET2_TIME_ROOT_CLK>, + <&clks IMX7D_PLL_ENET_MAIN_125M_CLK>, + <&clks IMX7D_ENET_PHY_REF_ROOT_CLK>; + clock-names = "ipg", "ahb", "ptp", + "enet_clk_ref", "enet_out"; + fsl,num-tx-queues=<3>; + fsl,num-rx-queues=<3>; + status = "disabled"; + }; }; }; };
Signature · 1 line
1.9.1
PATCH v3 4/4 ARM: dts: imx7d-sdb: add fec1 and fec2 support
In reply to Fugang DuanEnable fec1 and fec2 for i.MX7d-sdb board.
--- arch/arm/boot/dts/imx7d-sdb.dts | 76 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 75 insertions(+), 1 deletion(-)
arch/arm/boot/dts/imx7d-sdb.dts +75 -1
@@ -101,6 +101,45 @@ arm-supply = <&sw1a_reg>; }; +&fec1 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_enet1>; + assigned-clocks = <&clks IMX7D_ENET1_TIME_ROOT_SRC>, + <&clks IMX7D_ENET1_TIME_ROOT_CLK>; + assigned-clock-parents = <&clks IMX7D_PLL_ENET_MAIN_100M_CLK>; + assigned-clock-rates = <0>, <100000000>; + phy-mode = "rgmii"; + phy-handle = <ðphy0>; + fsl,magic-packet; + status = "okay"; + + mdio { + #address-cells = <1>; + #size-cells = <0>; + + ethphy0: ethernet-phy at 0 { + reg = <0>; + }; + + ethphy1: ethernet-phy at 1 { + reg = <1>; + }; + }; +}; + +&fec2 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_enet2>; + assigned-clocks = <&clks IMX7D_ENET2_TIME_ROOT_SRC>, + <&clks IMX7D_ENET2_TIME_ROOT_CLK>; + assigned-clock-parents = <&clks IMX7D_PLL_ENET_MAIN_100M_CLK>; + assigned-clock-rates = <0>, <100000000>; + phy-mode = "rgmii"; + phy-handle = <ðphy1>; + fsl,magic-packet; + status = "okay"; +}; + &i2c1 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_i2c1>;
@@ -246,6 +285,42 @@ pinctrl-0 = <&pinctrl_hog>; imx7d-sdb { + pinctrl_enet1: enet1grp { + fsl,pins = < + MX7D_PAD_GPIO1_IO10__ENET1_MDIO 0x3 + MX7D_PAD_GPIO1_IO11__ENET1_MDC 0x3 + MX7D_PAD_ENET1_RGMII_TXC__ENET1_RGMII_TXC 0x1 + MX7D_PAD_ENET1_RGMII_TD0__ENET1_RGMII_TD0 0x1 + MX7D_PAD_ENET1_RGMII_TD1__ENET1_RGMII_TD1 0x1 + MX7D_PAD_ENET1_RGMII_TD2__ENET1_RGMII_TD2 0x1 + MX7D_PAD_ENET1_RGMII_TD3__ENET1_RGMII_TD3 0x1 + MX7D_PAD_ENET1_RGMII_TX_CTL__ENET1_RGMII_TX_CTL 0x1 + MX7D_PAD_ENET1_RGMII_RXC__ENET1_RGMII_RXC 0x1 + MX7D_PAD_ENET1_RGMII_RD0__ENET1_RGMII_RD0 0x1 + MX7D_PAD_ENET1_RGMII_RD1__ENET1_RGMII_RD1 0x1 + MX7D_PAD_ENET1_RGMII_RD2__ENET1_RGMII_RD2 0x1 + MX7D_PAD_ENET1_RGMII_RD3__ENET1_RGMII_RD3 0x1 + MX7D_PAD_ENET1_RGMII_RX_CTL__ENET1_RGMII_RX_CTL 0x1 + >; + }; + + pinctrl_enet2: enet2grp { + fsl,pins = < + MX7D_PAD_EPDC_GDSP__ENET2_RGMII_TXC 0x1 + MX7D_PAD_EPDC_SDCE2__ENET2_RGMII_TD0 0x1 + MX7D_PAD_EPDC_SDCE3__ENET2_RGMII_TD1 0x1 + MX7D_PAD_EPDC_GDCLK__ENET2_RGMII_TD2 0x1 + MX7D_PAD_EPDC_GDOE__ENET2_RGMII_TD3 0x1 + MX7D_PAD_EPDC_GDRL__ENET2_RGMII_TX_CTL 0x1 + MX7D_PAD_EPDC_SDCE1__ENET2_RGMII_RXC 0x1 + MX7D_PAD_EPDC_SDCLK__ENET2_RGMII_RD0 0x1 + MX7D_PAD_EPDC_SDLE__ENET2_RGMII_RD1 0x1 + MX7D_PAD_EPDC_SDOE__ENET2_RGMII_RD2 0x1 + MX7D_PAD_EPDC_SDSHR__ENET2_RGMII_RD3 0x1 + MX7D_PAD_EPDC_SDCE0__ENET2_RGMII_RX_CTL 0x1 + >; + }; + pinctrl_hog: hoggrp { fsl,pins = < MX7D_PAD_UART3_CTS_B__GPIO4_IO7 0x14
@@ -281,7 +356,6 @@ >; }; - pinctrl_uart1: uart1grp { fsl,pins = < MX7D_PAD_UART1_TX_DATA__UART1_DCE_TX 0x79
Signature · 1 line
1.9.1
Shawn Guo
AppliedPATCH v3 4/4 ARM: dts: imx7d-sdb: add fec1 and fec2 support
Quoted 3 lines · Fugang Duan
Enable fec1 and fec2 for i.MX7d-sdb board.
Signed-off-by Fugang Duan <[email protected]>
Applied, thanks.
v3 cover Add fec1 and fec2 support for i.MX7d sdb board
In reply to Fugang DuanQuoted 4 lines · Fugang Duan
Fugang Duan (4):
ARM: imx7d: add imx7d iomux-gpr field define
ARM: imx: add enet init for i.MX7D platform
ARM: dts: imx7d: add fec1 and fec2 support for i.MX7d soc
Applied above 3.
Quoted 1 line
ARM: dts: imx7d-sdb: add fec1 and fec2 support
Will apply this one after the prerequisite is applied.
Shawn