LAN8720A and imx6ul

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LAN8720A and imx6ul

2,343 Views
tanvi_desai
Contributor I

Hello,

I configured a LAN8720 phy with imx6UL custom board and it is working fine in kernel but in u-boot it is showing following error:

Net: FEC MXC: board_eth_init:failed
Board Net Initialization Failed
No ethernet found.

I did following configuration in u-boot:

imx6ulevk.c

#define ENET_PAD_CTRL ( PAD_CTL_SRE_SLOW | PAD_CTL_SPEED_MED | \
PAD_CTL_HYS | PAD_CTL_PUS_100K_UP | \
PAD_CTL_DSE_40ohm )

#define ENET_CLK_PAD_CTRL ( PAD_CTL_SRE_FAST | PAD_CTL_DSE_40ohm | \
PAD_CTL_SPEED_MED | \
PAD_CTL_PUS_100K_UP | PAD_CTL_HYS )

static iomux_v3_cfg_t const fec1_pads[] = {
MX6_PAD_ENET2_RX_DATA0__ENET1_MDIO | MUX_PAD_CTRL(ENET_PAD_CTRL),
MX6_PAD_ENET2_RX_DATA1__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),
MX6_PAD_SNVS_TAMPER6__GPIO5_IO06 | MUX_PAD_CTRL(ENET_PAD_CTRL),
MX6_PAD_SNVS_TAMPER5__GPIO5_IO05 | MUX_PAD_CTRL(ENET_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));
}
else
printf("Warning: FEC ID 2 is NOT supported on J2 Board\n");
}

int board_eth_init(bd_t *bis){
struct iomuxc *const iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
int reg,ret;

setup_iomux_fec(0);
gpio_direction_output(IMX_GPIO_NR(5, 6) , 0);

reg = readl(&iomuxc_regs->gpr[1]);
reg |= IOMUXC_GPR1_ENET_CLK_SEL_MASK;
writel(reg, &iomuxc_regs->gpr[1]);

ret = enable_fec_anatop_clock(0, ENET_50MHZ);
if (ret)
return ret;

enable_enet_clk(1);

mdelay(30);
gpio_set_value(IMX_GPIO_NR(5, 6), 1);

ret = cpu_eth_init(bis);
if (ret)
printf("FEC MXC: %s:failed\n", __func__);

return ret;
}

int board_phy_config(struct phy_device *phydev){
if (phydev->drv->config)
phydev->drv->config(phydev);

return 0;
}

imx6ulevk.h

#define CONFIG_FEC_MXC
#define CONFIG_MII
#define CONFIG_FEC_ENET_DEV 0

#if (CONFIG_FEC_ENET_DEV == 0)
#define IMX_FEC_BASE ENET_BASE_ADDR
#define CONFIG_FEC_MXC_PHYADDR 0x2
#define CONFIG_FEC_XCV_TYPE RMII
#endif
#define CONFIG_ETHPRIME "FEC"

#define CONFIG_PHYLIB
#define CONFIG_PHY_SMSC

Tags (2)
0 Kudos
3 Replies

1,022 Views
igorpadykov
NXP Employee
NXP Employee

Hi Tanvi

please check uboot lan8720 init codes on

i.MX6UL ENET1 (with LAN8720A PHY) working in Uboot but not in Linux 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,022 Views
tanvi_desai
Contributor I

I tried that but still it was giving following error:

Net: FEC0 MXC: board_eth_init:failed
No ethernet found.

Regards,

Tanvi  

0 Kudos

1,022 Views
igorpadykov
NXP Employee
NXP Employee

could you check with oscilloscope if there is clock and data signals.

Best regards
igor

0 Kudos