1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#ifndef _NS87308_H_
25#define _NS87308_H_
26
27#include <asm/pci_io.h>
28
29
30
31
32void initialise_ns87308(void);
33
34
35
36
37struct GPIO
38{
39 unsigned char dta1;
40 unsigned char dir1;
41 unsigned char out1;
42 unsigned char puc1;
43 unsigned char dta2;
44 unsigned char dir2;
45 unsigned char out2;
46 unsigned char puc2;
47};
48
49
50
51
52#define PWM_FER1 0
53#define PWM_FER2 1
54#define PWM_PMC1 2
55#define PWM_PMC2 3
56#define PWM_PMC3 4
57#define PWM_WDTO 5
58#define PWM_WDCF 6
59#define PWM_WDST 7
60
61
62
63
64
65
66
67
68
69
70#define IO_INDEX_OFFSET_0x 0x0279
71#define IO_INDEX_OFFSET_10 0x015C
72#define IO_INDEX_OFFSET_11 0x002E
73#define IO_DATA_OFFSET_0x 0x0A79
74#define IO_DATA_OFFSET_10 0x015D
75#define IO_DATA_OFFSET_11 0x002F
76
77#if defined(CONFIG_SYS_NS87308_BADDR_0x)
78#define IO_INDEX (CONFIG_SYS_ISA_IO + IO_INDEX_OFFSET_0x)
79#define IO_DATA (CONFIG_SYS_ISA_IO + IO_DATA_OFFSET_0x)
80#elif defined(CONFIG_SYS_NS87308_BADDR_10)
81#define IO_INDEX (CONFIG_SYS_ISA_IO + IO_INDEX_OFFSET_10)
82#define IO_DATA (CONFIG_SYS_ISA_IO + IO_DATA_OFFSET_10)
83#elif defined(CONFIG_SYS_NS87308_BADDR_11)
84#define IO_INDEX (CONFIG_SYS_ISA_IO + IO_INDEX_OFFSET_11)
85#define IO_DATA (CONFIG_SYS_ISA_IO + IO_DATA_OFFSET_11)
86#endif
87
88
89
90#define SET_RD_DATA_PORT 0x00
91#define SERIAL_ISOLATION 0x01
92#define CONFIG_CONTROL 0x02
93#define WAKE_CSN 0x03
94#define RES_DATA 0x04
95#define STATUS 0x05
96#define SET_CSN 0x06
97#define LOGICAL_DEVICE 0x07
98
99
100#define SID_REG 0x20
101#define SUPOERIO_CONF1 0x21
102#define SUPOERIO_CONF2 0x22
103#define PGCS_INDEX 0x23
104#define PGCS_DATA 0x24
105
106
107
108
109
110
111#define ACTIVATE 0x30
112#define ACTIVATE_OFF 0x00
113#define ACTIVATE_ON 0x01
114
115#define BASE_ADDR_HIGH 0x60
116#define BASE_ADDR_LOW 0x61
117#define LUN_CONFIG_REG 0xF0
118#define DBASE_HIGH 0x60
119#define DBASE_LOW 0x61
120#define CBASE_HIGH 0x62
121#define CBASE_LOW 0x63
122
123
124#define LDEV_KBC1 0x00
125#define LDEV_KBC2 0x01
126#define LDEV_MOUSE 0x01
127#define LDEV_RTC_APC 0x02
128#define LDEV_FDC 0x03
129#define LDEV_PARP 0x04
130#define LDEV_UART2 0x05
131#define LDEV_UART1 0x06
132#define LDEV_GPIO 0x07
133#define LDEV_POWRMAN 0x08
134
135#define CONFIG_SYS_NS87308_KBC1 (1 << LDEV_KBC1)
136#define CONFIG_SYS_NS87308_KBC2 (1 << LDEV_KBC2)
137#define CONFIG_SYS_NS87308_MOUSE (1 << LDEV_MOUSE)
138#define CONFIG_SYS_NS87308_RTC_APC (1 << LDEV_RTC_APC)
139#define CONFIG_SYS_NS87308_FDC (1 << LDEV_FDC)
140#define CONFIG_SYS_NS87308_PARP (1 << LDEV_PARP)
141#define CONFIG_SYS_NS87308_UART2 (1 << LDEV_UART2)
142#define CONFIG_SYS_NS87308_UART1 (1 << LDEV_UART1)
143#define CONFIG_SYS_NS87308_GPIO (1 << LDEV_GPIO)
144#define CONFIG_SYS_NS87308_POWRMAN (1 << LDEV_POWRMAN)
145
146
147
148static inline void read_pnp_config(unsigned char index, unsigned char *data)
149{
150 pci_writeb(index,IO_INDEX);
151 pci_readb(IO_DATA, *data);
152}
153
154static inline void write_pnp_config(unsigned char index, unsigned char data)
155{
156 pci_writeb(index,IO_INDEX);
157 pci_writeb(data, IO_DATA);
158}
159
160static inline void pnp_set_device(unsigned char dev)
161{
162 write_pnp_config(LOGICAL_DEVICE, dev);
163}
164
165static inline void write_pm_reg(unsigned short base, unsigned char index, unsigned char data)
166{
167 pci_writeb(index, CONFIG_SYS_ISA_IO + base);
168 eieio();
169 pci_writeb(data, CONFIG_SYS_ISA_IO + base + 1);
170}
171
172
173
174
175
176#define PNP_SET_DEVICE_BASE(dev,base) \
177 pnp_set_device(dev); \
178 write_pnp_config(ACTIVATE, ACTIVATE_OFF); \
179 write_pnp_config(BASE_ADDR_HIGH, ((base) >> 8) & 0xff ); \
180 write_pnp_config(BASE_ADDR_LOW, (base) &0xff); \
181 write_pnp_config(ACTIVATE, ACTIVATE_ON);
182
183#define PNP_ACTIVATE_DEVICE(dev) \
184 pnp_set_device(dev); \
185 write_pnp_config(ACTIVATE, ACTIVATE_ON);
186
187#define PNP_DEACTIVATE_DEVICE(dev) \
188 pnp_set_device(dev); \
189 write_pnp_config(ACTIVATE, ACTIVATE_OFF);
190
191
192static inline void write_pgcs_config(unsigned char index, unsigned char data)
193{
194 write_pnp_config(PGCS_INDEX, index);
195 write_pnp_config(PGCS_DATA, data);
196}
197
198
199
200
201
202
203
204#define PGCS_CS_ASSERT_ON_WRITE 0x10
205#define PGCS_CS_ASSERT_ON_READ 0x20
206
207#define PNP_PGCS_CSLINE_BASE(cs, base) \
208 write_pgcs_config((cs) << 2, ((base) >> 8) & 0xff ); \
209 write_pgcs_config(((cs) << 2) + 1, (base) & 0xff );
210
211#define PNP_PGCS_CSLINE_CONF(cs, conf) \
212 write_pgcs_config(((cs) << 2) + 2, (conf) );
213
214
215
216
217
218
219#define MCR_MDSL_MSK 0xe0
220#define MCR_MDSL_UART 0x00
221#define MCR_MDSL_SHRPIR 0x02
222#define MCR_MDSL_SIR 0x03
223#define MCR_MDSL_CIR 0x06
224
225#define FCR_TXFTH0 0x10
226#define FCR_TXFTH1 0x20
227
228
229
230
231#ifndef CONFIG_SYS_NS87308_KBC1_BASE
232#define CONFIG_SYS_NS87308_KBC1_BASE 0x0060
233#endif
234#ifndef CONFIG_SYS_NS87308_RTC_BASE
235#define CONFIG_SYS_NS87308_RTC_BASE 0x0070
236#endif
237#ifndef CONFIG_SYS_NS87308_FDC_BASE
238#define CONFIG_SYS_NS87308_FDC_BASE 0x03F0
239#endif
240#ifndef CONFIG_SYS_NS87308_LPT_BASE
241#define CONFIG_SYS_NS87308_LPT_BASE 0x0278
242#endif
243#ifndef CONFIG_SYS_NS87308_UART1_BASE
244#define CONFIG_SYS_NS87308_UART1_BASE 0x03F8
245#endif
246#ifndef CONFIG_SYS_NS87308_UART2_BASE
247#define CONFIG_SYS_NS87308_UART2_BASE 0x02F8
248#endif
249
250#endif
251