/arch/mips/include/asm/lasat/lasat.h

http://github.com/mirrors/linux · C Header · 245 lines · 184 code · 34 blank · 27 comment · 5 complexity · 4402cdcafdcb509c3323de2317b51a5f MD5 · raw file

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