This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: query about PHY device driver
- From: Nick Garnett <nickg at ecoscentric dot com>
- To: "Vijay Padiyar" <vijay_padiyar at hotmail dot com>
- Cc: "eCos Support" <ecos-discuss at sources dot redhat dot com>
- Date: 24 Sep 2004 10:26:32 +0100
- Subject: Re: [ECOS] query about PHY device driver
- References: <BAY1-DAV1pkpLkTgbLY00037512@hotmail.com>
"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