AnsweredAssumed Answered

IMX6Q AR8031 ISSUE NO IPV4 ADDRESS

Question asked by Valentina Fernandez Alanis on Apr 4, 2016
Latest reply on Aug 30, 2016 by Makoto Harada

Hi,

 

We are facing a problem getting the AR8031 phy to work in a custom imx6 board. The issue is that we can’t get a manual IP address and we also can’t get an IP address from the DHCP server.

 

a) When trying with a manual IP:

 

Using FEC device

 

ARP Retry count exceeded; starting again

ARP Retry count exceeded; starting again

 

 

b) with DHCP

 

=> dhcp

BOOTP broadcast 1

BOOTP broadcast 2

BOOTP broadcast 3

BOOTP broadcast 4

 

 

  • Our board settings for u-boot:

 

--custom board c file (ethernet declarations):

 

static iomux_v3_cfg_t const enet_pads[] = {

  MX6_PAD_ENET_MDIO__ENET_MDIO | MUX_PAD_CTRL(ENET_PAD_CTRL),

  MX6_PAD_ENET_MDC__ENET_MDC | MUX_PAD_CTRL(ENET_PAD_CTRL),

  MX6_PAD_RGMII_TXC__RGMII_TXC | MUX_PAD_CTRL(ENET_PAD_CTRL),

  MX6_PAD_RGMII_TD0__RGMII_TD0 | MUX_PAD_CTRL(ENET_PAD_CTRL),

  MX6_PAD_RGMII_TD1__RGMII_TD1 | MUX_PAD_CTRL(ENET_PAD_CTRL),

  MX6_PAD_RGMII_TD2__RGMII_TD2 | MUX_PAD_CTRL(ENET_PAD_CTRL),

  MX6_PAD_RGMII_TD3__RGMII_TD3 | MUX_PAD_CTRL(ENET_PAD_CTRL),

  MX6_PAD_RGMII_TX_CTL__RGMII_TX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL),

  MX6_PAD_ENET_REF_CLK__ENET_TX_CLK | MUX_PAD_CTRL(ENET_PAD_CTRL),

  MX6_PAD_RGMII_RXC__RGMII_RXC | MUX_PAD_CTRL(ENET_PAD_CTRL),

  MX6_PAD_RGMII_RD0__RGMII_RD0 | MUX_PAD_CTRL(ENET_PAD_CTRL),

  MX6_PAD_RGMII_RD1__RGMII_RD1 | MUX_PAD_CTRL(ENET_PAD_CTRL),

  MX6_PAD_RGMII_RD2__RGMII_RD2 | MUX_PAD_CTRL(ENET_PAD_CTRL),

  MX6_PAD_RGMII_RD3__RGMII_RD3 | MUX_PAD_CTRL(ENET_PAD_CTRL),

  MX6_PAD_RGMII_RX_CTL__RGMII_RX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL),

  /* AR8031 PHY Reset */

  MX6_PAD_SD2_DAT2__GPIO1_IO13 | MUX_PAD_CTRL(NO_PAD_CTRL),

};

 

static void setup_iomux_enet(void)

{

  imx_iomux_v3_setup_multiple_pads(enet_pads, ARRAY_SIZE(enet_pads));

 

  /* Reset AR8031 PHY */

  gpio_direction_output(ETH_PHY_RESET, 0);

  udelay(500);

  gpio_set_value(ETH_PHY_RESET, 0);

}

 

int board_phy_config(struct phy_device *phydev)

{

  mx6_rgmii_rework(phydev);

 

  if (phydev->drv->config)

  phydev->drv->config(phydev);

 

  return 0;

}

 

int mx6_rgmii_rework(struct phy_device *phydev)

{

  unsigned short val;

 

  /* To enable AR8031 ouput a 125MHz clk from CLK_25M */

  phy_write(phydev, MDIO_DEVAD_NONE, 0xd, 0x7);

  phy_write(phydev, MDIO_DEVAD_NONE, 0xe, 0x8016);

  phy_write(phydev, MDIO_DEVAD_NONE, 0xd, 0x4007);

 

  phy_write(phydev, MDIO_DEVAD_NONE, 0x09, 0x0000);

 

  val = phy_read(phydev, MDIO_DEVAD_NONE, 0xe);

  val &= 0xffe3;

  val |= 0x18;

  phy_write(phydev, MDIO_DEVAD_NONE, 0xe, val);

 

  /* introduce tx clock delay */

  phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x5);

  val = phy_read(phydev, MDIO_DEVAD_NONE, 0x1e);

  val |= 0x0100;

  phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, val);

 

  return 0;

}

 

 

  • in the include/configs file:

 

#define CONFIG_CMD_PING

#define CONFIG_CMD_DHCP

#define CONFIG_CMD_MII

#define CONFIG_CMD_NET

