lasat.h 7.5 KB

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