Using RMII(LAN8720A) on iMx6Q

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

Using RMII(LAN8720A) on iMx6Q

3,616 Views
soberpeng
Contributor I

Hello,

We use LAN8720A as RMII phy on i.Mx6q, now we can set its IP but don't transfer data.

pastedImage_0.png

RMII_REF_CLK_50M is connected to GPIO_16.

board-mx6q_sabresd.h

  MX6Q_PAD_ENET_MDIO__ENET_MDIO,

  MX6Q_PAD_ENET_MDC__ENET_MDC,

  MX6Q_PAD_ENET_RXD0__ENET_RDATA_0,

  MX6Q_PAD_ENET_RXD1__ENET_RDATA_1,

  MX6Q_PAD_ENET_CRS_DV__ENET_RX_EN,

  MX6Q_PAD_ENET_RX_ER__ENET_RX_ER,

  MX6Q_PAD_ENET_TXD0__ENET_TDATA_0,

  MX6Q_PAD_ENET_TXD1__ENET_TDATA_1,

  MX6Q_PAD_ENET_TX_EN__ENET_TX_EN,

  MX6Q_PAD_GPIO_16__ENET_ANATOP_ETHERNET_REF_OUT,/* Internal connect for 1588 TS Clock  50M clock*/

  MX6Q_PAD_RGMII_TD3__GPIO_6_23,         /* RMII reset */

  //MX6Q_PAD_GPIO_5__GPIO_1_5,   /* PHY interrupt */

board-mx6q_sabresd.c

  mxc_iomux_set_gpr_register(1, 21, 1, 1);

 

static int mx6q_sabresd_fec_phy_init(struct phy_device *phydev)

{

  unsigned short val;

  /* reset phy */

  gpio_request(SABRESD_RMII_RST, "phy-rst");

  gpio_direction_output(SABRESD_RMII_RST, 0);

  mdelay(10);

  gpio_direction_output(SABRESD_RMII_RST, 1);

  val = phy_read(phydev, 0x0);

  phy_write(phydev, 0x0, (val |BMCR_RESET));

  msleep(500);

  /* check phy power */

  val = phy_read(phydev, 0x0);

  if (val & BMCR_PDOWN)

  {

  phy_write(phydev, 0x0, (val & ~BMCR_PDOWN));

  }

  return 0;

}

static struct fec_platform_data fec_data __initdata = {

  .init = mx6q_sabresd_fec_phy_init,

  .phy = PHY_INTERFACE_MODE_RMII,

#ifdef CONFIG_MX6_ENET_IRQ_TO_GPIO

  .gpio_irq = MX6_ENET_IRQ,

#endif

};

0 Kudos
8 Replies

1,678 Views
laszlotimko
Contributor III

I have similar problem with newer kernel:

RMII interface error on i.MX6Q

Unfortunately I haven't figured it out yet.

Laszlo

0 Kudos

1,678 Views
soberpeng
Contributor I

When I ping the router, terminal display the information as below

my router's IP is 192.168.1.1. it is alive.

Are there other things need to set up? then it will transmit data.

0 Kudos

1,678 Views
igorpadykov
NXP Employee
NXP Employee

Hi Sober

had you implemented lan8720 patch

Re: iMX6 RGMII + ENET_REF_CLK/ENET_TX_CLK

~igor

0 Kudos

1,677 Views
soberpeng
Contributor I

I have modifued the kernel is according to the patch.

When I use the wireshark to test the ping command. it display as the follow,

pastedImage_2.png

20:13:10:11:18:14 is board's mac. 68:5b:35:b6:3f:81 is PC's mac.

The terminal have display,

pastedImage_4.png

Now, I don't know what happen is on the network module.

0 Kudos

1,677 Views
BiyongSUN
NXP Employee
NXP Employee

It caputue shows, the sending is correct.

APR is sent out and APR response is sending back.

So as I suggest, please check the

Please check from the peer you ping to, if the packet is sent out and peer side has replied. Just i.MX6 could not receive from phy.

If so, please check the CRS_DV signal. It is the signal to tell mac the data is ready to receive.

Also please check the phy mode. 

0 Kudos

1,677 Views
soberpeng
Contributor I

The CRS_DV have signal, also can entry fec_recv function in uboot mxc_fec.c.

int fec_recv(struct eth_device *dev)

if (info->rxbd[info->rxIdx].cbd_sc & BD_ENET_RX_EMPTY) {

   length = -1;

   break; /* nothing received - leave for() loop */

}

the function checked recv buffer empty and break;

I couldn't find where to receive data and then give the info->rxbd assignment.

0 Kudos

1,677 Views
承王
Contributor I

hello,did you solve this problem?

0 Kudos

1,677 Views
BiyongSUN
NXP Employee
NXP Employee

H Sober,

Please check from the peer you ping to, if the packet is sent out and peer side has replied. Just i.MX6 could not receive from phy.

If so, please check the CRS_DV signal. It is the signal to tell mac the data is ready to receive.

Also please check the phy mode. 

0 Kudos