#define CONFIG_FEC_MXC

#define CONFIG_MII

#define IMX_FEC_BASE ENET_BASE_ADDR

#define CONFIG_FEC_XCV_TYPE RGMII

#define CONFIG_ETHPRIME "FEC"

#define CONFIG_FEC_MXC_PHYADDR 0

 

#define CONFIG_PHYLIB

#define CONFIG_PHY_ATHEROS

 

 

 

  • We can verify that u-boot is detecting the phy (also reading register values with mii dump):

 

U-Boot 2015.04-00132-g244c0eb-dirty (Apr 01 2016 - 21:56:49)

 

CPU:   Freescale i.MX6Q rev1.5 996 MHz (running at 792 MHz)

CPU:   Extended Commercial temperature grade (-20C to 105C) at 51C

Reset cause: WDOG

I2C:   ready

DRAM:  2 GiB

PMIC:  PFUZE100 ID=0x10

Flash: ## Unknown flash on Bank 1 - Size = 0x00000000 = 0 MB

0 Bytes

NAND:  0 MiB

MMC:   FSL_SDHC: 0

In:    serial

Out:   serial

Err:   serial

Net:   FEC [PRIME]

 

 

  • u-Boot env settings:

 

baudrate=115200

boot_fdt=try

bootargs=console=ttymxc3,115200 root=/dev/nfs ip=dhcp nfsroot=:,v3,tcp

bootcmd=mmc dev ${mmcdev};if mmc rescan; then if run loadbootscript; then run bo

otscript; else if run loadimage; then run mmcboot; else run netboot; fi; fi; els

e run netboot; fi

bootdelay=1

bootscript=echo Running bootscript from mmc ...; source

console=ttymxc3

display=mxcfb0:dev=hdmi,1280x720M@60,bpp=32 video=mxcfb1:off video=mxcfb2:off mx

c_hdmi.disable_hdmi_edid=1 consoleblank=0

ethact=FEC

ethaddr=00:19:B8:00:E5:4E

ethprime=FEC

fdt_addr=0x18000000

fdt_file=/boot/imx6q-pixiepro.dtb

fdt_high=0xffffffff

gatewayip=10.1.1.1

get_cmd=dhcp

image=/boot/zImage

initrd_high=0xffffffff

ip=dhcp

ip_dyn=yes

ipaddr=10.1.1.13

netmask=255.0.0.0

loadaddr=0x12000000

loadbootscript=ext4load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};

loadfdt=ext4load mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}

loadimage=ext4load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}

mmcargs=setenv bootargs console=${console},${baudrate} root=${mmcroot} video=${d

isplay}

mmcboot=echo Booting from mmc ...; run mmcargs; if test ${boot_fdt} = yes || tes

t ${boot_fdt} = try; then if run loadfdt; then bootz ${loadaddr} - ${fdt_addr};

else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT;

fi; fi; else bootz; fi;

mmcdev=0

mmcpart=2

mmcroot=/dev/mmcblk2p2 rootwait rw rootfstype=ext4

netargs=setenv bootargs console=${console},${baudrate} root=/dev/nfs ip=dhcp nfs

root=${serverip}:${nfsroot},v3,tcp

netboot=echo Booting from net ...; run netargs; if test ${ip_dyn} = yes; then se

tenv get_cmd dhcp; else setenv get_cmd tftp; fi; ${get_cmd} ${image}; if test ${

boot_fdt} = yes || test ${boot_fdt} = try; then if ${get_cmd} ${fdt_addr} ${fdt_

file}; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; the

n bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;

netmask=255.0.0.0

script=/boot/boot.scr

stderr=serial

stdin=serial

stdout=serial

update_sd_firmware=if test ${ip_dyn} = yes; then setenv get_cmd dhcp; else seten

v get_cmd tftp; fi; if mmc dev ${mmcdev}; then if ${get_cmd} ${update_sd_firmwar

e_filename}; then setexpr fw_sz ${filesize} / 0x200; setexpr fw_sz ${fw_sz} + 1;

mmc write ${loadaddr} 0x2 ${fw_sz}; fi; fi

 

 

  • We have also declared the pads on the device tree and we still can’t get an IPV4 address.

 

wlp1s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 10.1.1.194  netmask 255.0.0.0  broadcast 10.255.255.255

        inet6 fe80::82d2:1dff:fe5e:6c8f  prefixlen 64  scopeid 0x20<link>

        inet6 fd00:c0de::82d2:1dff:fe5e:6c8f  prefixlen 64  scopeid 0x0<global>

        ether 80:d2:1d:5e:6c:8f  txqueuelen 1000  (Ethernet)

        RX packets 125  bytes 18145 (17.7 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 74  bytes 12078 (11.7 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

 

Part of the schematic:

Ethernet.png

 

 

What could be the reason for this problem?

 

Thanks

Outcomes