RMII with imx6ul not working

cancel
Showing results for 
Search instead for 
Did you mean: 

RMII with imx6ul not working

1,531 Views
asmaa
Contributor V

Hello All,

We have custom board made on imx6ul. I am trying to get my ethernet working on ethernet2 with TI DP83822 in RMII mode. I am getting the following log output.

imx sema4 driver is registered.
[drm] Initialized vivante 1.0.0 20120216 for platform:Vivante GCCore on minor 0
[drm] Initialized vivante 1.0.0 20120216 on minor 0
brd: module loaded
loop: module loaded
spi_imx 2010000.ecspi: probed
libphy: Fixed MDIO Bus: probed
CAN device driver interface
OF: /soc/aips-bus@02000000/ethernet@020b4000: could not get #gpio-cells for /soc/aips-bus@02100000/i2c@021a4000/gpio@20
fec 20b4000.ethernet: 20b4000.ethernet supply phy not found, using dummy regulator
pps pps0: new PPS source ptp0
fec 20b4000.ethernet (unnamed net_device) (uninitialized): Invalid MAC address: 00:00:00:00:00:00
fec 20b4000.ethernet (unnamed net_device) (uninitialized): Using random MAC address: 1e:cd:92:b1:09:15
libphy: fec_enet_mii_bus: probed
fec 20b4000.ethernet eth0: registered PHC device 0
usbcore: registered new interface driver kaweth
pegasus: v0.9.3 (2013/04/25), Pegasus/Pegasus II USB Ethernet driver
usbcore: registered new interface driver pegasus
usbcore: registered new interface driver rtl8150
usbcore: registered new interface driver r8152
usbcore: registered new interface driver asix
usbcore: registered new interface driver ax88179_178a
usbcore: registered new interface driver cdc_ether
usbcore: registered new interface driver net1080
usbcore: registered new interface driver cdc_subset
usbcore: registered new interface driver zaurus
usbcore: registered new interface driver cdc_ncm
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver

When I do ifconfig, I get the following output:

root@imx6ulevk:~# ifconfig
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:2 errors:0 dropped:0 overruns:0 frame:0
TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:140 (140.0 B) TX bytes:140 (140.0 B)

I am not gettinh ethernet working, following is the device tree... what could be wrong 

pinctrl_enet2: enet2grp {
fsl,pins = <
MX6UL_PAD_GPIO1_IO07__ENET2_MDC 0x1b0b0
MX6UL_PAD_ENET1_TX_DATA1__ENET2_MDIO 0x1b0b0
MX6UL_PAD_ENET2_RX_EN__ENET2_RX_EN 0x1b0b0
MX6UL_PAD_ENET2_RX_ER__ENET2_RX_ER 0x1b0b0
MX6UL_PAD_ENET2_RX_DATA0__ENET2_RDATA00 0x1b0b0
MX6UL_PAD_ENET2_RX_DATA1__ENET2_RDATA01 0x1b0b0
MX6UL_PAD_ENET2_TX_EN__ENET2_TX_EN 0x1b0b0
MX6UL_PAD_ENET2_TX_DATA0__ENET2_TDATA00 0x1b0b0
MX6UL_PAD_ENET2_TX_DATA1__ENET2_TDATA01 0x1b0b0
MX6UL_PAD_ENET2_TX_CLK__ENET2_REF_CLK2 0x4001b031
>;

&fec2 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_enet2>;
pinctrl-assert-gpios = <&pca9535_1 8 GPIO_ACTIVE_HIGH>; /*dp83822 reset gpio*/
phy-mode = "rmii";
phy-handle = <&ethphy1>;
status = "okay";

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

ethphy1: ethernet-phy@0 {
compatible = "ethernet-phy-ieee802.3-c22";
reg = <0>;
clocks = <&clks IMX6UL_CLK_ENET2_REF>;
clock-names = "rmii-ref";
device-type = "ethernet-phy";
};
};
};

what could possibly be wrong?

I have also referred following links

linux/imx7d-sdb.dts at master · torvalds/linux · GitHub 

linux/imx6ul-14x14-evk.dts at master · torvalds/linux · GitHub 

imx6sx enet2 issue 

I have also made changes to mach-imx6ul.c

