Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Reg - MII Driver: (5 Items)
   
Reg - MII Driver  
Hi,

i m going to develope a new MII driver for my PHY for that i refered some of the sample driver in QNX from path (/sys/
dev/mii/gentbi.c ,Ikphy.c,Inphy.c), In that files  they are invoking PHY_READ/WRITE function but they have nt register 
mii_read /write functions.

Which mii_read/write function assoicated with that driver?

Can you please help on this.

Thanks and Regards
K.Senthil
RE: Reg - MII Driver  
Have a look in sys/dev/mii/miivar.h.


-----Original Message-----
From: Senthil K [mailto:community-noreply@qnx.com] 
Sent: Thursday, August 06, 2009 11:19 AM
To: drivers-networking
Subject: Reg - MII Driver

Hi,

i m going to develope a new MII driver for my PHY for that i refered
some of the sample driver in QNX from path (/sys/dev/mii/gentbi.c
,Ikphy.c,Inphy.c), In that files  they are invoking PHY_READ/WRITE
function but they have nt register mii_read /write functions.

Which mii_read/write function assoicated with that driver?

Can you please help on this.

Thanks and Regards
K.Senthil




_______________________________________________

Networking Drivers
http://community.qnx.com/sf/go/post35393
Re: RE: Reg - MII Driver  
Hi ,

I refered the same file (miivar.h)

The below function from gentbi.c file.

They invoking mii_readreg function.But they are not registering any read/write functions.

can you please tell me which read (*mii->mii_readreg)(parent, ma->mii_phyno, MII_BMSR); will invoke ?



gentbimatch(struct device *parent, struct cfdata *match, void *aux)
{
	struct mii_attach_args *ma = aux;
	struct mii_data *mii = ma->mii_data;
	int bmsr, extsr;

	/*
	 * We match as a generic TBI if:
	 *
	 *	- There is no media in the BMSR.
	 *	- EXTSR has only 1000X.
	 */
	bmsr = (*mii->mii_readreg)(parent, ma->mii_phyno, MII_BMSR);
	if ((bmsr & BMSR_EXTSTAT) == 0 || (bmsr & BMSR_MEDIAMASK) != 0)
		return (0);

		}

	return (0);
}
Thanks and Regards
K.Senthil

RE: Reg - MII Driver  
> develop a new MII driver for my PHY 

I really doubt you will need to do that.  The IEEE802.3u
standard specifies the layout and the values of the PHY
registers, which our libdrvr complies with.

Unless your PHY does not comply with the standard,
you do not need to modify the MDI_ libdrvr source
which is statically linked into the network drivers.

> they have no register mii_read /write functions.

That's what you need to write - nic (and possibly
board) specific functions to read and write PHY
registers, which usually involves reading and
writing registers on the NIC, often with timing
delay loops.

Once you have implemented the PHY read/write 
registers, generally they just work.  You may need
to put a little bit of board-specific setup code
in the init_phy() function in the driver mii.c
file, but that's it.

Oh yeah, there is another callback function in
the mii.c file which you might want to implement - 
the main reason is that you might need to program
the link duplex into a nic register.

Look at some of the mii.c driver source for ideas.

--
aboyd
Re: RE: Reg - MII Driver  
Hi Andrew,

I refered the same file (miivar.h)

The below function from gentbi.c file.

They invoking mii_readreg function.But they are not registering any read/write functions.

can you please tell me which read (*mii->mii_readreg)(parent, ma->mii_phyno, MII_BMSR); will invoke ?



gentbimatch(struct device *parent, struct cfdata *match, void *aux)
{
	struct mii_attach_args *ma = aux;
	struct mii_data *mii = ma->mii_data;
	int bmsr, extsr;

	/*
	 * We match as a generic TBI if:
	 *
	 *	- There is no media in the BMSR.
	 *	- EXTSR has only 1000X.
	 */
	bmsr = (*mii->mii_readreg)(parent, ma->mii_phyno, MII_BMSR);
	if ((bmsr & BMSR_EXTSTAT) == 0 || (bmsr & BMSR_MEDIAMASK) != 0)
		return (0);

		}

	return (0);
}
Thanks and Regards
K.Senthil