wbsioreg.h revision 1.10 1 /* $NetBSD: wbsioreg.h,v 1.10 2022/10/01 07:22:55 msaitoh Exp $ */
2
3 /* $OpenBSD: wbsioreg.h,v 1.4 2015/01/02 23:02:54 chris Exp $ */
4 /*
5 * Copyright (c) 2008 Mark Kettenis <kettenis (at) openbsd.org>
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20 /*
21 * Winbond LPC Super I/O driver registers
22 */
23
24 /* ISA bus registers */
25 #define WBSIO_INDEX 0x00 /* Configuration Index Register */
26 #define WBSIO_DATA 0x01 /* Configuration Data Register */
27
28 #define WBSIO_IOSIZE 0x02 /* ISA I/O space size */
29
30 #define WBSIO_CONF_EN_MAGIC 0x87 /* enable configuration mode */
31 #define WBSIO_CONF_DS_MAGIC 0xaa /* disable configuration mode */
32
33 /* Configuration Space Registers */
34 #define WBSIO_LDN 0x07 /* Logical Device Number */
35 #define WBSIO_MFS0 0x1A /* Multi Function Selection 0 */
36 #define WBSIO_MFS1 0x1B /* Multi Function Selection 1 */
37 #define WBSIO_MFS2 0x1C /* Multi Function Selection 2 */
38 #define WBSIO_MFS3 0x1D /* Multi Function Selection 3 */
39 #define WBSIO_ID 0x20 /* Device ID */
40 #define WBSIO_REV 0x21 /* Device Revision */
41 #define WBSIO_GOPT0 0x24 /* Global Option 0 */
42 #define WBSIO_GOPT1 0x26 /* Global Option 1 */
43 #define WBSIO_GOPT2 0x27 /* Global Option 2 */
44 #define WBSIO_GOPT3 0x28 /* Global Option 3 */
45 #define WBSIO_MFS4 0x2A /* Multi Function Selection 4 */
46 #define WBSIO_MFS5 0x2B /* Multi Function Selection 5 */
47 #define WBSIO_MFS6 0x2C /* Multi Function Selection 6 */
48 #define WBSIO_SFR 0x2F /* Strapping Function Result */
49
50
51 #define WBSIO_ID_W83627HF 0x52 /* 8bits */
52 #define WBSIO_ID_W83697HF 0x60
53 #define WBSIO_ID_W83637HF 0x70
54 #define WBSIO_ID_W83627THF 0x82
55 #define WBSIO_ID_W83687THF 0x85
56 #define WBSIO_ID_W83627SF 0x595 /* 12bits */
57 #define WBSIO_ID_W83697UG 0x681
58 #define WBSIO_ID_W83627EHF_A 0x885
59 #define WBSIO_ID_W83627EHF 0x886
60 #define WBSIO_ID_W83627DHG 0xa02
61 #define WBSIO_ID_W83627UHG 0xa23
62 #define WBSIO_ID_W83667HG 0xa51
63 #define WBSIO_ID_W83627DHGP 0xb07
64 #define WBSIO_ID_W83667HGB 0xb35
65 #define WBSIO_ID_NCT6775F 0xb47
66 #define WBSIO_ID_NCT6776F 0xc33
67 #define WBSIO_ID_NCT5104D 0xc45 /* 610[246]D */
68 #define WBSIO_ID_NCT6779D 0xc56
69 #define WBSIO_ID_NCT6791D 0xc80
70 #define WBSIO_ID_NCT6792D 0xc91
71 #define WBSIO_ID_NCT6793D 0xd12
72 #define WBSIO_ID_NCT6795D 0xd35
73 #define WBSIO_ID_NCT6796D 0xd420 /* 13bits */
74 #define WBSIO_ID_NCT6798D 0xd428
75 #define WBSIO_ID_NCT6799D 0xd800
76
77 /* Make the above WBSIO_ID_* vaue from WBSIO_ID, WBSIO_REV and IDbits */
78 #define WBSIO_MAKEID(id, rev, bits) \
79 (((bits) == 13) ? (((uint16_t)(id) << 8) | ((rev) & 0xf8)) : \
80 ((bits) == 12) ? (((uint16_t)(id) << 4) | ((rev) >> 4)) : (id))
81
82 #define WBSIO_MAKEREV(rev, bits) \
83 (((bits) == 13) ? ((rev) & 0x07) : ((bits) == 12) ? ((rev) & 0x0f) : \
84 (rev))
85
86 /* Strapping Function Result */
87 #define WBSIO_SFR_24M48M 0x01
88 #define WBSIO_SFR_LPT 0x02
89 #define WBSIO_SFR_TEST 0x04
90 #define WBSIO_SFR_DSW 0x08
91 #define WBSIO_SFR_AMDPWR 0x20
92 #define WBSIO_SFR_UARTP80 0x40
93
94 /* Logical Device Number (LDN) Assignments */
95 #define WBSIO_LDN_HM 0x0b
96 #define WBSIO_LDN_GPIO0 0x08 /* WDT, GPIO 0 */
97 #define WBSIO_LDN_GPIO1 0x09 /* GPIO 1 to GPIO 8 */
98
99 /* Hardware Monitor Control Registers (LDN B) */
100 #define WBSIO_HM_ADDR_MSB 0x60 /* Address [15:8] */
101 #define WBSIO_HM_ADDR_LSB 0x61 /* Address [7:0] */
102 #define WBSIO_HM_CONF 0xE4 /* Configuration Register */
103 #define WBSIO_HM_CONF_RSTOUT4 0x02 /* RSTOUT4# bit */
104 #define WBSIO_HM_CONF_RSTOUT3 0x04 /* RSTOUT3# bit */
105 #define WBSIO_HM_CONF_PWROK 0x08 /* Power OK Bit */
106
107 /* GPIO Registers */
108 #define WBSIO_GPIO_ADDR_MSB 0x60 /* Address [15:8] */
109 #define WBSIO_GPIO_ADDR_LSB 0x61 /* Address [7:0] */
110 #define WBSIO_GPIO_CONF 0x30 /* GPIO0, WDT1 config */
111 #define WBSIO_WDT_MODE 0xF5 /* WDT1 Control Mode */
112 #define WBSIO_WDT_CNTR 0xF6 /* WDT1 Counter */
113 #define WBSIO_WDT_STAT 0xF7 /* WDT1 Control & Status */
114 #define WBSIO_GPIO4_MFS 0xEE /* GPIO4 Multi-Function Select */
115
116 #define WBSIO_GPIO0_WDT1 __BIT(0)
117 #define WBSIO_GPIO0_ENABLE __BIT(1)
118
119 /* Reserved */
120 #define WBSIO_GPIO_BASEADDR __BIT(3) /* Base address mode */
121 #define WBSIO_GPIO1_ENABLE __BIT(1)
122 #define WBSIO_GPIO2_ENABLE __BIT(2)
123 #define WBSIO_GPIO3_ENABLE __BIT(3)
124 #define WBSIO_GPIO4_ENABLE __BIT(4)
125 #define WBSIO_GPIO5_ENABLE __BIT(5)
126 #define WBSIO_GPIO6_ENABLE __BIT(6)
127 #define WBSIO_GPIO7_ENABLE __BIT(7)
128 #define WBSIO_GPIO8_ENABLE __BIT(0)
129
130 #define WBSIO_GPIO_NPINS 64
131 #define WBSIO_GPIO_IOSIZE 0x06 /* GPIO register table size */
132
133 #define WBSIO_GPIO_GSR 0x00 /* GPIO Select Register */
134 #define WBSIO_GPIO_IOR 0x01 /* I/O direction */
135 #define WBSIO_GPIO_DAT 0x02 /* Data */
136 #define WBSIO_GPIO_INV 0x03 /* Inversion */
137 #define WBSIO_GPIO_DST 0x04 /* Event Status */
138 /* WDT1 Control Mode */
139 /* WDT1 control */
140 #define WBSIO_WDT_MODE_LEVEL __BIT(0)
141 /* enable/disable KBRST */
142 #define WBSIO_WDT_MODE_KBCRST __BIT(2)
143 #define WBSIO_WDT_MODE_MINUTES __BIT(3)
144 #define WBSIO_WDT_MODE_FASTER __BIT(4)
145
146 #define WBSIO_WDT_CNTR_STOP 0
147 #define WBSIO_WDT_CNTR_MAX 255
148
149 #define WBSIO_WDT_STAT_TIMEOUT __BIT(4)
150 #define WBSIO_WDT_STAT_EVENT __BIT(5)
151
152
153 /* NCT6779D */
154 #define WBSIO_NCT6779D_MFS2_GP00 __BIT(0)
155 #define WBSIO_NCT6779D_MFS2_GP01 __BIT(1)
156 #define WBSIO_NCT6779D_MFS2_GP02 __BIT(2)
157 #define WBSIO_NCT6779D_MFS2_GP03_MASK (__BIT(3)|__BIT(4))
158 #define WBSIO_NCT6779D_MFS2_GP04 __BIT(5)
159 #define WBSIO_NCT6779D_MFS2_GP05 __BIT(6)
160 #define WBSIO_NCT6779D_MFS2_GP06 __BIT(7)
161 #define WBSIO_NCT6779D_MFS3_GP07_MASK __BIT(0)
162 #define WBSIO_NCT6779D_MFS4_GP10_GP17 __BIT(6)
163 #define WBSIO_NCT6779D_MFS4_GP20_GP21 __BIT(0)
164 #define WBSIO_NCT6779D_MFS4_GP22_GP23 __BIT(1)
165 #define WBSIO_NCT6779D_MFS1_GP24_MASK __BIT(4)
166 #define WBSIO_NCT6779D_GOPT2_GP24_MASK __BIT(3)
167 #define WBSIO_NCT6779D_MFS4_GP25_MASK __BIT(3)
168 #define WBSIO_NCT6779D_GOPT2_GP25_MASK __BIT(3)
169 #define WBSIO_NCT6779D_MFS6_GP26 __BIT(0)
170 #define WBSIO_NCT6779D_MFS6_GP27_MASK (__BIT(3)|__BIT(4))
171 #define WBSIO_NCT6779D_MFS0_GP30 __BIT(6)
172 #define WBSIO_NCT6779D_MFS0_GP30_MASK __BIT(7)
173 #define WBSIO_NCT6779D_MFS0_GP31 __BIT(5)
174 #define WBSIO_NCT6779D_MFS1_GP31_MASK __BIT(0)
175 #define WBSIO_NCT6779D_MFS0_GP32 __BIT(4)
176 #define WBSIO_NCT6779D_MFS1_GP32_MASK __BIT(0)
177 #define WBSIO_NCT6779D_MFS6_GP33 __BIT(7)
178 #define WBSIO_NCT6779D_MFS6_GP33_MASK __BIT(6)
179 #define WBSIO_NCT6779D_MFS1_GP40 __BIT(3)
180 #define WBSIO_NCT6779D_MFS0_GP41 __BIT(3)
181 #define WBSIO_NCT6779D_MFS0_GP41_MASK __BIT(2)
182 #define WBSIO_NCT6779D_MFS1_GP42 (__BIT(1)|__BIT(2))
183 #define WBSIO_NCT6779D_GOPT2_GP43 __BIT(4)
184 #define WBSIO_NCT6779D_MFS1_GP44_GP45_MASK __BIT(6)
185 #define WBSIO_NCT6779D_GOPT2_GP46_MASK __BIT(5)
186 #define WBSIO_NCT6779D_MFS1_GP47 __BIT(7)
187 #define WBSIO_NCT6779D_HM_GP50_MASK __BIT(2)
188 #define WBSIO_NCT6779D_HM_GP52_MASK __BIT(1)
189 #define WBSIO_NCT6779D_HM_GP55_MASK __BIT(3)
190 #define WBSIO_NCT6779D_MFS5_GP74 __BIT(5)
191 #define WBSIO_NCT6779D_MFS5_GP75 __BIT(6)
192 #define WBSIO_NCT6779D_MFS5_GP76 __BIT(7)
193 #define WBSIO_NCT6779D_GPIO4_WDTO __BIT(4)
194