Dirk Eibach | a3f9d6c | 2015-10-28 11:46:32 +0100 | [diff] [blame^] | 1 | /* |
| 2 | * (C) Copyright 2014 |
| 3 | * Dirk Eibach, Guntermann & Drunck GmbH, eibach@gdsys.de |
| 4 | * |
| 5 | * SPDX-License-Identifier: GPL-2.0+ |
| 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | |
| 10 | #include <gdsys_fpga.h> |
| 11 | |
| 12 | enum { |
| 13 | UNITTYPE_MAIN_SERVER = 0, |
| 14 | UNITTYPE_MAIN_USER = 1, |
| 15 | UNITTYPE_VIDEO_SERVER = 2, |
| 16 | UNITTYPE_VIDEO_USER = 3, |
| 17 | }; |
| 18 | |
| 19 | enum { |
| 20 | UNITTYPEPCB_DVI = 0, |
| 21 | UNITTYPEPCB_DP_165 = 1, |
| 22 | UNITTYPEPCB_DP_300 = 2, |
| 23 | UNITTYPEPCB_HDMI = 3, |
| 24 | }; |
| 25 | |
| 26 | enum { |
| 27 | COMPRESSION_NONE = 0, |
| 28 | COMPRESSION_TYPE1_DELTA = 1, |
| 29 | COMPRESSION_TYPE1_TYPE2_DELTA = 3, |
| 30 | }; |
| 31 | |
| 32 | enum { |
| 33 | AUDIO_NONE = 0, |
| 34 | AUDIO_TX = 1, |
| 35 | AUDIO_RX = 2, |
| 36 | AUDIO_RXTX = 3, |
| 37 | }; |
| 38 | |
| 39 | enum { |
| 40 | SYSCLK_147456 = 0, |
| 41 | }; |
| 42 | |
| 43 | enum { |
| 44 | RAM_DDR2_32 = 0, |
| 45 | RAM_DDR3_32 = 1, |
| 46 | }; |
| 47 | |
| 48 | enum { |
| 49 | CARRIER_SPEED_1G = 0, |
| 50 | CARRIER_SPEED_2_5G = 1, |
| 51 | }; |
| 52 | |
| 53 | bool ioep_fpga_has_osd(unsigned int fpga) |
| 54 | { |
| 55 | u16 fpga_features; |
| 56 | unsigned feature_osd; |
| 57 | |
| 58 | FPGA_GET_REG(0, fpga_features, &fpga_features); |
| 59 | feature_osd = fpga_features & (1<<11); |
| 60 | |
| 61 | return feature_osd; |
| 62 | } |
| 63 | |
| 64 | void ioep_fpga_print_info(unsigned int fpga) |
| 65 | { |
| 66 | u16 versions; |
| 67 | u16 fpga_version; |
| 68 | u16 fpga_features; |
| 69 | unsigned unit_type; |
| 70 | unsigned unit_type_pcb_video; |
| 71 | unsigned feature_compression; |
| 72 | unsigned feature_osd; |
| 73 | unsigned feature_audio; |
| 74 | unsigned feature_sysclock; |
| 75 | unsigned feature_ramconfig; |
| 76 | unsigned feature_carrier_speed; |
| 77 | unsigned feature_carriers; |
| 78 | unsigned feature_video_channels; |
| 79 | |
| 80 | FPGA_GET_REG(fpga, versions, &versions); |
| 81 | FPGA_GET_REG(fpga, fpga_version, &fpga_version); |
| 82 | FPGA_GET_REG(fpga, fpga_features, &fpga_features); |
| 83 | |
| 84 | unit_type = (versions & 0xf000) >> 12; |
| 85 | unit_type_pcb_video = (versions & 0x01c0) >> 6; |
| 86 | feature_compression = (fpga_features & 0xe000) >> 13; |
| 87 | feature_osd = fpga_features & (1<<11); |
| 88 | feature_audio = (fpga_features & 0x0600) >> 9; |
| 89 | feature_sysclock = (fpga_features & 0x0180) >> 7; |
| 90 | feature_ramconfig = (fpga_features & 0x0060) >> 5; |
| 91 | feature_carrier_speed = fpga_features & (1<<4); |
| 92 | feature_carriers = (fpga_features & 0x000c) >> 2; |
| 93 | feature_video_channels = fpga_features & 0x0003; |
| 94 | |
| 95 | switch (unit_type) { |
| 96 | case UNITTYPE_MAIN_SERVER: |
| 97 | case UNITTYPE_MAIN_USER: |
| 98 | printf("Mainchannel"); |
| 99 | break; |
| 100 | |
| 101 | case UNITTYPE_VIDEO_SERVER: |
| 102 | case UNITTYPE_VIDEO_USER: |
| 103 | printf("Videochannel"); |
| 104 | break; |
| 105 | |
| 106 | default: |
| 107 | printf("UnitType %d(not supported)", unit_type); |
| 108 | break; |
| 109 | } |
| 110 | |
| 111 | switch (unit_type) { |
| 112 | case UNITTYPE_MAIN_SERVER: |
| 113 | case UNITTYPE_VIDEO_SERVER: |
| 114 | printf(" Server"); |
| 115 | if (versions & (1<<4)) |
| 116 | printf(" UC"); |
| 117 | break; |
| 118 | |
| 119 | case UNITTYPE_MAIN_USER: |
| 120 | case UNITTYPE_VIDEO_USER: |
| 121 | printf(" User"); |
| 122 | break; |
| 123 | |
| 124 | default: |
| 125 | break; |
| 126 | } |
| 127 | |
| 128 | if (versions & (1<<5)) |
| 129 | printf(" Fiber"); |
| 130 | else |
| 131 | printf(" CAT"); |
| 132 | |
| 133 | switch (unit_type_pcb_video) { |
| 134 | case UNITTYPEPCB_DVI: |
| 135 | printf(" DVI,"); |
| 136 | break; |
| 137 | |
| 138 | case UNITTYPEPCB_DP_165: |
| 139 | printf(" DP 165MPix/s,"); |
| 140 | break; |
| 141 | |
| 142 | case UNITTYPEPCB_DP_300: |
| 143 | printf(" DP 300MPix/s,"); |
| 144 | break; |
| 145 | |
| 146 | case UNITTYPEPCB_HDMI: |
| 147 | printf(" HDMI,"); |
| 148 | break; |
| 149 | } |
| 150 | |
| 151 | printf(" FPGA V %d.%02d\n features:", |
| 152 | fpga_version / 100, fpga_version % 100); |
| 153 | |
| 154 | |
| 155 | switch (feature_compression) { |
| 156 | case COMPRESSION_NONE: |
| 157 | printf(" no compression"); |
| 158 | break; |
| 159 | |
| 160 | case COMPRESSION_TYPE1_DELTA: |
| 161 | printf(" type1-deltacompression"); |
| 162 | break; |
| 163 | |
| 164 | case COMPRESSION_TYPE1_TYPE2_DELTA: |
| 165 | printf(" type1-deltacompression, type2-inlinecompression"); |
| 166 | break; |
| 167 | |
| 168 | default: |
| 169 | printf(" compression %d(not supported)", feature_compression); |
| 170 | break; |
| 171 | } |
| 172 | |
| 173 | printf(", %sosd", feature_osd ? "" : "no "); |
| 174 | |
| 175 | switch (feature_audio) { |
| 176 | case AUDIO_NONE: |
| 177 | printf(", no audio"); |
| 178 | break; |
| 179 | |
| 180 | case AUDIO_TX: |
| 181 | printf(", audio tx"); |
| 182 | break; |
| 183 | |
| 184 | case AUDIO_RX: |
| 185 | printf(", audio rx"); |
| 186 | break; |
| 187 | |
| 188 | case AUDIO_RXTX: |
| 189 | printf(", audio rx+tx"); |
| 190 | break; |
| 191 | |
| 192 | default: |
| 193 | printf(", audio %d(not supported)", feature_audio); |
| 194 | break; |
| 195 | } |
| 196 | |
| 197 | puts(",\n "); |
| 198 | |
| 199 | switch (feature_sysclock) { |
| 200 | case SYSCLK_147456: |
| 201 | printf("clock 147.456 MHz"); |
| 202 | break; |
| 203 | |
| 204 | default: |
| 205 | printf("clock %d(not supported)", feature_sysclock); |
| 206 | break; |
| 207 | } |
| 208 | |
| 209 | switch (feature_ramconfig) { |
| 210 | case RAM_DDR2_32: |
| 211 | printf(", RAM 32 bit DDR2"); |
| 212 | break; |
| 213 | |
| 214 | case RAM_DDR3_32: |
| 215 | printf(", RAM 32 bit DDR3"); |
| 216 | break; |
| 217 | |
| 218 | default: |
| 219 | printf(", RAM %d(not supported)", feature_ramconfig); |
| 220 | break; |
| 221 | } |
| 222 | |
| 223 | printf(", %d carrier(s) %s", feature_carriers, |
| 224 | feature_carrier_speed ? "2.5Gbit/s" : "1Gbit/s"); |
| 225 | |
| 226 | printf(", %d video channel(s)\n", feature_video_channels); |
| 227 | } |