Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
mii.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 Piotr Mienkowski
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
11#ifndef ZEPHYR_INCLUDE_NET_MII_H_
12#define ZEPHYR_INCLUDE_NET_MII_H_
13
21/* MII management registers */
23#define MII_BMCR 0x0
25#define MII_BMSR 0x1
27#define MII_PHYID1R 0x2
29#define MII_PHYID2R 0x3
31#define MII_ANAR 0x4
33#define MII_ANLPAR 0x5
35#define MII_ANER 0x6
37#define MII_ANNPTR 0x7
39#define MII_ANLPRNPR 0x8
41#define MII_MMD_ACR 0xd
43#define MII_MMD_AADR 0xe
45#define MII_ESTAT 0xf
46
47/* Basic Mode Control Register (BMCR) bit definitions */
49#define MII_BMCR_RESET (1 << 15)
51#define MII_BMCR_LOOPBACK (1 << 14)
53#define MII_BMCR_SPEED_LSB (1 << 13)
55#define MII_BMCR_AUTONEG_ENABLE (1 << 12)
57#define MII_BMCR_POWER_DOWN (1 << 11)
59#define MII_BMCR_ISOLATE (1 << 10)
61#define MII_BMCR_AUTONEG_RESTART (1 << 9)
63#define MII_BMCR_DUPLEX_MODE (1 << 8)
65#define MII_BMCR_SPEED_MSB (1 << 6)
67#define MII_BMCR_SPEED_MASK (1 << 6 | 1 << 13)
69#define MII_BMCR_SPEED_10 (0 << 6 | 0 << 13)
71#define MII_BMCR_SPEED_100 (0 << 6 | 1 << 13)
73#define MII_BMCR_SPEED_1000 (1 << 6 | 0 << 13)
74
75/* Basic Mode Status Register (BMSR) bit definitions */
77#define MII_BMSR_100BASE_T4 (1 << 15)
79#define MII_BMSR_100BASE_X_FULL (1 << 14)
81#define MII_BMSR_100BASE_X_HALF (1 << 13)
83#define MII_BMSR_10_FULL (1 << 12)
85#define MII_BMSR_10_HALF (1 << 11)
87#define MII_BMSR_100BASE_T2_FULL (1 << 10)
89#define MII_BMSR_100BASE_T2_HALF (1 << 9)
91#define MII_BMSR_EXTEND_STATUS (1 << 8)
93#define MII_BMSR_MF_PREAMB_SUPPR (1 << 6)
95#define MII_BMSR_AUTONEG_COMPLETE (1 << 5)
97#define MII_BMSR_REMOTE_FAULT (1 << 4)
99#define MII_BMSR_AUTONEG_ABILITY (1 << 3)
101#define MII_BMSR_LINK_STATUS (1 << 2)
103#define MII_BMSR_JABBER_DETECT (1 << 1)
105#define MII_BMSR_EXTEND_CAPAB (1 << 0)
106
107/* Auto-negotiation Advertisement Register (ANAR) bit definitions */
108/* Auto-negotiation Link Partner Ability Register (ANLPAR) bit definitions */
110#define MII_ADVERTISE_NEXT_PAGE (1 << 15)
112#define MII_ADVERTISE_LPACK (1 << 14)
114#define MII_ADVERTISE_REMOTE_FAULT (1 << 13)
116#define MII_ADVERTISE_ASYM_PAUSE (1 << 11)
118#define MII_ADVERTISE_PAUSE (1 << 10)
120#define MII_ADVERTISE_100BASE_T4 (1 << 9)
122#define MII_ADVERTISE_100_FULL (1 << 8)
124#define MII_ADVERTISE_100_HALF (1 << 7)
126#define MII_ADVERTISE_10_FULL (1 << 6)
128#define MII_ADVERTISE_10_HALF (1 << 5)
130#define MII_ADVERTISE_SEL_MASK (0x1F << 0)
131#define MII_ADVERTISE_SEL_IEEE_802_3 0x01
132
133#define MII_ADVERTISE_ALL (MII_ADVERTISE_10_HALF | MII_ADVERTISE_10_FULL |\
134 MII_ADVERTISE_100_HALF | MII_ADVERTISE_100_FULL |\
135 MII_ADVERTISE_SEL_IEEE_802_3)
136
141#endif /* ZEPHYR_INCLUDE_NET_MII_H_ */