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:
73 int i = getenv_f("serial#", buf, sizeof(buf));
74 ihs_fpga_t *fpga = (ihs_fpga_t *) CONFIG_SYS_FPGA_BASE(0);
75 u16 versions = in_le16(&fpga->versions);
76 u16 fpga_version = in_le16(&fpga->fpga_version);
77 u16 fpga_features = in_le16(&fpga->fpga_features);
79 unsigned hardware_version;
80 unsigned feature_compression;
82 unsigned feature_audio;
83 unsigned feature_sysclock;
84 unsigned feature_ramconfig;
85 unsigned feature_carriers;
86 unsigned feature_video_channels;
88 unit_type = (versions & 0xf000) >> 12;
89 hardware_version = versions & 0x000f;
90 feature_compression = (fpga_features & 0xe000) >> 13;
91 feature_osd = fpga_features & (1<<11);
92 feature_audio = (fpga_features & 0x0600) >> 9;
93 feature_sysclock = (fpga_features & 0x0180) >> 7;
94 feature_ramconfig = (fpga_features & 0x0060) >> 5;
95 feature_carriers = (fpga_features & 0x000c) >> 2;
96 feature_video_channels = fpga_features & 0x0003;
109 case UNITTYPE_MAIN_USER:
110 printf("Mainchannel");
113 case UNITTYPE_VIDEO_USER:
114 printf("Videochannel");
118 printf("UnitType %d(not supported)", unit_type);
122 switch (hardware_version) {
124 printf(" HW-Ver 1.00\n");
128 printf(" HW-Ver 1.04\n");
132 printf(" HW-Ver 1.10\n");
136 printf(" HW-Ver %d(not supported)\n",
141 printf(" FPGA V %d.%02d, features:",
142 fpga_version / 100, fpga_version % 100);
145 switch (feature_compression) {
146 case COMPRESSION_NONE:
147 printf(" no compression");
150 case COMPRESSION_TYPE1_DELTA:
151 printf(" type1-deltacompression");
155 printf(" compression %d(not supported)", feature_compression);
159 printf(", %sosd", feature_osd ? "" : "no ");
161 switch (feature_audio) {
163 printf(", no audio");
167 printf(", audio tx");
171 printf(", audio rx");
175 printf(", audio rx+tx");
179 printf(", audio %d(not supported)", feature_audio);
185 switch (feature_sysclock) {
187 printf("clock 147.456 MHz");
191 printf("clock %d(not supported)", feature_sysclock);
195 switch (feature_ramconfig) {
197 printf(", RAM 32 bit DDR2");
201 printf(", RAM %d(not supported)", feature_ramconfig);
205 printf(", %d carrier(s)", feature_carriers);
207 printf(", %d video channel(s)\n", feature_video_channels);
212 int last_stage_init(void)
218 * provide access to fpga gpios (for I2C bitbang)
220 void fpga_gpio_set(int pin)
222 out_le16((void *)(CONFIG_SYS_FPGA0_BASE + 0x18), pin);
225 void fpga_gpio_clear(int pin)
227 out_le16((void *)(CONFIG_SYS_FPGA0_BASE + 0x16), pin);
230 int fpga_gpio_get(int pin)
232 return in_le16((void *)(CONFIG_SYS_FPGA0_BASE + 0x14)) & pin;