MOXA linux-2.6.x / linux-2.6.9-uc0 from sdlinux-moxaart.tgz
[linux-2.6.9-moxart.git] / drivers / net / sungem_phy.h
blobb86573804e620785784e2b8ef684515106924235
1 #ifndef __SUNGEM_PHY_H__
2 #define __SUNGEM_PHY_H__
4 struct mii_phy;
6 /* Operations supported by any kind of PHY */
7 struct mii_phy_ops
9 int (*init)(struct mii_phy *phy);
10 int (*suspend)(struct mii_phy *phy, int wol_options);
11 int (*setup_aneg)(struct mii_phy *phy, u32 advertise);
12 int (*setup_forced)(struct mii_phy *phy, int speed, int fd);
13 int (*poll_link)(struct mii_phy *phy);
14 int (*read_link)(struct mii_phy *phy);
17 /* Structure used to statically define an mii/gii based PHY */
18 struct mii_phy_def
20 u32 phy_id; /* Concatenated ID1 << 16 | ID2 */
21 u32 phy_id_mask; /* Significant bits */
22 u32 features; /* Ethtool SUPPORTED_* defines */
23 int magic_aneg; /* Autoneg does all speed test for us */
24 const char* name;
25 const struct mii_phy_ops* ops;
28 /* An instance of a PHY, partially borrowed from mii_if_info */
29 struct mii_phy
31 struct mii_phy_def* def;
32 int advertising;
33 int mii_id;
35 /* 1: autoneg enabled, 0: disabled */
36 int autoneg;
38 /* forced speed & duplex (no autoneg)
39 * partner speed & duplex & pause (autoneg)
41 int speed;
42 int duplex;
43 int pause;
45 /* Provided by host chip */
46 struct net_device* dev;
47 int (*mdio_read) (struct net_device *dev, int mii_id, int reg);
48 void (*mdio_write) (struct net_device *dev, int mii_id, int reg, int val);
51 /* Pass in a struct mii_phy with dev, mdio_read and mdio_write
52 * filled, the remaining fields will be filled on return
54 extern int mii_phy_probe(struct mii_phy *phy, int mii_id);
57 /* MII definitions missing from mii.h */
59 #define BMCR_SPD2 0x0040 /* Gigabit enable (bcm54xx) */
60 #define LPA_PAUSE 0x0400
62 /* More PHY registers (model specific) */
64 /* MII BCM5201 MULTIPHY interrupt register */
65 #define MII_BCM5201_INTERRUPT 0x1A
66 #define MII_BCM5201_INTERRUPT_INTENABLE 0x4000
68 #define MII_BCM5201_AUXMODE2 0x1B
69 #define MII_BCM5201_AUXMODE2_LOWPOWER 0x0008
71 #define MII_BCM5201_MULTIPHY 0x1E
73 /* MII BCM5201 MULTIPHY register bits */
74 #define MII_BCM5201_MULTIPHY_SERIALMODE 0x0002
75 #define MII_BCM5201_MULTIPHY_SUPERISOLATE 0x0008
77 /* MII BCM5221 Additional registers */
78 #define MII_BCM5221_TEST 0x1f
79 #define MII_BCM5221_TEST_ENABLE_SHADOWS 0x0080
80 #define MII_BCM5221_SHDOW_AUX_STAT2 0x1b
81 #define MII_BCM5221_SHDOW_AUX_STAT2_APD 0x0020
82 #define MII_BCM5221_SHDOW_AUX_MODE4 0x1a
83 #define MII_BCM5221_SHDOW_AUX_MODE4_CLKLOPWR 0x0004
85 /* MII BCM5400 1000-BASET Control register */
86 #define MII_BCM5400_GB_CONTROL 0x09
87 #define MII_BCM5400_GB_CONTROL_FULLDUPLEXCAP 0x0200
89 /* MII BCM5400 AUXCONTROL register */
90 #define MII_BCM5400_AUXCONTROL 0x18
91 #define MII_BCM5400_AUXCONTROL_PWR10BASET 0x0004
93 /* MII BCM5400 AUXSTATUS register */
94 #define MII_BCM5400_AUXSTATUS 0x19
95 #define MII_BCM5400_AUXSTATUS_LINKMODE_MASK 0x0700
96 #define MII_BCM5400_AUXSTATUS_LINKMODE_SHIFT 8
98 /* 1000BT control (Marvell & BCM54xx at least) */
99 #define MII_1000BASETCONTROL 0x09
100 #define MII_1000BASETCONTROL_FULLDUPLEXCAP 0x0200
101 #define MII_1000BASETCONTROL_HALFDUPLEXCAP 0x0100
103 /* Marvell 88E1011 PHY control */
104 #define MII_M1011_PHY_SPEC_CONTROL 0x10
105 #define MII_M1011_PHY_SPEC_CONTROL_MANUAL_MDIX 0x20
106 #define MII_M1011_PHY_SPEC_CONTROL_AUTO_MDIX 0x40
108 /* Marvell 88E1011 PHY status */
109 #define MII_M1011_PHY_SPEC_STATUS 0x11
110 #define MII_M1011_PHY_SPEC_STATUS_1000 0x8000
111 #define MII_M1011_PHY_SPEC_STATUS_100 0x4000
112 #define MII_M1011_PHY_SPEC_STATUS_SPD_MASK 0xc000
113 #define MII_M1011_PHY_SPEC_STATUS_FULLDUPLEX 0x2000
114 #define MII_M1011_PHY_SPEC_STATUS_RESOLVED 0x0800
116 #endif /* __SUNGEM_PHY_H__ */