0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _UAPI__LINUX_MII_H__
0010 #define _UAPI__LINUX_MII_H__
0011
0012 #include <linux/types.h>
0013 #include <linux/ethtool.h>
0014
0015
0016 #define MII_BMCR 0x00
0017 #define MII_BMSR 0x01
0018 #define MII_PHYSID1 0x02
0019 #define MII_PHYSID2 0x03
0020 #define MII_ADVERTISE 0x04
0021 #define MII_LPA 0x05
0022 #define MII_EXPANSION 0x06
0023 #define MII_CTRL1000 0x09
0024 #define MII_STAT1000 0x0a
0025 #define MII_MMD_CTRL 0x0d
0026 #define MII_MMD_DATA 0x0e
0027 #define MII_ESTATUS 0x0f
0028 #define MII_DCOUNTER 0x12
0029 #define MII_FCSCOUNTER 0x13
0030 #define MII_NWAYTEST 0x14
0031 #define MII_RERRCOUNTER 0x15
0032 #define MII_SREVISION 0x16
0033 #define MII_RESV1 0x17
0034 #define MII_LBRERROR 0x18
0035 #define MII_PHYADDR 0x19
0036 #define MII_RESV2 0x1a
0037 #define MII_TPISTATUS 0x1b
0038 #define MII_NCONFIG 0x1c
0039
0040
0041 #define BMCR_RESV 0x003f
0042 #define BMCR_SPEED1000 0x0040
0043 #define BMCR_CTST 0x0080
0044 #define BMCR_FULLDPLX 0x0100
0045 #define BMCR_ANRESTART 0x0200
0046 #define BMCR_ISOLATE 0x0400
0047 #define BMCR_PDOWN 0x0800
0048 #define BMCR_ANENABLE 0x1000
0049 #define BMCR_SPEED100 0x2000
0050 #define BMCR_LOOPBACK 0x4000
0051 #define BMCR_RESET 0x8000
0052 #define BMCR_SPEED10 0x0000
0053
0054
0055 #define BMSR_ERCAP 0x0001
0056 #define BMSR_JCD 0x0002
0057 #define BMSR_LSTATUS 0x0004
0058 #define BMSR_ANEGCAPABLE 0x0008
0059 #define BMSR_RFAULT 0x0010
0060 #define BMSR_ANEGCOMPLETE 0x0020
0061 #define BMSR_RESV 0x00c0
0062 #define BMSR_ESTATEN 0x0100
0063 #define BMSR_100HALF2 0x0200
0064 #define BMSR_100FULL2 0x0400
0065 #define BMSR_10HALF 0x0800
0066 #define BMSR_10FULL 0x1000
0067 #define BMSR_100HALF 0x2000
0068 #define BMSR_100FULL 0x4000
0069 #define BMSR_100BASE4 0x8000
0070
0071
0072 #define ADVERTISE_SLCT 0x001f
0073 #define ADVERTISE_CSMA 0x0001
0074 #define ADVERTISE_10HALF 0x0020
0075 #define ADVERTISE_1000XFULL 0x0020
0076 #define ADVERTISE_10FULL 0x0040
0077 #define ADVERTISE_1000XHALF 0x0040
0078 #define ADVERTISE_100HALF 0x0080
0079 #define ADVERTISE_1000XPAUSE 0x0080
0080 #define ADVERTISE_100FULL 0x0100
0081 #define ADVERTISE_1000XPSE_ASYM 0x0100
0082 #define ADVERTISE_100BASE4 0x0200
0083 #define ADVERTISE_PAUSE_CAP 0x0400
0084 #define ADVERTISE_PAUSE_ASYM 0x0800
0085 #define ADVERTISE_RESV 0x1000
0086 #define ADVERTISE_RFAULT 0x2000
0087 #define ADVERTISE_LPACK 0x4000
0088 #define ADVERTISE_NPAGE 0x8000
0089
0090 #define ADVERTISE_FULL (ADVERTISE_100FULL | ADVERTISE_10FULL | \
0091 ADVERTISE_CSMA)
0092 #define ADVERTISE_ALL (ADVERTISE_10HALF | ADVERTISE_10FULL | \
0093 ADVERTISE_100HALF | ADVERTISE_100FULL)
0094
0095
0096 #define LPA_SLCT 0x001f
0097 #define LPA_10HALF 0x0020
0098 #define LPA_1000XFULL 0x0020
0099 #define LPA_10FULL 0x0040
0100 #define LPA_1000XHALF 0x0040
0101 #define LPA_100HALF 0x0080
0102 #define LPA_1000XPAUSE 0x0080
0103 #define LPA_100FULL 0x0100
0104 #define LPA_1000XPAUSE_ASYM 0x0100
0105 #define LPA_100BASE4 0x0200
0106 #define LPA_PAUSE_CAP 0x0400
0107 #define LPA_PAUSE_ASYM 0x0800
0108 #define LPA_RESV 0x1000
0109 #define LPA_RFAULT 0x2000
0110 #define LPA_LPACK 0x4000
0111 #define LPA_NPAGE 0x8000
0112
0113 #define LPA_DUPLEX (LPA_10FULL | LPA_100FULL)
0114 #define LPA_100 (LPA_100FULL | LPA_100HALF | LPA_100BASE4)
0115
0116
0117 #define EXPANSION_NWAY 0x0001
0118 #define EXPANSION_LCWP 0x0002
0119 #define EXPANSION_ENABLENPAGE 0x0004
0120 #define EXPANSION_NPCAPABLE 0x0008
0121 #define EXPANSION_MFAULTS 0x0010
0122 #define EXPANSION_RESV 0xffe0
0123
0124 #define ESTATUS_1000_XFULL 0x8000
0125 #define ESTATUS_1000_XHALF 0x4000
0126 #define ESTATUS_1000_TFULL 0x2000
0127 #define ESTATUS_1000_THALF 0x1000
0128
0129
0130 #define NWAYTEST_RESV1 0x00ff
0131 #define NWAYTEST_LOOPBACK 0x0100
0132 #define NWAYTEST_RESV2 0xfe00
0133
0134
0135 #define ADVERTISE_SGMII 0x0001
0136 #define LPA_SGMII 0x0001
0137 #define LPA_SGMII_SPD_MASK 0x0c00
0138 #define LPA_SGMII_FULL_DUPLEX 0x1000
0139 #define LPA_SGMII_DPX_SPD_MASK 0x1C00
0140 #define LPA_SGMII_10 0x0000
0141 #define LPA_SGMII_10HALF 0x0000
0142 #define LPA_SGMII_10FULL 0x1000
0143 #define LPA_SGMII_100 0x0400
0144 #define LPA_SGMII_100HALF 0x0400
0145 #define LPA_SGMII_100FULL 0x1400
0146 #define LPA_SGMII_1000 0x0800
0147 #define LPA_SGMII_1000HALF 0x0800
0148 #define LPA_SGMII_1000FULL 0x1800
0149 #define LPA_SGMII_LINK 0x8000
0150
0151
0152 #define ADVERTISE_1000FULL 0x0200
0153 #define ADVERTISE_1000HALF 0x0100
0154 #define CTL1000_PREFER_MASTER 0x0400
0155 #define CTL1000_AS_MASTER 0x0800
0156 #define CTL1000_ENABLE_MASTER 0x1000
0157
0158
0159 #define LPA_1000MSFAIL 0x8000
0160 #define LPA_1000MSRES 0x4000
0161 #define LPA_1000LOCALRXOK 0x2000
0162 #define LPA_1000REMRXOK 0x1000
0163 #define LPA_1000FULL 0x0800
0164 #define LPA_1000HALF 0x0400
0165
0166
0167 #define FLOW_CTRL_TX 0x01
0168 #define FLOW_CTRL_RX 0x02
0169
0170
0171 #define MII_MMD_CTRL_DEVAD_MASK 0x1f
0172 #define MII_MMD_CTRL_ADDR 0x0000
0173 #define MII_MMD_CTRL_NOINCR 0x4000
0174 #define MII_MMD_CTRL_INCR_RDWT 0x8000
0175 #define MII_MMD_CTRL_INCR_ON_WT 0xC000
0176
0177
0178 struct mii_ioctl_data {
0179 __u16 phy_id;
0180 __u16 reg_num;
0181 __u16 val_in;
0182 __u16 val_out;
0183 };
0184
0185 #endif