blob: 47784b2e8e3b0f43cbdb42a3cc80a3e27b414454 [file] [log] [blame]
Piotr Mienkowski93e46cc2016-11-10 02:12:41 +01001/*
2 * Copyright (c) 2016 Piotr Mienkowski
3 *
David B. Kinderac74d8b2017-01-18 17:01:01 -08004 * SPDX-License-Identifier: Apache-2.0
Piotr Mienkowski93e46cc2016-11-10 02:12:41 +01005 */
6
7/** @file
8 * @brief Definitions for IEEE 802.3, Section 2 MII compatible PHY transceivers
9 */
10
Flavio Ceolin67ca1762018-09-14 10:43:44 -070011#ifndef ZEPHYR_INCLUDE_NET_MII_H_
12#define ZEPHYR_INCLUDE_NET_MII_H_
Piotr Mienkowski93e46cc2016-11-10 02:12:41 +010013
Jukka Rissanen539b0c42017-07-20 16:29:45 +030014/**
15 * @addtogroup ethernet
16 * @{
17 */
18
Piotr Mienkowski93e46cc2016-11-10 02:12:41 +010019/* MII management registers */
20#define MII_BMCR 0x0 /** Basic Mode Control Register */
21#define MII_BMSR 0x1 /** Basic Mode Status Register */
22#define MII_PHYID1R 0x2 /** PHY ID 1 Register */
23#define MII_PHYID2R 0x3 /** PHY ID 2 Register */
24#define MII_ANAR 0x4 /** Auto-Negotiation Advertisement Register */
25#define MII_ANLPAR 0x5 /** Auto-Negotiation Link Partner Ability Reg */
26#define MII_ANER 0x6 /** Auto-Negotiation Expansion Register */
27#define MII_ANNPTR 0x7 /** Auto-Negotiation Next Page Transmit Register */
28#define MII_ANLPRNPR 0x8 /** Auto-Negotiation Link Partner Received Next Page Reg */
29#define MII_MMD_ACR 0xd /** MMD Access Control Register */
30#define MII_MMD_AADR 0xe /** MMD Access Address Data Register */
31#define MII_ESTAT 0xf /** Extended Status Register */
32
33/* Basic Mode Control Register (BMCR) bit definitions */
34#define MII_BMCR_RESET (1 << 15) /** PHY reset */
35#define MII_BMCR_LOOPBACK (1 << 14) /** enable loopback mode */
36#define MII_BMCR_SPEED_LSB (1 << 13) /** 10=1000Mbps 01=100Mbps; 00=10Mbps */
37#define MII_BMCR_AUTONEG_ENABLE (1 << 12) /** Auto-Negotiation enable */
38#define MII_BMCR_POWER_DOWN (1 << 11) /** power down mode */
39#define MII_BMCR_ISOLATE (1 << 10) /** isolate electrically PHY from MII */
40#define MII_BMCR_AUTONEG_RESTART (1 << 9) /** restart auto-negotiation */
41#define MII_BMCR_DUPLEX_MODE (1 << 8) /** full duplex mode */
42#define MII_BMCR_SPEED_MSB (1 << 6) /** 10=1000Mbps 01=100Mbps; 00=10Mbps */
43#define MII_BMCR_SPEED_MASK (1 << 6 | 1 << 13) /** Link Speed Field */
44#define MII_BMCR_SPEED_10 (0 << 6 | 0 << 13) /** select speed 10 Mb/s */
45#define MII_BMCR_SPEED_100 (0 << 6 | 1 << 13) /** select speed 100 Mb/s */
46#define MII_BMCR_SPEED_1000 (1 << 6 | 0 << 13) /** select speed 1000 Mb/s */
47
48/* Basic Mode Status Register (BMSR) bit definitions */
49#define MII_BMSR_100BASE_T4 (1 << 15) /** 100BASE-T4 capable */
50#define MII_BMSR_100BASE_X_FULL (1 << 14) /** 100BASE-X full duplex capable */
51#define MII_BMSR_100BASE_X_HALF (1 << 13) /** 100BASE-X half duplex capable */
52#define MII_BMSR_10_FULL (1 << 12) /** 10 Mb/s full duplex capable */
53#define MII_BMSR_10_HALF (1 << 11) /** 10 Mb/s half duplex capable */
54#define MII_BMSR_100BASE_T2_FULL (1 << 10) /** 100BASE-T2 full duplex capable */
55#define MII_BMSR_100BASE_T2_HALF (1 << 9) /** 100BASE-T2 half duplex capable */
56#define MII_BMSR_EXTEND_STATUS (1 << 8) /** extend status information in reg 15 */
57#define MII_BMSR_MF_PREAMB_SUPPR (1 << 6) /** PHY accepts management frames with preamble suppressed */
58#define MII_BMSR_AUTONEG_COMPLETE (1 << 5) /** Auto-negotiation process completed */
59#define MII_BMSR_REMOTE_FAULT (1 << 4) /** remote fault detected */
60#define MII_BMSR_AUTONEG_ABILITY (1 << 3) /** PHY is able to perform Auto-Negotiation */
61#define MII_BMSR_LINK_STATUS (1 << 2) /** link is up */
62#define MII_BMSR_JABBER_DETECT (1 << 1) /** jabber condition detected */
63#define MII_BMSR_EXTEND_CAPAB (1 << 0) /** extended register capabilities */
64
65/* Auto-negotiation Advertisement Register (ANAR) bit definitions */
66/* Auto-negotiation Link Partner Ability Register (ANLPAR) bit definitions */
67#define MII_ADVERTISE_NEXT_PAGE (1 << 15) /** next page */
68#define MII_ADVERTISE_LPACK (1 << 14) /** link partner acknowledge response */
69#define MII_ADVERTISE_REMOTE_FAULT (1 << 13) /** remote fault */
70#define MII_ADVERTISE_ASYM_PAUSE (1 << 11) /** try for asymmetric pause */
71#define MII_ADVERTISE_PAUSE (1 << 10) /** try for pause */
72#define MII_ADVERTISE_100BASE_T4 (1 << 9) /** try for 100BASE-T4 support */
73#define MII_ADVERTISE_100_FULL (1 << 8) /** try for 100BASE-X full duplex support */
74#define MII_ADVERTISE_100_HALF (1 << 7) /** try for 100BASE-X support */
75#define MII_ADVERTISE_10_FULL (1 << 6) /** try for 10 Mb/s full duplex support */
76#define MII_ADVERTISE_10_HALF (1 << 5) /** try for 10 Mb/s half duplex support */
77#define MII_ADVERTISE_SEL_MASK (0x1F << 0) /** Selector Field */
78#define MII_ADVERTISE_SEL_IEEE_802_3 0x01
79
80#define MII_ADVERTISE_ALL (MII_ADVERTISE_10_HALF | MII_ADVERTISE_10_FULL |\
81 MII_ADVERTISE_100_HALF | MII_ADVERTISE_100_FULL |\
82 MII_ADVERTISE_SEL_IEEE_802_3)
83
Jukka Rissanen539b0c42017-07-20 16:29:45 +030084/**
85 * @}
86 */
87
Flavio Ceolin67ca1762018-09-14 10:43:44 -070088#endif /* ZEPHYR_INCLUDE_NET_MII_H_ */