This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

query about PHY device driver


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??

Regards

Chandrashekhar Padiyar

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]