This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
query about PHY device driver
- From: "Vijay Padiyar" <vijay_padiyar at hotmail dot com>
- To: "eCos Support" <ecos-discuss at sources dot redhat dot com>,"Nick Garnett" <nickg at ecoscentric dot com>
- Date: Fri, 24 Sep 2004 09:41:53 +0530
- Subject: [ECOS] 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