The Fast Ethernet Controller (FEC) driver performs the full set of IEEE 802.3/Ethernet CSMA/CD media access control and channel interface functions. The FEC requires an external interface adapter and transceiver function to complete the interface to the Ethernet media. It supports half- or full-duplex operation on 10Mbps, 100Mbps, and 1000Mbps Ethernet networks.
The FEC driver supports the following features:
-
Half- and full-duplex operation
-
Link status change detection
-
Auto-negotiation (determines the network speed and half- or full-duplex operation)
-
Transmission of features such as automatic retransmission on collision and CRC generation
-
Statistics collection, such as transmit collisions, from the device
You can access the network adapter through the ifconfig
command.
The driver auto-probes the external adapter (PHY device).
Kernel configuration
You can manage Ethernet driver support through the kernel configuration option FEC Ethernet controller (CONFIG_FEC
).
These options are enabled as built-in on the ConnectCore 6 SBC kernel configuration file.
Kernel driver
The Ethernet driver for the ConnectCore 6 is located at drivers/net/ethernet/freescale/fec_main.c
.
Device tree bindings and customization
The i.MX6 Ethernet interface device tree binding is documented at Documentation/devicetree/bindings/net/fsl-fec.txt
.
The FEC interface is defined in the i.MX6 CPU, ConnectCore 6, and ConnectCore 6 SBC device tree files.
Definition of the FEC
fec: ethernet@2188000 {
compatible = "fsl,imx6q-fec";
reg = <0x02188000 0x4000>;
interrupt-names = "int0", "pps";
interrupts = <0 118 IRQ_TYPE_LEVEL_HIGH>,
<0 119 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clks IMX6QDL_CLK_ENET>,
<&clks IMX6QDL_CLK_ENET>,
<&clks IMX6QDL_CLK_ENET_REF>;
clock-names = "ipg", "ahb", "ptp";
stop-mode = <&gpr 0x34 27>;
fsl,wakeup_irq = <0>;
status = "disabled";
};
IOMUX configuration
enet {
pinctrl_enet: enet {
fsl,pins = <
MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0
MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0
MX6QDL_PAD_RGMII_TXC__RGMII_TXC 0x1b0b0
MX6QDL_PAD_RGMII_TD0__RGMII_TD0 0x1b0b0
MX6QDL_PAD_RGMII_TD1__RGMII_TD1 0x1b0b0
MX6QDL_PAD_RGMII_TD2__RGMII_TD2 0x1b0b0
MX6QDL_PAD_RGMII_TD3__RGMII_TD3 0x1b0b0
MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL 0x1b0b0
MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK 0x1b0b0
MX6QDL_PAD_RGMII_RXC__RGMII_RXC 0x1b0b0
MX6QDL_PAD_RGMII_RD0__RGMII_RD0 0x1b0b0
MX6QDL_PAD_RGMII_RD1__RGMII_RD1 0x1b0b0
MX6QDL_PAD_RGMII_RD2__RGMII_RD2 0x1b0b0
MX6QDL_PAD_RGMII_RD3__RGMII_RD3 0x1b0b0
MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x1b0b0
MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK 0x1b0b0
MX6QDL_PAD_ENET_TX_EN__GPIO1_IO28 0x1b0b0
MX6QDL_PAD_ENET_CRS_DV__GPIO1_IO25 0x1b0b0
>;
};
};
Ethernet enabling and PHY parameters
&fec {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_enet>;
phy-mode = "rgmii";
phy-reset-gpios = <&gpio1 25 GPIO_ACTIVE_HIGH>;
phy-reset-duration = <10>;
phy-reset-wait = <1>;
phy-supply = <&ldo4>;
fsl,magic-packet;
status = "okay";
};
MAC address
The MAC address of the i.MX6 Ethernet interface is programmed in the U-Boot environment (variable ethaddr
) on the ConnectCore 6 eMMC.
It is also printed on the module label.
U-Boot writes the MAC address in the ethaddr
environment variable into the fec
device tree node under the local-mac-address
property.
Known issues
-
The NXP i.MX6 CPU has a documented errata ERR004512 whereby the maximum performance of the Gigabit FEC is limited to 400Mbps (total for Tx and Rx).
-
The Micrel PHY KSZ9031 on the SBC carrier board may take between five and six seconds to auto-negotiate with Gigabit switches. To avoid this long delay during boot, the variable
$bootscript
is undefined by default and the auto bootscript feature does not run. To speed up the PHY’s auto-negotiation, you can:-
Use a 10/100 switch (not Gigabit).
-
Force the Micrel PHY to work as master during master/slave negotiation by setting the
$phy_mode
U-Boot environment variable tomaster
.
-
Ethernet user space usage
In the Linux system, the Ethernet interface is known as ethX
where X is a number, starting at 0, that indicates the interface index.
The Ethernet (FEC) driver exposes device data through the sysfs at /sys/class/net/ethX
.
You can configure the Ethernet settings (IP, netmask, and so on) using the configuration file /etc/network/interfaces
.
You can manually configure and bring the interface up/down using the ifconfig
program.