gdsys_fpga.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. /*
  2. * (C) Copyright 2010
  3. * Dirk Eibach, Guntermann & Drunck GmbH, eibach@gdsys.de
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #ifndef __GDSYS_FPGA_H
  8. #define __GDSYS_FPGA_H
  9. int init_func_fpga(void);
  10. enum {
  11. FPGA_STATE_DONE_FAILED = 1 << 0,
  12. FPGA_STATE_REFLECTION_FAILED = 1 << 1,
  13. FPGA_STATE_PLATFORM = 1 << 2,
  14. };
  15. int get_fpga_state(unsigned dev);
  16. void print_fpga_state(unsigned dev);
  17. int fpga_set_reg(u32 fpga, u16 *reg, off_t regoff, u16 data);
  18. int fpga_get_reg(u32 fpga, u16 *reg, off_t regoff, u16 *data);
  19. extern struct ihs_fpga *fpga_ptr[];
  20. #define FPGA_SET_REG(ix, fld, val) \
  21. fpga_set_reg((ix), \
  22. &fpga_ptr[ix]->fld, \
  23. offsetof(struct ihs_fpga, fld), \
  24. val)
  25. #define FPGA_GET_REG(ix, fld, val) \
  26. fpga_get_reg((ix), \
  27. &fpga_ptr[ix]->fld, \
  28. offsetof(struct ihs_fpga, fld), \
  29. val)
  30. struct ihs_gpio {
  31. u16 read;
  32. u16 clear;
  33. u16 set;
  34. };
  35. struct ihs_i2c {
  36. u16 interrupt_status;
  37. u16 interrupt_enable;
  38. u16 write_mailbox_ext;
  39. u16 write_mailbox;
  40. u16 read_mailbox_ext;
  41. u16 read_mailbox;
  42. };
  43. struct ihs_osd {
  44. u16 version;
  45. u16 features;
  46. u16 control;
  47. u16 xy_size;
  48. u16 xy_scale;
  49. u16 x_pos;
  50. u16 y_pos;
  51. };
  52. struct ihs_mdio {
  53. u16 control;
  54. u16 address_data;
  55. u16 rx_data;
  56. };
  57. struct ihs_io_ep {
  58. u16 transmit_data;
  59. u16 rx_tx_control;
  60. u16 receive_data;
  61. u16 rx_tx_status;
  62. u16 reserved;
  63. u16 device_address;
  64. u16 target_address;
  65. };
  66. #ifdef CONFIG_NEO
  67. struct ihs_fpga {
  68. u16 reflection_low; /* 0x0000 */
  69. u16 versions; /* 0x0002 */
  70. u16 fpga_features; /* 0x0004 */
  71. u16 fpga_version; /* 0x0006 */
  72. u16 reserved_0[8187]; /* 0x0008 */
  73. u16 reflection_high; /* 0x3ffe */
  74. };
  75. #endif
  76. #ifdef CONFIG_IO
  77. struct ihs_fpga {
  78. u16 reflection_low; /* 0x0000 */
  79. u16 versions; /* 0x0002 */
  80. u16 fpga_features; /* 0x0004 */
  81. u16 fpga_version; /* 0x0006 */
  82. u16 reserved_0[5]; /* 0x0008 */
  83. u16 quad_serdes_reset; /* 0x0012 */
  84. u16 reserved_1[8181]; /* 0x0014 */
  85. u16 reflection_high; /* 0x3ffe */
  86. };
  87. #endif
  88. #ifdef CONFIG_IO64
  89. struct ihs_fpga_channel {
  90. u16 status_int;
  91. u16 config_int;
  92. u16 switch_connect_config;
  93. u16 tx_destination;
  94. };
  95. struct ihs_fpga_hicb {
  96. u16 status_int;
  97. u16 config_int;
  98. };
  99. struct ihs_fpga {
  100. u16 reflection_low; /* 0x0000 */
  101. u16 versions; /* 0x0002 */
  102. u16 fpga_features; /* 0x0004 */
  103. u16 fpga_version; /* 0x0006 */
  104. u16 reserved_0[5]; /* 0x0008 */
  105. u16 quad_serdes_reset; /* 0x0012 */
  106. u16 reserved_1[502]; /* 0x0014 */
  107. struct ihs_fpga_channel ch[32]; /* 0x0400 */
  108. struct ihs_fpga_channel hicb_ch[32]; /* 0x0500 */
  109. u16 reserved_2[7487]; /* 0x0580 */
  110. u16 reflection_high; /* 0x3ffe */
  111. };
  112. #endif
  113. #ifdef CONFIG_IOCON
  114. struct ihs_fpga {
  115. u16 reflection_low; /* 0x0000 */
  116. u16 versions; /* 0x0002 */
  117. u16 fpga_version; /* 0x0004 */
  118. u16 fpga_features; /* 0x0006 */
  119. u16 reserved_0[1]; /* 0x0008 */
  120. u16 top_interrupt; /* 0x000a */
  121. u16 reserved_1[4]; /* 0x000c */
  122. struct ihs_gpio gpio; /* 0x0014 */
  123. u16 mpc3w_control; /* 0x001a */
  124. u16 reserved_2[2]; /* 0x001c */
  125. struct ihs_io_ep ep; /* 0x0020 */
  126. u16 reserved_3[9]; /* 0x002e */
  127. struct ihs_i2c i2c0; /* 0x0040 */
  128. u16 reserved_4[10]; /* 0x004c */
  129. u16 mc_int; /* 0x0060 */
  130. u16 mc_int_en; /* 0x0062 */
  131. u16 mc_status; /* 0x0064 */
  132. u16 mc_control; /* 0x0066 */
  133. u16 mc_tx_data; /* 0x0068 */
  134. u16 mc_tx_address; /* 0x006a */
  135. u16 mc_tx_cmd; /* 0x006c */
  136. u16 mc_res; /* 0x006e */
  137. u16 mc_rx_cmd_status; /* 0x0070 */
  138. u16 mc_rx_data; /* 0x0072 */
  139. u16 reserved_5[69]; /* 0x0074 */
  140. u16 reflection_high; /* 0x00fe */
  141. struct ihs_osd osd0; /* 0x0100 */
  142. u16 reserved_6[889]; /* 0x010e */
  143. u16 videomem0[2048]; /* 0x0800 */
  144. };
  145. #endif
  146. #if defined(CONFIG_HRCON) || defined(CONFIG_STRIDER_CON_DP)
  147. struct ihs_fpga {
  148. u16 reflection_low; /* 0x0000 */
  149. u16 versions; /* 0x0002 */
  150. u16 fpga_version; /* 0x0004 */
  151. u16 fpga_features; /* 0x0006 */
  152. u16 reserved_0[1]; /* 0x0008 */
  153. u16 top_interrupt; /* 0x000a */
  154. u16 reserved_1[2]; /* 0x000c */
  155. u16 control; /* 0x0010 */
  156. u16 extended_control; /* 0x0012 */
  157. struct ihs_gpio gpio; /* 0x0014 */
  158. u16 mpc3w_control; /* 0x001a */
  159. u16 reserved_2[2]; /* 0x001c */
  160. struct ihs_io_ep ep; /* 0x0020 */
  161. u16 reserved_3[9]; /* 0x002e */
  162. struct ihs_i2c i2c0; /* 0x0040 */
  163. u16 reserved_4[10]; /* 0x004c */
  164. u16 mc_int; /* 0x0060 */
  165. u16 mc_int_en; /* 0x0062 */
  166. u16 mc_status; /* 0x0064 */
  167. u16 mc_control; /* 0x0066 */
  168. u16 mc_tx_data; /* 0x0068 */
  169. u16 mc_tx_address; /* 0x006a */
  170. u16 mc_tx_cmd; /* 0x006c */
  171. u16 mc_res; /* 0x006e */
  172. u16 mc_rx_cmd_status; /* 0x0070 */
  173. u16 mc_rx_data; /* 0x0072 */
  174. u16 reserved_5[69]; /* 0x0074 */
  175. u16 reflection_high; /* 0x00fe */
  176. struct ihs_osd osd0; /* 0x0100 */
  177. #ifdef CONFIG_SYS_OSD_DH
  178. u16 reserved_6[57]; /* 0x010e */
  179. struct ihs_osd osd1; /* 0x0180 */
  180. u16 reserved_7[9]; /* 0x018e */
  181. struct ihs_i2c i2c1; /* 0x01a0 */
  182. u16 reserved_8[1834]; /* 0x01ac */
  183. u16 videomem0[2048]; /* 0x1000 */
  184. u16 videomem1[2048]; /* 0x2000 */
  185. #else
  186. u16 reserved_6[889]; /* 0x010e */
  187. u16 videomem0[2048]; /* 0x0800 */
  188. #endif
  189. };
  190. #endif
  191. #ifdef CONFIG_STRIDER_CPU
  192. struct ihs_fpga {
  193. u16 reflection_low; /* 0x0000 */
  194. u16 versions; /* 0x0002 */
  195. u16 fpga_version; /* 0x0004 */
  196. u16 fpga_features; /* 0x0006 */
  197. u16 reserved_0[1]; /* 0x0008 */
  198. u16 top_interrupt; /* 0x000a */
  199. u16 reserved_1[3]; /* 0x000c */
  200. u16 extended_control; /* 0x0012 */
  201. struct ihs_gpio gpio; /* 0x0014 */
  202. u16 mpc3w_control; /* 0x001a */
  203. u16 reserved_2[2]; /* 0x001c */
  204. struct ihs_io_ep ep; /* 0x0020 */
  205. u16 reserved_3[9]; /* 0x002e */
  206. u16 mc_int; /* 0x0040 */
  207. u16 mc_int_en; /* 0x0042 */
  208. u16 mc_status; /* 0x0044 */
  209. u16 mc_control; /* 0x0046 */
  210. u16 mc_tx_data; /* 0x0048 */
  211. u16 mc_tx_address; /* 0x004a */
  212. u16 mc_tx_cmd; /* 0x004c */
  213. u16 mc_res; /* 0x004e */
  214. u16 mc_rx_cmd_status; /* 0x0050 */
  215. u16 mc_rx_data; /* 0x0052 */
  216. u16 reserved_4[62]; /* 0x0054 */
  217. struct ihs_i2c i2c0; /* 0x00d0 */
  218. };
  219. #endif
  220. #ifdef CONFIG_STRIDER_CON
  221. struct ihs_fpga {
  222. u16 reflection_low; /* 0x0000 */
  223. u16 versions; /* 0x0002 */
  224. u16 fpga_version; /* 0x0004 */
  225. u16 fpga_features; /* 0x0006 */
  226. u16 reserved_0[1]; /* 0x0008 */
  227. u16 top_interrupt; /* 0x000a */
  228. u16 reserved_1[4]; /* 0x000c */
  229. struct ihs_gpio gpio; /* 0x0014 */
  230. u16 mpc3w_control; /* 0x001a */
  231. u16 reserved_2[2]; /* 0x001c */
  232. struct ihs_io_ep ep; /* 0x0020 */
  233. u16 reserved_3[9]; /* 0x002e */
  234. struct ihs_i2c i2c0; /* 0x0040 */
  235. u16 reserved_4[10]; /* 0x004c */
  236. u16 mc_int; /* 0x0060 */
  237. u16 mc_int_en; /* 0x0062 */
  238. u16 mc_status; /* 0x0064 */
  239. u16 mc_control; /* 0x0066 */
  240. u16 mc_tx_data; /* 0x0068 */
  241. u16 mc_tx_address; /* 0x006a */
  242. u16 mc_tx_cmd; /* 0x006c */
  243. u16 mc_res; /* 0x006e */
  244. u16 mc_rx_cmd_status; /* 0x0070 */
  245. u16 mc_rx_data; /* 0x0072 */
  246. u16 reserved_5[70]; /* 0x0074 */
  247. struct ihs_osd osd0; /* 0x0100 */
  248. u16 reserved_6[889]; /* 0x010e */
  249. u16 videomem0[2048]; /* 0x0800 */
  250. };
  251. #endif
  252. #ifdef CONFIG_DLVISION_10G
  253. struct ihs_fpga {
  254. u16 reflection_low; /* 0x0000 */
  255. u16 versions; /* 0x0002 */
  256. u16 fpga_version; /* 0x0004 */
  257. u16 fpga_features; /* 0x0006 */
  258. u16 reserved_0[10]; /* 0x0008 */
  259. u16 extended_interrupt; /* 0x001c */
  260. u16 reserved_1[29]; /* 0x001e */
  261. u16 mpc3w_control; /* 0x0058 */
  262. u16 reserved_2[3]; /* 0x005a */
  263. struct ihs_i2c i2c0; /* 0x0060 */
  264. u16 reserved_3[2]; /* 0x006c */
  265. struct ihs_i2c i2c1; /* 0x0070 */
  266. u16 reserved_4[194]; /* 0x007c */
  267. struct ihs_osd osd0; /* 0x0200 */
  268. u16 reserved_5[761]; /* 0x020e */
  269. u16 videomem0[2048]; /* 0x0800 */
  270. };
  271. #endif
  272. #endif