gdsys_fpga.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2010
  4. * Dirk Eibach, Guntermann & Drunck GmbH, dirk.eibach@gdsys.cc
  5. */
  6. #ifndef __GDSYS_FPGA_H
  7. #define __GDSYS_FPGA_H
  8. #ifdef CONFIG_GDSYS_LEGACY_DRIVERS
  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. #endif
  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. #endif