wbsioreg.h revision 1.7 1 /* $NetBSD: wbsioreg.h,v 1.7 2017/12/13 00:27:53 knakahara 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
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
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
74 /* Strapping Function Result */
75 #define WBSIO_SFR_24M48M 0x01
76 #define WBSIO_SFR_LPT 0x02
77 #define WBSIO_SFR_TEST 0x04
78 #define WBSIO_SFR_DSW 0x08
79 #define WBSIO_SFR_AMDPWR 0x20
80 #define WBSIO_SFR_UARTP80 0x40
81
82 /* Logical Device Number (LDN) Assignments */
83 #define WBSIO_LDN_HM 0x0b
84 #define WBSIO_LDN_GPIO0 0x08 /* WDT, GPIO 0 */
85 #define WBSIO_LDN_GPIO1 0x09 /* GPIO 1 to GPIO 8 */
86
87 /* Hardware Monitor Control Registers (LDN B) */
88 #define WBSIO_HM_ADDR_MSB 0x60 /* Address [15:8] */
89 #define WBSIO_HM_ADDR_LSB 0x61 /* Address [7:0] */
90 #define WBSIO_HM_CONF 0xE4 /* Configuration Register */
91 #define WBSIO_HM_CONF_RSTOUT4 0x02 /* RSTOUT4# bit */
92 #define WBSIO_HM_CONF_RSTOUT3 0x04 /* RSTOUT3# bit */
93 #define WBSIO_HM_CONF_PWROK 0x08 /* Power OK Bit */
94
95 /* GPIO Registers */
96 #define WBSIO_GPIO_ADDR_MSB 0x60 /* Address [15:8] */
97 #define WBSIO_GPIO_ADDR_LSB 0x61 /* Address [7:0] */
98 #define WBSIO_GPIO_CONF 0x30 /* GPIO0, WDT1 config */
99 #define WBSIO_WDT_MODE 0xF5 /* WDT1 Control Mode */
100 #define WBSIO_WDT_CNTR 0xF6 /* WDT1 Counter */
101 #define WBSIO_WDT_STAT 0xF7 /* WDT1 Control & Status */
102 #define WBSIO_GPIO4_MFS 0xEE /* GPIO4 Multi-Function Select */
103
104 #define WBSIO_GPIO0_WDT1 __BIT(0)
105 #define WBSIO_GPIO0_ENABLE __BIT(1)
106
107 /* Reserved */
108 #define WBSIO_GPIO_BASEADDR __BIT(3) /* Base address mode */
109 #define WBSIO_GPIO1_ENABLE __BIT(1)
110 #define WBSIO_GPIO2_ENABLE __BIT(2)
111 #define WBSIO_GPIO3_ENABLE __BIT(3)
112 #define WBSIO_GPIO4_ENABLE __BIT(4)
113 #define WBSIO_GPIO5_ENABLE __BIT(5)
114 #define WBSIO_GPIO6_ENABLE __BIT(6)
115 #define WBSIO_GPIO7_ENABLE __BIT(7)
116 #define WBSIO_GPIO8_ENABLE __BIT(0)
117
118 #define WBSIO_GPIO_NPINS 64
119 #define WBSIO_GPIO_IOSIZE 0x06 /* GPIO register table size */
120
121 #define WBSIO_GPIO_GSR 0x00 /* GPIO Select Register */
122 #define WBSIO_GPIO_IOR 0x01 /* I/O direction */
123 #define WBSIO_GPIO_DAT 0x02 /* Data */
124 #define WBSIO_GPIO_INV 0x03 /* Inversion */
125 #define WBSIO_GPIO_DST 0x04 /* Event Status */
126 /* WDT1 Control Mode */
127 /* WDT1 control */
128 #define WBSIO_WDT_MODE_LEVEL __BIT(0)
129 /* enable/disable KBRST */
130 #define WBSIO_WDT_MODE_KBCRST __BIT(2)
131 #define WBSIO_WDT_MODE_MINUTES __BIT(3)
132 #define WBSIO_WDT_MODE_FASTER __BIT(4)
133
134 #define WBSIO_WDT_CNTR_STOP 0
135 #define WBSIO_WDT_CNTR_MAX 255
136
137 #define WBSIO_WDT_STAT_TIMEOUT __BIT(4)
138 #define WBSIO_WDT_STAT_EVENT __BIT(5)
139
140
141 /* NCT6779D */
142 #define WBSIO_NCT6779D_MFS2_GP00 __BIT(0)
143 #define WBSIO_NCT6779D_MFS2_GP01 __BIT(1)
144 #define WBSIO_NCT6779D_MFS2_GP02 __BIT(2)
145 #define WBSIO_NCT6779D_MFS2_GP03_MASK (__BIT(3)|__BIT(4))
146 #define WBSIO_NCT6779D_MFS2_GP04 __BIT(5)
147 #define WBSIO_NCT6779D_MFS2_GP05 __BIT(6)
148 #define WBSIO_NCT6779D_MFS2_GP06 __BIT(7)
149 #define WBSIO_NCT6779D_MFS3_GP07_MASK __BIT(0)
150 #define WBSIO_NCT6779D_MFS4_GP10_GP17 __BIT(6)
151 #define WBSIO_NCT6779D_MFS4_GP20_GP21 __BIT(0)
152 #define WBSIO_NCT6779D_MFS4_GP22_GP23 __BIT(1)
153 #define WBSIO_NCT6779D_MFS1_GP24_MASK __BIT(4)
154 #define WBSIO_NCT6779D_GOPT2_GP24_MASK __BIT(3)
155 #define WBSIO_NCT6779D_MFS4_GP25_MASK __BIT(3)
156 #define WBSIO_NCT6779D_GOPT2_GP25_MASK __BIT(3)
157 #define WBSIO_NCT6779D_MFS6_GP26 __BIT(0)
158 #define WBSIO_NCT6779D_MFS6_GP27_MASK (__BIT(3)|__BIT(4))
159 #define WBSIO_NCT6779D_MFS0_GP30 __BIT(6)
160 #define WBSIO_NCT6779D_MFS0_GP30_MASK __BIT(7)
161 #define WBSIO_NCT6779D_MFS0_GP31 __BIT(5)
162 #define WBSIO_NCT6779D_MFS1_GP31_MASK __BIT(0)
163 #define WBSIO_NCT6779D_MFS0_GP32 __BIT(4)
164 #define WBSIO_NCT6779D_MFS1_GP32_MASK __BIT(0)
165 #define WBSIO_NCT6779D_MFS6_GP33 __BIT(7)
166 #define WBSIO_NCT6779D_MFS6_GP33_MASK __BIT(6)
167 #define WBSIO_NCT6779D_MFS1_GP40 __BIT(3)
168 #define WBSIO_NCT6779D_MFS0_GP41 __BIT(3)
169 #define WBSIO_NCT6779D_MFS0_GP41_MASK __BIT(2)
170 #define WBSIO_NCT6779D_MFS1_GP42 (__BIT(1)|__BIT(2))
171 #define WBSIO_NCT6779D_GOPT2_GP43 __BIT(4)
172 #define WBSIO_NCT6779D_MFS1_GP44_GP45_MASK __BIT(6)
173 #define WBSIO_NCT6779D_GOPT2_GP46_MASK __BIT(5)
174 #define WBSIO_NCT6779D_MFS1_GP47 __BIT(7)
175 #define WBSIO_NCT6779D_HM_GP50_MASK __BIT(2)
176 #define WBSIO_NCT6779D_HM_GP52_MASK __BIT(1)
177 #define WBSIO_NCT6779D_HM_GP55_MASK __BIT(3)
178 #define WBSIO_NCT6779D_MFS5_GP74 __BIT(5)
179 #define WBSIO_NCT6779D_MFS5_GP75 __BIT(6)
180 #define WBSIO_NCT6779D_MFS5_GP76 __BIT(7)
181 #define WBSIO_NCT6779D_GPIO4_WDTO __BIT(4)
182