Hi,all
I have been blocked at this problem for one month. And i have found that if i build the driver in module and insert---remove----insert it,the ethernet phy will work well.It's something wrong with the initial of phy. The second phy can not be detected in the function 'fec_enet_mii_probe' of 'fec_main.c ' when first init the ethernet.
phy_dev = of_phy_connect(ndev, fep->phy_node,
&fec_enet_adjust_link, 0,
fep->phy_interface);
if (!phy_dev)
return -ENODEV;
and in function 'fec_enet_mii_init' of 'fec_main.c', it say that:
/*
* The i.MX28 dual fec interfaces are not equal.
* Here are the differences:
*
* - fec0 supports MII & RMII modes while fec1 only supports RMII
* - fec0 acts as the 1588 time master while fec1 is slave
* - external phys can only be configured by fec0
*
* That is to say fec1 can not work independently. It only works
* when fec0 is working. The reason behind this design is that the
* second interface is added primarily for Switch mode.
*
* Because of the last point above, both phys are attached on fec0
* mdio interface in board design, and need to be configured by
* fec0 mii_bus.
*/
But in dts file, mdio gpio is defined at fec2 not fec1.
pinctrl_enet1: enet1grp {
fsl,pins = <
//MX6UL_PAD_GPIO1_IO07__ENET1_MDC 0x1b0b0
//MX6UL_PAD_GPIO1_IO06__ENET1_MDIO 0x1b0b0
MX6UL_PAD_ENET1_RX_EN__ENET1_RX_EN 0x1b0b0
MX6UL_PAD_ENET1_RX_ER__ENET1_RX_ER 0x1b0b0
MX6UL_PAD_ENET1_RX_DATA0__ENET1_RDATA00 0x1b0b0
MX6UL_PAD_ENET1_RX_DATA1__ENET1_RDATA01 0x1b0b0
MX6UL_PAD_ENET1_TX_EN__ENET1_TX_EN 0x1b0b0
MX6UL_PAD_ENET1_TX_DATA0__ENET1_TDATA00 0x1b0b0
MX6UL_PAD_ENET1_TX_DATA1__ENET1_TDATA01 0x1b0b0
MX6UL_PAD_ENET1_TX_CLK__ENET1_REF_CLK1 0x4001b011
MX6UL_PAD_GPIO1_IO04__GPIO1_IO04 0xb0 /* ethet1 reset */
MX6UL_PAD_GPIO1_IO08__GPIO1_IO08 0x11 /* ethet1 interrupt */
>;
};
pinctrl_enet2: enet2grp {
fsl,pins = <
MX6UL_PAD_GPIO1_IO07__ENET2_MDC 0x1b0b0
MX6UL_PAD_GPIO1_IO06__ENET2_MDIO 0x1b0b0
MX6UL_PAD_ENET2_RX_EN__ENET2_RX_EN 0x1b0b0
MX6UL_PAD_ENET2_RX_ER__ENET2_RX_ER 0x1b0b0
MX6UL_PAD_ENET2_RX_DATA0__ENET2_RDATA00 0x1b0b0
MX6UL_PAD_ENET2_RX_DATA1__ENET2_RDATA01 0x1b0b0
MX6UL_PAD_ENET2_TX_EN__ENET2_TX_EN 0x1b0b0
MX6UL_PAD_ENET2_TX_DATA0__ENET2_TDATA00 0x1b0b0
MX6UL_PAD_ENET2_TX_DATA1__ENET2_TDATA01 0x1b0b0
MX6UL_PAD_ENET2_TX_CLK__ENET2_REF_CLK2 0x4001b011
MX6UL_PAD_GPIO1_IO03__GPIO1_IO03 0xb0 /* ethet2 reset */
MX6UL_PAD_GPIO1_IO09__GPIO1_IO09 0x11 /* ethet2 interrupt */
>;
};
If i defined it in fec1 and adjust like this:
&fec1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_enet1>;
phy-reset-gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>;
phy-reset-duration = <5>;
phy-mode = "rmii";
phy-handle = <ðphy0>;
status = "okay";
mdio {
#address-cells = <1>;
#size-cells = <0>;
ethphy0: ethernet-phy@1 {
compatible = "ethernet-phy-ieee802.3-c22";
reg = <1>;
};
ethphy1: ethernet-phy@0 {
compatible = "ethernet-phy-ieee802.3-c22";
reg = <0>;
};
};
};
&fec2 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_enet2>;
phy-reset-gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>;
phy-reset-duration = <5>;
phy-mode = "rmii";
phy-handle = <ðphy1>;
status = "okay";
};
The device will have eth0/eth1 in ' ifconfig -a ' ,but can not be used, report that
root@imx6ul7d:~# dmesg |grep -i eth0
fec 20b4000.ethernet eth0: registered PHC device 0
root@imx6ul7d:~# dmesg |grep -i eth1
fec 2188000.ethernet eth1: registered PHC device 1
root@imx6ul7d:~# ifconfig eth0 up
ifconfig: SIOCSIFFLAGS: No such device
root@imx6ul7d:~# ifconfig eth1 up
ifconfig: SIOCSIFFLAGS: No such device
I have no ideas how to adjust the drivers to make the power-up sequence right. Can anyone give suggestion about this? Thanks!
Hi Mingyang
one can try second fec using procedure described below for i.MX28 EVK and L2.6.35
Submit i.MX53 & i.MX28 Linux kernel patches
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------