common.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2008
  4. * Heiko Schocher, DENX Software Engineering, hs@denx.de.
  5. */
  6. #ifndef __KEYMILE_COMMON_H
  7. #define __KEYMILE_COMMON_H
  8. #define WRG_RESET 0x80
  9. #define H_OPORTS_14 0x40
  10. #define WRG_LED 0x02
  11. #define WRL_BOOT 0x01
  12. #define OPRTL_XBUFENA 0x20
  13. #define H_OPORTS_SCC4_ENA 0x10
  14. #define H_OPORTS_SCC4_FD_ENA 0x04
  15. #define H_OPORTS_FCC1_PW_DWN 0x01
  16. #define PIGGY_PRESENT 0x80
  17. struct km_bec_fpga {
  18. unsigned char id;
  19. unsigned char rev;
  20. unsigned char oprth;
  21. unsigned char oprtl;
  22. unsigned char res1[3];
  23. unsigned char bprth;
  24. unsigned char bprtl;
  25. unsigned char gprt3;
  26. unsigned char gprt2;
  27. unsigned char gprt1;
  28. unsigned char gprt0;
  29. unsigned char res2[2];
  30. unsigned char prst;
  31. unsigned char res3[0xfff0];
  32. unsigned char pgy_id;
  33. unsigned char pgy_rev;
  34. unsigned char pgy_outputs;
  35. unsigned char pgy_eth;
  36. };
  37. #define BFTICU_DIPSWITCH_MASK 0x0f
  38. /*
  39. * BFTICU FPGA iomap
  40. * BFTICU is used on mgcoge and mgocge3ne
  41. */
  42. struct bfticu_iomap {
  43. u8 xi_ena; /* General defect enable */
  44. u8 pack1[3];
  45. u8 en_csn;
  46. u8 pack2;
  47. u8 safe_mem;
  48. u8 pack3;
  49. u8 id;
  50. u8 pack4;
  51. u8 rev;
  52. u8 build;
  53. u8 p_frc;
  54. u8 p_msk;
  55. u8 pack5[2];
  56. u8 xg_int;
  57. u8 pack6[15];
  58. u8 s_conf;
  59. u8 pack7;
  60. u8 dmx_conf12;
  61. u8 pack8;
  62. u8 s_clkslv;
  63. u8 pack9[11];
  64. u8 d_conf;
  65. u8 d_mask_ca;
  66. u8 d_pll_del;
  67. u8 pack10[16];
  68. u8 t_conf_ca;
  69. u8 t_mask_ca;
  70. u8 pack11[13];
  71. u8 m_def0;
  72. u8 m_def1;
  73. u8 m_def2;
  74. u8 m_def3;
  75. u8 m_def4;
  76. u8 m_def5;
  77. u8 m_def_trap0;
  78. u8 m_def_trap1;
  79. u8 m_def_trap2;
  80. u8 m_def_trap3;
  81. u8 m_def_trap4;
  82. u8 m_def_trap5;
  83. u8 m_mask_def0;
  84. u8 m_mask_def1;
  85. u8 m_mask_def2;
  86. u8 m_mask_def3;
  87. u8 m_mask_def4;
  88. u8 m_mask_def5;
  89. u8 m_def_mask0;
  90. u8 m_def_mask1;
  91. u8 m_def_mask2;
  92. u8 m_def_mask3;
  93. u8 m_def_mask4;
  94. u8 m_def_mask5;
  95. u8 m_def_pri;
  96. u8 pack12[11];
  97. u8 hw_status;
  98. u8 pack13;
  99. u8 hw_control1;
  100. u8 hw_control2;
  101. u8 hw_control3;
  102. u8 pack14[7];
  103. u8 led_on; /* Leds */
  104. u8 pack15;
  105. u8 sfp_control; /* SFP modules */
  106. u8 pack16;
  107. u8 alarm_control; /* Alarm output */
  108. u8 pack17;
  109. u8 icps; /* ICN clock pulse shaping */
  110. u8 mswitch; /* Read mode switch */
  111. u8 pack18[6];
  112. u8 pb_dbug;
  113. };
  114. #if !defined(CONFIG_PIGGY_MAC_ADRESS_OFFSET)
  115. #define CONFIG_PIGGY_MAC_ADRESS_OFFSET 0
  116. #endif
  117. int ethernet_present(void);
  118. int ivm_read_eeprom(unsigned char *buf, int len);
  119. int ivm_analyze_eeprom(unsigned char *buf, int len);
  120. int trigger_fpga_config(void);
  121. int wait_for_fpga_config(void);
  122. int fpga_reset(void);
  123. int toggle_eeprom_spi_bus(void);
  124. int get_testpin(void);
  125. int set_km_env(void);
  126. #define DELAY_ABORT_SEQ 62 /* @200kHz 9 clocks = 44us, 62us is ok */
  127. #define DELAY_HALF_PERIOD (500 / (CONFIG_SYS_I2C_SPEED / 1000))
  128. int i2c_soft_read_pin(void);
  129. int i2c_make_abort(void);
  130. #endif /* __KEYMILE_COMMON_H */