[ECOS] query about PHY device driver

Vijay Padiyar vijay_padiyar@hotmail.com
Fri Sep 24 14:01:00 GMT 2004


Hi Nick

Thanks for replying! Well no the state read from the Status register during
the first read isn't all zeros. Because then it would go into the if()
statement below and display "... waiting for auto-negotiation", which it
doesn't. So the 'Auto-negotiation Complete' bit in the Status register isn't
zero. As a result, the program goes into the 'else' part of the code and
configures the other parameters, namely 'Link up/down', '10/100 Mbps' and
'Full-duplex support'. It is here that it reads the 'Link up/down' bit as
zero the first time, and one on all subsequent occasions.

Thanks for your help! We're investigating where it could be going wrong.

Regards

Chandrashekhar Padiyar


----- Original Message -----
From: "Nick Garnett" <nickg@ecoscentric.com>
To: "Vijay Padiyar" <vijay_padiyar@hotmail.com>
Cc: "eCos Support" <ecos-discuss@sources.redhat.com>
Sent: Friday, September 24, 2004 2:56 PM
Subject: Re: [ECOS] query about PHY device driver


> "Vijay Padiyar" <vijay_padiyar@hotmail.com> writes:
>
> > Hi
> >
> > We're using the Intel LXT971A PHY device on our board. We modified the
> > AM79C874.c driver and configured it for our device. Now the thing is,
when
> > it reads the Status register (Reg. no. 1) from the PHY device the FIRST
> > TIME, it shows the Link Status (bit 2) as down (0).
> >
> > Following is the code from LXT971A.c (adapted from AM79C874.c)
> >
> > ------------------------------------------------------------------
> >
> > // Read negotiated state
> >     if (_eth_phy_read(f, 0x1, f->phy_addr, &phy_state)) {
> >         if ((phy_state & 0x20) == 0) {
> >             diag_printf("... waiting for auto-negotiation");
> >
> > ------------------------------------------------------------------
> >
> > The _eth_phy_read() function returns the Link Status as down, i.e.
> > (phy_state & 0x0004) turns out to be zero.
> >
> > if ((phy_state & 0x0004) != 0) *state |= ETH_PHY_STAT_LINK;
> >
> > So the 'ETH_PHY_STAT_LINK' bit in '*state' doesn't get set.
> >
> > The most peculiar thing is, if we simply add a dummy _eth_phy_read()
above
> > the actual _eth_phy_read(), we get the correct link status!! That is,
only
> > the first read operation returns the incorrect status. All subsequent
reads
> > return the link status as true.
> >
> > So for the time being, we're proceeding with the dummy read as follows:
> >
> > ------------------------------------------------------------------
> >
> > // Read negotiated state
> > _eth_phy_read(f, 0x1, f->phy_addr, &phy_state)        //Dummy read
> >     if (_eth_phy_read(f, 0x1, f->phy_addr, &phy_state)) {
> >         if ((phy_state & 0x20) == 0) {
> >             diag_printf("... waiting for auto-negotiation");
> >
> > ------------------------------------------------------------------
> >
> > But why is this happening??
>
> I cannot explain why this happens, but I have seen this with other
> PHYs. However, I have also done a port to a board using an LXT971A and
> did not see this problem there, so it is unlikely to be a property of
> the PHY.
>
> Does the value read on the first access look like a sensible PHY
> status register apart from the Link Status bit, or is it all zero?
>
>
> --
> Nick Garnett                    eCos Kernel Architect
> http://www.ecoscentric.com/     The eCos and RedBoot experts
>
>

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list