RMII configuration with KSZ8081 and iMX6DL

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

RMII configuration with KSZ8081 and iMX6DL

Jump to solution
7,983 Views
hiromiyokoo
Contributor II

Hello,

I need some help configuring the ethernet. On my board I have a KSZ8081RNBIA in RMII and an iMX6DL.

I'm using "core-image-minimal", I configured the kernel (3.10.17-r0) to load the proper driver and I added in the device tree this code:

fec: ethernet@02188000 {

                compatible = "fsl,imx6q-fec";

                reg = <0x02188000 0x4000>;

                interrupts = <0 118 0x04 0 119 0x04>;

                clocks = <&clks 117>, <&clks 117>, <&clks 190>;

                clock-names = "ipg", "ahb", "ptp";

                status = "disabled";

            };

&fec {

    pinctrl-names = "default";

    pinctrl-0 = <&pinctrl_enet_1>;

    phy-mode = "rmii";

    phy-handle = <&ethphy1>;

    status = "okay";

    mdio {

        #address-cells = <1>;

        #size-cells    = <0>;

        ethphy1: ethernet-phy@0 {

            compatible = "micrel,ksz8081";

            device_type = "ethernet-phy";

            reg = <0>;

           };

        };

};

enet {

        pinctrl_enet_1: enetgrp-1 {

            fsl,pins = <

                MX6QDL_PAD_ENET_TXD0__ENET_TX_DATA0   0x1b0b0

                MX6QDL_PAD_ENET_TXD1__ENET_TX_DATA1   0x1b0b0

                MX6QDL_PAD_ENET_TX_EN__ENET_TX_EN     0x1b0b0

                MX6QDL_PAD_ENET_RXD0__ENET_RX_DATA0   0x1b0b0

                MX6QDL_PAD_ENET_RXD1__ENET_RX_DATA1   0x1b0b0

                MX6QDL_PAD_ENET_CRS_DV__ENET_RX_EN    0x1b0b0

                MX6QDL_PAD_ENET_MDC__ENET_MDC         0x1b0b0

                MX6QDL_PAD_ENET_MDIO__ENET_MDIO          0x1b0b0

                MX6QDL_PAD_ENET_RX_ER__ENET_RX_ER     0x1b0b0

                MX6QDL_PAD_ENET_REF_CLK__GPIO1_IO23   0x80000000 // Connected to interrupt from KSZ8081

                MX6QDL_PAD_GPIO_16__ENET_REF_CLK      0x4001b0a8

            >;

        };

};

But when I try to configure the connection (ifconfig ...) and then I try to send a ping it hungs (I have to press ctrl+c).

In the kernel log I find this line:

Configuring network interfaces... fec 2188000.ethernet eth0: Freescale FEC PHY driver (Micrel KSZ8081 or KSZ8091) (mii_bus:phy_addr=2188000.ethernet:00, irq=-1)

Is there some problem in the configuration? Should I add something about the interrupt connection to the device tree? I've already tried to add something but with no success.

Please help me,

Thank you in advance

Labels (3)
0 Kudos
Reply
1 Solution
3,990 Views
hiromiyokoo
Contributor II

I finally solved the issue, adding:

int regval = phy_read(phydev, MII_KSZPHY_OMSO);

regval &= 0xFC;

regval |= KSZPHY_OMSO_RMII_OVERRIDE;

phy_write(phydev, MII_KSZPHY_OMSO, regval);

to

kszphy_config_init

in

micrel.c

Even if there are still rx frame errors to be inspected.

View solution in original post

0 Kudos
Reply
3 Replies
3,991 Views
hiromiyokoo
Contributor II

I finally solved the issue, adding:

int regval = phy_read(phydev, MII_KSZPHY_OMSO);

regval &= 0xFC;

regval |= KSZPHY_OMSO_RMII_OVERRIDE;

phy_write(phydev, MII_KSZPHY_OMSO, regval);

to

kszphy_config_init

in

micrel.c

Even if there are still rx frame errors to be inspected.

0 Kudos
Reply
3,990 Views
igorpadykov
NXP Employee
NXP Employee

Hi Roberto

one can look at solution provided for KSZ8031 with i.MX6S

RMII interface on i.MX6 Solo

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

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

-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply
3,990 Views
hiromiyokoo
Contributor II

Hi Igor,

I looked at the solution you linked but I don't have clock problems.

Looking at the Micrel driver in Linux I found that it doesn't use the device tree (in this version of Linux), so this part of the device tree is useless:

        ethphy1: ethernet-phy@0 {

            compatible = "micrel,ksz8081";

            device_type = "ethernet-phy";

            reg = <0>;

           }

I don't know what to do...

0 Kudos
Reply