Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 /*
0003  * linux/mdio.h: definitions for MDIO (clause 45) transceivers
0004  * Copyright 2006-2009 Solarflare Communications Inc.
0005  *
0006  * This program is free software; you can redistribute it and/or modify it
0007  * under the terms of the GNU General Public License version 2 as published
0008  * by the Free Software Foundation, incorporated herein by reference.
0009  */
0010 
0011 #ifndef _UAPI__LINUX_MDIO_H__
0012 #define _UAPI__LINUX_MDIO_H__
0013 
0014 #include <linux/types.h>
0015 #include <linux/mii.h>
0016 
0017 /* MDIO Manageable Devices (MMDs). */
0018 #define MDIO_MMD_PMAPMD     1   /* Physical Medium Attachment/
0019                      * Physical Medium Dependent */
0020 #define MDIO_MMD_WIS        2   /* WAN Interface Sublayer */
0021 #define MDIO_MMD_PCS        3   /* Physical Coding Sublayer */
0022 #define MDIO_MMD_PHYXS      4   /* PHY Extender Sublayer */
0023 #define MDIO_MMD_DTEXS      5   /* DTE Extender Sublayer */
0024 #define MDIO_MMD_TC     6   /* Transmission Convergence */
0025 #define MDIO_MMD_AN     7   /* Auto-Negotiation */
0026 #define MDIO_MMD_C22EXT     29  /* Clause 22 extension */
0027 #define MDIO_MMD_VEND1      30  /* Vendor specific 1 */
0028 #define MDIO_MMD_VEND2      31  /* Vendor specific 2 */
0029 
0030 /* Generic MDIO registers. */
0031 #define MDIO_CTRL1      MII_BMCR
0032 #define MDIO_STAT1      MII_BMSR
0033 #define MDIO_DEVID1     MII_PHYSID1
0034 #define MDIO_DEVID2     MII_PHYSID2
0035 #define MDIO_SPEED      4   /* Speed ability */
0036 #define MDIO_DEVS1      5   /* Devices in package */
0037 #define MDIO_DEVS2      6
0038 #define MDIO_CTRL2      7   /* 10G control 2 */
0039 #define MDIO_STAT2      8   /* 10G status 2 */
0040 #define MDIO_PMA_TXDIS      9   /* 10G PMA/PMD transmit disable */
0041 #define MDIO_PMA_RXDET      10  /* 10G PMA/PMD receive signal detect */
0042 #define MDIO_PMA_EXTABLE    11  /* 10G PMA/PMD extended ability */
0043 #define MDIO_PKGID1     14  /* Package identifier */
0044 #define MDIO_PKGID2     15
0045 #define MDIO_AN_ADVERTISE   16  /* AN advertising (base page) */
0046 #define MDIO_AN_LPA     19  /* AN LP abilities (base page) */
0047 #define MDIO_PCS_EEE_ABLE   20  /* EEE Capability register */
0048 #define MDIO_PCS_EEE_ABLE2  21  /* EEE Capability register 2 */
0049 #define MDIO_PMA_NG_EXTABLE 21  /* 2.5G/5G PMA/PMD extended ability */
0050 #define MDIO_PCS_EEE_WK_ERR 22  /* EEE wake error counter */
0051 #define MDIO_PHYXS_LNSTAT   24  /* PHY XGXS lane state */
0052 #define MDIO_AN_EEE_ADV     60  /* EEE advertisement */
0053 #define MDIO_AN_EEE_LPABLE  61  /* EEE link partner ability */
0054 #define MDIO_AN_EEE_ADV2    62  /* EEE advertisement 2 */
0055 #define MDIO_AN_EEE_LPABLE2 63  /* EEE link partner ability 2 */
0056 #define MDIO_AN_CTRL2       64  /* AN THP bypass request control */
0057 
0058 /* Media-dependent registers. */
0059 #define MDIO_PMA_10GBT_SWAPPOL  130 /* 10GBASE-T pair swap & polarity */
0060 #define MDIO_PMA_10GBT_TXPWR    131 /* 10GBASE-T TX power control */
0061 #define MDIO_PMA_10GBT_SNR  133 /* 10GBASE-T SNR margin, lane A.
0062                      * Lanes B-D are numbered 134-136. */
0063 #define MDIO_PMA_10GBR_FSRT_CSR 147 /* 10GBASE-R fast retrain status and control */
0064 #define MDIO_PMA_10GBR_FECABLE  170 /* 10GBASE-R FEC ability */
0065 #define MDIO_PCS_10GBX_STAT1    24  /* 10GBASE-X PCS status 1 */
0066 #define MDIO_PCS_10GBRT_STAT1   32  /* 10GBASE-R/-T PCS status 1 */
0067 #define MDIO_PCS_10GBRT_STAT2   33  /* 10GBASE-R/-T PCS status 2 */
0068 #define MDIO_AN_10GBT_CTRL  32  /* 10GBASE-T auto-negotiation control */
0069 #define MDIO_AN_10GBT_STAT  33  /* 10GBASE-T auto-negotiation status */
0070 #define MDIO_B10L_PMA_CTRL  2294    /* 10BASE-T1L PMA control */
0071 #define MDIO_PMA_10T1L_STAT 2295    /* 10BASE-T1L PMA status */
0072 #define MDIO_PCS_10T1L_CTRL 2278    /* 10BASE-T1L PCS control */
0073 #define MDIO_PMA_PMD_BT1    18  /* BASE-T1 PMA/PMD extended ability */
0074 #define MDIO_AN_T1_CTRL     512 /* BASE-T1 AN control */
0075 #define MDIO_AN_T1_STAT     513 /* BASE-T1 AN status */
0076 #define MDIO_AN_T1_ADV_L    514 /* BASE-T1 AN advertisement register [15:0] */
0077 #define MDIO_AN_T1_ADV_M    515 /* BASE-T1 AN advertisement register [31:16] */
0078 #define MDIO_AN_T1_ADV_H    516 /* BASE-T1 AN advertisement register [47:32] */
0079 #define MDIO_AN_T1_LP_L     517 /* BASE-T1 AN LP Base Page ability register [15:0] */
0080 #define MDIO_AN_T1_LP_M     518 /* BASE-T1 AN LP Base Page ability register [31:16] */
0081 #define MDIO_AN_T1_LP_H     519 /* BASE-T1 AN LP Base Page ability register [47:32] */
0082 #define MDIO_PMA_PMD_BT1_CTRL   2100    /* BASE-T1 PMA/PMD control register */
0083 
0084 /* LASI (Link Alarm Status Interrupt) registers, defined by XENPAK MSA. */
0085 #define MDIO_PMA_LASI_RXCTRL    0x9000  /* RX_ALARM control */
0086 #define MDIO_PMA_LASI_TXCTRL    0x9001  /* TX_ALARM control */
0087 #define MDIO_PMA_LASI_CTRL  0x9002  /* LASI control */
0088 #define MDIO_PMA_LASI_RXSTAT    0x9003  /* RX_ALARM status */
0089 #define MDIO_PMA_LASI_TXSTAT    0x9004  /* TX_ALARM status */
0090 #define MDIO_PMA_LASI_STAT  0x9005  /* LASI status */
0091 
0092 /* Control register 1. */
0093 /* Enable extended speed selection */
0094 #define MDIO_CTRL1_SPEEDSELEXT      (BMCR_SPEED1000 | BMCR_SPEED100)
0095 /* All speed selection bits */
0096 #define MDIO_CTRL1_SPEEDSEL     (MDIO_CTRL1_SPEEDSELEXT | 0x003c)
0097 #define MDIO_CTRL1_FULLDPLX     BMCR_FULLDPLX
0098 #define MDIO_CTRL1_LPOWER       BMCR_PDOWN
0099 #define MDIO_CTRL1_RESET        BMCR_RESET
0100 #define MDIO_PMA_CTRL1_LOOPBACK     0x0001
0101 #define MDIO_PMA_CTRL1_SPEED1000    BMCR_SPEED1000
0102 #define MDIO_PMA_CTRL1_SPEED100     BMCR_SPEED100
0103 #define MDIO_PCS_CTRL1_LOOPBACK     BMCR_LOOPBACK
0104 #define MDIO_PHYXS_CTRL1_LOOPBACK   BMCR_LOOPBACK
0105 #define MDIO_AN_CTRL1_RESTART       BMCR_ANRESTART
0106 #define MDIO_AN_CTRL1_ENABLE        BMCR_ANENABLE
0107 #define MDIO_AN_CTRL1_XNP       0x2000  /* Enable extended next page */
0108 #define MDIO_PCS_CTRL1_CLKSTOP_EN   0x400   /* Stop the clock during LPI */
0109 
0110 /* 10 Gb/s */
0111 #define MDIO_CTRL1_SPEED10G     (MDIO_CTRL1_SPEEDSELEXT | 0x00)
0112 /* 10PASS-TS/2BASE-TL */
0113 #define MDIO_CTRL1_SPEED10P2B       (MDIO_CTRL1_SPEEDSELEXT | 0x04)
0114 /* 2.5 Gb/s */
0115 #define MDIO_CTRL1_SPEED2_5G        (MDIO_CTRL1_SPEEDSELEXT | 0x18)
0116 /* 5 Gb/s */
0117 #define MDIO_CTRL1_SPEED5G      (MDIO_CTRL1_SPEEDSELEXT | 0x1c)
0118 
0119 /* Status register 1. */
0120 #define MDIO_STAT1_LPOWERABLE       0x0002  /* Low-power ability */
0121 #define MDIO_STAT1_LSTATUS      BMSR_LSTATUS
0122 #define MDIO_STAT1_FAULT        0x0080  /* Fault */
0123 #define MDIO_AN_STAT1_LPABLE        0x0001  /* Link partner AN ability */
0124 #define MDIO_AN_STAT1_ABLE      BMSR_ANEGCAPABLE
0125 #define MDIO_AN_STAT1_RFAULT        BMSR_RFAULT
0126 #define MDIO_AN_STAT1_COMPLETE      BMSR_ANEGCOMPLETE
0127 #define MDIO_AN_STAT1_PAGE      0x0040  /* Page received */
0128 #define MDIO_AN_STAT1_XNP       0x0080  /* Extended next page status */
0129 
0130 /* Speed register. */
0131 #define MDIO_SPEED_10G          0x0001  /* 10G capable */
0132 #define MDIO_PMA_SPEED_2B       0x0002  /* 2BASE-TL capable */
0133 #define MDIO_PMA_SPEED_10P      0x0004  /* 10PASS-TS capable */
0134 #define MDIO_PMA_SPEED_1000     0x0010  /* 1000M capable */
0135 #define MDIO_PMA_SPEED_100      0x0020  /* 100M capable */
0136 #define MDIO_PMA_SPEED_10       0x0040  /* 10M capable */
0137 #define MDIO_PCS_SPEED_10P2B        0x0002  /* 10PASS-TS/2BASE-TL capable */
0138 #define MDIO_PCS_SPEED_2_5G     0x0040  /* 2.5G capable */
0139 #define MDIO_PCS_SPEED_5G       0x0080  /* 5G capable */
0140 
0141 /* Device present registers. */
0142 #define MDIO_DEVS_PRESENT(devad)    (1 << (devad))
0143 #define MDIO_DEVS_C22PRESENT        MDIO_DEVS_PRESENT(0)
0144 #define MDIO_DEVS_PMAPMD        MDIO_DEVS_PRESENT(MDIO_MMD_PMAPMD)
0145 #define MDIO_DEVS_WIS           MDIO_DEVS_PRESENT(MDIO_MMD_WIS)
0146 #define MDIO_DEVS_PCS           MDIO_DEVS_PRESENT(MDIO_MMD_PCS)
0147 #define MDIO_DEVS_PHYXS         MDIO_DEVS_PRESENT(MDIO_MMD_PHYXS)
0148 #define MDIO_DEVS_DTEXS         MDIO_DEVS_PRESENT(MDIO_MMD_DTEXS)
0149 #define MDIO_DEVS_TC            MDIO_DEVS_PRESENT(MDIO_MMD_TC)
0150 #define MDIO_DEVS_AN            MDIO_DEVS_PRESENT(MDIO_MMD_AN)
0151 #define MDIO_DEVS_C22EXT        MDIO_DEVS_PRESENT(MDIO_MMD_C22EXT)
0152 #define MDIO_DEVS_VEND1         MDIO_DEVS_PRESENT(MDIO_MMD_VEND1)
0153 #define MDIO_DEVS_VEND2         MDIO_DEVS_PRESENT(MDIO_MMD_VEND2)
0154 
0155 /* Control register 2. */
0156 #define MDIO_PMA_CTRL2_TYPE     0x000f  /* PMA/PMD type selection */
0157 #define MDIO_PMA_CTRL2_10GBCX4      0x0000  /* 10GBASE-CX4 type */
0158 #define MDIO_PMA_CTRL2_10GBEW       0x0001  /* 10GBASE-EW type */
0159 #define MDIO_PMA_CTRL2_10GBLW       0x0002  /* 10GBASE-LW type */
0160 #define MDIO_PMA_CTRL2_10GBSW       0x0003  /* 10GBASE-SW type */
0161 #define MDIO_PMA_CTRL2_10GBLX4      0x0004  /* 10GBASE-LX4 type */
0162 #define MDIO_PMA_CTRL2_10GBER       0x0005  /* 10GBASE-ER type */
0163 #define MDIO_PMA_CTRL2_10GBLR       0x0006  /* 10GBASE-LR type */
0164 #define MDIO_PMA_CTRL2_10GBSR       0x0007  /* 10GBASE-SR type */
0165 #define MDIO_PMA_CTRL2_10GBLRM      0x0008  /* 10GBASE-LRM type */
0166 #define MDIO_PMA_CTRL2_10GBT        0x0009  /* 10GBASE-T type */
0167 #define MDIO_PMA_CTRL2_10GBKX4      0x000a  /* 10GBASE-KX4 type */
0168 #define MDIO_PMA_CTRL2_10GBKR       0x000b  /* 10GBASE-KR type */
0169 #define MDIO_PMA_CTRL2_1000BT       0x000c  /* 1000BASE-T type */
0170 #define MDIO_PMA_CTRL2_1000BKX      0x000d  /* 1000BASE-KX type */
0171 #define MDIO_PMA_CTRL2_100BTX       0x000e  /* 100BASE-TX type */
0172 #define MDIO_PMA_CTRL2_10BT     0x000f  /* 10BASE-T type */
0173 #define MDIO_PMA_CTRL2_2_5GBT       0x0030  /* 2.5GBaseT type */
0174 #define MDIO_PMA_CTRL2_5GBT     0x0031  /* 5GBaseT type */
0175 #define MDIO_PMA_CTRL2_BASET1       0x003D  /* BASE-T1 type */
0176 #define MDIO_PCS_CTRL2_TYPE     0x0003  /* PCS type selection */
0177 #define MDIO_PCS_CTRL2_10GBR        0x0000  /* 10GBASE-R type */
0178 #define MDIO_PCS_CTRL2_10GBX        0x0001  /* 10GBASE-X type */
0179 #define MDIO_PCS_CTRL2_10GBW        0x0002  /* 10GBASE-W type */
0180 #define MDIO_PCS_CTRL2_10GBT        0x0003  /* 10GBASE-T type */
0181 
0182 /* Status register 2. */
0183 #define MDIO_STAT2_RXFAULT      0x0400  /* Receive fault */
0184 #define MDIO_STAT2_TXFAULT      0x0800  /* Transmit fault */
0185 #define MDIO_STAT2_DEVPRST      0xc000  /* Device present */
0186 #define MDIO_STAT2_DEVPRST_VAL      0x8000  /* Device present value */
0187 #define MDIO_PMA_STAT2_LBABLE       0x0001  /* PMA loopback ability */
0188 #define MDIO_PMA_STAT2_10GBEW       0x0002  /* 10GBASE-EW ability */
0189 #define MDIO_PMA_STAT2_10GBLW       0x0004  /* 10GBASE-LW ability */
0190 #define MDIO_PMA_STAT2_10GBSW       0x0008  /* 10GBASE-SW ability */
0191 #define MDIO_PMA_STAT2_10GBLX4      0x0010  /* 10GBASE-LX4 ability */
0192 #define MDIO_PMA_STAT2_10GBER       0x0020  /* 10GBASE-ER ability */
0193 #define MDIO_PMA_STAT2_10GBLR       0x0040  /* 10GBASE-LR ability */
0194 #define MDIO_PMA_STAT2_10GBSR       0x0080  /* 10GBASE-SR ability */
0195 #define MDIO_PMD_STAT2_TXDISAB      0x0100  /* PMD TX disable ability */
0196 #define MDIO_PMA_STAT2_EXTABLE      0x0200  /* Extended abilities */
0197 #define MDIO_PMA_STAT2_RXFLTABLE    0x1000  /* Receive fault ability */
0198 #define MDIO_PMA_STAT2_TXFLTABLE    0x2000  /* Transmit fault ability */
0199 #define MDIO_PCS_STAT2_10GBR        0x0001  /* 10GBASE-R capable */
0200 #define MDIO_PCS_STAT2_10GBX        0x0002  /* 10GBASE-X capable */
0201 #define MDIO_PCS_STAT2_10GBW        0x0004  /* 10GBASE-W capable */
0202 #define MDIO_PCS_STAT2_RXFLTABLE    0x1000  /* Receive fault ability */
0203 #define MDIO_PCS_STAT2_TXFLTABLE    0x2000  /* Transmit fault ability */
0204 
0205 /* Transmit disable register. */
0206 #define MDIO_PMD_TXDIS_GLOBAL       0x0001  /* Global PMD TX disable */
0207 #define MDIO_PMD_TXDIS_0        0x0002  /* PMD TX disable 0 */
0208 #define MDIO_PMD_TXDIS_1        0x0004  /* PMD TX disable 1 */
0209 #define MDIO_PMD_TXDIS_2        0x0008  /* PMD TX disable 2 */
0210 #define MDIO_PMD_TXDIS_3        0x0010  /* PMD TX disable 3 */
0211 
0212 /* Receive signal detect register. */
0213 #define MDIO_PMD_RXDET_GLOBAL       0x0001  /* Global PMD RX signal detect */
0214 #define MDIO_PMD_RXDET_0        0x0002  /* PMD RX signal detect 0 */
0215 #define MDIO_PMD_RXDET_1        0x0004  /* PMD RX signal detect 1 */
0216 #define MDIO_PMD_RXDET_2        0x0008  /* PMD RX signal detect 2 */
0217 #define MDIO_PMD_RXDET_3        0x0010  /* PMD RX signal detect 3 */
0218 
0219 /* Extended abilities register. */
0220 #define MDIO_PMA_EXTABLE_10GCX4     0x0001  /* 10GBASE-CX4 ability */
0221 #define MDIO_PMA_EXTABLE_10GBLRM    0x0002  /* 10GBASE-LRM ability */
0222 #define MDIO_PMA_EXTABLE_10GBT      0x0004  /* 10GBASE-T ability */
0223 #define MDIO_PMA_EXTABLE_10GBKX4    0x0008  /* 10GBASE-KX4 ability */
0224 #define MDIO_PMA_EXTABLE_10GBKR     0x0010  /* 10GBASE-KR ability */
0225 #define MDIO_PMA_EXTABLE_1000BT     0x0020  /* 1000BASE-T ability */
0226 #define MDIO_PMA_EXTABLE_1000BKX    0x0040  /* 1000BASE-KX ability */
0227 #define MDIO_PMA_EXTABLE_100BTX     0x0080  /* 100BASE-TX ability */
0228 #define MDIO_PMA_EXTABLE_10BT       0x0100  /* 10BASE-T ability */
0229 #define MDIO_PMA_EXTABLE_BT1        0x0800  /* BASE-T1 ability */
0230 #define MDIO_PMA_EXTABLE_NBT        0x4000  /* 2.5/5GBASE-T ability */
0231 
0232 /* PHY XGXS lane state register. */
0233 #define MDIO_PHYXS_LNSTAT_SYNC0     0x0001
0234 #define MDIO_PHYXS_LNSTAT_SYNC1     0x0002
0235 #define MDIO_PHYXS_LNSTAT_SYNC2     0x0004
0236 #define MDIO_PHYXS_LNSTAT_SYNC3     0x0008
0237 #define MDIO_PHYXS_LNSTAT_ALIGN     0x1000
0238 
0239 /* PMA 10GBASE-T pair swap & polarity */
0240 #define MDIO_PMA_10GBT_SWAPPOL_ABNX 0x0001  /* Pair A/B uncrossed */
0241 #define MDIO_PMA_10GBT_SWAPPOL_CDNX 0x0002  /* Pair C/D uncrossed */
0242 #define MDIO_PMA_10GBT_SWAPPOL_AREV 0x0100  /* Pair A polarity reversed */
0243 #define MDIO_PMA_10GBT_SWAPPOL_BREV 0x0200  /* Pair B polarity reversed */
0244 #define MDIO_PMA_10GBT_SWAPPOL_CREV 0x0400  /* Pair C polarity reversed */
0245 #define MDIO_PMA_10GBT_SWAPPOL_DREV 0x0800  /* Pair D polarity reversed */
0246 
0247 /* PMA 10GBASE-T TX power register. */
0248 #define MDIO_PMA_10GBT_TXPWR_SHORT  0x0001  /* Short-reach mode */
0249 
0250 /* PMA 10GBASE-T SNR registers. */
0251 /* Value is SNR margin in dB, clamped to range [-127, 127], plus 0x8000. */
0252 #define MDIO_PMA_10GBT_SNR_BIAS     0x8000
0253 #define MDIO_PMA_10GBT_SNR_MAX      127
0254 
0255 /* PMA 10GBASE-R FEC ability register. */
0256 #define MDIO_PMA_10GBR_FECABLE_ABLE 0x0001  /* FEC ability */
0257 #define MDIO_PMA_10GBR_FECABLE_ERRABLE  0x0002  /* FEC error indic. ability */
0258 
0259 /* PMA 10GBASE-R Fast Retrain status and control register. */
0260 #define MDIO_PMA_10GBR_FSRT_ENABLE  0x0001  /* Fast retrain enable */
0261 
0262 /* PCS 10GBASE-R/-T status register 1. */
0263 #define MDIO_PCS_10GBRT_STAT1_BLKLK 0x0001  /* Block lock attained */
0264 
0265 /* PCS 10GBASE-R/-T status register 2. */
0266 #define MDIO_PCS_10GBRT_STAT2_ERR   0x00ff
0267 #define MDIO_PCS_10GBRT_STAT2_BER   0x3f00
0268 
0269 /* AN 10GBASE-T control register. */
0270 #define MDIO_AN_10GBT_CTRL_ADVFSRT2_5G  0x0020  /* Advertise 2.5GBASE-T fast retrain */
0271 #define MDIO_AN_10GBT_CTRL_ADV2_5G  0x0080  /* Advertise 2.5GBASE-T */
0272 #define MDIO_AN_10GBT_CTRL_ADV5G    0x0100  /* Advertise 5GBASE-T */
0273 #define MDIO_AN_10GBT_CTRL_ADV10G   0x1000  /* Advertise 10GBASE-T */
0274 
0275 /* AN 10GBASE-T status register. */
0276 #define MDIO_AN_10GBT_STAT_LP2_5G   0x0020  /* LP is 2.5GBT capable */
0277 #define MDIO_AN_10GBT_STAT_LP5G     0x0040  /* LP is 5GBT capable */
0278 #define MDIO_AN_10GBT_STAT_LPTRR    0x0200  /* LP training reset req. */
0279 #define MDIO_AN_10GBT_STAT_LPLTABLE 0x0400  /* LP loop timing ability */
0280 #define MDIO_AN_10GBT_STAT_LP10G    0x0800  /* LP is 10GBT capable */
0281 #define MDIO_AN_10GBT_STAT_REMOK    0x1000  /* Remote OK */
0282 #define MDIO_AN_10GBT_STAT_LOCOK    0x2000  /* Local OK */
0283 #define MDIO_AN_10GBT_STAT_MS       0x4000  /* Master/slave config */
0284 #define MDIO_AN_10GBT_STAT_MSFLT    0x8000  /* Master/slave config fault */
0285 
0286 /* 10BASE-T1L PMA control */
0287 #define MDIO_PMA_10T1L_CTRL_LB_EN   0x0001  /* Enable loopback mode */
0288 #define MDIO_PMA_10T1L_CTRL_EEE_EN  0x0400  /* Enable EEE mode */
0289 #define MDIO_PMA_10T1L_CTRL_LOW_POWER   0x0800  /* Low-power mode */
0290 #define MDIO_PMA_10T1L_CTRL_2V4_EN  0x1000  /* Enable 2.4 Vpp operating mode */
0291 #define MDIO_PMA_10T1L_CTRL_TX_DIS  0x4000  /* Transmit disable */
0292 #define MDIO_PMA_10T1L_CTRL_PMA_RST 0x8000  /* MA reset */
0293 
0294 /* 10BASE-T1L PMA status register. */
0295 #define MDIO_PMA_10T1L_STAT_LINK    0x0001  /* PMA receive link up */
0296 #define MDIO_PMA_10T1L_STAT_FAULT   0x0002  /* Fault condition detected */
0297 #define MDIO_PMA_10T1L_STAT_POLARITY    0x0004  /* Receive polarity is reversed */
0298 #define MDIO_PMA_10T1L_STAT_RECV_FAULT  0x0200  /* Able to detect fault on receive path */
0299 #define MDIO_PMA_10T1L_STAT_EEE     0x0400  /* PHY has EEE ability */
0300 #define MDIO_PMA_10T1L_STAT_LOW_POWER   0x0800  /* PMA has low-power ability */
0301 #define MDIO_PMA_10T1L_STAT_2V4_ABLE    0x1000  /* PHY has 2.4 Vpp operating mode ability */
0302 #define MDIO_PMA_10T1L_STAT_LB_ABLE 0x2000  /* PHY has loopback ability */
0303 
0304 /* 10BASE-T1L PCS control register. */
0305 #define MDIO_PCS_10T1L_CTRL_LB      0x4000  /* Enable PCS level loopback mode */
0306 #define MDIO_PCS_10T1L_CTRL_RESET   0x8000  /* PCS reset */
0307 
0308 /* BASE-T1 PMA/PMD extended ability register. */
0309 #define MDIO_PMA_PMD_BT1_B10L_ABLE  0x0004  /* 10BASE-T1L Ability */
0310 
0311 /* BASE-T1 auto-negotiation advertisement register [15:0] */
0312 #define MDIO_AN_T1_ADV_L_PAUSE_CAP  ADVERTISE_PAUSE_CAP
0313 #define MDIO_AN_T1_ADV_L_PAUSE_ASYM ADVERTISE_PAUSE_ASYM
0314 #define MDIO_AN_T1_ADV_L_FORCE_MS   0x1000  /* Force Master/slave Configuration */
0315 #define MDIO_AN_T1_ADV_L_REMOTE_FAULT   ADVERTISE_RFAULT
0316 #define MDIO_AN_T1_ADV_L_ACK        ADVERTISE_LPACK
0317 #define MDIO_AN_T1_ADV_L_NEXT_PAGE_REQ  ADVERTISE_NPAGE
0318 
0319 /* BASE-T1 auto-negotiation advertisement register [31:16] */
0320 #define MDIO_AN_T1_ADV_M_B10L       0x4000  /* device is compatible with 10BASE-T1L */
0321 #define MDIO_AN_T1_ADV_M_MST        0x0010  /* advertise master preference */
0322 
0323 /* BASE-T1 auto-negotiation advertisement register [47:32] */
0324 #define MDIO_AN_T1_ADV_H_10L_TX_HI_REQ  0x1000  /* 10BASE-T1L High Level Transmit Request */
0325 #define MDIO_AN_T1_ADV_H_10L_TX_HI  0x2000  /* 10BASE-T1L High Level Transmit Ability */
0326 
0327 /* BASE-T1 AN LP Base Page ability register [15:0] */
0328 #define MDIO_AN_T1_LP_L_PAUSE_CAP   LPA_PAUSE_CAP
0329 #define MDIO_AN_T1_LP_L_PAUSE_ASYM  LPA_PAUSE_ASYM
0330 #define MDIO_AN_T1_LP_L_FORCE_MS    0x1000  /* LP Force Master/slave Configuration */
0331 #define MDIO_AN_T1_LP_L_REMOTE_FAULT    LPA_RFAULT
0332 #define MDIO_AN_T1_LP_L_ACK     LPA_LPACK
0333 #define MDIO_AN_T1_LP_L_NEXT_PAGE_REQ   LPA_NPAGE
0334 
0335 /* BASE-T1 AN LP Base Page ability register [31:16] */
0336 #define MDIO_AN_T1_LP_M_MST     0x0010  /* LP master preference */
0337 #define MDIO_AN_T1_LP_M_B10L        0x4000  /* LP is compatible with 10BASE-T1L */
0338 
0339 /* BASE-T1 AN LP Base Page ability register [47:32] */
0340 #define MDIO_AN_T1_LP_H_10L_TX_HI_REQ   0x1000  /* 10BASE-T1L High Level LP Transmit Request */
0341 #define MDIO_AN_T1_LP_H_10L_TX_HI   0x2000  /* 10BASE-T1L High Level LP Transmit Ability */
0342 
0343 /* BASE-T1 PMA/PMD control register */
0344 #define MDIO_PMA_PMD_BT1_CTRL_CFG_MST   0x4000 /* MASTER-SLAVE config value */
0345 
0346 /* EEE Supported/Advertisement/LP Advertisement registers.
0347  *
0348  * EEE capability Register (3.20), Advertisement (7.60) and
0349  * Link partner ability (7.61) registers have and can use the same identical
0350  * bit masks.
0351  */
0352 #define MDIO_AN_EEE_ADV_100TX   0x0002  /* Advertise 100TX EEE cap */
0353 #define MDIO_AN_EEE_ADV_1000T   0x0004  /* Advertise 1000T EEE cap */
0354 /* Note: the two defines above can be potentially used by the user-land
0355  * and cannot remove them now.
0356  * So, we define the new generic MDIO_EEE_100TX and MDIO_EEE_1000T macros
0357  * using the previous ones (that can be considered obsolete).
0358  */
0359 #define MDIO_EEE_100TX      MDIO_AN_EEE_ADV_100TX   /* 100TX EEE cap */
0360 #define MDIO_EEE_1000T      MDIO_AN_EEE_ADV_1000T   /* 1000T EEE cap */
0361 #define MDIO_EEE_10GT       0x0008  /* 10GT EEE cap */
0362 #define MDIO_EEE_1000KX     0x0010  /* 1000KX EEE cap */
0363 #define MDIO_EEE_10GKX4     0x0020  /* 10G KX4 EEE cap */
0364 #define MDIO_EEE_10GKR      0x0040  /* 10G KR EEE cap */
0365 #define MDIO_EEE_40GR_FW    0x0100  /* 40G R fast wake */
0366 #define MDIO_EEE_40GR_DS    0x0200  /* 40G R deep sleep */
0367 #define MDIO_EEE_100GR_FW   0x1000  /* 100G R fast wake */
0368 #define MDIO_EEE_100GR_DS   0x2000  /* 100G R deep sleep */
0369 
0370 #define MDIO_EEE_2_5GT      0x0001  /* 2.5GT EEE cap */
0371 #define MDIO_EEE_5GT        0x0002  /* 5GT EEE cap */
0372 
0373 /* AN MultiGBASE-T AN control 2 */
0374 #define MDIO_AN_THP_BP2_5GT 0x0008  /* 2.5GT THP bypass request */
0375 
0376 /* 2.5G/5G Extended abilities register. */
0377 #define MDIO_PMA_NG_EXTABLE_2_5GBT  0x0001  /* 2.5GBASET ability */
0378 #define MDIO_PMA_NG_EXTABLE_5GBT    0x0002  /* 5GBASET ability */
0379 
0380 /* LASI RX_ALARM control/status registers. */
0381 #define MDIO_PMA_LASI_RX_PHYXSLFLT  0x0001  /* PHY XS RX local fault */
0382 #define MDIO_PMA_LASI_RX_PCSLFLT    0x0008  /* PCS RX local fault */
0383 #define MDIO_PMA_LASI_RX_PMALFLT    0x0010  /* PMA/PMD RX local fault */
0384 #define MDIO_PMA_LASI_RX_OPTICPOWERFLT  0x0020  /* RX optical power fault */
0385 #define MDIO_PMA_LASI_RX_WISLFLT    0x0200  /* WIS local fault */
0386 
0387 /* LASI TX_ALARM control/status registers. */
0388 #define MDIO_PMA_LASI_TX_PHYXSLFLT  0x0001  /* PHY XS TX local fault */
0389 #define MDIO_PMA_LASI_TX_PCSLFLT    0x0008  /* PCS TX local fault */
0390 #define MDIO_PMA_LASI_TX_PMALFLT    0x0010  /* PMA/PMD TX local fault */
0391 #define MDIO_PMA_LASI_TX_LASERPOWERFLT  0x0080  /* Laser output power fault */
0392 #define MDIO_PMA_LASI_TX_LASERTEMPFLT   0x0100  /* Laser temperature fault */
0393 #define MDIO_PMA_LASI_TX_LASERBICURRFLT 0x0200  /* Laser bias current fault */
0394 
0395 /* LASI control/status registers. */
0396 #define MDIO_PMA_LASI_LSALARM       0x0001  /* LS_ALARM enable/status */
0397 #define MDIO_PMA_LASI_TXALARM       0x0002  /* TX_ALARM enable/status */
0398 #define MDIO_PMA_LASI_RXALARM       0x0004  /* RX_ALARM enable/status */
0399 
0400 /* Mapping between MDIO PRTAD/DEVAD and mii_ioctl_data::phy_id */
0401 
0402 #define MDIO_PHY_ID_C45         0x8000
0403 #define MDIO_PHY_ID_PRTAD       0x03e0
0404 #define MDIO_PHY_ID_DEVAD       0x001f
0405 #define MDIO_PHY_ID_C45_MASK                        \
0406     (MDIO_PHY_ID_C45 | MDIO_PHY_ID_PRTAD | MDIO_PHY_ID_DEVAD)
0407 
0408 static inline __u16 mdio_phy_id_c45(int prtad, int devad)
0409 {
0410     return MDIO_PHY_ID_C45 | (prtad << 5) | devad;
0411 }
0412 
0413 /* UsxgmiiChannelInfo[15:0] for USXGMII in-band auto-negotiation.*/
0414 #define MDIO_USXGMII_EEE_CLK_STP    0x0080  /* EEE clock stop supported */
0415 #define MDIO_USXGMII_EEE        0x0100  /* EEE supported */
0416 #define MDIO_USXGMII_SPD_MASK       0x0e00  /* USXGMII speed mask */
0417 #define MDIO_USXGMII_FULL_DUPLEX    0x1000  /* USXGMII full duplex */
0418 #define MDIO_USXGMII_DPX_SPD_MASK   0x1e00  /* USXGMII duplex and speed bits */
0419 #define MDIO_USXGMII_10         0x0000  /* 10Mbps */
0420 #define MDIO_USXGMII_10HALF     0x0000  /* 10Mbps half-duplex */
0421 #define MDIO_USXGMII_10FULL     0x1000  /* 10Mbps full-duplex */
0422 #define MDIO_USXGMII_100        0x0200  /* 100Mbps */
0423 #define MDIO_USXGMII_100HALF        0x0200  /* 100Mbps half-duplex */
0424 #define MDIO_USXGMII_100FULL        0x1200  /* 100Mbps full-duplex */
0425 #define MDIO_USXGMII_1000       0x0400  /* 1000Mbps */
0426 #define MDIO_USXGMII_1000HALF       0x0400  /* 1000Mbps half-duplex */
0427 #define MDIO_USXGMII_1000FULL       0x1400  /* 1000Mbps full-duplex */
0428 #define MDIO_USXGMII_10G        0x0600  /* 10Gbps */
0429 #define MDIO_USXGMII_10GHALF        0x0600  /* 10Gbps half-duplex */
0430 #define MDIO_USXGMII_10GFULL        0x1600  /* 10Gbps full-duplex */
0431 #define MDIO_USXGMII_2500       0x0800  /* 2500Mbps */
0432 #define MDIO_USXGMII_2500HALF       0x0800  /* 2500Mbps half-duplex */
0433 #define MDIO_USXGMII_2500FULL       0x1800  /* 2500Mbps full-duplex */
0434 #define MDIO_USXGMII_5000       0x0a00  /* 5000Mbps */
0435 #define MDIO_USXGMII_5000HALF       0x0a00  /* 5000Mbps half-duplex */
0436 #define MDIO_USXGMII_5000FULL       0x1a00  /* 5000Mbps full-duplex */
0437 #define MDIO_USXGMII_LINK       0x8000  /* PHY link with copper-side partner */
0438 
0439 #endif /* _UAPI__LINUX_MDIO_H__ */