dlvision-10g.c 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. /*
  2. * (C) Copyright 2010
  3. * Dirk Eibach, Guntermann & Drunck GmbH, eibach@gdsys.de
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #include <common.h>
  24. #include <command.h>
  25. #include <asm/processor.h>
  26. #include <asm/io.h>
  27. #include <asm/ppc4xx-gpio.h>
  28. #include <gdsys_fpga.h>
  29. #include "../common/osd.h"
  30. enum {
  31. UNITTYPE_VIDEO_USER = 0,
  32. UNITTYPE_MAIN_USER = 1,
  33. UNITTYPE_VIDEO_SERVER = 2,
  34. UNITTYPE_MAIN_SERVER = 3,
  35. };
  36. enum {
  37. HWVER_101 = 0,
  38. HWVER_110 = 1,
  39. };
  40. enum {
  41. AUDIO_NONE = 0,
  42. AUDIO_TX = 1,
  43. AUDIO_RX = 2,
  44. AUDIO_RXTX = 3,
  45. };
  46. enum {
  47. SYSCLK_156250 = 2,
  48. };
  49. enum {
  50. RAM_NONE = 0,
  51. RAM_DDR2_32 = 1,
  52. RAM_DDR2_64 = 2,
  53. };
  54. static void print_fpga_info(unsigned dev)
  55. {
  56. ihs_fpga_t *fpga = (ihs_fpga_t *) CONFIG_SYS_FPGA_BASE(dev);
  57. u16 versions = in_le16(&fpga->versions);
  58. u16 fpga_version = in_le16(&fpga->fpga_version);
  59. u16 fpga_features = in_le16(&fpga->fpga_features);
  60. unsigned unit_type;
  61. unsigned hardware_version;
  62. unsigned feature_compression;
  63. unsigned feature_rs232;
  64. unsigned feature_audio;
  65. unsigned feature_sysclock;
  66. unsigned feature_ramconfig;
  67. unsigned feature_carrier_speed;
  68. unsigned feature_carriers;
  69. unsigned feature_video_channels;
  70. int fpga_state = get_fpga_state(dev);
  71. printf("FPGA%d: ", dev);
  72. hardware_version = versions & 0x000f;
  73. if (fpga_state
  74. && !((hardware_version == HWVER_101)
  75. && (fpga_state == FPGA_STATE_DONE_FAILED))) {
  76. puts("not available\n");
  77. print_fpga_state(dev);
  78. return;
  79. }
  80. unit_type = (versions >> 4) & 0x000f;
  81. hardware_version = versions & 0x000f;
  82. feature_compression = (fpga_features >> 13) & 0x0003;
  83. feature_rs232 = fpga_features & (1<<11);
  84. feature_audio = (fpga_features >> 9) & 0x0003;
  85. feature_sysclock = (fpga_features >> 7) & 0x0003;
  86. feature_ramconfig = (fpga_features >> 5) & 0x0003;
  87. feature_carrier_speed = fpga_features & (1<<4);
  88. feature_carriers = (fpga_features >> 2) & 0x0003;
  89. feature_video_channels = fpga_features & 0x0003;
  90. switch (unit_type) {
  91. case UNITTYPE_VIDEO_USER:
  92. printf("Videochannel Userside");
  93. break;
  94. case UNITTYPE_MAIN_USER:
  95. printf("Mainchannel Userside");
  96. break;
  97. case UNITTYPE_VIDEO_SERVER:
  98. printf("Videochannel Serverside");
  99. break;
  100. case UNITTYPE_MAIN_SERVER:
  101. printf("Mainchannel Serverside");
  102. break;
  103. default:
  104. printf("UnitType %d(not supported)", unit_type);
  105. break;
  106. }
  107. switch (hardware_version) {
  108. case HWVER_101:
  109. printf(" HW-Ver 1.01\n");
  110. break;
  111. case HWVER_110:
  112. printf(" HW-Ver 1.10\n");
  113. break;
  114. default:
  115. printf(" HW-Ver %d(not supported)\n",
  116. hardware_version);
  117. break;
  118. }
  119. printf(" FPGA V %d.%02d, features:",
  120. fpga_version / 100, fpga_version % 100);
  121. printf(" %sRS232", feature_rs232 ? "" : "no ");
  122. switch (feature_audio) {
  123. case AUDIO_NONE:
  124. printf(", no audio");
  125. break;
  126. case AUDIO_TX:
  127. printf(", audio tx");
  128. break;
  129. case AUDIO_RX:
  130. printf(", audio rx");
  131. break;
  132. case AUDIO_RXTX:
  133. printf(", audio rx+tx");
  134. break;
  135. default:
  136. printf(", audio %d(not supported)", feature_audio);
  137. break;
  138. }
  139. switch (feature_sysclock) {
  140. case SYSCLK_156250:
  141. printf(", clock 156.25 MHz");
  142. break;
  143. default:
  144. printf(", clock %d(not supported)", feature_sysclock);
  145. break;
  146. }
  147. puts(",\n ");
  148. switch (feature_ramconfig) {
  149. case RAM_NONE:
  150. printf("no RAM");
  151. break;
  152. case RAM_DDR2_32:
  153. printf("RAM 32 bit DDR2");
  154. break;
  155. case RAM_DDR2_64:
  156. printf("RAM 64 bit DDR2");
  157. break;
  158. default:
  159. printf("RAM %d(not supported)", feature_ramconfig);
  160. break;
  161. }
  162. printf(", %d carrier(s) %s", feature_carriers,
  163. feature_carrier_speed ? "10 Gbit/s" : "of unknown speed");
  164. printf(", %d video channel(s)\n", feature_video_channels);
  165. }
  166. /*
  167. * Check Board Identity:
  168. */
  169. int checkboard(void)
  170. {
  171. unsigned k;
  172. char *s = getenv("serial#");
  173. printf("Board: ");
  174. printf("DLVision 10G");
  175. if (s != NULL) {
  176. puts(", serial# ");
  177. puts(s);
  178. }
  179. puts("\n");
  180. for (k = 0; k < CONFIG_SYS_FPGA_COUNT; ++k)
  181. print_fpga_info(k);
  182. return 0;
  183. }
  184. int last_stage_init(void)
  185. {
  186. unsigned k;
  187. for (k = 0; k < CONFIG_SYS_OSD_SCREENS; ++k)
  188. if (!get_fpga_state(k)
  189. || (get_fpga_state(k) == FPGA_STATE_DONE_FAILED))
  190. osd_probe(k);
  191. return 0;
  192. }