【imx6ul】系统移植之修改LAN8720的RESET管脚

1、修改网卡LAN8720的复位管脚

1.1 uboot的修改

uboot/board/freescale/mx6ul_14x14_evk$/mx6ul_14x14_evk.c

#ifdef CONFIG_FEC_MXC
/*
 * pin conflicts for fec1 and fec2, GPIO1_IO06 and GPIO1_IO07 can only
 * be used for ENET1 or ENET2, cannot be used for both.
 */
static iomux_v3_cfg_t const fec1_pads[] = {
        MX6_PAD_GPIO1_IO06__ENET1_MDIO | MUX_PAD_CTRL(MDIO_PAD_CTRL),
        MX6_PAD_GPIO1_IO07__ENET1_MDC | MUX_PAD_CTRL(ENET_PAD_CTRL),
        MX6_PAD_ENET1_TX_DATA0__ENET1_TDATA00 | MUX_PAD_CTRL(ENET_PAD_CTRL),
        MX6_PAD_ENET1_TX_DATA1__ENET1_TDATA01 | MUX_PAD_CTRL(ENET_PAD_CTRL),
        MX6_PAD_ENET1_TX_EN__ENET1_TX_EN | MUX_PAD_CTRL(ENET_PAD_CTRL),
        MX6_PAD_ENET1_TX_CLK__ENET1_REF_CLK1 | MUX_PAD_CTRL(ENET_CLK_PAD_CTRL),
        MX6_PAD_ENET1_RX_DATA0__ENET1_RDATA00 | MUX_PAD_CTRL(ENET_PAD_CTRL),
        MX6_PAD_ENET1_RX_DATA1__ENET1_RDATA01 | MUX_PAD_CTRL(ENET_PAD_CTRL),
        MX6_PAD_ENET1_RX_ER__ENET1_RX_ER | MUX_PAD_CTRL(ENET_PAD_CTRL),
        MX6_PAD_ENET1_RX_EN__ENET1_RX_EN | MUX_PAD_CTRL(ENET_PAD_CTRL),
    /* PHY Reset */
        MX6_PAD_GPIO1_IO08__GPIO1_IO08 | MUX_PAD_CTRL(NO_PAD_CTRL),
};


static void setup_iomux_fec(int fec_id)
{
        if (fec_id == 0){
                imx_iomux_v3_setup_multiple_pads(fec1_pads,
                                                 ARRAY_SIZE(fec1_pads));
        /* Reset the PHY */
        gpio_direction_output(IMX_GPIO_NR(1, 8) , 0);
        udelay(500);
        gpio_direction_output(IMX_GPIO_NR(1, 8) , 1);
    }else
                imx_iomux_v3_setup_multiple_pads(fec2_pads,
                                                 ARRAY_SIZE(fec2_pads));
}

1.2 内核设备树修改

Linux/arch/arm/boot/dts/imx6ul-14x14-evk.dts


&fec1 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_enet1>;
        phy-mode = "rmii";
        phy-handle = <ðphy0>;
        phy-reset-gpios = <&gpio1 8 GPIO_ACTIVE_LOW>;
        phy-reset-duration = <1>;
        status = "okay";

    mdio {
                #address-cells = <1>;
                #size-cells = <0>;

                ethphy0: ethernet-phy@0 {
                        compatible = "ethernet-phy-ieee802.3-c22";
                        reg = <0>;
                };
                ethphy1: ethernet-phy@1 {
                        compatible = "ethernet-phy-ieee802.3-c22";
                        reg = <1>;
                };
        };

};

linux-3.14.38/drivers/net/ethernet/freescale/

https://blog.csdn.net/xswy1/article/details/80690136

https://blog.csdn.net/Foverve1/article/details/89359326

https://blog.csdn.net/bzw073/article/details/42519791

https://blog.csdn.net/a746742897/article/details/53321313

https://blog.csdn.net/qq_37375427/article/details/79010839

https://blog.csdn.net/huan447882949/article/details/79769641

你可能感兴趣的:(imx6ul)