]>
git.ipfire.org Git - people/ms/u-boot.git/blob - board/gdsys/405ep/iocon.c
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>
31 #include <gdsys_fpga.h>
33 #include "../common/osd.h"
35 #define LATCH0_BASE (CONFIG_SYS_LATCH_BASE)
36 #define LATCH1_BASE (CONFIG_SYS_LATCH_BASE + 0x100)
37 #define LATCH2_BASE (CONFIG_SYS_LATCH_BASE + 0x200)
40 UNITTYPE_MAIN_SERVER
= 0,
41 UNITTYPE_MAIN_USER
= 1,
42 UNITTYPE_VIDEO_SERVER
= 2,
43 UNITTYPE_VIDEO_USER
= 3,
54 COMPRESSION_TYPE1_DELTA
,
73 * Check Board Identity:
77 char *s
= getenv("serial#");
93 static void print_fpga_info(void)
95 struct ihs_fpga
*fpga
= (struct ihs_fpga
*) CONFIG_SYS_FPGA_BASE(0);
96 u16 versions
= in_le16(&fpga
->versions
);
97 u16 fpga_version
= in_le16(&fpga
->fpga_version
);
98 u16 fpga_features
= in_le16(&fpga
->fpga_features
);
100 unsigned hardware_version
;
101 unsigned feature_compression
;
102 unsigned feature_osd
;
103 unsigned feature_audio
;
104 unsigned feature_sysclock
;
105 unsigned feature_ramconfig
;
106 unsigned feature_carriers
;
107 unsigned feature_video_channels
;
109 unit_type
= (versions
& 0xf000) >> 12;
110 hardware_version
= versions
& 0x000f;
111 feature_compression
= (fpga_features
& 0xe000) >> 13;
112 feature_osd
= fpga_features
& (1<<11);
113 feature_audio
= (fpga_features
& 0x0600) >> 9;
114 feature_sysclock
= (fpga_features
& 0x0180) >> 7;
115 feature_ramconfig
= (fpga_features
& 0x0060) >> 5;
116 feature_carriers
= (fpga_features
& 0x000c) >> 2;
117 feature_video_channels
= fpga_features
& 0x0003;
120 case UNITTYPE_MAIN_USER
:
121 printf("Mainchannel");
124 case UNITTYPE_VIDEO_USER
:
125 printf("Videochannel");
129 printf("UnitType %d(not supported)", unit_type
);
133 switch (hardware_version
) {
135 printf(" HW-Ver 1.00\n");
139 printf(" HW-Ver 1.04\n");
143 printf(" HW-Ver 1.10\n");
147 printf(" HW-Ver %d(not supported)\n",
152 printf(" FPGA V %d.%02d, features:",
153 fpga_version
/ 100, fpga_version
% 100);
156 switch (feature_compression
) {
157 case COMPRESSION_NONE
:
158 printf(" no compression");
161 case COMPRESSION_TYPE1_DELTA
:
162 printf(" type1-deltacompression");
166 printf(" compression %d(not supported)", feature_compression
);
170 printf(", %sosd", feature_osd
? "" : "no ");
172 switch (feature_audio
) {
174 printf(", no audio");
178 printf(", audio tx");
182 printf(", audio rx");
186 printf(", audio rx+tx");
190 printf(", audio %d(not supported)", feature_audio
);
196 switch (feature_sysclock
) {
198 printf("clock 147.456 MHz");
202 printf("clock %d(not supported)", feature_sysclock
);
206 switch (feature_ramconfig
) {
208 printf(", RAM 32 bit DDR2");
212 printf(", RAM %d(not supported)", feature_ramconfig
);
216 printf(", %d carrier(s)", feature_carriers
);
218 printf(", %d video channel(s)\n", feature_video_channels
);
221 int last_stage_init(void)
229 * provide access to fpga gpios (for I2C bitbang)
231 void fpga_gpio_set(int pin
)
233 out_le16((void *)(CONFIG_SYS_FPGA0_BASE
+ 0x18), pin
);
236 void fpga_gpio_clear(int pin
)
238 out_le16((void *)(CONFIG_SYS_FPGA0_BASE
+ 0x16), pin
);
241 int fpga_gpio_get(int pin
)
243 return in_le16((void *)(CONFIG_SYS_FPGA0_BASE
+ 0x14)) & pin
;
246 void gd405ep_init(void)
250 void gd405ep_set_fpga_reset(unsigned state
)
253 out_le16((void *)LATCH0_BASE
, CONFIG_SYS_LATCH0_RESET
);
254 out_le16((void *)LATCH1_BASE
, CONFIG_SYS_LATCH1_RESET
);
256 out_le16((void *)LATCH0_BASE
, CONFIG_SYS_LATCH0_BOOT
);
257 out_le16((void *)LATCH1_BASE
, CONFIG_SYS_LATCH1_BOOT
);
261 void gd405ep_setup_hw(void)
264 * set "startup-finished"-gpios
266 gpio_write_bit(21, 0);
267 gpio_write_bit(22, 1);
270 int gd405ep_get_fpga_done(unsigned fpga
)
272 return in_le16((void *)LATCH2_BASE
) & CONFIG_SYS_FPGA_DONE(fpga
);