| Both sides previous revision Previous revision Next revision | Previous revision |
| mii_and_mdio [2018/10/06 18:09] – [Links] rpjday | mii_and_mdio [2018/10/09 11:06] (current) – [Files] rpjday |
|---|
| ===== Links ===== | ===== Links ===== |
| |
| * [[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include|include]] | * [[https://www.electronicdesign.com/microcontrollers/use-mdio-bus-interrogate-complex-devices|Use The MDIO Bus To Interrogate Complex Devices]] |
| * [[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi|uapi]] | * [[https://www.totalphase.com/support/articles/200349206-MDIO-Background|MDIO Background]] |
| * [[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux|linux]] | * [[http://www.ieee802.org/3/efm/public/nov02/oam/pannell_oam_1_1102.pdf|Clause 22 Access to |
| | Clause 45 Registers]] |
| | * [[https://www.intel.com/content/www/us/en/programmable/documentation/sfo1400787952932/iga1401395383139/iga1401395383732/iga1401395384075.html|Intel MDIO Clause 45]] |
| | |
| | ===== Files ===== |
| | |
| | * [[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include|include/]] |
| | * [[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi|uapi/]] |
| | * [[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux|linux/]] |
| * [[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/mii.h|mii.h]] | * [[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/mii.h|mii.h]] |
| * [[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/mdio.h|mdio.h]] | * [[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/mdio.h|mdio.h]] |
| * [[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux|linux]] | * [[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux|linux/]] |
| * [[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/mii.h|mii.h]] | * [[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/mii.h|mii.h]] |
| * [[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/mdio.h|mdio.h]] | * [[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/mdio.h|mdio.h]] |
| * [[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers|drivers]] | * [[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/of_mdio.h|of_mdio.h]] |
| * [[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net|net]] | * [[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/phy.h|phy.h]] |
| | * [[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers|drivers/]] |
| | * [[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net|net/]] |
| * [[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/mii.c|mii.c]] | * [[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/mii.c|mii.c]] |
| * [[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/mdio.c|mdio.c]] | * [[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/mdio.c|mdio.c]] |
| | * [[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/of|of/]] |
| | * [[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/of/of_mdio.c|of_mdio.c]] |
| |
| | ===== MII ===== |
| |
| ===== Files ===== | |
| |
| ==== include/uapi/linux/mii.h ==== | |
| |
| <code> | |
| #include <linux/types.h> | |
| #include <linux/ethtool.h> | |
| |
| /* Generic MII registers. */ | |
| #define MII_BMCR 0x00 /* Basic mode control register */ | |
| #define MII_BMSR 0x01 /* Basic mode status register */ | |
| #define MII_PHYSID1 0x02 /* PHYS ID 1 */ | |
| #define MII_PHYSID2 0x03 /* PHYS ID 2 */ | |
| </code> | |
| |
| ==== include/uapi/linux/mdio.h ==== | |
| |
| === DEVADs === | |
| |
| <code> | |
| #include <linux/types.h> | |
| #include <linux/mii.h> | |
| |
| /* MDIO Manageable Devices (MMDs). */ | |
| #define MDIO_MMD_PMAPMD 1 /* Physical Medium Attachment/ | |
| * Physical Medium Dependent */ | |
| #define MDIO_MMD_WIS 2 /* WAN Interface Sublayer */ | |
| #define MDIO_MMD_PCS 3 /* Physical Coding Sublayer */ | |
| #define MDIO_MMD_PHYXS 4 /* PHY Extender Sublayer */ | |
| #define MDIO_MMD_DTEXS 5 /* DTE Extender Sublayer */ | |
| #define MDIO_MMD_TC 6 /* Transmission Convergence */ | |
| #define MDIO_MMD_AN 7 /* Auto-Negotiation */ | |
| #define MDIO_MMD_C22EXT 29 /* Clause 22 extension */ | |
| #define MDIO_MMD_VEND1 30 /* Vendor specific 1 */ | |
| #define MDIO_MMD_VEND2 31 /* Vendor specific 2 */ | |
| </code> | |
| |
| === DEVAD = 1 (PMA/PMD) === | |
| |
| <code> | |
| /* Generic MDIO registers. */ | |
| #define MDIO_CTRL1 MII_BMCR | |
| #define MDIO_STAT1 MII_BMSR | |
| #define MDIO_DEVID1 MII_PHYSID1 | |
| #define MDIO_DEVID2 MII_PHYSID2 | |
| #define MDIO_SPEED 4 /* Speed ability */ | |
| #define MDIO_DEVS1 5 /* Devices in package */ | |
| #define MDIO_DEVS2 6 | |
| #define MDIO_CTRL2 7 /* 10G control 2 */ | |
| #define MDIO_STAT2 8 /* 10G status 2 */ | |
| #define MDIO_PMA_TXDIS 9 /* 10G PMA/PMD transmit disable */ | |
| #define MDIO_PMA_RXDET 10 /* 10G PMA/PMD receive signal detect */ | |
| #define MDIO_PMA_EXTABLE 11 /* 10G PMA/PMD extended ability */ | |
| #define MDIO_PKGID1 14 /* Package identifier */ | |
| #define MDIO_PKGID2 15 | |
| </code> | |
| |
| === DEVAD = 7 (AN) === | |
| |
| <code> | |
| #define MDIO_AN_ADVERTISE 16 /* AN advertising (base page) */ | |
| #define MDIO_AN_LPA 19 /* AN LP abilities (base page) */ | |
| </code> | |
| |
| === DEVAD = 3 (PCS) === | |
| |
| <code> | |
| #define MDIO_PCS_EEE_ABLE 20 /* EEE Capability register */ | |
| #define MDIO_PCS_EEE_WK_ERR 22 /* EEE wake error counter */ | |
| </code> | |
| |
| === Don't know === | |
| |
| <code> | |
| #define MDIO_PHYXS_LNSTAT 24 /* PHY XGXS lane state */ | |
| </code> | |
| |
| === DEVAD = 7 (AN) === | |
| |
| What's with 61? Not in data sheet. | |
| |
| <code> | |
| #define MDIO_AN_EEE_ADV 60 /* EEE advertisement */ | |
| #define MDIO_AN_EEE_LPABLE 61 /* EEE link partner ability */ | |
| </code> | |
| |
| === DEVAD = 1 (PMA) === | |
| |
| <code> | |
| /* Media-dependent registers. */ | |
| #define MDIO_PMA_10GBT_SWAPPOL 130 /* 10GBASE-T pair swap & polarity */ | |
| #define MDIO_PMA_10GBT_TXPWR 131 /* 10GBASE-T TX power control */ | |
| #define MDIO_PMA_10GBT_SNR 133 /* 10GBASE-T SNR margin, lane A. | |
| * Lanes B-D are numbered 134-136. */ | |
| * </code> | |
| |
| === Don't know === | |
| |
| <code> | |
| #define MDIO_PMA_10GBR_FECABLE 170 /* 10GBASE-R FEC ability */ | |
| </code> | |
| |
| === Don't know === | |
| |
| <code> | |
| #define MDIO_PCS_10GBX_STAT1 24 /* 10GBASE-X PCS status 1 */ | |
| #define MDIO_PCS_10GBRT_STAT1 32 /* 10GBASE-R/-T PCS status 1 */ | |
| #define MDIO_PCS_10GBRT_STAT2 33 /* 10GBASE-R/-T PCS status 2 */ | |
| </code> | |
| |
| === DEVAD = 7 (AN) === | |
| |
| <code> | |
| #define MDIO_AN_10GBT_CTRL 32 /* 10GBASE-T auto-negotiation control */ | |
| #define MDIO_AN_10GBT_STAT 33 /* 10GBASE-T auto-negotiation status */ | |
| </code> | |