IMX6ULL based custom board: ENET1 doesn't get up

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

IMX6ULL based custom board: ENET1 doesn't get up

3,306件の閲覧回数
digesh_patel
Contributor II

I have imx6ull based custom board and trying to bring up the Ethernet interface. I am using the ENET1 interface with the external phy chip micrel ksz8081RNBIA I am building the 4.14 kernel with yocto.

When I am booting my kernel i am getting below errors in the log and not able to bring up the ethernet interface:

fec 2188000.ethernet: 2188000.ethernet supply phy not found, using dummy regulator
pps pps0: new PPS source ptp0
fec 2188000.ethernet (unnamed net_device) (uninitialized): Invalid MAC address: 00:00:00:00:00:00
fec 2188000.ethernet (unnamed net_device) (uninitialized): Using random MAC address: 62:92:9e:21:75:87
libphy: fec_enet_mii_bus: probed
fec 2188000.ethernet eth0: registered PHC device 0

Attaching the full log herewith.

I can  see the eth0 interface when doing ifconfig. But when I try to make this interface up my board gets hang badly. Ctrl c doen't work after this. I need to reboot the board.

Here is the dts configuration I am trying on enet1 interface:

&iomuxc_snvs {
            pinctrl-names = "default_snvs";
              imx6ul-evk {
               pinctrl_enet1_ctrl: enet1ctrlgrp {
               fsl,pins = <
               /* Used for Ethernet Interrupt */
               MX6ULL_PAD_SNVS_TAMPER5__GPIO5_IO05 0x79
                 >;
};

&fec1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_enet1
&pinctrl_enet1_ctrl>;
phy-mode = "rmii";
phy-handle = <&ethphy0>;
status = "okay";

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

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

                  };
};

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 0x4001b031
            MX6UL_PAD_GPIO1_IO08__GPIO1_IO08 0x17059
         >;
};

GPIO1_IO08 is my external reset configuration and as per ENET1_REF_CLK value setting it is 50Mhz

Can anyone help me out what I am missing?

Thanks

Digesh

0 件の賞賛
返信
8 返答(返信)

2,822件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

Hi Digesh

one can check #define CONFIG_FEC_ENET_DEV in

uboot/include/configs/mx6ullevk.h   

mx6ullevk.h\configs\include - uboot-imx - i.MX U-Boot 

reference clock in function setup_fec() in

uboot/board/freescale/mx6ullevk/mx6ullevk.c

mx6ullevk.c\mx6ullevk\freescale\board - uboot-imx - i.MX U-Boot 

IOMUXC_GPR_GPR1 register defines direction of reference clock,

description can be found in sect.32.4.2 GPR1 General Purpose Register (IOMUXC_GPR_GPR1)

i.MX6ULL Reference Manual. Also may be useful

https://community.nxp.com/thread/387739 

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

0 件の賞賛
返信

2,822件の閲覧回数
digesh_patel
Contributor II

I will try that but meanwhile could you please let me know in what case we get "(unnamed net_device) (uninitialized):". In fec_mai.c file net_device structure is used. In what case name[] and reg_state are not filled?

0 件の賞賛
返信

2,822件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

you can trace it using AN4553 Using Open Source Debugging Tools for Linux on i.MX Processors
https://www.nxp.com/docs/en/application-note/AN4553.pdf

Best regards
igor

0 件の賞賛
返信

2,822件の閲覧回数
digesh_patel
Contributor II

It looks like i am not able to fetch the fep->phy_node when doing the fec_probe. I am getting a garbage value there. As per the code it derives from the "phy-handle" from the dts file. Below is my relevant dts snippet for fec1. 

&fec1 {
   pinctrl-names = "default";
   pinctrl-0 = <&pinctrl_enet1
               &pinctrl_enet1_ctrl>;
   phy-mode = "rmii";
   phy-handle = <&ethphy0>;
   status = "okay";

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

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

     };
};

Any idea why it occures?

Thanks,

Digesh

0 件の賞賛
返信

2,822件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

one cam check nxp example linux/arch/arm/boot/dts/imx6ull-14x14-evk.dts

imx6ull-14x14-evk.dts\dts\boot\arm\arch - linux-imx - i.MX Linux kernel 

Best regards
igor

0 件の賞賛
返信

2,822件の閲覧回数
digesh_patel
Contributor II

I took the reference from  linux/arch/arm/boot/dts/imx6ull-14x14-evk.dts and the dts file I use is mentioned earlier at starting of this thread. The only thing I changed in the dts is the ENET1_nRST GPIO and ENET1_nINT pins. I am still facing some issues in bringing up the fec1.

There are two issue:

1. At the time of fec_probe I get the "fep->phy_node" value as garbage

2. At the kernel boot time, as part of fec driver prob it calls fec_restart where ENET registers (control, interrupt event, mii speed control etc.) are being configured. After the kernel boot I am able to see the eth0 interface in ifconfig. Here is the ifconfig output:

# ifconfig -a
eth0 Link encap:Ethernet HWaddr 36:6b:33:80:70:b3
         BROADCAST MULTICAST MTU:1500 Metric:1
         RX packets:0 errors:0 dropped:0 overruns:0 frame:0
         TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

lo      Link encap:Local Loopback
         inet addr:127.0.0.1 Mask:255.0.0.0
         inet6 addr: ::1/128 Scope:Host
         UP LOOPBACK RUNNING MTU:65536 Metric:1
         RX packets:160 errors:0 dropped:0 overruns:0 frame:0
         TX packets:160 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         RX bytes:12160 (11.8 KiB) TX bytes:12160 (11.8 KiB)

sit0    Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
         NOARP MTU:1480 Metric:1
         RX packets:0 errors:0 dropped:0 overruns:0 frame:0
         TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

 

When I am trying to bring the eth0 interface up It hangs forever at "writel(1, fep->hwp + FEC_ECNTRL);" when writing on control register at 0x24 offset. 

static void  fec_restart(struct net_device *ndev)
{
      struct fec_enet_private *fep = netdev_priv(ndev);
      u32 val;
      u32 temp_mac[2];
      u32 rcntl = OPT_FRAME_SIZE | 0x04;
      u32 ecntl = FEC_ENET_ETHEREN; /* ETHEREN */

      /* Whack a reset. We should wait for this.
      * For i.MX6SX SOC, enet use AXI bus, we use disable MAC
      * instead of reset MAC itself.
      */
      if (fep->quirks & FEC_QUIRK_HAS_AVB) {
      writel(0, fep->hwp + FEC_ECNTRL);
      } else {
      writel(1, fep->hwp + FEC_ECNTRL); <<<<<<< it hangs forever during "ifconfig eth0 up" 
      udelay(10);
      }

   ...

}

The same fec_restart call works without hang during the kernel boot process but after boot when doing so hangs the board forever. Please let me know if anything is missing.

Thanks,

Digesh

0 件の賞賛
返信

2,822件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

>I took the reference from  linux/arch/arm/boot/dts/imx6ull-14x14-evk.dts and the

>dts file I use is mentioned earlier at starting of this thread.

actually there are differencies with imx6ull-14x14-evk.dts\dts\boot\arm\arch - linux-imx - i.MX Linux kernel 

for example no clocks = <&clks IMX6UL_CLK_ENET_REF>;

Best regards
igor

0 件の賞賛
返信

2,822件の閲覧回数
digesh_patel
Contributor II

I have tried that too with no success.

0 件の賞賛
返信