ihphyreg.h revision 1.2 1 1.2 msaitoh /* $NetBSD: ihphyreg.h,v 1.2 2017/07/18 08:22:55 msaitoh Exp $ */
2 1.1 christos
3 1.1 christos /*-
4 1.1 christos * Copyright (c) 2010 The NetBSD Foundation, Inc.
5 1.1 christos * All rights reserved.
6 1.1 christos *
7 1.1 christos * Redistribution and use in source and binary forms, with or without
8 1.1 christos * modification, are permitted provided that the following conditions
9 1.1 christos * are met:
10 1.1 christos * 1. Redistributions of source code must retain the above copyright
11 1.1 christos * notice, this list of conditions and the following disclaimer.
12 1.1 christos * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 christos * notice, this list of conditions and the following disclaimer in the
14 1.1 christos * documentation and/or other materials provided with the distribution.
15 1.1 christos *
16 1.1 christos * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17 1.1 christos * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 1.1 christos * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 1.1 christos * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 1.1 christos * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 1.1 christos * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 1.1 christos * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 1.1 christos * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 1.1 christos * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 1.1 christos * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 1.1 christos * POSSIBILITY OF SUCH DAMAGE.
27 1.1 christos */
28 1.1 christos
29 1.1 christos #ifndef _DEV_MII_IHPHYREG_H_
30 1.1 christos #define _DEV_MII_IHPHYREG_H_
31 1.1 christos
32 1.1 christos #include <dev/mii/inbmphyreg.h>
33 1.1 christos
34 1.1 christos /*
35 1.1 christos * Intel 82577LM registers.
36 1.1 christos */
37 1.1 christos
38 1.1 christos /* PHY Control Register 2 */
39 1.1 christos #define IHPHY_MII_ECR2 BME1000_REG(0, 18)
40 1.1 christos
41 1.1 christos /* Loopback Control Register */
42 1.1 christos #define IHPHY_MII_LCR BME1000_REG(0, 19)
43 1.1 christos
44 1.1 christos /* RX Error Counter Register */
45 1.1 christos #define IHPHY_MII_RXERR BME1000_REG(0, 20)
46 1.1 christos
47 1.1 christos /* Management Interface Register */
48 1.1 christos #define IHPHY_MII_MIR BME1000_REG(0, 21)
49 1.1 christos
50 1.1 christos /* PHY Configuration Register */
51 1.1 christos #define IHPHY_MII_CFG BME1000_REG(0, 22)
52 1.1 christos #define IHPHY_CFG_TX_CRS 0x8000 /* CRS transmit enable */
53 1.1 christos #define IHPHY_CFG_FIFO_DEPTH 0x3000 /* Transmit FIFO depth*/
54 1.1 christos #define IHPHY_CFG_DOWN_SHIFT 0x0C00 /* Automatic speed downshift mode */
55 1.1 christos #define IHPHY_CFG_ALT_PAGE 0x0080 /* Alternate next page */
56 1.1 christos #define IHPHY_CFG_GRP_MDIO 0x0040 /* Group MDIO mode enable */
57 1.1 christos #define IHPHY_CFG_TX_CLOCK 0x0020 /* Transmit clock enable */
58 1.1 christos
59 1.1 christos /* PHY Control Register */
60 1.1 christos #define IHPHY_MII_ECR BME1000_REG(0, 23)
61 1.1 christos #define IHPHY_ECR_LNK_EN 0x2000 /* Link enable */
62 1.1 christos #define IHPHY_ECR_DOWN_SHIFT 0x1C00 /* Automatic speed downshift attempts */
63 1.1 christos #define IHPHY_ECR_LNK_PARTNER 0x0080 /* Link Partner Detected */
64 1.1 christos #define IHPHY_ECR_JABBER 0x0040 /* Jabber (10BASE-T) */
65 1.1 christos #define IHPHY_ECR_SQE 0x0020 /* Heartbeat (10BASE-T) */
66 1.1 christos #define IHPHY_ECR_TP_LOOPBACK 0x0010 /* TP loopback (10BASE-T) */
67 1.1 christos #define IHPHY_ECR_PRE_LENGTH 0x000C /* Preamble length (10BASE-T) */
68 1.1 christos
69 1.1 christos /* Interrupt Mask Register */
70 1.1 christos #define IHPHY_MII_IMR BME1000_REG(0, 24)
71 1.1 christos
72 1.1 christos /* Interrupt Status Register */
73 1.1 christos #define IHPHY_MII_ISR BME1000_REG(0, 25)
74 1.1 christos
75 1.1 christos /* PHY Status Register */
76 1.1 christos #define IHPHY_MII_ESR BME1000_REG(0, 26)
77 1.1 christos #define IHPHY_ESR_STANDBY 0x8000 /* PHY in standby */
78 1.1 christos #define IHPHY_ESR_ANEG_FAULT 0x6000 /* Autonegotation fault status */
79 1.1 christos #define IHPHY_ESR_ANEG_STAT 0x1000 /* Autonegotiation status */
80 1.1 christos #define IHPHY_ESR_PAIR_SWAP 0x0800 /* Pair swap on pairs A and B */
81 1.1 christos #define IHPHY_ESR_POLARITY 0x0400 /* Polarity status */
82 1.1 christos #define IHPHY_ESR_SPEED 0x0300 /* Speed status */
83 1.1 christos #define IHPHY_ESR_DUPLEX 0x0080 /* Duplex status */
84 1.1 christos #define IHPHY_ESR_LINK 0x0040 /* Link status */
85 1.1 christos #define IHPHY_ESR_TRANSMIT 0x0020 /* Transmit status */
86 1.1 christos #define IHPHY_ESR_RECEIVE 0x0010 /* Receive status */
87 1.1 christos #define IHPHY_ESR_COLLISION 0x0008 /* Collision status */
88 1.1 christos #define IHPHY_ESR_ANEG_BOTH 0x0004 /* Autonegotiation enabled for both */
89 1.1 christos #define IHPHY_ESR_PAUSE 0x0002 /* Link partner has PAUSE */
90 1.1 christos #define IHPHY_ESR_ASYM_PAUSE 0x0001 /* Link partner has asymmetric PAUSE */
91 1.1 christos
92 1.1 christos #define IHPHY_SPEED_10 0x0000
93 1.1 christos #define IHPHY_SPEED_100 0x0100
94 1.1 christos #define IHPHY_SPEED_1000 0x0200
95 1.1 christos
96 1.1 christos /* LED Control Register 1 */
97 1.1 christos #define IHPHY_MII_LED1 BME1000_REG(0, 27)
98 1.1 christos
99 1.1 christos /* LED Control Register 2 */
100 1.1 christos #define IHPHY_MII_LED2 BME1000_REG(0, 28)
101 1.1 christos
102 1.1 christos /* LED Control Register 3 */
103 1.1 christos #define IHPHY_MII_LED3 BME1000_REG(0, 29)
104 1.1 christos
105 1.1 christos /* Diagnostics Control Register */
106 1.1 christos #define IHPHY_MII_DCR BME1000_REG(0, 30)
107 1.1 christos
108 1.1 christos /* Diagnostics Status Register */
109 1.1 christos #define IHPHY_MII_DSR BME1000_REG(0, 31)
110 1.1 christos
111 1.2 msaitoh /*
112 1.2 msaitoh * XXX I21[789] documents say that the SMBus Address register is at
113 1.2 msaitoh * PHY address 01, Page 0 (not 768), Register 26.
114 1.2 msaitoh */
115 1.2 msaitoh #define HV_SMB_ADDR BME1000_REG(768, 26)
116 1.2 msaitoh #define HV_SMB_ADDR_ADDR 0x007f
117 1.2 msaitoh #define HV_SMB_ADDR_VALID (1 << 7)
118 1.2 msaitoh #define HV_SMB_ADDR_FREQ_LOW (1 << 8)
119 1.2 msaitoh #define HV_SMB_ADDR_PEC_EN (1 << 9)
120 1.2 msaitoh #define HV_SMB_ADDR_FREQ_HIGH (1 << 12)
121 1.2 msaitoh
122 1.1 christos #endif /* _DEV_IHPHY_MIIREG_H_ */
123