iMX-25 fec problem - set ethernet speed

cancel
Showing results for 
Search instead for 
Did you mean: 

iMX-25 fec problem - set ethernet speed

533 Views
joeyezekiel
Contributor II

Hi

We're using the freescale iMX 25 with linux 2.6.31 for one of our projects and having an issue with the ethernet communication. There is a large packet loss recorded which is very erratic.

For us to manually debug this, we need to change the ethernet speed from auto negotiation to 100 FDX. Is there any easy way to do this? ethtool somehow does not play well with 2.6.31.

Any way to change this setting on the fec.c kernel code?

Regards,

Joe

Labels (3)
5 Replies

94 Views
bpe
NXP TechSupport
NXP TechSupport

FEC driver in kernel 2.6.31 simply does not have hooks for ethool, nor

there is any other means to adjust the link duplex or data rate at

runtime. Generally, link establishment is the function of the PHY,

thus the simplest way to force the PHY to set any link parameter is

to alter what the phy_info_t structure field startup points to.

See the definitions of  phy_cmd_t, phy_info_t types and how variables

of these types are instantiated for supported PHYs in fec.c Note that this

method is static, that is, to setup for another link parameters,

you will need to change the source and rebuild again.


Have a great day,
Platon

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

94 Views
joeyezekiel
Contributor II

This is what I have. DP83848 is what is being used. Currently, mk_mii_write(MII_REG_CR, 0x1200) is being used for auto negotiation is my guess. What should this be changed to for 100FDX? What is the significance of PHY_STAT_100HDX? Please don't mind the novice questions. Thanks.

static void mii_parse_dp8384x_sr2(uint mii_reg, struct net_device *dev)

{

    struct fec_enet_private *fep = netdev_priv(dev);

    volatile uint *s = &(fep->phy_status);

    *s &= ~(PHY_STAT_SPMASK | PHY_STAT_LINK | PHY_STAT_ANC);

    /* Link up */

    if (mii_reg & 0x0001) {

        fep->link = 1;

        *s |= PHY_STAT_LINK;

    } else

        fep->link = 0;

    /* Status of link */

    if (mii_reg & 0x0010)  /* Autonegotioation complete */

        *s |= PHY_STAT_ANC;

    if (mii_reg & 0x0002) {  /* 10MBps? */

        if (mii_reg & 0x0004)  /* Full Duplex? */

            *s |= PHY_STAT_10FDX;

        else

            *s |= PHY_STAT_10HDX;

    } else {                  /* 100 Mbps? */

        if (mii_reg & 0x0004)  /* Full Duplex? */

            *s |= PHY_STAT_100FDX;

        else

            *s |= PHY_STAT_100HDX;

    }

    if (mii_reg & 0x0008)

        *s |= PHY_STAT_FAULT;

}

static phy_info_t phy_info_dp83848= {

    0x020005ce,

    "DP83848",

    (const phy_cmd_t []) {  /* config */

        { mk_mii_read(MII_REG_CR), mii_parse_cr },

        { mk_mii_read(MII_REG_ANAR), mii_parse_anar },

        { mk_mii_read(MII_DP8384X_PHYSTST), mii_parse_dp8384x_sr2 },

        { mk_mii_end, }

    },

    (const phy_cmd_t []) {  /* startup - enable interrupts */

        { mk_mii_write(MII_REG_CR, 0x1200), NULL }, /* autonegotiate */

        { mk_mii_read(MII_REG_SR), mii_parse_sr },

        { mk_mii_end, }

    },

    (const phy_cmd_t []) { /* ack_int - never happens, no interrupt */

        { mk_mii_end, }

    },

    (const phy_cmd_t []) {  /* shutdown */

        { mk_mii_end, }

    },

};

0 Kudos

94 Views
fabio_estevam
NXP Employee
NXP Employee

Hi Joey,

Maybe you can try a newer kernel, like 4.0.

Regards,

Fabio Estevam

0 Kudos

94 Views
joeyezekiel
Contributor II

Thanks for your reply Fabio. Due to time and other constraints, we need to try and fix this on the 2.6.31 version as this is a legacy system still in use. So are you saying this is a known issue? Is there anything that can be done?

0 Kudos

94 Views
fabio_estevam
NXP Employee
NXP Employee

Hi Joey,

I was not aware of this issue. Using 4.0 was just a suggestion.

Regards,

Fabio Estevam

0 Kudos