]>
Commit | Line | Data |
---|---|---|
e2211743 WD |
1 | /* |
2 | * (C) Copyright 2000-2002 | |
3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.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 | ||
24 | #ifndef __COMMON_H_ | |
25 | #define __COMMON_H_ 1 | |
26 | ||
27 | #undef _LINUX_CONFIG_H | |
28 | #define _LINUX_CONFIG_H 1 /* avoid reading Linux autoconf.h file */ | |
29 | ||
30 | typedef unsigned char uchar; | |
31 | typedef volatile unsigned long vu_long; | |
32 | typedef volatile unsigned short vu_short; | |
33 | typedef volatile unsigned char vu_char; | |
34 | ||
35 | #include <config.h> | |
36 | #include <linux/bitops.h> | |
37 | #include <linux/types.h> | |
38 | #include <linux/string.h> | |
39 | #include <asm/ptrace.h> | |
40 | #include <stdarg.h> | |
41 | #if defined(CONFIG_PCI) && defined(CONFIG_440) | |
42 | #include <pci.h> | |
43 | #endif | |
44 | #ifdef CONFIG_8xx | |
45 | #include <asm/8xx_immap.h> | |
46 | #elif defined(CONFIG_8260) | |
47 | #include <asm/immap_8260.h> | |
48 | #endif | |
49 | #ifdef CONFIG_4xx | |
50 | #include <ppc4xx.h> | |
51 | #endif | |
52 | #ifdef CONFIG_HYMOD | |
53 | #include <asm/hymod.h> | |
54 | #endif | |
55 | #ifdef CONFIG_ARM | |
56 | #define asmlinkage /* nothing */ | |
57 | #endif | |
58 | ||
59 | #include <part.h> | |
60 | #include <flash.h> | |
61 | #include <image.h> | |
62 | ||
63 | #ifdef DEBUG | |
64 | #define debug(fmt,args...) printf (fmt ,##args) | |
65 | #else | |
66 | #define debug(fmt,args...) | |
67 | #endif /* DEBUG */ | |
68 | ||
69 | typedef void (interrupt_handler_t)(void *); | |
70 | ||
71 | #include <asm/u-boot.h> /* boot information for Linux kernel */ | |
72 | #include <asm/global_data.h> /* global data used for startup functions */ | |
73 | ||
74 | /* enable common handling for all TQM8xxL boards */ | |
75 | #if defined(CONFIG_TQM823L) || defined(CONFIG_TQM850L) || \ | |
76 | defined(CONFIG_TQM855L) || defined(CONFIG_TQM860L) | |
77 | # ifndef CONFIG_TQM8xxL | |
78 | # define CONFIG_TQM8xxL | |
79 | # endif | |
80 | #endif | |
81 | ||
82 | ||
83 | /* | |
84 | * Function Prototypes | |
85 | */ | |
86 | ||
87 | #if CONFIG_SERIAL_SOFTWARE_FIFO | |
88 | void serial_buffered_init (void); | |
89 | void serial_buffered_putc (const char); | |
90 | void serial_buffered_puts (const char *); | |
91 | int serial_buffered_getc (void); | |
92 | int serial_buffered_tstc (void); | |
93 | #endif /* CONFIG_SERIAL_SOFTWARE_FIFO */ | |
94 | ||
95 | void hang (void) __attribute__ ((noreturn)); | |
96 | ||
97 | /* */ | |
98 | long int initdram (int); | |
99 | int display_options (void); | |
100 | void print_size (ulong, const char *); | |
101 | ||
102 | /* common/main.c */ | |
103 | void main_loop (void); | |
104 | int run_command (const char *cmd, int flag); | |
105 | int readline (const char *const prompt); | |
106 | void reset_cmd_timeout(void); | |
107 | ||
108 | /* common/board.c */ | |
109 | void board_init_f (ulong); | |
110 | void board_init_r (gd_t *, ulong); | |
111 | int checkboard (void); | |
112 | int checkflash (void); | |
113 | int checkdram (void); | |
114 | char * strmhz(char *buf, long hz); | |
115 | int last_stage_init(void); | |
116 | ||
117 | /* common/flash.c */ | |
118 | void flash_perror (int); | |
119 | ||
120 | /* common/cmd_bootm.c */ | |
121 | void print_image_hdr (image_header_t *hdr); | |
122 | ||
123 | extern ulong load_addr; /* Default Load Address */ | |
124 | ||
125 | /* common/cmd_nvedit.c */ | |
126 | int env_init (void); | |
127 | void env_relocate (void); | |
128 | char *getenv (uchar *); | |
129 | int getenv_r (uchar *name, uchar *buf, unsigned len); | |
130 | int saveenv (void); | |
131 | #ifdef CONFIG_PPC /* ARM version to be fixed! */ | |
132 | void inline setenv (char *, char *); | |
133 | #endif /* CONFIG_PPC */ | |
134 | #ifdef CONFIG_ARM | |
135 | # include <asm/u-boot-arm.h> /* ARM version to be fixed! */ | |
136 | #endif /* CONFIG_ARM */ | |
137 | ||
138 | void pci_init (void); | |
139 | void pciinfo (int, int); | |
140 | ||
141 | #if defined(CONFIG_PCI) && defined(CONFIG_440) | |
142 | # if defined(CFG_PCI_PRE_INIT) | |
143 | int pci_pre_init (struct pci_controller * ); | |
144 | # endif | |
145 | # if defined(CFG_PCI_TARGET_INIT) | |
146 | void pci_target_init (struct pci_controller *); | |
147 | # endif | |
148 | # if defined(CFG_PCI_MASTER_INIT) | |
149 | void pci_master_init (struct pci_controller *); | |
150 | # endif | |
151 | int is_pci_host (struct pci_controller *); | |
152 | #endif | |
153 | ||
154 | int misc_init_f (void); | |
155 | int misc_init_r (void); | |
156 | ||
157 | /* $(BOARD)/$(BOARD).c */ | |
158 | void reset_phy (void); | |
159 | ||
160 | /* $(BOARD)/eeprom.c */ | |
161 | void eeprom_init (void); | |
162 | int eeprom_read (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt); | |
163 | int eeprom_write (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt); | |
164 | #ifdef CONFIG_LWMON | |
165 | extern uchar pic_read (uchar reg); | |
166 | extern void pic_write (uchar reg, uchar val); | |
167 | #endif | |
168 | ||
169 | /* | |
170 | * Set this up regardless of board | |
171 | * type, to prevent errors. | |
172 | */ | |
173 | #if defined(CONFIG_SPI) || !defined(CFG_I2C_EEPROM_ADDR) | |
174 | # define CFG_DEF_EEPROM_ADDR 0 | |
175 | #else | |
176 | # define CFG_DEF_EEPROM_ADDR CFG_I2C_EEPROM_ADDR | |
177 | #endif /* CONFIG_SPI || !defined(CFG_I2C_EEPROM_ADDR) */ | |
178 | ||
179 | #if defined(CONFIG_PCU_E) || defined(CONFIG_CCM) | |
180 | extern void spi_init_f (void); | |
181 | extern void spi_init_r (void); | |
182 | extern ssize_t spi_read (uchar *, int, uchar *, int); | |
183 | extern ssize_t spi_write (uchar *, int, uchar *, int); | |
184 | #endif | |
185 | ||
186 | #ifdef CONFIG_RPXCLASSIC | |
187 | void rpxclassic_init (void); | |
188 | #endif | |
189 | ||
190 | #ifdef CONFIG_MBX | |
191 | /* $(BOARD)/mbx8xx.c */ | |
192 | void mbx_init (void); | |
193 | void board_serial_init (void); | |
194 | void board_ether_init (void); | |
195 | #endif | |
196 | ||
197 | #if defined(CONFIG_RPXCLASSIC) || defined(CONFIG_MBX) || defined(CONFIG_IAD210) | |
198 | void board_get_enetaddr (uchar *addr); | |
199 | #endif | |
200 | ||
201 | #ifdef CONFIG_HERMES | |
202 | /* $(BOARD)/hermes.c */ | |
203 | void hermes_start_lxt980 (int speed); | |
204 | #endif | |
205 | ||
206 | #ifdef CONFIG_EVB64260 | |
207 | void evb64260_init(void); | |
208 | void debug_led(int, int); | |
209 | void display_mem_map(void); | |
210 | void perform_soft_reset(void); | |
211 | #endif | |
212 | ||
213 | void load_sernum_ethaddr (void); | |
214 | ||
215 | /* $(BOARD)/$(BOARD).c */ | |
216 | int board_pre_init (void); | |
217 | int board_postclk_init (void); /* after clocks/timebase, before env/serial */ | |
218 | void board_poweroff (void); | |
219 | ||
220 | #if defined(CFG_DRAM_TEST) | |
221 | int testdram(void); | |
222 | #endif /* CFG_DRAM_TEST */ | |
223 | ||
224 | /* $(CPU)/start.S */ | |
225 | #ifdef CONFIG_8xx | |
226 | uint get_immr (uint); | |
227 | #endif | |
228 | uint get_pvr (void); | |
229 | uint rd_ic_cst (void); | |
230 | void wr_ic_cst (uint); | |
231 | void wr_ic_adr (uint); | |
232 | uint rd_dc_cst (void); | |
233 | void wr_dc_cst (uint); | |
234 | void wr_dc_adr (uint); | |
235 | int icache_status (void); | |
236 | void icache_enable (void); | |
237 | void icache_disable(void); | |
238 | int dcache_status (void); | |
239 | void dcache_enable (void); | |
240 | void dcache_disable(void); | |
241 | void relocate_code (ulong, gd_t *, ulong); | |
242 | ulong get_endaddr (void); | |
243 | void trap_init (ulong); | |
244 | #if defined (CONFIG_4xx) || \ | |
245 | defined (CONFIG_74xx_7xx) || \ | |
246 | defined (CONFIG_74x) || \ | |
247 | defined (CONFIG_75x) || \ | |
248 | defined (CONFIG_74xx) | |
249 | unsigned char in8(unsigned int); | |
250 | void out8(unsigned int, unsigned char); | |
251 | unsigned short in16(unsigned int); | |
252 | unsigned short in16r(unsigned int); | |
253 | void out16(unsigned int, unsigned short value); | |
254 | void out16r(unsigned int, unsigned short value); | |
255 | unsigned long in32(unsigned int); | |
256 | unsigned long in32r(unsigned int); | |
257 | void out32(unsigned int, unsigned long value); | |
258 | void out32r(unsigned int, unsigned long value); | |
259 | void ppcDcbf(unsigned long value); | |
260 | void ppcDcbi(unsigned long value); | |
261 | void ppcSync(void); | |
262 | #endif | |
263 | ||
264 | /* $(CPU)/cpu.c */ | |
265 | int checkcpu (void); | |
266 | int checkicache (void); | |
267 | int checkdcache (void); | |
268 | void upmconfig (unsigned int, unsigned int *, unsigned int); | |
269 | ulong get_tbclk (void); | |
270 | ||
271 | /* $(CPU)/serial.c */ | |
272 | int serial_init (void); | |
273 | void serial_setbrg (void); | |
274 | void serial_putc (const char); | |
275 | void serial_puts (const char *); | |
276 | void serial_addr (unsigned int); | |
277 | int serial_getc (void); | |
278 | int serial_tstc (void); | |
279 | ||
280 | /* $(CPU)/speed.c */ | |
281 | int get_clocks (void); | |
282 | #if defined(CONFIG_8260) | |
283 | int prt_8260_clks (void); | |
284 | #endif | |
285 | #ifdef CONFIG_4xx | |
286 | ulong get_OPB_freq (void); | |
287 | ulong get_PCI_freq (void); | |
288 | #endif | |
289 | #if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) | |
290 | ulong get_FCLK (void); | |
291 | ulong get_HCLK (void); | |
292 | ulong get_PCLK (void); | |
293 | ulong get_UCLK (void); | |
294 | #endif | |
295 | ulong get_bus_freq (ulong); | |
296 | ||
297 | #if defined(CONFIG_4xx) || defined(CONFIG_IOP480) | |
298 | # if defined(CONFIG_440) | |
299 | typedef PPC440_SYS_INFO sys_info_t; | |
300 | # else | |
301 | typedef PPC405_SYS_INFO sys_info_t; | |
302 | # endif | |
303 | void get_sys_info ( sys_info_t * ); | |
304 | #endif | |
305 | ||
306 | /* $(CPU)/cpu_init.c */ | |
307 | #if defined(CONFIG_8xx) || defined(CONFIG_8260) | |
308 | void cpu_init_f (volatile immap_t *immr); | |
309 | #endif | |
310 | #ifdef CONFIG_4xx | |
311 | void cpu_init_f (void); | |
312 | #endif | |
313 | int cpu_init_r (void); | |
314 | #if defined(CONFIG_8260) | |
315 | int prt_8260_rsr (void); | |
316 | #endif | |
317 | ||
318 | /* $(CPU)/interrupts.c */ | |
319 | int interrupt_init (void); | |
320 | void timer_interrupt (struct pt_regs *); | |
321 | void external_interrupt (struct pt_regs *); | |
322 | void irq_install_handler(int, interrupt_handler_t *, void *); | |
323 | void irq_free_handler (int); | |
324 | void reset_timer (void); | |
325 | ulong get_timer (ulong base); | |
326 | void set_timer (ulong t); | |
327 | void enable_interrupts (void); | |
328 | int disable_interrupts (void); | |
329 | ||
330 | /* $(CPU)/.../commproc.c */ | |
331 | int dpram_init (void); | |
332 | uint dpram_base(void); | |
333 | uint dpram_base_align(uint align); | |
334 | uint dpram_alloc(uint size); | |
335 | uint dpram_alloc_align(uint size,uint align); | |
336 | void post_word_store (ulong); | |
337 | ulong post_word_load (void); | |
338 | ||
339 | /* $(CPU)/.../<eth> */ | |
340 | void mii_init (void); | |
341 | ||
342 | /* $(CPU)/.../lcd.c */ | |
343 | ulong lcd_setmem (ulong); | |
344 | ||
345 | /* $(CPU)/.../vfd.c */ | |
346 | ulong vfd_setmem (ulong); | |
347 | ||
348 | /* $(CPU)/.../video.c */ | |
349 | ulong video_setmem (ulong); | |
350 | ||
351 | /* ppc/cache.c */ | |
352 | void flush_cache (unsigned long, unsigned long); | |
353 | ||
354 | /* ppc/ticks.S */ | |
355 | unsigned long long get_ticks(void); | |
356 | void wait_ticks (unsigned long); | |
357 | ||
358 | /* ppc/time.c */ | |
359 | void udelay (unsigned long); | |
360 | ulong usec2ticks (unsigned long usec); | |
361 | ulong ticks2usec (unsigned long ticks); | |
362 | int init_timebase (void); | |
363 | ||
364 | /* ppc/vsprintf.c */ | |
365 | ulong simple_strtoul(const char *cp,char **endp,unsigned int base); | |
366 | long simple_strtol(const char *cp,char **endp,unsigned int base); | |
367 | void panic(const char *fmt, ...); | |
368 | int sprintf(char * buf, const char *fmt, ...); | |
369 | int vsprintf(char *buf, const char *fmt, va_list args); | |
370 | ||
371 | /* ppc/crc32.c */ | |
372 | ulong crc32 (ulong, const unsigned char *, uint); | |
373 | ulong crc32_no_comp (ulong, const unsigned char *, uint); | |
374 | ||
375 | /* common/console.c */ | |
376 | extern void **syscall_tbl; | |
377 | ||
378 | int console_init_f(void); /* Before relocation; uses the serial stuff */ | |
379 | int console_init_r(void); /* After relocation; uses the console stuff */ | |
380 | int console_assign (int file, char *devname); /* Assign the console */ | |
381 | int ctrlc (void); | |
382 | int had_ctrlc (void); /* have we had a Control-C since last clear? */ | |
383 | void clear_ctrlc (void); /* clear the Control-C condition */ | |
384 | int disable_ctrlc (int); /* 1 to disable, 0 to enable Control-C detect */ | |
385 | ||
386 | /* | |
387 | * STDIO based functions (can always be used) | |
388 | */ | |
389 | ||
390 | /* serial stuff */ | |
391 | void serial_printf (const char *fmt, ...); | |
392 | ||
393 | /* stdin */ | |
394 | int getc(void); | |
395 | int tstc(void); | |
396 | ||
397 | /* stdout */ | |
398 | void putc(const char c); | |
399 | void puts(const char *s); | |
400 | void printf(const char *fmt, ...); | |
401 | ||
402 | /* stderr */ | |
403 | #define eputc(c) fputc(stderr, c) | |
404 | #define eputs(s) fputs(stderr, s) | |
405 | #define eprintf(fmt,args...) fprintf(stderr,fmt ,##args) | |
406 | ||
407 | /* | |
408 | * FILE based functions (can only be used AFTER relocation!) | |
409 | */ | |
410 | ||
411 | #define stdin 0 | |
412 | #define stdout 1 | |
413 | #define stderr 2 | |
414 | #define MAX_FILES 3 | |
415 | ||
416 | void fprintf(int file, const char *fmt, ...); | |
417 | void fputs(int file, const char *s); | |
418 | void fputc(int file, const char c); | |
419 | int ftstc(int file); | |
420 | int fgetc(int file); | |
421 | ||
422 | int pcmcia_init (void); | |
423 | ||
424 | #ifdef CONFIG_SHOW_BOOT_PROGRESS | |
425 | void show_boot_progress (int status); | |
426 | #endif | |
427 | ||
428 | #endif /* __COMMON_H_ */ |