Linux Audio

Check our new training course

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