gdsys_fpga.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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 write_mailbox;
  37. u16 write_mailbox_ext;
  38. u16 read_mailbox;
  39. u16 read_mailbox_ext;
  40. };
  41. struct ihs_osd {
  42. u16 version;
  43. u16 features;
  44. u16 control;
  45. u16 xy_size;
  46. u16 xy_scale;
  47. u16 x_pos;
  48. u16 y_pos;
  49. };
  50. #ifdef CONFIG_NEO
  51. struct ihs_fpga {
  52. u16 reflection_low; /* 0x0000 */
  53. u16 versions; /* 0x0002 */
  54. u16 fpga_features; /* 0x0004 */
  55. u16 fpga_version; /* 0x0006 */
  56. u16 reserved_0[8187]; /* 0x0008 */
  57. u16 reflection_high; /* 0x3ffe */
  58. };
  59. #endif
  60. #ifdef CONFIG_IO
  61. struct ihs_fpga {
  62. u16 reflection_low; /* 0x0000 */
  63. u16 versions; /* 0x0002 */
  64. u16 fpga_features; /* 0x0004 */
  65. u16 fpga_version; /* 0x0006 */
  66. u16 reserved_0[5]; /* 0x0008 */
  67. u16 quad_serdes_reset; /* 0x0012 */
  68. u16 reserved_1[8181]; /* 0x0014 */
  69. u16 reflection_high; /* 0x3ffe */
  70. };
  71. #endif
  72. #ifdef CONFIG_IO64
  73. struct ihs_fpga_channel {
  74. u16 status_int;
  75. u16 config_int;
  76. u16 switch_connect_config;
  77. u16 tx_destination;
  78. };
  79. struct ihs_fpga_hicb {
  80. u16 status_int;
  81. u16 config_int;
  82. };
  83. struct ihs_fpga {
  84. u16 reflection_low; /* 0x0000 */
  85. u16 versions; /* 0x0002 */
  86. u16 fpga_features; /* 0x0004 */
  87. u16 fpga_version; /* 0x0006 */
  88. u16 reserved_0[5]; /* 0x0008 */
  89. u16 quad_serdes_reset; /* 0x0012 */
  90. u16 reserved_1[502]; /* 0x0014 */
  91. struct ihs_fpga_channel ch[32]; /* 0x0400 */
  92. struct ihs_fpga_channel hicb_ch[32]; /* 0x0500 */
  93. u16 reserved_2[7487]; /* 0x0580 */
  94. u16 reflection_high; /* 0x3ffe */
  95. };
  96. #endif
  97. #ifdef CONFIG_IOCON
  98. struct ihs_fpga {
  99. u16 reflection_low; /* 0x0000 */
  100. u16 versions; /* 0x0002 */
  101. u16 fpga_version; /* 0x0004 */
  102. u16 fpga_features; /* 0x0006 */
  103. u16 reserved_0[6]; /* 0x0008 */
  104. struct ihs_gpio gpio; /* 0x0014 */
  105. u16 mpc3w_control; /* 0x001a */
  106. u16 reserved_1[19]; /* 0x001c */
  107. u16 videocontrol; /* 0x0042 */
  108. u16 reserved_2[14]; /* 0x0044 */
  109. u16 mc_int; /* 0x0060 */
  110. u16 mc_int_en; /* 0x0062 */
  111. u16 mc_status; /* 0x0064 */
  112. u16 mc_control; /* 0x0066 */
  113. u16 mc_tx_data; /* 0x0068 */
  114. u16 mc_tx_address; /* 0x006a */
  115. u16 mc_tx_cmd; /* 0x006c */
  116. u16 mc_res; /* 0x006e */
  117. u16 mc_rx_cmd_status; /* 0x0070 */
  118. u16 mc_rx_data; /* 0x0072 */
  119. u16 reserved_3[69]; /* 0x0074 */
  120. u16 reflection_high; /* 0x00fe */
  121. struct ihs_osd osd; /* 0x0100 */
  122. u16 reserved_4[889]; /* 0x010e */
  123. u16 videomem[31736]; /* 0x0800 */
  124. };
  125. #endif
  126. #ifdef CONFIG_DLVISION_10G
  127. struct ihs_fpga {
  128. u16 reflection_low; /* 0x0000 */
  129. u16 versions; /* 0x0002 */
  130. u16 fpga_version; /* 0x0004 */
  131. u16 fpga_features; /* 0x0006 */
  132. u16 reserved_0[10]; /* 0x0008 */
  133. u16 extended_interrupt; /* 0x001c */
  134. u16 reserved_1[9]; /* 0x001e */
  135. struct ihs_i2c i2c; /* 0x0030 */
  136. u16 reserved_2[16]; /* 0x0038 */
  137. u16 mpc3w_control; /* 0x0058 */
  138. u16 reserved_3[34]; /* 0x005a */
  139. u16 videocontrol; /* 0x009e */
  140. u16 reserved_4[176]; /* 0x00a0 */
  141. struct ihs_osd osd; /* 0x0200 */
  142. u16 reserved_5[761]; /* 0x020e */
  143. u16 videomem[31736]; /* 0x0800 */
  144. };
  145. #endif
  146. #endif