static void __init imx6ul_enet_phy_init(void)
{
    if (IS_BUILTIN(CONFIG_PHYLIB)) {
        /*
         *  qt850 uses DP83822
         *
         */
        #define TI_DP83822_PHY_ID       0x2000a240
        phy_register_fixup(PHY_ANY_ID, TI_DP83822_PHY_ID,
                 0xffffffff, DP83822_phy_fixup);
                 pr_warn("TI_DP83822_PHY_ID initialiseing\n");    
    }
}

Any other change do I need to make for clock or anything?

Thanks,

Asma

7 Replies

954 Views
asmaa
Contributor V

@Igorpadykov,

Thank you for quick reply.

I want to use external clock from DP83822. So if do setup_fec, I believe it tries to set up internal clock.

Is my device tree right to setup external clock, In other word how can I set up external clock?

And here is my setup_fec, same as imx6ulevk - Is it correct?

struct iomuxc *const iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR;
    int ret;

    if (fec_id == 0) {
        if (check_module_fused(MX6_MODULE_ENET1))
            return -1;

        /*
         * Use 50M anatop loopback REF_CLK1 for ENET1,
         * clear gpr1[13], set gpr1[17].
         */
        clrsetbits_le32(&iomuxc_regs->gpr[1], IOMUX_GPR1_FEC1_MASK,
                IOMUX_GPR1_FEC1_CLOCK_MUX1_SEL_MASK);
    } else {
        if (check_module_fused(MX6_MODULE_ENET2))
            return -1;

        /*
         * Use 50M anatop loopback REF_CLK2 for ENET2,
         * clear gpr1[14], set gpr1[18].
         */
        clrsetbits_le32(&iomuxc_regs->gpr[1], IOMUX_GPR1_FEC2_MASK,
                IOMUX_GPR1_FEC2_CLOCK_MUX1_SEL_MASK);
    }

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

    enable_enet_clk(1);

    return 0;
}
0 Kudos

954 Views
igorpadykov
NXP TechSupport
NXP TechSupport

Hi Asma

clock direction is described in sect.30.4.2 GPR1 General Purpose Register (IOMUXC_GPR_GPR1)

i.MX6UL Reference Manual. First please check if it is working in uboot.

 

Best regards
igor

0 Kudos

954 Views
asmaa
Contributor V

igorpadykov

No it is not working. So in what scenarios it doesnt work?

0 Kudos

954 Views
igorpadykov
NXP TechSupport
NXP TechSupport

Hi Asma

one can try to debug it in similar way as on below link

Ethernet problem with i.MX 7Dual and DP83849IVS PHY 

Start with uboot function setup_fec() and check "ENET2_TX_CLK__ENET2_REF_CLK"

clock with oscilloscope

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

This clock direction is described in sect.30.4.2 GPR1 General Purpose Register (IOMUXC_GPR_GPR1)

i.MX6UL Reference Manual. First check if it is working in uboot.

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

954 Views
asmaa
Contributor V

Hi igorpadykov‌,

Thanks for the reply, My ethernet is up now. 

root@imx6ulevk:~# ifconfig
eth0 Link encap:Ethernet HWaddr f2:36:34:63:49:58
inet addr:169.254.234.123 Bcast:169.254.255.255 Mask:255.255.0.0
inet6 addr: fe80::f036:34ff:fe63:4958/64 Scope:Link
UP BROADCAST RUNNING MULTICAST DYNAMIC MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:84 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:22690 (22.1 KiB)

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:10 errors:0 dropped:0 overruns:0 frame:0
TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1036 (1.0 KiB) TX bytes:1036 (1.0 KiB)

But when i do ping, I get host not reachable.

root@imx6ulevk:/etc/network# ifdown eth0
ifdown: interface eth0 not configured
root@imx6ulevk:/etc/network# ping 8.8.8.8
connect: Network is unreachable
root@imx6ulevk:/etc/network# ping www.google.com
ping: www.google.com: Name or service not known
root@imx6ulevk:/etc/network#

what could possibly the reason for this?

Regards,

Asma

0 Kudos

954 Views
asmaa
Contributor V

Hi igorpadykov‌,

In addition to above, I am not getting clock on the pin in uboot. What could go possibly the problem?

0 Kudos

954 Views
igorpadykov
NXP TechSupport
NXP TechSupport

Hi Asma

what clock is used, internal or external.

Best regards
igor

0 Kudos