3 * Dirk Eibach, Guntermann & Drunck GmbH, eibach@gdsys.de
5 * See file CREDITS for list of people who contributed to this
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.
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.
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,
26 #include <asm/processor.h>
28 #include <asm/ppc4xx-gpio.h>
30 #include <gdsys_fpga.h>
32 #include "../common/osd.h"
35 UNITTYPE_MAIN_SERVER = 0,
36 UNITTYPE_MAIN_USER = 1,
37 UNITTYPE_VIDEO_SERVER = 2,
38 UNITTYPE_VIDEO_USER = 3,
49 COMPRESSION_TYPE1_DELTA,
68 * Check Board Identity:
72 ihs_fpga_t *fpga = (ihs_fpga_t *) CONFIG_SYS_FPGA_BASE(0);
73 char *s = getenv("serial#");
74 u16 versions = in_le16(&fpga->versions);
75 u16 fpga_version = in_le16(&fpga->fpga_version);
76 u16 fpga_features = in_le16(&fpga->fpga_features);
78 unsigned hardware_version;
79 unsigned feature_compression;
81 unsigned feature_audio;
82 unsigned feature_sysclock;
83 unsigned feature_ramconfig;
84 unsigned feature_carriers;
85 unsigned feature_video_channels;
87 unit_type = (versions & 0xf000) >> 12;
88 hardware_version = versions & 0x000f;
89 feature_compression = (fpga_features & 0xe000) >> 13;
90 feature_osd = fpga_features & (1<<11);
91 feature_audio = (fpga_features & 0x0600) >> 9;
92 feature_sysclock = (fpga_features & 0x0180) >> 7;
93 feature_ramconfig = (fpga_features & 0x0060) >> 5;
94 feature_carriers = (fpga_features & 0x000c) >> 2;
95 feature_video_channels = fpga_features & 0x0003;
108 case UNITTYPE_MAIN_USER:
109 printf("Mainchannel");
112 case UNITTYPE_VIDEO_USER:
113 printf("Videochannel");
117 printf("UnitType %d(not supported)", unit_type);
121 switch (hardware_version) {
123 printf(" HW-Ver 1.00\n");
127 printf(" HW-Ver 1.04\n");
131 printf(" HW-Ver 1.10\n");
135 printf(" HW-Ver %d(not supported)\n",
140 printf(" FPGA V %d.%02d, features:",
141 fpga_version / 100, fpga_version % 100);
144 switch (feature_compression) {
145 case COMPRESSION_NONE:
146 printf(" no compression");
149 case COMPRESSION_TYPE1_DELTA:
150 printf(" type1-deltacompression");
154 printf(" compression %d(not supported)", feature_compression);
158 printf(", %sosd", feature_osd ? "" : "no ");
160 switch (feature_audio) {
162 printf(", no audio");
166 printf(", audio tx");
170 printf(", audio rx");
174 printf(", audio rx+tx");
178 printf(", audio %d(not supported)", feature_audio);
184 switch (feature_sysclock) {
186 printf("clock 147.456 MHz");
190 printf("clock %d(not supported)", feature_sysclock);
194 switch (feature_ramconfig) {
196 printf(", RAM 32 bit DDR2");
200 printf(", RAM %d(not supported)", feature_ramconfig);
204 printf(", %d carrier(s)", feature_carriers);
206 printf(", %d video channel(s)\n", feature_video_channels);
211 int last_stage_init(void)
217 * provide access to fpga gpios (for I2C bitbang)
219 void fpga_gpio_set(int pin)
221 out_le16((void *)(CONFIG_SYS_FPGA0_BASE + 0x18), pin);
224 void fpga_gpio_clear(int pin)
226 out_le16((void *)(CONFIG_SYS_FPGA0_BASE + 0x16), pin);
229 int fpga_gpio_get(int pin)
231 return in_le16((void *)(CONFIG_SYS_FPGA0_BASE + 0x14)) & pin;