Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - MDIO/MII settings for Ethernet with io-net and io-pkt: (3 Items)
   
MDIO/MII settings for Ethernet with io-net and io-pkt  
Hi,

does anyone happen to know how I can access PHY device registers via MDIO/MII?
So far I have found out my BSP (mpc8313) includes some functions
  mpc_mii_read() and mpc_mii_write()
but those are only used by the BSP internal functions mpc_init_phy() and mpc_mii_callback(). mpc_mii_read() is declared 
in the driver's devctl.c, but it is never called by the handler.

We need to use it for configuring an external switch, whose registers can be written via MDIO/MII.

I have searched a bit and have found "DCMD_IO_NET_MIIPHY"... but that's all, no docu.

What is the proper way of doing this? Can I just add DCMD_IO_NET_MIIPHY to the devctl switch statement? Do I need some 
locking against other threads here? Or does the io-net framework (?) already do this before calliing mpc_devctl()? Can I
 "invent" my own parameter formats for DCMD_IO_NET_MIIPHY or is there any standard?

And last but not least: how is this all solved with io-pkt? Currently I only have io-net with this BSP... does it treat 
all of this the same or are there any differences?

Thanks & Greetings,
 Marc
RE: MDIO/MII settings for Ethernet with io-net and io-pkt  
> how I can access PHY device registers via MDIO/MII?

The network driver does this all the time, for link
management - see the mii.c source.

> have found "DCMD_IO_NET_MIIPHY"

I just grepped the io-net driver source - I really,
really wish it was publicly available, but I understand
if we do, our lawyers will tar and feather us - and 
it appears that this extension was added for the
"tulip" driver.

> Can I just add DCMD_IO_NET_MIIPHY to the devctl
> switch statement?

That's what the tulip driver did - it just calls
a function, with pointers to the driver structure,
and the devctl data.

> Do I need some locking against other threads here? 

You sure do!  You must ensure that you acquire the
same mutex as the driver does, before it accesses
the mii registers.

> Can I "invent" my own parameter formats for 
> DCMD_IO_NET_MIIPHY or is there any standard?

I would just copy what the tulip driver does.
I can probably give you some source, as long
as our lawyers don't find out about it.

> how is this all solved with io-pkt? 

I don't think io-pkt has an API for reading
and writing network driver MII registers, but
I may be mistaken.  Rob?  Sean?

--
aboyd
RE: MDIO/MII settings for Ethernet with io-net and io-pkt  

> parameter formats for DCMD_IO_NET_MIIPHY or is there any standard?

At the end of usr/include/hw/nicinfo.h I see a typedef
of nic_miiphy_dcmd_t ... that struct is passed in as
the "data" for the devctl, to the tulip driver.  I
would probably just copy that.  There are a bunch of
NIC_MIIPHY defines there, that you will probably find
handy.

--
aboyd