gdsys_fpga.h 7.2 KB

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