Zephyr Project API
4.1.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
15
#include <
zephyr/sys/util_macro.h
>
16
26
/* MII management registers */
28
#define MII_BMCR 0x0
30
#define MII_BMSR 0x1
32
#define MII_PHYID1R 0x2
34
#define MII_PHYID2R 0x3
36
#define MII_ANAR 0x4
38
#define MII_ANLPAR 0x5
40
#define MII_ANER 0x6
42
#define MII_ANNPTR 0x7
44
#define MII_ANLPRNPR 0x8
46
#define MII_1KTCR 0x9
48
#define MII_1KSTSR 0xa
50
#define MII_MMD_ACR 0xd
52
#define MII_MMD_AADR 0xe
54
#define MII_ESTAT 0xf
55
56
/* Basic Mode Control Register (BMCR) bit definitions */
57
#define MII_BMCR_RESET_BIT 15
58
#define MII_BMCR_LOOPBACK_BIT 14
59
#define MII_BMCR_SPEED_LSB_BIT 13
60
#define MII_BMCR_AUTONEG_ENABLE_BIT 12
61
#define MII_BMCR_POWER_DOWN_BIT 11
62
#define MII_BMCR_ISOLATE_BIT 10
63
#define MII_BMCR_AUTONEG_RESTART_BIT 9
64
#define MII_BMCR_DUPLEX_MODE_BIT 8
65
#define MII_BMCR_SPEED_MSB_BIT 6
67
#define MII_BMCR_RESET BIT(MII_BMCR_RESET_BIT)
69
#define MII_BMCR_LOOPBACK BIT(MII_BMCR_LOOPBACK_BIT)
71
#define MII_BMCR_SPEED_LSB BIT(MII_BMCR_SPEED_LSB_BIT)
73
#define MII_BMCR_AUTONEG_ENABLE BIT(MII_BMCR_AUTONEG_ENABLE_BIT)
75
#define MII_BMCR_POWER_DOWN BIT(MII_BMCR_POWER_DOWN_BIT)
77
#define MII_BMCR_ISOLATE BIT(MII_BMCR_ISOLATE_BIT)
79
#define MII_BMCR_AUTONEG_RESTART BIT(MII_BMCR_AUTONEG_RESTART_BIT)
81
#define MII_BMCR_DUPLEX_MODE BIT(MII_BMCR_DUPLEX_MODE_BIT)
83
#define MII_BMCR_SPEED_MSB BIT(MII_BMCR_SPEED_MSB_BIT)
85
#define MII_BMCR_SPEED_MASK (MII_BMCR_SPEED_MSB | MII_BMCR_SPEED_LSB)
87
#define MII_BMCR_SPEED_10 0
89
#define MII_BMCR_SPEED_100 BIT(MII_BMCR_SPEED_LSB_BIT)
91
#define MII_BMCR_SPEED_1000 BIT(MII_BMCR_SPEED_MSB_BIT)
92
93
/* Basic Mode Status Register (BMSR) bit definitions */
95
#define MII_BMSR_100BASE_T4 BIT(15)
97
#define MII_BMSR_100BASE_X_FULL BIT(14)
99
#define MII_BMSR_100BASE_X_HALF BIT(13)
101
#define MII_BMSR_10_FULL BIT(12)
103
#define MII_BMSR_10_HALF BIT(11)
105
#define MII_BMSR_100BASE_T2_FULL BIT(10)
107
#define MII_BMSR_100BASE_T2_HALF BIT(9)
109
#define MII_BMSR_EXTEND_STATUS BIT(8)
111
#define MII_BMSR_MF_PREAMB_SUPPR BIT(6)
113
#define MII_BMSR_AUTONEG_COMPLETE BIT(5)
115
#define MII_BMSR_REMOTE_FAULT BIT(4)
117
#define MII_BMSR_AUTONEG_ABILITY BIT(3)
119
#define MII_BMSR_LINK_STATUS BIT(2)
121
#define MII_BMSR_JABBER_DETECT BIT(1)
123
#define MII_BMSR_EXTEND_CAPAB BIT(0)
124
125
/* Auto-negotiation Advertisement Register (ANAR) bit definitions */
126
/* Auto-negotiation Link Partner Ability Register (ANLPAR) bit definitions */
127
#define MII_ADVERTISE_NEXT_PAGE_BIT 15
128
#define MII_ADVERTISE_LPACK_BIT 14
129
#define MII_ADVERTISE_REMOTE_FAULT_BIT 13
130
#define MII_ADVERTISE_ASYM_PAUSE_BIT 11
131
#define MII_ADVERTISE_PAUSE_BIT 10
132
#define MII_ADVERTISE_100BASE_T4_BIT 9
133
#define MII_ADVERTISE_100_FULL_BIT 8
134
#define MII_ADVERTISE_100_HALF_BIT 7
135
#define MII_ADVERTISE_10_FULL_BIT 6
136
#define MII_ADVERTISE_10_HALF_BIT 5
138
#define MII_ADVERTISE_NEXT_PAGE BIT(MII_ADVERTISE_NEXT_PAGE_BIT)
140
#define MII_ADVERTISE_LPACK BIT(MII_ADVERTISE_LPACK_BIT)
142
#define MII_ADVERTISE_REMOTE_FAULT BIT(MII_ADVERTISE_REMOTE_FAULT_BIT)
144
#define MII_ADVERTISE_ASYM_PAUSE BIT(MII_ADVERTISE_ASYM_PAUSE_BIT)
146
#define MII_ADVERTISE_PAUSE BIT(MII_ADVERTISE_PAUSE_BIT)
148
#define MII_ADVERTISE_100BASE_T4 BIT(MII_ADVERTISE_100BASE_T4_BIT)
150
#define MII_ADVERTISE_100_FULL BIT(MII_ADVERTISE_100_FULL_BIT)
152
#define MII_ADVERTISE_100_HALF BIT(MII_ADVERTISE_100_HALF_BIT)
154
#define MII_ADVERTISE_10_FULL BIT(MII_ADVERTISE_10_FULL_BIT)
156
#define MII_ADVERTISE_10_HALF BIT(MII_ADVERTISE_10_HALF_BIT)
158
#define MII_ADVERTISE_SEL_MASK (0x1F << 0)
160
#define MII_ADVERTISE_SEL_IEEE_802_3 0x01
161
162
/* 1000BASE-T Control Register bit definitions */
163
#define MII_ADVERTISE_1000_FULL_BIT 9
164
#define MII_ADVERTISE_1000_HALF_BIT 8
166
#define MII_ADVERTISE_1000_FULL BIT(MII_ADVERTISE_1000_FULL_BIT)
168
#define MII_ADVERTISE_1000_HALF BIT(MII_ADVERTISE_1000_HALF_BIT)
169
171
#define MII_ADVERTISE_ALL (MII_ADVERTISE_10_HALF | MII_ADVERTISE_10_FULL |\
172
MII_ADVERTISE_100_HALF | MII_ADVERTISE_100_FULL |\
173
MII_ADVERTISE_SEL_IEEE_802_3)
174
175
/* Extended Status Register bit definitions */
177
#define MII_ESTAT_1000BASE_X_FULL BIT(15)
179
#define MII_ESTAT_1000BASE_X_HALF BIT(14)
181
#define MII_ESTAT_1000BASE_T_FULL BIT(13)
183
#define MII_ESTAT_1000BASE_T_HALF BIT(12)
184
185
/* MMD Access Control Register (MII_MMD_ACR) Register bit definitions */
187
#define MII_MMD_ACR_DEVAD_MASK (0x1F << 0)
189
#define MII_MMD_ACR_ADDR (0x00 << 14)
190
#define MII_MMD_ACR_DATA_NO_POS_INC (0x01 << 14)
191
#define MII_MMD_ACR_DATA_RW_POS_INC (0x10 << 14)
192
#define MII_MMD_ACR_DATA_W_POS_INC (0x11 << 14)
193
198
#endif
/* ZEPHYR_INCLUDE_NET_MII_H_ */
util_macro.h
Macro utilities.
include
zephyr
net
mii.h
Generated on Fri Jun 20 2025 13:59:10 for Zephyr Project API by
1.9.8