Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
mii.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 Piotr Mienkowski
3 * Copyright 2022 NXP
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
12#ifndef ZEPHYR_INCLUDE_NET_MII_H_
13#define ZEPHYR_INCLUDE_NET_MII_H_
14
24/* MII management registers */
26#define MII_BMCR 0x0
28#define MII_BMSR 0x1
30#define MII_PHYID1R 0x2
32#define MII_PHYID2R 0x3
34#define MII_ANAR 0x4
36#define MII_ANLPAR 0x5
38#define MII_ANER 0x6
40#define MII_ANNPTR 0x7
42#define MII_ANLPRNPR 0x8
44#define MII_1KTCR 0x9
46#define MII_1KSTSR 0xa
48#define MII_MMD_ACR 0xd
50#define MII_MMD_AADR 0xe
52#define MII_ESTAT 0xf
53
54/* Basic Mode Control Register (BMCR) bit definitions */
56#define MII_BMCR_RESET (1 << 15)
58#define MII_BMCR_LOOPBACK (1 << 14)
60#define MII_BMCR_SPEED_LSB (1 << 13)
62#define MII_BMCR_AUTONEG_ENABLE (1 << 12)
64#define MII_BMCR_POWER_DOWN (1 << 11)
66#define MII_BMCR_ISOLATE (1 << 10)
68#define MII_BMCR_AUTONEG_RESTART (1 << 9)
70#define MII_BMCR_DUPLEX_MODE (1 << 8)
72#define MII_BMCR_SPEED_MSB (1 << 6)
74#define MII_BMCR_SPEED_MASK (1 << 6 | 1 << 13)
76#define MII_BMCR_SPEED_10 (0 << 6 | 0 << 13)
78#define MII_BMCR_SPEED_100 (0 << 6 | 1 << 13)
80#define MII_BMCR_SPEED_1000 (1 << 6 | 0 << 13)
81
82/* Basic Mode Status Register (BMSR) bit definitions */
84#define MII_BMSR_100BASE_T4 (1 << 15)
86#define MII_BMSR_100BASE_X_FULL (1 << 14)
88#define MII_BMSR_100BASE_X_HALF (1 << 13)
90#define MII_BMSR_10_FULL (1 << 12)
92#define MII_BMSR_10_HALF (1 << 11)
94#define MII_BMSR_100BASE_T2_FULL (1 << 10)
96#define MII_BMSR_100BASE_T2_HALF (1 << 9)
98#define MII_BMSR_EXTEND_STATUS (1 << 8)
100#define MII_BMSR_MF_PREAMB_SUPPR (1 << 6)
102#define MII_BMSR_AUTONEG_COMPLETE (1 << 5)
104#define MII_BMSR_REMOTE_FAULT (1 << 4)
106#define MII_BMSR_AUTONEG_ABILITY (1 << 3)
108#define MII_BMSR_LINK_STATUS (1 << 2)
110#define MII_BMSR_JABBER_DETECT (1 << 1)
112#define MII_BMSR_EXTEND_CAPAB (1 << 0)
113
114/* Auto-negotiation Advertisement Register (ANAR) bit definitions */
115/* Auto-negotiation Link Partner Ability Register (ANLPAR) bit definitions */
117#define MII_ADVERTISE_NEXT_PAGE (1 << 15)
119#define MII_ADVERTISE_LPACK (1 << 14)
121#define MII_ADVERTISE_REMOTE_FAULT (1 << 13)
123#define MII_ADVERTISE_ASYM_PAUSE (1 << 11)
125#define MII_ADVERTISE_PAUSE (1 << 10)
127#define MII_ADVERTISE_100BASE_T4 (1 << 9)
129#define MII_ADVERTISE_100_FULL (1 << 8)
131#define MII_ADVERTISE_100_HALF (1 << 7)
133#define MII_ADVERTISE_10_FULL (1 << 6)
135#define MII_ADVERTISE_10_HALF (1 << 5)
137#define MII_ADVERTISE_SEL_MASK (0x1F << 0)
139#define MII_ADVERTISE_SEL_IEEE_802_3 0x01
140
141/* 1000BASE-T Control Register bit definitions */
143#define MII_ADVERTISE_1000_FULL (1 << 9)
145#define MII_ADVERTISE_1000_HALF (1 << 8)
146
148#define MII_ADVERTISE_ALL (MII_ADVERTISE_10_HALF | MII_ADVERTISE_10_FULL |\
149 MII_ADVERTISE_100_HALF | MII_ADVERTISE_100_FULL |\
150 MII_ADVERTISE_SEL_IEEE_802_3)
151
152/* Extended Status Register bit definitions */
154#define MII_ESTAT_1000BASE_X_FULL (1 << 15)
156#define MII_ESTAT_1000BASE_X_HALF (1 << 14)
158#define MII_ESTAT_1000BASE_T_FULL (1 << 13)
160#define MII_ESTAT_1000BASE_T_HALF (1 << 12)
161
162/* MMD Access Control Register (MII_MMD_ACR) Register bit definitions */
164#define MII_MMD_ACR_DEVAD_MASK (0x1F << 0)
166#define MII_MMD_ACR_ADDR (0x00 << 14)
167#define MII_MMD_ACR_DATA_NO_POS_INC (0x01 << 14)
168#define MII_MMD_ACR_DATA_RW_POS_INC (0x10 << 14)
169#define MII_MMD_ACR_DATA_W_POS_INC (0x11 << 14)
170
175#endif /* ZEPHYR_INCLUDE_NET_MII_H_ */