11da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/*****************************************************************************/
21da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
31da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/*
41da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	stallion.h  -- stallion multiport serial driver.
51da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
61da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	Copyright (C) 1996-1998  Stallion Technologies
71da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	Copyright (C) 1994-1996  Greg Ungerer.
81da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
91da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	This program is free software; you can redistribute it and/or modify
101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	it under the terms of the GNU General Public License as published by
111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	the Free Software Foundation; either version 2 of the License, or
121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	(at your option) any later version.
131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	This program is distributed in the hope that it will be useful,
151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	but WITHOUT ANY WARRANTY; without even the implied warranty of
161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	GNU General Public License for more details.
181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *
191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	You should have received a copy of the GNU General Public License
201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	along with this program; if not, write to the Free Software
211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */
231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/*****************************************************************************/
251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifndef	_STALLION_H
261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define	_STALLION_H
271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/*****************************************************************************/
281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/*
301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	Define important driver constants here.
311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */
321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define	STL_MAXBRDS		4
331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define	STL_MAXPANELS		4
341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define	STL_MAXBANKS		8
351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define	STL_PORTSPERPANEL	16
361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define	STL_MAXPORTS		64
371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define	STL_MAXDEVS		(STL_MAXBRDS * STL_MAXPORTS)
381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/*
411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	Define a set of structures to hold all the board/panel/port info
421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	for our ports. These will be dynamically allocated as required.
431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */
441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/*
461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	Define a ring queue structure for each port. This will hold the
471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	TX data waiting to be output. Characters are fed into this buffer
481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	from the line discipline (or even direct from user space!) and
491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	then fed into the UARTs during interrupts. Will use a classic ring
501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	queue here for this. The good thing about this type of ring queue
511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	is that the head and tail pointers can be updated without interrupt
521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	protection - since "write" code only needs to change the head, and
531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	interrupt code only needs to change the tail.
541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */
55ca7ed0f22f4876986b2eb1fbd80ba78e07fd69d5Jiri Slabystruct stlrq {
561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	char	*buf;
571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	char	*head;
581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	char	*tail;
59ca7ed0f22f4876986b2eb1fbd80ba78e07fd69d5Jiri Slaby};
601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/*
621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	Port, panel and board structures to hold status info about each.
631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	The board structure contains pointers to structures for each panel
641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	connected to it, and in turn each panel structure contains pointers
651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	for each port structure for each port on that panel. Note that
661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	the port structure also contains the board and panel number that it
671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	is associated with, this makes it (fairly) easy to get back to the
681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	board/panel info for a port.
691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */
70ca7ed0f22f4876986b2eb1fbd80ba78e07fd69d5Jiri Slabystruct stlport {
711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	unsigned long		magic;
72f8ae47641611fcdf175ab8bbe89054731b16971dAlan Cox	struct tty_port		port;
736b2c9457bb377bf843f0a3ca2f4eb2ef69c67985Jiri Slaby	unsigned int		portnr;
746b2c9457bb377bf843f0a3ca2f4eb2ef69c67985Jiri Slaby	unsigned int		panelnr;
756b2c9457bb377bf843f0a3ca2f4eb2ef69c67985Jiri Slaby	unsigned int		brdnr;
761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	int			ioaddr;
771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	int			uartaddr;
786b2c9457bb377bf843f0a3ca2f4eb2ef69c67985Jiri Slaby	unsigned int		pagenr;
7964b33619a30ff18c1535ee779572ecffcc4711d2Al Viro	unsigned long		istate;
801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	int			baud_base;
811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	int			custom_divisor;
821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	int			close_delay;
831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	int			closing_wait;
841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	int			openwaitcnt;
851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	int			brklen;
861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	unsigned int		sigs;
871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	unsigned int		rxignoremsk;
881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	unsigned int		rxmarkmsk;
891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	unsigned int		imr;
901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	unsigned int		crenable;
911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	unsigned long		clk;
921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	unsigned long		hwid;
931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	void			*uartp;
941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	comstats_t		stats;
95ca7ed0f22f4876986b2eb1fbd80ba78e07fd69d5Jiri Slaby	struct stlrq		tx;
96ca7ed0f22f4876986b2eb1fbd80ba78e07fd69d5Jiri Slaby};
971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
98ca7ed0f22f4876986b2eb1fbd80ba78e07fd69d5Jiri Slabystruct stlpanel {
991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	unsigned long	magic;
1006b2c9457bb377bf843f0a3ca2f4eb2ef69c67985Jiri Slaby	unsigned int	panelnr;
1016b2c9457bb377bf843f0a3ca2f4eb2ef69c67985Jiri Slaby	unsigned int	brdnr;
1026b2c9457bb377bf843f0a3ca2f4eb2ef69c67985Jiri Slaby	unsigned int	pagenr;
1036b2c9457bb377bf843f0a3ca2f4eb2ef69c67985Jiri Slaby	unsigned int	nrports;
1041da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	int		iobase;
1051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	void		*uartp;
1061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	void		(*isr)(struct stlpanel *panelp, unsigned int iobase);
1071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	unsigned int	hwid;
1081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	unsigned int	ackmask;
109ca7ed0f22f4876986b2eb1fbd80ba78e07fd69d5Jiri Slaby	struct stlport	*ports[STL_PORTSPERPANEL];
110ca7ed0f22f4876986b2eb1fbd80ba78e07fd69d5Jiri Slaby};
1111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
112ca7ed0f22f4876986b2eb1fbd80ba78e07fd69d5Jiri Slabystruct stlbrd {
1131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	unsigned long	magic;
1146b2c9457bb377bf843f0a3ca2f4eb2ef69c67985Jiri Slaby	unsigned int	brdnr;
1156b2c9457bb377bf843f0a3ca2f4eb2ef69c67985Jiri Slaby	unsigned int	brdtype;
1166b2c9457bb377bf843f0a3ca2f4eb2ef69c67985Jiri Slaby	unsigned int	state;
1176b2c9457bb377bf843f0a3ca2f4eb2ef69c67985Jiri Slaby	unsigned int	nrpanels;
1186b2c9457bb377bf843f0a3ca2f4eb2ef69c67985Jiri Slaby	unsigned int	nrports;
1196b2c9457bb377bf843f0a3ca2f4eb2ef69c67985Jiri Slaby	unsigned int	nrbnks;
1201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	int		irq;
1211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	int		irqtype;
1221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	int		(*isr)(struct stlbrd *brdp);
1231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	unsigned int	ioaddr1;
1241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	unsigned int	ioaddr2;
1251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	unsigned int	iosize1;
1261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	unsigned int	iosize2;
1271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	unsigned int	iostatus;
1281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	unsigned int	ioctrl;
1291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	unsigned int	ioctrlval;
1301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	unsigned int	hwid;
1311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	unsigned long	clk;
1321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	unsigned int	bnkpageaddr[STL_MAXBANKS];
1331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	unsigned int	bnkstataddr[STL_MAXBANKS];
134ca7ed0f22f4876986b2eb1fbd80ba78e07fd69d5Jiri Slaby	struct stlpanel	*bnk2panel[STL_MAXBANKS];
135ca7ed0f22f4876986b2eb1fbd80ba78e07fd69d5Jiri Slaby	struct stlpanel	*panels[STL_MAXPANELS];
136ca7ed0f22f4876986b2eb1fbd80ba78e07fd69d5Jiri Slaby};
1371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/*
1401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds *	Define MAGIC numbers used for above structures.
1411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */
1421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define	STL_PORTMAGIC	0x5a7182c9
1431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define	STL_PANELMAGIC	0x7ef621a1
1441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define	STL_BOARDMAGIC	0xa2267f52
1451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/*****************************************************************************/
1471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif
148