1 |
1276 |
phoenix |
/*
|
2 |
|
|
* lasat.h
|
3 |
|
|
*
|
4 |
|
|
* Thomas Horsten <thh@lasat.com>
|
5 |
|
|
* Copyright (C) 2000 LASAT Networks A/S.
|
6 |
|
|
*
|
7 |
|
|
* ########################################################################
|
8 |
|
|
*
|
9 |
|
|
* This program is free software; you can distribute it and/or modify it
|
10 |
|
|
* under the terms of the GNU General Public License (Version 2) as
|
11 |
|
|
* published by the Free Software Foundation.
|
12 |
|
|
*
|
13 |
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
14 |
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
15 |
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
16 |
|
|
* for more details.
|
17 |
|
|
*
|
18 |
|
|
* You should have received a copy of the GNU General Public License along
|
19 |
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
20 |
|
|
* 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
|
21 |
|
|
*
|
22 |
|
|
* ########################################################################
|
23 |
|
|
*
|
24 |
|
|
* Configuration for LASAT boards, loads the appropriate include files.
|
25 |
|
|
*
|
26 |
|
|
*/
|
27 |
|
|
#ifndef _LASAT_H
|
28 |
|
|
#define _LASAT_H
|
29 |
|
|
|
30 |
|
|
#ifndef _LANGUAGE_ASSEMBLY
|
31 |
|
|
|
32 |
|
|
extern struct lasat_misc {
|
33 |
|
|
volatile u32 *reset_reg;
|
34 |
|
|
volatile u32 *flash_wp_reg;
|
35 |
|
|
u32 flash_wp_bit;
|
36 |
|
|
} *lasat_misc;
|
37 |
|
|
|
38 |
|
|
enum lasat_mtdparts {
|
39 |
|
|
LASAT_MTD_BOOTLOADER,
|
40 |
|
|
LASAT_MTD_SERVICE,
|
41 |
|
|
LASAT_MTD_NORMAL,
|
42 |
|
|
LASAT_MTD_CONFIG,
|
43 |
|
|
LASAT_MTD_FS,
|
44 |
|
|
LASAT_MTD_LAST
|
45 |
|
|
};
|
46 |
|
|
|
47 |
|
|
/*
|
48 |
|
|
* The format of the data record in the EEPROM.
|
49 |
|
|
* See Documentation/LASAT/eeprom.txt for a detailed description
|
50 |
|
|
* of the fields in this struct, and the LASAT Hardware Configuration
|
51 |
|
|
* field specification for a detailed description of the config
|
52 |
|
|
* field.
|
53 |
|
|
*/
|
54 |
|
|
#include <linux/types.h>
|
55 |
|
|
|
56 |
|
|
#define LASAT_EEPROM_VERSION 7
|
57 |
|
|
struct lasat_eeprom_struct {
|
58 |
|
|
unsigned int version;
|
59 |
|
|
unsigned int cfg[3];
|
60 |
|
|
unsigned char hwaddr[6];
|
61 |
|
|
unsigned char print_partno[12];
|
62 |
|
|
unsigned char term0;
|
63 |
|
|
unsigned char print_serial[14];
|
64 |
|
|
unsigned char term1;
|
65 |
|
|
unsigned char prod_partno[12];
|
66 |
|
|
unsigned char term2;
|
67 |
|
|
unsigned char prod_serial[14];
|
68 |
|
|
unsigned char term3;
|
69 |
|
|
unsigned char passwd_hash[16];
|
70 |
|
|
unsigned char pwdnull;
|
71 |
|
|
unsigned char vendid;
|
72 |
|
|
unsigned char ts_ref;
|
73 |
|
|
unsigned char ts_signoff;
|
74 |
|
|
unsigned char reserved[11];
|
75 |
|
|
unsigned char debugaccess;
|
76 |
|
|
unsigned short prid;
|
77 |
|
|
unsigned int serviceflag;
|
78 |
|
|
unsigned int ipaddr;
|
79 |
|
|
unsigned int netmask;
|
80 |
|
|
unsigned int crc32;
|
81 |
|
|
};
|
82 |
|
|
|
83 |
|
|
struct lasat_eeprom_struct_pre7 {
|
84 |
|
|
unsigned int version;
|
85 |
|
|
unsigned int flags[3];
|
86 |
|
|
unsigned char hwaddr0[6];
|
87 |
|
|
unsigned char hwaddr1[6];
|
88 |
|
|
unsigned char print_partno[9];
|
89 |
|
|
unsigned char term0;
|
90 |
|
|
unsigned char print_serial[14];
|
91 |
|
|
unsigned char term1;
|
92 |
|
|
unsigned char prod_partno[9];
|
93 |
|
|
unsigned char term2;
|
94 |
|
|
unsigned char prod_serial[14];
|
95 |
|
|
unsigned char term3;
|
96 |
|
|
unsigned char passwd_hash[24];
|
97 |
|
|
unsigned char pwdnull;
|
98 |
|
|
unsigned char vendor;
|
99 |
|
|
unsigned char ts_ref;
|
100 |
|
|
unsigned char ts_signoff;
|
101 |
|
|
unsigned char reserved[6];
|
102 |
|
|
unsigned int writecount;
|
103 |
|
|
unsigned int ipaddr;
|
104 |
|
|
unsigned int netmask;
|
105 |
|
|
unsigned int crc32;
|
106 |
|
|
};
|
107 |
|
|
|
108 |
|
|
/* Configuration descriptor encoding - see the doc for details */
|
109 |
|
|
|
110 |
|
|
#define LASAT_W0_DSCTYPE(v) ( ( (v) ) & 0xf )
|
111 |
|
|
#define LASAT_W0_BMID(v) ( ( (v) >> 0x04 ) & 0xf )
|
112 |
|
|
#define LASAT_W0_CPUTYPE(v) ( ( (v) >> 0x08 ) & 0xf )
|
113 |
|
|
#define LASAT_W0_BUSSPEED(v) ( ( (v) >> 0x0c ) & 0xf )
|
114 |
|
|
#define LASAT_W0_CPUCLK(v) ( ( (v) >> 0x10 ) & 0xf )
|
115 |
|
|
#define LASAT_W0_SDRAMBANKSZ(v) ( ( (v) >> 0x14 ) & 0xf )
|
116 |
|
|
#define LASAT_W0_SDRAMBANKS(v) ( ( (v) >> 0x18 ) & 0xf )
|
117 |
|
|
#define LASAT_W0_L2CACHE(v) ( ( (v) >> 0x1c ) & 0xf )
|
118 |
|
|
|
119 |
|
|
#define LASAT_W1_EDHAC(v) ( ( (v) ) & 0xf )
|
120 |
|
|
#define LASAT_W1_HIFN(v) ( ( (v) >> 0x04 ) & 0x1 )
|
121 |
|
|
#define LASAT_W1_ISDN(v) ( ( (v) >> 0x05 ) & 0x1 )
|
122 |
|
|
#define LASAT_W1_IDE(v) ( ( (v) >> 0x06 ) & 0x1 )
|
123 |
|
|
#define LASAT_W1_HDLC(v) ( ( (v) >> 0x07 ) & 0x1 )
|
124 |
|
|
#define LASAT_W1_USVERSION(v) ( ( (v) >> 0x08 ) & 0x1 )
|
125 |
|
|
#define LASAT_W1_4MACS(v) ( ( (v) >> 0x09 ) & 0x1 )
|
126 |
|
|
#define LASAT_W1_EXTSERIAL(v) ( ( (v) >> 0x0a ) & 0x1 )
|
127 |
|
|
#define LASAT_W1_FLASHSIZE(v) ( ( (v) >> 0x0c ) & 0xf )
|
128 |
|
|
#define LASAT_W1_PCISLOTS(v) ( ( (v) >> 0x10 ) & 0xf )
|
129 |
|
|
#define LASAT_W1_PCI1OPT(v) ( ( (v) >> 0x14 ) & 0xf )
|
130 |
|
|
#define LASAT_W1_PCI2OPT(v) ( ( (v) >> 0x18 ) & 0xf )
|
131 |
|
|
#define LASAT_W1_PCI3OPT(v) ( ( (v) >> 0x1c ) & 0xf )
|
132 |
|
|
|
133 |
|
|
/* Routines specific to LASAT boards */
|
134 |
|
|
|
135 |
|
|
#define LASAT_BMID_MASQUERADE2 0
|
136 |
|
|
#define LASAT_BMID_MASQUERADEPRO 1
|
137 |
|
|
#define LASAT_BMID_SAFEPIPE25 2
|
138 |
|
|
#define LASAT_BMID_SAFEPIPE50 3
|
139 |
|
|
#define LASAT_BMID_SAFEPIPE100 4
|
140 |
|
|
#define LASAT_BMID_SAFEPIPE5000 5
|
141 |
|
|
#define LASAT_BMID_SAFEPIPE7000 6
|
142 |
|
|
#define LASAT_BMID_SAFEPIPE1000 7
|
143 |
|
|
//#define LASAT_BMID_SAFEPIPE30 7
|
144 |
|
|
//#define LASAT_BMID_SAFEPIPE5100 8
|
145 |
|
|
//#define LASAT_BMID_SAFEPIPE7100 9
|
146 |
|
|
#define LASAT_BMID_UNKNOWN 0xf
|
147 |
|
|
#define LASAT_MAX_BMID_NAMES 9 // no larger than 15!
|
148 |
|
|
|
149 |
|
|
#define LASAT_HAS_EDHAC ( 1 << 0 )
|
150 |
|
|
#define LASAT_EDHAC_FAST ( 1 << 1 )
|
151 |
|
|
#define LASAT_HAS_EADI ( 1 << 2 )
|
152 |
|
|
#define LASAT_HAS_HIFN ( 1 << 3 )
|
153 |
|
|
#define LASAT_HAS_ISDN ( 1 << 4 )
|
154 |
|
|
#define LASAT_HAS_LEASEDLINE_IF ( 1 << 5 )
|
155 |
|
|
#define LASAT_HAS_HDC ( 1 << 6 )
|
156 |
|
|
|
157 |
|
|
#define LASAT_PRID_MASQUERADE2 0
|
158 |
|
|
#define LASAT_PRID_MASQUERADEPRO 1
|
159 |
|
|
#define LASAT_PRID_SAFEPIPE25 2
|
160 |
|
|
#define LASAT_PRID_SAFEPIPE50 3
|
161 |
|
|
#define LASAT_PRID_SAFEPIPE100 4
|
162 |
|
|
#define LASAT_PRID_SAFEPIPE5000 5
|
163 |
|
|
#define LASAT_PRID_SAFEPIPE7000 6
|
164 |
|
|
#define LASAT_PRID_SAFEPIPE30 7
|
165 |
|
|
#define LASAT_PRID_SAFEPIPE5100 8
|
166 |
|
|
#define LASAT_PRID_SAFEPIPE7100 9
|
167 |
|
|
|
168 |
|
|
#define LASAT_PRID_SAFEPIPE1110 10
|
169 |
|
|
#define LASAT_PRID_SAFEPIPE3020 11
|
170 |
|
|
#define LASAT_PRID_SAFEPIPE3030 12
|
171 |
|
|
#define LASAT_PRID_SAFEPIPE5020 13
|
172 |
|
|
#define LASAT_PRID_SAFEPIPE5030 14
|
173 |
|
|
#define LASAT_PRID_SAFEPIPE1120 15
|
174 |
|
|
#define LASAT_PRID_SAFEPIPE1130 16
|
175 |
|
|
#define LASAT_PRID_SAFEPIPE6010 17
|
176 |
|
|
#define LASAT_PRID_SAFEPIPE6110 18
|
177 |
|
|
#define LASAT_PRID_SAFEPIPE6210 19
|
178 |
|
|
#define LASAT_PRID_SAFEPIPE1020 20
|
179 |
|
|
#define LASAT_PRID_SAFEPIPE1040 21
|
180 |
|
|
#define LASAT_PRID_SAFEPIPE1060 22
|
181 |
|
|
|
182 |
|
|
struct lasat_info {
|
183 |
|
|
unsigned int li_cpu_hz;
|
184 |
|
|
unsigned int li_bus_hz;
|
185 |
|
|
unsigned int li_bmid;
|
186 |
|
|
unsigned int li_memsize;
|
187 |
|
|
unsigned int li_flash_size;
|
188 |
|
|
unsigned int li_prid;
|
189 |
|
|
unsigned char li_bmstr[16];
|
190 |
|
|
unsigned char li_namestr[32];
|
191 |
|
|
unsigned char li_typestr[16];
|
192 |
|
|
/* Info on the Flash layout */
|
193 |
|
|
unsigned int li_flash_base;
|
194 |
|
|
unsigned long li_flashpart_base[LASAT_MTD_LAST];
|
195 |
|
|
unsigned long li_flashpart_size[LASAT_MTD_LAST];
|
196 |
|
|
struct lasat_eeprom_struct li_eeprom_info;
|
197 |
|
|
unsigned int li_eeprom_upgrade_version;
|
198 |
|
|
unsigned int li_debugaccess;
|
199 |
|
|
};
|
200 |
|
|
|
201 |
|
|
extern struct lasat_info lasat_board_info;
|
202 |
|
|
|
203 |
|
|
static inline unsigned long lasat_flash_partition_start(int partno)
|
204 |
|
|
{
|
205 |
|
|
if (partno < 0 || partno >= LASAT_MTD_LAST)
|
206 |
|
|
return 0;
|
207 |
|
|
|
208 |
|
|
return lasat_board_info.li_flashpart_base[partno];
|
209 |
|
|
}
|
210 |
|
|
|
211 |
|
|
static inline unsigned long lasat_flash_partition_size(int partno)
|
212 |
|
|
{
|
213 |
|
|
if (partno < 0 || partno >= LASAT_MTD_LAST)
|
214 |
|
|
return 0;
|
215 |
|
|
|
216 |
|
|
return lasat_board_info.li_flashpart_size[partno];
|
217 |
|
|
}
|
218 |
|
|
|
219 |
|
|
/* Called from setup() to initialize the global board_info struct */
|
220 |
|
|
extern int lasat_init_board_info(void);
|
221 |
|
|
|
222 |
|
|
/* Write the modified EEPROM info struct */
|
223 |
|
|
extern void lasat_write_eeprom_info(void);
|
224 |
|
|
|
225 |
|
|
#define N_MACHTYPES 2
|
226 |
|
|
/* for calibration of delays */
|
227 |
|
|
|
228 |
|
|
#include <asm/delay.h>
|
229 |
|
|
#include <asm/bootinfo.h>
|
230 |
|
|
/* calculating with the slowest board with 100 MHz clock */
|
231 |
|
|
#define LASAT_100_DIVIDER 20
|
232 |
|
|
/* All 200's run at 250 MHz clock */
|
233 |
|
|
#define LASAT_200_DIVIDER 8
|
234 |
|
|
|
235 |
|
|
extern unsigned int lasat_ndelay_divider;
|
236 |
|
|
|
237 |
|
|
static inline void lasat_ndelay(unsigned int ns)
|
238 |
|
|
{
|
239 |
|
|
__delay(ns / lasat_ndelay_divider);
|
240 |
|
|
}
|
241 |
|
|
|
242 |
|
|
extern void (* prom_printf)(const char *fmt, ...);
|
243 |
|
|
|
244 |
|
|
#endif /* !defined (_LANGUAGE_ASSEMBLY) */
|
245 |
|
|
|
246 |
|
|
#define LASAT_SERVICEMODE_MAGIC_1 0xdeadbeef
|
247 |
|
|
#define LASAT_SERVICEMODE_MAGIC_2 0xfedeabba
|
248 |
|
|
|
249 |
|
|
/* Lasat 200 boards */
|
250 |
|
|
#define Vrc5074_PHYS_BASE 0x1fa00000
|
251 |
|
|
#define Vrc5074_BASE (KSEG1ADDR(Vrc5074_PHYS_BASE))
|
252 |
|
|
#define PCI_WINDOW1 0x1a000000
|
253 |
|
|
|
254 |
|
|
#endif /* _LASAT_H */
|