xref: /OK3568_Linux_fs/kernel/include/uapi/linux/cyclades.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2*4882a593Smuzhiyun /* $Revision: 3.0 $$Date: 1998/11/02 14:20:59 $
3*4882a593Smuzhiyun  * linux/include/linux/cyclades.h
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * This file was initially written by
6*4882a593Smuzhiyun  * Randolph Bentson <bentson@grieg.seaslug.org> and is maintained by
7*4882a593Smuzhiyun  * Ivan Passos <ivan@cyclades.com>.
8*4882a593Smuzhiyun  *
9*4882a593Smuzhiyun  * This file contains the general definitions for the cyclades.c driver
10*4882a593Smuzhiyun  *$Log: cyclades.h,v $
11*4882a593Smuzhiyun  *Revision 3.1  2002/01/29 11:36:16  henrique
12*4882a593Smuzhiyun  *added throttle field on struct cyclades_port to indicate whether the
13*4882a593Smuzhiyun  *port is throttled or not
14*4882a593Smuzhiyun  *
15*4882a593Smuzhiyun  *Revision 3.1  2000/04/19 18:52:52  ivan
16*4882a593Smuzhiyun  *converted address fields to unsigned long and added fields for physical
17*4882a593Smuzhiyun  *addresses on cyclades_card structure;
18*4882a593Smuzhiyun  *
19*4882a593Smuzhiyun  *Revision 3.0  1998/11/02 14:20:59  ivan
20*4882a593Smuzhiyun  *added nports field on cyclades_card structure;
21*4882a593Smuzhiyun  *
22*4882a593Smuzhiyun  *Revision 2.5  1998/08/03 16:57:01  ivan
23*4882a593Smuzhiyun  *added cyclades_idle_stats structure;
24*4882a593Smuzhiyun  *
25*4882a593Smuzhiyun  *Revision 2.4  1998/06/01 12:09:53  ivan
26*4882a593Smuzhiyun  *removed closing_wait2 from cyclades_port structure;
27*4882a593Smuzhiyun  *
28*4882a593Smuzhiyun  *Revision 2.3  1998/03/16 18:01:12  ivan
29*4882a593Smuzhiyun  *changes in the cyclades_port structure to get it closer to the
30*4882a593Smuzhiyun  *standard serial port structure;
31*4882a593Smuzhiyun  *added constants for new ioctls;
32*4882a593Smuzhiyun  *
33*4882a593Smuzhiyun  *Revision 2.2  1998/02/17 16:50:00  ivan
34*4882a593Smuzhiyun  *changes in the cyclades_port structure (addition of shutdown_wait and
35*4882a593Smuzhiyun  *chip_rev variables);
36*4882a593Smuzhiyun  *added constants for new ioctls and for CD1400 rev. numbers.
37*4882a593Smuzhiyun  *
38*4882a593Smuzhiyun  *Revision 2.1	1997/10/24 16:03:00  ivan
39*4882a593Smuzhiyun  *added rflow (which allows enabling the CD1400 special flow control
40*4882a593Smuzhiyun  *feature) and rtsdtr_inv (which allows DTR/RTS pin inversion) to
41*4882a593Smuzhiyun  *cyclades_port structure;
42*4882a593Smuzhiyun  *added Alpha support
43*4882a593Smuzhiyun  *
44*4882a593Smuzhiyun  *Revision 2.0  1997/06/30 10:30:00  ivan
45*4882a593Smuzhiyun  *added some new doorbell command constants related to IOCTLW and
46*4882a593Smuzhiyun  *UART error signaling
47*4882a593Smuzhiyun  *
48*4882a593Smuzhiyun  *Revision 1.8  1997/06/03 15:30:00  ivan
49*4882a593Smuzhiyun  *added constant ZFIRM_HLT
50*4882a593Smuzhiyun  *added constant CyPCI_Ze_win ( = 2 * Cy_PCI_Zwin)
51*4882a593Smuzhiyun  *
52*4882a593Smuzhiyun  *Revision 1.7  1997/03/26 10:30:00  daniel
53*4882a593Smuzhiyun  *new entries at the end of cyclades_port struct to reallocate
54*4882a593Smuzhiyun  *variables illegally allocated within card memory.
55*4882a593Smuzhiyun  *
56*4882a593Smuzhiyun  *Revision 1.6  1996/09/09 18:35:30  bentson
57*4882a593Smuzhiyun  *fold in changes for Cyclom-Z -- including structures for
58*4882a593Smuzhiyun  *communicating with board as well modest changes to original
59*4882a593Smuzhiyun  *structures to support new features.
60*4882a593Smuzhiyun  *
61*4882a593Smuzhiyun  *Revision 1.5  1995/11/13 21:13:31  bentson
62*4882a593Smuzhiyun  *changes suggested by Michael Chastain <mec@duracef.shout.net>
63*4882a593Smuzhiyun  *to support use of this file in non-kernel applications
64*4882a593Smuzhiyun  *
65*4882a593Smuzhiyun  *
66*4882a593Smuzhiyun  */
67*4882a593Smuzhiyun 
68*4882a593Smuzhiyun #ifndef _UAPI_LINUX_CYCLADES_H
69*4882a593Smuzhiyun #define _UAPI_LINUX_CYCLADES_H
70*4882a593Smuzhiyun 
71*4882a593Smuzhiyun #include <linux/types.h>
72*4882a593Smuzhiyun 
73*4882a593Smuzhiyun struct cyclades_monitor {
74*4882a593Smuzhiyun         unsigned long           int_count;
75*4882a593Smuzhiyun         unsigned long           char_count;
76*4882a593Smuzhiyun         unsigned long           char_max;
77*4882a593Smuzhiyun         unsigned long           char_last;
78*4882a593Smuzhiyun };
79*4882a593Smuzhiyun 
80*4882a593Smuzhiyun /*
81*4882a593Smuzhiyun  * These stats all reflect activity since the device was last initialized.
82*4882a593Smuzhiyun  * (i.e., since the port was opened with no other processes already having it
83*4882a593Smuzhiyun  * open)
84*4882a593Smuzhiyun  */
85*4882a593Smuzhiyun struct cyclades_idle_stats {
86*4882a593Smuzhiyun     __kernel_old_time_t in_use;	/* Time device has been in use (secs) */
87*4882a593Smuzhiyun     __kernel_old_time_t recv_idle; /* Time since last char received (secs) */
88*4882a593Smuzhiyun     __kernel_old_time_t xmit_idle; /* Time since last char transmitted (secs) */
89*4882a593Smuzhiyun     unsigned long  recv_bytes;	/* Bytes received */
90*4882a593Smuzhiyun     unsigned long  xmit_bytes;	/* Bytes transmitted */
91*4882a593Smuzhiyun     unsigned long  overruns;	/* Input overruns */
92*4882a593Smuzhiyun     unsigned long  frame_errs;	/* Input framing errors */
93*4882a593Smuzhiyun     unsigned long  parity_errs;	/* Input parity errors */
94*4882a593Smuzhiyun };
95*4882a593Smuzhiyun 
96*4882a593Smuzhiyun #define CYCLADES_MAGIC  0x4359
97*4882a593Smuzhiyun 
98*4882a593Smuzhiyun #define CYGETMON                0x435901
99*4882a593Smuzhiyun #define CYGETTHRESH             0x435902
100*4882a593Smuzhiyun #define CYSETTHRESH             0x435903
101*4882a593Smuzhiyun #define CYGETDEFTHRESH          0x435904
102*4882a593Smuzhiyun #define CYSETDEFTHRESH          0x435905
103*4882a593Smuzhiyun #define CYGETTIMEOUT            0x435906
104*4882a593Smuzhiyun #define CYSETTIMEOUT            0x435907
105*4882a593Smuzhiyun #define CYGETDEFTIMEOUT         0x435908
106*4882a593Smuzhiyun #define CYSETDEFTIMEOUT         0x435909
107*4882a593Smuzhiyun #define CYSETRFLOW		0x43590a
108*4882a593Smuzhiyun #define CYGETRFLOW		0x43590b
109*4882a593Smuzhiyun #define CYSETRTSDTR_INV		0x43590c
110*4882a593Smuzhiyun #define CYGETRTSDTR_INV		0x43590d
111*4882a593Smuzhiyun #define CYZSETPOLLCYCLE		0x43590e
112*4882a593Smuzhiyun #define CYZGETPOLLCYCLE		0x43590f
113*4882a593Smuzhiyun #define CYGETCD1400VER		0x435910
114*4882a593Smuzhiyun #define	CYSETWAIT		0x435912
115*4882a593Smuzhiyun #define	CYGETWAIT		0x435913
116*4882a593Smuzhiyun 
117*4882a593Smuzhiyun /*************** CYCLOM-Z ADDITIONS ***************/
118*4882a593Smuzhiyun 
119*4882a593Smuzhiyun #define CZIOC           ('M' << 8)
120*4882a593Smuzhiyun #define CZ_NBOARDS      (CZIOC|0xfa)
121*4882a593Smuzhiyun #define CZ_BOOT_START   (CZIOC|0xfb)
122*4882a593Smuzhiyun #define CZ_BOOT_DATA    (CZIOC|0xfc)
123*4882a593Smuzhiyun #define CZ_BOOT_END     (CZIOC|0xfd)
124*4882a593Smuzhiyun #define CZ_TEST         (CZIOC|0xfe)
125*4882a593Smuzhiyun 
126*4882a593Smuzhiyun #define CZ_DEF_POLL	(HZ/25)
127*4882a593Smuzhiyun 
128*4882a593Smuzhiyun #define MAX_BOARD       4       /* Max number of boards */
129*4882a593Smuzhiyun #define MAX_DEV         256     /* Max number of ports total */
130*4882a593Smuzhiyun #define	CYZ_MAX_SPEED	921600
131*4882a593Smuzhiyun 
132*4882a593Smuzhiyun #define	CYZ_FIFO_SIZE	16
133*4882a593Smuzhiyun 
134*4882a593Smuzhiyun #define CYZ_BOOT_NWORDS 0x100
135*4882a593Smuzhiyun struct CYZ_BOOT_CTRL {
136*4882a593Smuzhiyun         unsigned short  nboard;
137*4882a593Smuzhiyun         int             status[MAX_BOARD];
138*4882a593Smuzhiyun         int             nchannel[MAX_BOARD];
139*4882a593Smuzhiyun         int             fw_rev[MAX_BOARD];
140*4882a593Smuzhiyun         unsigned long   offset;
141*4882a593Smuzhiyun         unsigned long   data[CYZ_BOOT_NWORDS];
142*4882a593Smuzhiyun };
143*4882a593Smuzhiyun 
144*4882a593Smuzhiyun 
145*4882a593Smuzhiyun #ifndef DP_WINDOW_SIZE
146*4882a593Smuzhiyun /*
147*4882a593Smuzhiyun  *	Memory Window Sizes
148*4882a593Smuzhiyun  */
149*4882a593Smuzhiyun 
150*4882a593Smuzhiyun #define	DP_WINDOW_SIZE		(0x00080000)	/* window size 512 Kb */
151*4882a593Smuzhiyun #define	ZE_DP_WINDOW_SIZE	(0x00100000)	/* window size 1 Mb (Ze and
152*4882a593Smuzhiyun 						  8Zo V.2 */
153*4882a593Smuzhiyun #define	CTRL_WINDOW_SIZE	(0x00000080)	/* runtime regs 128 bytes */
154*4882a593Smuzhiyun 
155*4882a593Smuzhiyun /*
156*4882a593Smuzhiyun  *	CUSTOM_REG - Cyclom-Z/PCI Custom Registers Set. The driver
157*4882a593Smuzhiyun  *	normally will access only interested on the fpga_id, fpga_version,
158*4882a593Smuzhiyun  *	start_cpu and stop_cpu.
159*4882a593Smuzhiyun  */
160*4882a593Smuzhiyun 
161*4882a593Smuzhiyun struct	CUSTOM_REG {
162*4882a593Smuzhiyun 	__u32	fpga_id;		/* FPGA Identification Register */
163*4882a593Smuzhiyun 	__u32	fpga_version;		/* FPGA Version Number Register */
164*4882a593Smuzhiyun 	__u32	cpu_start;		/* CPU start Register (write) */
165*4882a593Smuzhiyun 	__u32	cpu_stop;		/* CPU stop Register (write) */
166*4882a593Smuzhiyun 	__u32	misc_reg;		/* Miscellaneous Register */
167*4882a593Smuzhiyun 	__u32	idt_mode;		/* IDT mode Register */
168*4882a593Smuzhiyun 	__u32	uart_irq_status;	/* UART IRQ status Register */
169*4882a593Smuzhiyun 	__u32	clear_timer0_irq;	/* Clear timer interrupt Register */
170*4882a593Smuzhiyun 	__u32	clear_timer1_irq;	/* Clear timer interrupt Register */
171*4882a593Smuzhiyun 	__u32	clear_timer2_irq;	/* Clear timer interrupt Register */
172*4882a593Smuzhiyun 	__u32	test_register;		/* Test Register */
173*4882a593Smuzhiyun 	__u32	test_count;		/* Test Count Register */
174*4882a593Smuzhiyun 	__u32	timer_select;		/* Timer select register */
175*4882a593Smuzhiyun 	__u32	pr_uart_irq_status;	/* Prioritized UART IRQ stat Reg */
176*4882a593Smuzhiyun 	__u32	ram_wait_state;		/* RAM wait-state Register */
177*4882a593Smuzhiyun 	__u32	uart_wait_state;	/* UART wait-state Register */
178*4882a593Smuzhiyun 	__u32	timer_wait_state;	/* timer wait-state Register */
179*4882a593Smuzhiyun 	__u32	ack_wait_state;		/* ACK wait State Register */
180*4882a593Smuzhiyun };
181*4882a593Smuzhiyun 
182*4882a593Smuzhiyun /*
183*4882a593Smuzhiyun  *	RUNTIME_9060 - PLX PCI9060ES local configuration and shared runtime
184*4882a593Smuzhiyun  *	registers. This structure can be used to access the 9060 registers
185*4882a593Smuzhiyun  *	(memory mapped).
186*4882a593Smuzhiyun  */
187*4882a593Smuzhiyun 
188*4882a593Smuzhiyun struct RUNTIME_9060 {
189*4882a593Smuzhiyun 	__u32	loc_addr_range;	/* 00h - Local Address Range */
190*4882a593Smuzhiyun 	__u32	loc_addr_base;	/* 04h - Local Address Base */
191*4882a593Smuzhiyun 	__u32	loc_arbitr;	/* 08h - Local Arbitration */
192*4882a593Smuzhiyun 	__u32	endian_descr;	/* 0Ch - Big/Little Endian Descriptor */
193*4882a593Smuzhiyun 	__u32	loc_rom_range;	/* 10h - Local ROM Range */
194*4882a593Smuzhiyun 	__u32	loc_rom_base;	/* 14h - Local ROM Base */
195*4882a593Smuzhiyun 	__u32	loc_bus_descr;	/* 18h - Local Bus descriptor */
196*4882a593Smuzhiyun 	__u32	loc_range_mst;	/* 1Ch - Local Range for Master to PCI */
197*4882a593Smuzhiyun 	__u32	loc_base_mst;	/* 20h - Local Base for Master PCI */
198*4882a593Smuzhiyun 	__u32	loc_range_io;	/* 24h - Local Range for Master IO */
199*4882a593Smuzhiyun 	__u32	pci_base_mst;	/* 28h - PCI Base for Master PCI */
200*4882a593Smuzhiyun 	__u32	pci_conf_io;	/* 2Ch - PCI configuration for Master IO */
201*4882a593Smuzhiyun 	__u32	filler1;	/* 30h */
202*4882a593Smuzhiyun 	__u32	filler2;	/* 34h */
203*4882a593Smuzhiyun 	__u32	filler3;	/* 38h */
204*4882a593Smuzhiyun 	__u32	filler4;	/* 3Ch */
205*4882a593Smuzhiyun 	__u32	mail_box_0;	/* 40h - Mail Box 0 */
206*4882a593Smuzhiyun 	__u32	mail_box_1;	/* 44h - Mail Box 1 */
207*4882a593Smuzhiyun 	__u32	mail_box_2;	/* 48h - Mail Box 2 */
208*4882a593Smuzhiyun 	__u32	mail_box_3;	/* 4Ch - Mail Box 3 */
209*4882a593Smuzhiyun 	__u32	filler5;	/* 50h */
210*4882a593Smuzhiyun 	__u32	filler6;	/* 54h */
211*4882a593Smuzhiyun 	__u32	filler7;	/* 58h */
212*4882a593Smuzhiyun 	__u32	filler8;	/* 5Ch */
213*4882a593Smuzhiyun 	__u32	pci_doorbell;	/* 60h - PCI to Local Doorbell */
214*4882a593Smuzhiyun 	__u32	loc_doorbell;	/* 64h - Local to PCI Doorbell */
215*4882a593Smuzhiyun 	__u32	intr_ctrl_stat;	/* 68h - Interrupt Control/Status */
216*4882a593Smuzhiyun 	__u32	init_ctrl;	/* 6Ch - EEPROM control, Init Control, etc */
217*4882a593Smuzhiyun };
218*4882a593Smuzhiyun 
219*4882a593Smuzhiyun /* Values for the Local Base Address re-map register */
220*4882a593Smuzhiyun 
221*4882a593Smuzhiyun #define	WIN_RAM		0x00000001L	/* set the sliding window to RAM */
222*4882a593Smuzhiyun #define	WIN_CREG	0x14000001L	/* set the window to custom Registers */
223*4882a593Smuzhiyun 
224*4882a593Smuzhiyun /* Values timer select registers */
225*4882a593Smuzhiyun 
226*4882a593Smuzhiyun #define	TIMER_BY_1M	0x00		/* clock divided by 1M */
227*4882a593Smuzhiyun #define	TIMER_BY_256K	0x01		/* clock divided by 256k */
228*4882a593Smuzhiyun #define	TIMER_BY_128K	0x02		/* clock divided by 128k */
229*4882a593Smuzhiyun #define	TIMER_BY_32K	0x03		/* clock divided by 32k */
230*4882a593Smuzhiyun 
231*4882a593Smuzhiyun /****************** ****************** *******************/
232*4882a593Smuzhiyun #endif
233*4882a593Smuzhiyun 
234*4882a593Smuzhiyun #ifndef ZFIRM_ID
235*4882a593Smuzhiyun /* #include "zfwint.h" */
236*4882a593Smuzhiyun /****************** ****************** *******************/
237*4882a593Smuzhiyun /*
238*4882a593Smuzhiyun  *	This file contains the definitions for interfacing with the
239*4882a593Smuzhiyun  *	Cyclom-Z ZFIRM Firmware.
240*4882a593Smuzhiyun  */
241*4882a593Smuzhiyun 
242*4882a593Smuzhiyun /* General Constant definitions */
243*4882a593Smuzhiyun 
244*4882a593Smuzhiyun #define	MAX_CHAN	64		/* max number of channels per board */
245*4882a593Smuzhiyun 
246*4882a593Smuzhiyun /* firmware id structure (set after boot) */
247*4882a593Smuzhiyun 
248*4882a593Smuzhiyun #define ID_ADDRESS	0x00000180L	/* signature/pointer address */
249*4882a593Smuzhiyun #define	ZFIRM_ID	0x5557465AL	/* ZFIRM/U signature */
250*4882a593Smuzhiyun #define	ZFIRM_HLT	0x59505B5CL	/* ZFIRM needs external power supply */
251*4882a593Smuzhiyun #define	ZFIRM_RST	0x56040674L	/* RST signal (due to FW reset) */
252*4882a593Smuzhiyun 
253*4882a593Smuzhiyun #define	ZF_TINACT_DEF	1000		/* default inactivity timeout
254*4882a593Smuzhiyun 					   (1000 ms) */
255*4882a593Smuzhiyun #define	ZF_TINACT	ZF_TINACT_DEF
256*4882a593Smuzhiyun 
257*4882a593Smuzhiyun struct	FIRM_ID {
258*4882a593Smuzhiyun 	__u32	signature;		/* ZFIRM/U signature */
259*4882a593Smuzhiyun 	__u32	zfwctrl_addr;		/* pointer to ZFW_CTRL structure */
260*4882a593Smuzhiyun };
261*4882a593Smuzhiyun 
262*4882a593Smuzhiyun /* Op. System id */
263*4882a593Smuzhiyun 
264*4882a593Smuzhiyun #define	C_OS_LINUX	0x00000030	/* generic Linux system */
265*4882a593Smuzhiyun 
266*4882a593Smuzhiyun /* channel op_mode */
267*4882a593Smuzhiyun 
268*4882a593Smuzhiyun #define	C_CH_DISABLE	0x00000000	/* channel is disabled */
269*4882a593Smuzhiyun #define	C_CH_TXENABLE	0x00000001	/* channel Tx enabled */
270*4882a593Smuzhiyun #define	C_CH_RXENABLE	0x00000002	/* channel Rx enabled */
271*4882a593Smuzhiyun #define	C_CH_ENABLE	0x00000003	/* channel Tx/Rx enabled */
272*4882a593Smuzhiyun #define	C_CH_LOOPBACK	0x00000004	/* Loopback mode */
273*4882a593Smuzhiyun 
274*4882a593Smuzhiyun /* comm_parity - parity */
275*4882a593Smuzhiyun 
276*4882a593Smuzhiyun #define	C_PR_NONE	0x00000000	/* None */
277*4882a593Smuzhiyun #define	C_PR_ODD	0x00000001	/* Odd */
278*4882a593Smuzhiyun #define C_PR_EVEN	0x00000002	/* Even */
279*4882a593Smuzhiyun #define C_PR_MARK	0x00000004	/* Mark */
280*4882a593Smuzhiyun #define C_PR_SPACE	0x00000008	/* Space */
281*4882a593Smuzhiyun #define C_PR_PARITY	0x000000ff
282*4882a593Smuzhiyun 
283*4882a593Smuzhiyun #define	C_PR_DISCARD	0x00000100	/* discard char with frame/par error */
284*4882a593Smuzhiyun #define C_PR_IGNORE	0x00000200	/* ignore frame/par error */
285*4882a593Smuzhiyun 
286*4882a593Smuzhiyun /* comm_data_l - data length and stop bits */
287*4882a593Smuzhiyun 
288*4882a593Smuzhiyun #define C_DL_CS5	0x00000001
289*4882a593Smuzhiyun #define C_DL_CS6	0x00000002
290*4882a593Smuzhiyun #define C_DL_CS7	0x00000004
291*4882a593Smuzhiyun #define C_DL_CS8	0x00000008
292*4882a593Smuzhiyun #define	C_DL_CS		0x0000000f
293*4882a593Smuzhiyun #define C_DL_1STOP	0x00000010
294*4882a593Smuzhiyun #define C_DL_15STOP	0x00000020
295*4882a593Smuzhiyun #define C_DL_2STOP	0x00000040
296*4882a593Smuzhiyun #define	C_DL_STOP	0x000000f0
297*4882a593Smuzhiyun 
298*4882a593Smuzhiyun /* interrupt enabling/status */
299*4882a593Smuzhiyun 
300*4882a593Smuzhiyun #define	C_IN_DISABLE	0x00000000	/* zero, disable interrupts */
301*4882a593Smuzhiyun #define	C_IN_TXBEMPTY	0x00000001	/* tx buffer empty */
302*4882a593Smuzhiyun #define	C_IN_TXLOWWM	0x00000002	/* tx buffer below LWM */
303*4882a593Smuzhiyun #define	C_IN_RXHIWM	0x00000010	/* rx buffer above HWM */
304*4882a593Smuzhiyun #define	C_IN_RXNNDT	0x00000020	/* rx no new data timeout */
305*4882a593Smuzhiyun #define	C_IN_MDCD	0x00000100	/* modem DCD change */
306*4882a593Smuzhiyun #define	C_IN_MDSR	0x00000200	/* modem DSR change */
307*4882a593Smuzhiyun #define	C_IN_MRI	0x00000400	/* modem RI change */
308*4882a593Smuzhiyun #define	C_IN_MCTS	0x00000800	/* modem CTS change */
309*4882a593Smuzhiyun #define	C_IN_RXBRK	0x00001000	/* Break received */
310*4882a593Smuzhiyun #define	C_IN_PR_ERROR	0x00002000	/* parity error */
311*4882a593Smuzhiyun #define	C_IN_FR_ERROR	0x00004000	/* frame error */
312*4882a593Smuzhiyun #define C_IN_OVR_ERROR  0x00008000      /* overrun error */
313*4882a593Smuzhiyun #define C_IN_RXOFL	0x00010000      /* RX buffer overflow */
314*4882a593Smuzhiyun #define C_IN_IOCTLW	0x00020000      /* I/O control w/ wait */
315*4882a593Smuzhiyun #define C_IN_MRTS	0x00040000	/* modem RTS drop */
316*4882a593Smuzhiyun #define C_IN_ICHAR	0x00080000
317*4882a593Smuzhiyun 
318*4882a593Smuzhiyun /* flow control */
319*4882a593Smuzhiyun 
320*4882a593Smuzhiyun #define	C_FL_OXX	0x00000001	/* output Xon/Xoff flow control */
321*4882a593Smuzhiyun #define	C_FL_IXX	0x00000002	/* output Xon/Xoff flow control */
322*4882a593Smuzhiyun #define C_FL_OIXANY	0x00000004	/* output Xon/Xoff (any xon) */
323*4882a593Smuzhiyun #define	C_FL_SWFLOW	0x0000000f
324*4882a593Smuzhiyun 
325*4882a593Smuzhiyun /* flow status */
326*4882a593Smuzhiyun 
327*4882a593Smuzhiyun #define	C_FS_TXIDLE	0x00000000	/* no Tx data in the buffer or UART */
328*4882a593Smuzhiyun #define	C_FS_SENDING	0x00000001	/* UART is sending data */
329*4882a593Smuzhiyun #define	C_FS_SWFLOW	0x00000002	/* Tx is stopped by received Xoff */
330*4882a593Smuzhiyun 
331*4882a593Smuzhiyun /* rs_control/rs_status RS-232 signals */
332*4882a593Smuzhiyun 
333*4882a593Smuzhiyun #define C_RS_PARAM	0x80000000	/* Indicates presence of parameter in
334*4882a593Smuzhiyun 					   IOCTLM command */
335*4882a593Smuzhiyun #define	C_RS_RTS	0x00000001	/* RTS */
336*4882a593Smuzhiyun #define	C_RS_DTR	0x00000004	/* DTR */
337*4882a593Smuzhiyun #define	C_RS_DCD	0x00000100	/* CD */
338*4882a593Smuzhiyun #define	C_RS_DSR	0x00000200	/* DSR */
339*4882a593Smuzhiyun #define	C_RS_RI		0x00000400	/* RI */
340*4882a593Smuzhiyun #define	C_RS_CTS	0x00000800	/* CTS */
341*4882a593Smuzhiyun 
342*4882a593Smuzhiyun /* commands Host <-> Board */
343*4882a593Smuzhiyun 
344*4882a593Smuzhiyun #define	C_CM_RESET	0x01		/* reset/flush buffers */
345*4882a593Smuzhiyun #define	C_CM_IOCTL	0x02		/* re-read CH_CTRL */
346*4882a593Smuzhiyun #define	C_CM_IOCTLW	0x03		/* re-read CH_CTRL, intr when done */
347*4882a593Smuzhiyun #define	C_CM_IOCTLM	0x04		/* RS-232 outputs change */
348*4882a593Smuzhiyun #define	C_CM_SENDXOFF	0x10		/* send Xoff */
349*4882a593Smuzhiyun #define	C_CM_SENDXON	0x11		/* send Xon */
350*4882a593Smuzhiyun #define C_CM_CLFLOW	0x12		/* Clear flow control (resume) */
351*4882a593Smuzhiyun #define	C_CM_SENDBRK	0x41		/* send break */
352*4882a593Smuzhiyun #define	C_CM_INTBACK	0x42		/* Interrupt back */
353*4882a593Smuzhiyun #define	C_CM_SET_BREAK	0x43		/* Tx break on */
354*4882a593Smuzhiyun #define	C_CM_CLR_BREAK	0x44		/* Tx break off */
355*4882a593Smuzhiyun #define	C_CM_CMD_DONE	0x45		/* Previous command done */
356*4882a593Smuzhiyun #define C_CM_INTBACK2	0x46		/* Alternate Interrupt back */
357*4882a593Smuzhiyun #define	C_CM_TINACT	0x51		/* set inactivity detection */
358*4882a593Smuzhiyun #define	C_CM_IRQ_ENBL	0x52		/* enable generation of interrupts */
359*4882a593Smuzhiyun #define	C_CM_IRQ_DSBL	0x53		/* disable generation of interrupts */
360*4882a593Smuzhiyun #define	C_CM_ACK_ENBL	0x54		/* enable acknowledged interrupt mode */
361*4882a593Smuzhiyun #define	C_CM_ACK_DSBL	0x55		/* disable acknowledged intr mode */
362*4882a593Smuzhiyun #define	C_CM_FLUSH_RX	0x56		/* flushes Rx buffer */
363*4882a593Smuzhiyun #define	C_CM_FLUSH_TX	0x57		/* flushes Tx buffer */
364*4882a593Smuzhiyun #define C_CM_Q_ENABLE	0x58		/* enables queue access from the
365*4882a593Smuzhiyun 					   driver */
366*4882a593Smuzhiyun #define C_CM_Q_DISABLE  0x59            /* disables queue access from the
367*4882a593Smuzhiyun 					   driver */
368*4882a593Smuzhiyun 
369*4882a593Smuzhiyun #define	C_CM_TXBEMPTY	0x60		/* Tx buffer is empty */
370*4882a593Smuzhiyun #define	C_CM_TXLOWWM	0x61		/* Tx buffer low water mark */
371*4882a593Smuzhiyun #define	C_CM_RXHIWM	0x62		/* Rx buffer high water mark */
372*4882a593Smuzhiyun #define	C_CM_RXNNDT	0x63		/* rx no new data timeout */
373*4882a593Smuzhiyun #define	C_CM_TXFEMPTY	0x64
374*4882a593Smuzhiyun #define	C_CM_ICHAR	0x65
375*4882a593Smuzhiyun #define	C_CM_MDCD	0x70		/* modem DCD change */
376*4882a593Smuzhiyun #define	C_CM_MDSR	0x71		/* modem DSR change */
377*4882a593Smuzhiyun #define	C_CM_MRI	0x72		/* modem RI change */
378*4882a593Smuzhiyun #define	C_CM_MCTS	0x73		/* modem CTS change */
379*4882a593Smuzhiyun #define C_CM_MRTS	0x74		/* modem RTS drop */
380*4882a593Smuzhiyun #define	C_CM_RXBRK	0x84		/* Break received */
381*4882a593Smuzhiyun #define	C_CM_PR_ERROR	0x85		/* Parity error */
382*4882a593Smuzhiyun #define	C_CM_FR_ERROR	0x86		/* Frame error */
383*4882a593Smuzhiyun #define C_CM_OVR_ERROR  0x87            /* Overrun error */
384*4882a593Smuzhiyun #define C_CM_RXOFL	0x88            /* RX buffer overflow */
385*4882a593Smuzhiyun #define	C_CM_CMDERROR	0x90		/* command error */
386*4882a593Smuzhiyun #define	C_CM_FATAL	0x91		/* fatal error */
387*4882a593Smuzhiyun #define	C_CM_HW_RESET	0x92		/* reset board */
388*4882a593Smuzhiyun 
389*4882a593Smuzhiyun /*
390*4882a593Smuzhiyun  *	CH_CTRL - This per port structure contains all parameters
391*4882a593Smuzhiyun  *	that control an specific port. It can be seen as the
392*4882a593Smuzhiyun  *	configuration registers of a "super-serial-controller".
393*4882a593Smuzhiyun  */
394*4882a593Smuzhiyun 
395*4882a593Smuzhiyun struct CH_CTRL {
396*4882a593Smuzhiyun 	__u32	op_mode;	/* operation mode */
397*4882a593Smuzhiyun 	__u32	intr_enable;	/* interrupt masking */
398*4882a593Smuzhiyun 	__u32	sw_flow;	/* SW flow control */
399*4882a593Smuzhiyun 	__u32	flow_status;	/* output flow status */
400*4882a593Smuzhiyun 	__u32	comm_baud;	/* baud rate  - numerically specified */
401*4882a593Smuzhiyun 	__u32	comm_parity;	/* parity */
402*4882a593Smuzhiyun 	__u32	comm_data_l;	/* data length/stop */
403*4882a593Smuzhiyun 	__u32	comm_flags;	/* other flags */
404*4882a593Smuzhiyun 	__u32	hw_flow;	/* HW flow control */
405*4882a593Smuzhiyun 	__u32	rs_control;	/* RS-232 outputs */
406*4882a593Smuzhiyun 	__u32	rs_status;	/* RS-232 inputs */
407*4882a593Smuzhiyun 	__u32	flow_xon;	/* xon char */
408*4882a593Smuzhiyun 	__u32	flow_xoff;	/* xoff char */
409*4882a593Smuzhiyun 	__u32	hw_overflow;	/* hw overflow counter */
410*4882a593Smuzhiyun 	__u32	sw_overflow;	/* sw overflow counter */
411*4882a593Smuzhiyun 	__u32	comm_error;	/* frame/parity error counter */
412*4882a593Smuzhiyun 	__u32 ichar;
413*4882a593Smuzhiyun 	__u32 filler[7];
414*4882a593Smuzhiyun };
415*4882a593Smuzhiyun 
416*4882a593Smuzhiyun 
417*4882a593Smuzhiyun /*
418*4882a593Smuzhiyun  *	BUF_CTRL - This per channel structure contains
419*4882a593Smuzhiyun  *	all Tx and Rx buffer control for a given channel.
420*4882a593Smuzhiyun  */
421*4882a593Smuzhiyun 
422*4882a593Smuzhiyun struct	BUF_CTRL	{
423*4882a593Smuzhiyun 	__u32	flag_dma;	/* buffers are in Host memory */
424*4882a593Smuzhiyun 	__u32	tx_bufaddr;	/* address of the tx buffer */
425*4882a593Smuzhiyun 	__u32	tx_bufsize;	/* tx buffer size */
426*4882a593Smuzhiyun 	__u32	tx_threshold;	/* tx low water mark */
427*4882a593Smuzhiyun 	__u32	tx_get;		/* tail index tx buf */
428*4882a593Smuzhiyun 	__u32	tx_put;		/* head index tx buf */
429*4882a593Smuzhiyun 	__u32	rx_bufaddr;	/* address of the rx buffer */
430*4882a593Smuzhiyun 	__u32	rx_bufsize;	/* rx buffer size */
431*4882a593Smuzhiyun 	__u32	rx_threshold;	/* rx high water mark */
432*4882a593Smuzhiyun 	__u32	rx_get;		/* tail index rx buf */
433*4882a593Smuzhiyun 	__u32	rx_put;		/* head index rx buf */
434*4882a593Smuzhiyun 	__u32	filler[5];	/* filler to align structures */
435*4882a593Smuzhiyun };
436*4882a593Smuzhiyun 
437*4882a593Smuzhiyun /*
438*4882a593Smuzhiyun  *	BOARD_CTRL - This per board structure contains all global
439*4882a593Smuzhiyun  *	control fields related to the board.
440*4882a593Smuzhiyun  */
441*4882a593Smuzhiyun 
442*4882a593Smuzhiyun struct BOARD_CTRL {
443*4882a593Smuzhiyun 
444*4882a593Smuzhiyun 	/* static info provided by the on-board CPU */
445*4882a593Smuzhiyun 	__u32	n_channel;	/* number of channels */
446*4882a593Smuzhiyun 	__u32	fw_version;	/* firmware version */
447*4882a593Smuzhiyun 
448*4882a593Smuzhiyun 	/* static info provided by the driver */
449*4882a593Smuzhiyun 	__u32	op_system;	/* op_system id */
450*4882a593Smuzhiyun 	__u32	dr_version;	/* driver version */
451*4882a593Smuzhiyun 
452*4882a593Smuzhiyun 	/* board control area */
453*4882a593Smuzhiyun 	__u32	inactivity;	/* inactivity control */
454*4882a593Smuzhiyun 
455*4882a593Smuzhiyun 	/* host to FW commands */
456*4882a593Smuzhiyun 	__u32	hcmd_channel;	/* channel number */
457*4882a593Smuzhiyun 	__u32	hcmd_param;	/* pointer to parameters */
458*4882a593Smuzhiyun 
459*4882a593Smuzhiyun 	/* FW to Host commands */
460*4882a593Smuzhiyun 	__u32	fwcmd_channel;	/* channel number */
461*4882a593Smuzhiyun 	__u32	fwcmd_param;	/* pointer to parameters */
462*4882a593Smuzhiyun 	__u32	zf_int_queue_addr; /* offset for INT_QUEUE structure */
463*4882a593Smuzhiyun 
464*4882a593Smuzhiyun 	/* filler so the structures are aligned */
465*4882a593Smuzhiyun 	__u32	filler[6];
466*4882a593Smuzhiyun };
467*4882a593Smuzhiyun 
468*4882a593Smuzhiyun /* Host Interrupt Queue */
469*4882a593Smuzhiyun 
470*4882a593Smuzhiyun #define QUEUE_SIZE	(10*MAX_CHAN)
471*4882a593Smuzhiyun 
472*4882a593Smuzhiyun struct	INT_QUEUE {
473*4882a593Smuzhiyun 	unsigned char	intr_code[QUEUE_SIZE];
474*4882a593Smuzhiyun 	unsigned long	channel[QUEUE_SIZE];
475*4882a593Smuzhiyun 	unsigned long	param[QUEUE_SIZE];
476*4882a593Smuzhiyun 	unsigned long	put;
477*4882a593Smuzhiyun 	unsigned long	get;
478*4882a593Smuzhiyun };
479*4882a593Smuzhiyun 
480*4882a593Smuzhiyun /*
481*4882a593Smuzhiyun  *	ZFW_CTRL - This is the data structure that includes all other
482*4882a593Smuzhiyun  *	data structures used by the Firmware.
483*4882a593Smuzhiyun  */
484*4882a593Smuzhiyun 
485*4882a593Smuzhiyun struct ZFW_CTRL {
486*4882a593Smuzhiyun 	struct BOARD_CTRL	board_ctrl;
487*4882a593Smuzhiyun 	struct CH_CTRL		ch_ctrl[MAX_CHAN];
488*4882a593Smuzhiyun 	struct BUF_CTRL		buf_ctrl[MAX_CHAN];
489*4882a593Smuzhiyun };
490*4882a593Smuzhiyun 
491*4882a593Smuzhiyun /****************** ****************** *******************/
492*4882a593Smuzhiyun #endif
493*4882a593Smuzhiyun 
494*4882a593Smuzhiyun #endif /* _UAPI_LINUX_CYCLADES_H */
495