2009-10-01 15:51:28

by Mark Jackson

[permalink] [raw]
Subject: Accessing PHY registers

On our custom AVR32 board, we've a pair of NatSemi DP83848 PHYs.

dmesg shows the following:-

MACB_mii_bus: probed
eth0: Atmel MACB at 0xfff01800 irq 25 (00:19:66:88:76:a4)
eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=0:01, irq=-1)
macb macb.1: invalid hw address, using random
MACB_mii_bus: probed
eth1: Atmel MACB at 0xfff01c00 irq 26 (42:36:af:ab:e4:b5)
eth1: attached PHY driver [Generic PHY] (mii_bus:phy_addr=1:03, irq=-1)

Can anyone shed some light on how I might read / write the PHY registers
from userspace ?

I've looked at ethtool, but it doesn't appear to work:-

# ethtool eth0
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full
Port: MII
PHYAD: 1
Transceiver: external
Auto-negotiation: on
Link detected: yes
# ethtool -d eth0
Cannot get register dump: Operation not supported

Anyone got some sample code (I guess using sockets and ioctl calls ?)
I could take a look at ?

Thanks
Mark