Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /*****************************************************************************/ |
| 2 | |
| 3 | /* |
| 4 | * stallion.h -- stallion multiport serial driver. |
| 5 | * |
| 6 | * Copyright (C) 1996-1998 Stallion Technologies |
| 7 | * Copyright (C) 1994-1996 Greg Ungerer. |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by |
| 11 | * the Free Software Foundation; either version 2 of the License, or |
| 12 | * (at your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 22 | */ |
| 23 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | /*****************************************************************************/ |
| 25 | #ifndef _STALLION_H |
| 26 | #define _STALLION_H |
| 27 | /*****************************************************************************/ |
| 28 | |
| 29 | /* |
| 30 | * Define important driver constants here. |
| 31 | */ |
| 32 | #define STL_MAXBRDS 4 |
| 33 | #define STL_MAXPANELS 4 |
| 34 | #define STL_MAXBANKS 8 |
| 35 | #define STL_PORTSPERPANEL 16 |
| 36 | #define STL_MAXPORTS 64 |
| 37 | #define STL_MAXDEVS (STL_MAXBRDS * STL_MAXPORTS) |
| 38 | |
| 39 | |
| 40 | /* |
| 41 | * Define a set of structures to hold all the board/panel/port info |
| 42 | * for our ports. These will be dynamically allocated as required. |
| 43 | */ |
| 44 | |
| 45 | /* |
| 46 | * Define a ring queue structure for each port. This will hold the |
| 47 | * TX data waiting to be output. Characters are fed into this buffer |
| 48 | * from the line discipline (or even direct from user space!) and |
| 49 | * then fed into the UARTs during interrupts. Will use a classic ring |
| 50 | * queue here for this. The good thing about this type of ring queue |
| 51 | * is that the head and tail pointers can be updated without interrupt |
| 52 | * protection - since "write" code only needs to change the head, and |
| 53 | * interrupt code only needs to change the tail. |
| 54 | */ |
Jiri Slaby | ca7ed0f | 2006-12-08 02:38:39 -0800 | [diff] [blame] | 55 | struct stlrq { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | char *buf; |
| 57 | char *head; |
| 58 | char *tail; |
Jiri Slaby | ca7ed0f | 2006-12-08 02:38:39 -0800 | [diff] [blame] | 59 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | |
| 61 | /* |
| 62 | * Port, panel and board structures to hold status info about each. |
| 63 | * The board structure contains pointers to structures for each panel |
| 64 | * connected to it, and in turn each panel structure contains pointers |
| 65 | * for each port structure for each port on that panel. Note that |
| 66 | * the port structure also contains the board and panel number that it |
| 67 | * is associated with, this makes it (fairly) easy to get back to the |
| 68 | * board/panel info for a port. |
| 69 | */ |
Jiri Slaby | ca7ed0f | 2006-12-08 02:38:39 -0800 | [diff] [blame] | 70 | struct stlport { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | unsigned long magic; |
Jiri Slaby | 6b2c945 | 2006-12-08 02:39:15 -0800 | [diff] [blame] | 72 | unsigned int portnr; |
| 73 | unsigned int panelnr; |
| 74 | unsigned int brdnr; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | int ioaddr; |
| 76 | int uartaddr; |
Jiri Slaby | 6b2c945 | 2006-12-08 02:39:15 -0800 | [diff] [blame] | 77 | unsigned int pagenr; |
Al Viro | 64b3361 | 2007-10-14 19:35:20 +0100 | [diff] [blame] | 78 | unsigned long istate; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | int flags; |
| 80 | int baud_base; |
| 81 | int custom_divisor; |
| 82 | int close_delay; |
| 83 | int closing_wait; |
| 84 | int refcount; |
| 85 | int openwaitcnt; |
| 86 | int brklen; |
| 87 | unsigned int sigs; |
| 88 | unsigned int rxignoremsk; |
| 89 | unsigned int rxmarkmsk; |
| 90 | unsigned int imr; |
| 91 | unsigned int crenable; |
| 92 | unsigned long clk; |
| 93 | unsigned long hwid; |
| 94 | void *uartp; |
| 95 | struct tty_struct *tty; |
| 96 | wait_queue_head_t open_wait; |
| 97 | wait_queue_head_t close_wait; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | comstats_t stats; |
Jiri Slaby | ca7ed0f | 2006-12-08 02:38:39 -0800 | [diff] [blame] | 99 | struct stlrq tx; |
| 100 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | |
Jiri Slaby | ca7ed0f | 2006-12-08 02:38:39 -0800 | [diff] [blame] | 102 | struct stlpanel { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | unsigned long magic; |
Jiri Slaby | 6b2c945 | 2006-12-08 02:39:15 -0800 | [diff] [blame] | 104 | unsigned int panelnr; |
| 105 | unsigned int brdnr; |
| 106 | unsigned int pagenr; |
| 107 | unsigned int nrports; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 108 | int iobase; |
| 109 | void *uartp; |
| 110 | void (*isr)(struct stlpanel *panelp, unsigned int iobase); |
| 111 | unsigned int hwid; |
| 112 | unsigned int ackmask; |
Jiri Slaby | ca7ed0f | 2006-12-08 02:38:39 -0800 | [diff] [blame] | 113 | struct stlport *ports[STL_PORTSPERPANEL]; |
| 114 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 | |
Jiri Slaby | ca7ed0f | 2006-12-08 02:38:39 -0800 | [diff] [blame] | 116 | struct stlbrd { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 117 | unsigned long magic; |
Jiri Slaby | 6b2c945 | 2006-12-08 02:39:15 -0800 | [diff] [blame] | 118 | unsigned int brdnr; |
| 119 | unsigned int brdtype; |
| 120 | unsigned int state; |
| 121 | unsigned int nrpanels; |
| 122 | unsigned int nrports; |
| 123 | unsigned int nrbnks; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 124 | int irq; |
| 125 | int irqtype; |
| 126 | int (*isr)(struct stlbrd *brdp); |
| 127 | unsigned int ioaddr1; |
| 128 | unsigned int ioaddr2; |
| 129 | unsigned int iosize1; |
| 130 | unsigned int iosize2; |
| 131 | unsigned int iostatus; |
| 132 | unsigned int ioctrl; |
| 133 | unsigned int ioctrlval; |
| 134 | unsigned int hwid; |
| 135 | unsigned long clk; |
| 136 | unsigned int bnkpageaddr[STL_MAXBANKS]; |
| 137 | unsigned int bnkstataddr[STL_MAXBANKS]; |
Jiri Slaby | ca7ed0f | 2006-12-08 02:38:39 -0800 | [diff] [blame] | 138 | struct stlpanel *bnk2panel[STL_MAXBANKS]; |
| 139 | struct stlpanel *panels[STL_MAXPANELS]; |
| 140 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 141 | |
| 142 | |
| 143 | /* |
| 144 | * Define MAGIC numbers used for above structures. |
| 145 | */ |
| 146 | #define STL_PORTMAGIC 0x5a7182c9 |
| 147 | #define STL_PANELMAGIC 0x7ef621a1 |
| 148 | #define STL_BOARDMAGIC 0xa2267f52 |
| 149 | |
| 150 | /*****************************************************************************/ |
| 151 | #endif |