gdsys_fpga.h 3.7 KB

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