mpc5200 fec error

Grant Likely grant.likely at secretlab.ca
Thu May 21 02:49:15 EST 2009


On Wed, May 20, 2009 at 10:41 AM, Eric Millbrandt
<emillbrandt at dekaresearch.com> wrote:
> It looks like the phy is never getting reset properly after the FEC_IEVENT_RFIFO_ERROR.  I threw some printk's into the fec mdio driver

Yes, that sounds familiar.  Most likely, the value of the MDIO bus
control register got clobbered and not reset when the FEC was reset.
Try adding this line to the beginning of mpc52xx_fec_mdio_transfer():

out_be32(&fec->mii_speed, 0x7e);

It's a dirty ugly hack, but it should help.  If that works, then I can
come up with a better solution.  Part of the problem is that the MDIO
handling in the current code really isn't very good.  I've got changes
queued up in -next which cleans it up quite a bit which should make it
easier to fix properly.

g.

>
> /drivers/net/fec_mpc52xx_phy.c
>  25 static int mpc52xx_fec_mdio_transfer(struct mii_bus *bus, int phy_id,
>  26                 int reg, u32 value)
>  27 {
>  28         struct mpc52xx_fec_mdio_priv *priv = bus->priv;
>  29         struct mpc52xx_fec __iomem *fec;
>  30         int tries = 100;
>  31
>  32         value |= (phy_id << FEC_MII_DATA_PA_SHIFT) & FEC_MII_DATA_PA_MSK;
>  33         value |= (reg << FEC_MII_DATA_RA_SHIFT) & FEC_MII_DATA_RA_MSK;
>  34
>  35         fec = priv->regs;
>  36         out_be32(&fec->ievent, FEC_IEVENT_MII);
>  37         out_be32(&priv->regs->mii_data, value);
>  38
>  39         /* wait for it to finish, this takes about 23 us on lite5200b */
>  40         while (!(in_be32(&fec->ievent) & FEC_IEVENT_MII) && --tries)
>  41                 udelay(5);
>  42
>  43         if (!tries) {
>  44                 printk("Unable to reset phy\n");
>  45                 return -ETIMEDOUT;
>  46         }
>  47
>  48         return value & FEC_MII_DATA_OP_RD ?
>  49                 in_be32(&priv->regs->mii_data) & FEC_MII_DATA_DATAMSK : 0;
>  50 }
>
> and got this
>
> [  127.085632] net eth0: FEC_IEVENT_RFIFO_ERROR
> [  127.093401] Resetting FEC
> [  127.096620] Unable to reset phy
> [  127.322224] Unable to reset phy
> [  128.321987] PHY: f0003000:00 - Link is Down
> [  129.221034] net eth0: FEC_IEVENT_RFIFO_ERROR
> [  129.228165] Resetting FEC
> [  129.231384] Unable to reset phy
> [  129.322286] Unable to reset phy
> [  132.885863] net eth0: FEC_IEVENT_RFIFO_ERROR
> [  132.893002] Resetting FEC
> [  132.896176] Unable to reset phy
> [  133.322202] Unable to reset phy
> [  135.684793] net eth0: FEC_IEVENT_RFIFO_ERROR
> [  135.691969] Resetting FEC
> [  135.695192] Unable to reset phy
> [  136.322530] Unable to reset phy
> [  138.490805] net eth0: FEC_IEVENT_RFIFO_ERROR
> [  138.497963] Resetting FEC
> [  138.501135] Unable to reset phy
> [  139.334200] Unable to reset phy
>
> I guess I have to spend some quality time with the 5200 manual.
>
>
> _________________________________________________________________________________________
>
> This e-mail and the information, including any attachments, it contains are intended to be a confidential communication only to the person or entity to whom it is addressed and may contain information that is privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender and destroy the original message.
>
> Thank you.
>
> Please consider the environment before printing this email.
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.



More information about the Linuxppc-dev mailing list