2 * (C) Copyright 2000-2002
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.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,
27 #undef _LINUX_CONFIG_H
28 #define _LINUX_CONFIG_H 1 /* avoid reading Linux autoconf.h file */
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;
36 #include <linux/bitops.h>
37 #include <linux/types.h>
38 #include <linux/string.h>
39 #include <asm/ptrace.h>
41 #if defined(CONFIG_PCI) && defined(CONFIG_440)
45 #include <asm/8xx_immap.h>
47 #define CONFIG_MPC86x 1
50 #define CONFIG_MPC86x 1
52 #if defined(CONFIG_MPC866P) || \
53 defined(CONFIG_MPC866T) || \
54 defined(CONFIG_MPC859T) || \
55 defined(CONFIG_MPC859DSL) || \
56 defined(CONFIG_MPC852T)
57 #define CONFIG_MPC866_et_al 1
58 #define CONFIG_MPC86x 1
60 #elif defined(CONFIG_5xx)
61 #include <asm/5xx_immap.h>
62 #elif defined(CONFIG_8260)
63 #include <asm/immap_8260.h>
67 #include <asm/immap_85xx.h>
73 #include <board/hymod/hymod.h>
76 #define asmlinkage /* nothing */
84 #define debug(fmt,args...) printf (fmt ,##args)
85 #define debugX(level,fmt,args...) if (DEBUG>=level) printf(fmt,##args);
87 #define debug(fmt,args...)
88 #define debugX(level,fmt,args...)
91 typedef void (interrupt_handler_t)(void *);
93 #include <asm/u-boot.h> /* boot information for Linux kernel */
94 #include <asm/global_data.h> /* global data used for startup functions */
97 * enable common handling for all TQM8xxL/M boards:
98 * - CONFIG_TQM8xxM will be defined for all TQM8xxM boards
99 * - CONFIG_TQM8xxL will be defined for all TQM8xxL _and_ TQM8xxM boards
101 #if defined(CONFIG_TQM823M) || defined(CONFIG_TQM850M) || \
102 defined(CONFIG_TQM855M) || defined(CONFIG_TQM860M) || \
103 defined(CONFIG_TQM862M)
104 # ifndef CONFIG_TQM8xxM
105 # define CONFIG_TQM8xxM
108 #if defined(CONFIG_TQM823L) || defined(CONFIG_TQM850L) || \
109 defined(CONFIG_TQM855L) || defined(CONFIG_TQM860L) || \
110 defined(CONFIG_TQM862L) || defined(CONFIG_TQM8xxM)
111 # ifndef CONFIG_TQM8xxL
112 # define CONFIG_TQM8xxL
118 * General Purpose Utilities
121 ({ typeof (X) __x = (X), __y = (Y); \
122 (__x < __y) ? __x : __y; })
125 ({ typeof (X) __x = (X), __y = (Y); \
126 (__x > __y) ? __x : __y; })
130 * Function Prototypes
133 #if CONFIG_SERIAL_SOFTWARE_FIFO
134 void serial_buffered_init (void);
135 void serial_buffered_putc (const char);
136 void serial_buffered_puts (const char *);
137 int serial_buffered_getc (void);
138 int serial_buffered_tstc (void);
139 #endif /* CONFIG_SERIAL_SOFTWARE_FIFO */
141 void hang (void) __attribute__ ((noreturn));
144 long int initdram (int);
145 int display_options (void);
146 void print_size (ulong, const char *);
149 void main_loop (void);
150 int run_command (const char *cmd, int flag);
151 int readline (const char *const prompt);
152 void init_cmd_timeout(void);
153 void reset_cmd_timeout(void);
155 /* lib_$(ARCH)/board.c */
156 void board_init_f (ulong);
157 void board_init_r (gd_t *, ulong);
158 int checkboard (void);
159 int checkflash (void);
160 int checkdram (void);
161 char * strmhz(char *buf, long hz);
162 int last_stage_init(void);
163 extern ulong monitor_flash_len;
166 void flash_perror (int);
168 /* common/cmd_autoscript.c */
169 int autoscript (ulong addr);
171 /* common/cmd_bootm.c */
172 void print_image_hdr (image_header_t *hdr);
174 extern ulong load_addr; /* Default Load Address */
176 /* common/cmd_nvedit.c */
178 void env_relocate (void);
179 char *getenv (uchar *);
180 int getenv_r (uchar *name, uchar *buf, unsigned len);
182 #ifdef CONFIG_PPC /* ARM version to be fixed! */
183 void inline setenv (char *, char *);
185 void setenv (char *, char *);
186 #endif /* CONFIG_PPC */
188 # include <asm/u-boot-arm.h> /* ARM version to be fixed! */
189 #endif /* CONFIG_ARM */
190 #ifdef CONFIG_I386 /* x86 version to be fixed! */
191 # include <asm/u-boot-i386.h>
192 #endif /* CONFIG_I386 */
194 void pci_init (void);
195 void pci_init_board(void);
196 void pciinfo (int, int);
198 #if defined(CONFIG_PCI) && defined(CONFIG_440)
199 # if defined(CFG_PCI_PRE_INIT)
200 int pci_pre_init (struct pci_controller * );
202 # if defined(CFG_PCI_TARGET_INIT)
203 void pci_target_init (struct pci_controller *);
205 # if defined(CFG_PCI_MASTER_INIT)
206 void pci_master_init (struct pci_controller *);
208 int is_pci_host (struct pci_controller *);
211 int misc_init_f (void);
212 int misc_init_r (void);
214 /* common/exports.c */
215 void jumptable_init(void);
217 /* $(BOARD)/$(BOARD).c */
218 void reset_phy (void);
219 void fdc_hw_init (void);
221 /* $(BOARD)/eeprom.c */
222 void eeprom_init (void);
224 int eeprom_probe (unsigned dev_addr, unsigned offset);
226 int eeprom_read (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt);
227 int eeprom_write (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt);
229 extern uchar pic_read (uchar reg);
230 extern void pic_write (uchar reg, uchar val);
234 * Set this up regardless of board
235 * type, to prevent errors.
237 #if defined(CONFIG_SPI) || !defined(CFG_I2C_EEPROM_ADDR)
238 # define CFG_DEF_EEPROM_ADDR 0
240 # define CFG_DEF_EEPROM_ADDR CFG_I2C_EEPROM_ADDR
241 #endif /* CONFIG_SPI || !defined(CFG_I2C_EEPROM_ADDR) */
243 #if defined(CONFIG_SPI)
244 extern void spi_init_f (void);
245 extern void spi_init_r (void);
246 extern ssize_t spi_read (uchar *, int, uchar *, int);
247 extern ssize_t spi_write (uchar *, int, uchar *, int);
250 #ifdef CONFIG_RPXCLASSIC
251 void rpxclassic_init (void);
255 /* $(BOARD)/mbx8xx.c */
256 void mbx_init (void);
257 void board_serial_init (void);
258 void board_ether_init (void);
261 #if defined(CONFIG_RPXCLASSIC) || defined(CONFIG_MBX) || defined(CONFIG_IAD210)
262 void board_get_enetaddr (uchar *addr);
266 /* $(BOARD)/hermes.c */
267 void hermes_start_lxt980 (int speed);
270 #ifdef CONFIG_EVB64260
271 void evb64260_init(void);
272 void debug_led(int, int);
273 void display_mem_map(void);
274 void perform_soft_reset(void);
277 void load_sernum_ethaddr (void);
279 /* $(BOARD)/$(BOARD).c */
280 int board_pre_init (void);
281 int board_post_init (void);
282 int board_postclk_init (void); /* after clocks/timebase, before env/serial */
283 void board_poweroff (void);
285 #if defined(CFG_DRAM_TEST)
287 #endif /* CFG_DRAM_TEST */
290 #if defined(CONFIG_5xx) || \
292 uint get_immr (uint);
296 uint rd_ic_cst (void);
297 void wr_ic_cst (uint);
298 void wr_ic_adr (uint);
299 uint rd_dc_cst (void);
300 void wr_dc_cst (uint);
301 void wr_dc_adr (uint);
302 int icache_status (void);
303 void icache_enable (void);
304 void icache_disable(void);
305 int dcache_status (void);
306 void dcache_enable (void);
307 void dcache_disable(void);
308 void relocate_code (ulong, gd_t *, ulong);
309 ulong get_endaddr (void);
310 void trap_init (ulong);
311 #if defined (CONFIG_4xx) || \
312 defined (CONFIG_74xx_7xx) || \
313 defined (CONFIG_74x) || \
314 defined (CONFIG_75x) || \
315 defined (CONFIG_74xx)
316 unsigned char in8(unsigned int);
317 void out8(unsigned int, unsigned char);
318 unsigned short in16(unsigned int);
319 unsigned short in16r(unsigned int);
320 void out16(unsigned int, unsigned short value);
321 void out16r(unsigned int, unsigned short value);
322 unsigned long in32(unsigned int);
323 unsigned long in32r(unsigned int);
324 void out32(unsigned int, unsigned long value);
325 void out32r(unsigned int, unsigned long value);
326 void ppcDcbf(unsigned long value);
327 void ppcDcbi(unsigned long value);
333 int checkicache (void);
334 int checkdcache (void);
335 void upmconfig (unsigned int, unsigned int *, unsigned int);
336 ulong get_tbclk (void);
338 /* $(CPU)/serial.c */
339 int serial_init (void);
340 void serial_setbrg (void);
341 void serial_putc (const char);
342 void serial_puts (const char *);
343 void serial_addr (unsigned int);
344 int serial_getc (void);
345 int serial_tstc (void);
348 int get_clocks (void);
349 #if defined(CONFIG_8260)
350 int prt_8260_clks (void);
352 #if defined(CONFIG_MPC5XXX)
353 int prt_mpc5xxx_clks (void);
356 ulong get_OPB_freq (void);
357 ulong get_PCI_freq (void);
359 #if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410)
360 ulong get_FCLK (void);
361 ulong get_HCLK (void);
362 ulong get_PCLK (void);
363 ulong get_UCLK (void);
365 ulong get_bus_freq (ulong);
367 #if defined(CONFIG_MPC85xx)
368 typedef MPC85xx_SYS_INFO sys_info_t;
369 void get_sys_info ( sys_info_t * );
372 #if defined(CONFIG_4xx) || defined(CONFIG_IOP480)
373 # if defined(CONFIG_440)
374 typedef PPC440_SYS_INFO sys_info_t;
376 typedef PPC405_SYS_INFO sys_info_t;
378 void get_sys_info ( sys_info_t * );
381 /* $(CPU)/cpu_init.c */
382 #if defined(CONFIG_8xx) || defined(CONFIG_8260)
383 void cpu_init_f (volatile immap_t *immr);
385 #if defined(CONFIG_4xx) || defined(CONFIG_MPC85xx)
386 void cpu_init_f (void);
388 int cpu_init_r (void);
389 #if defined(CONFIG_8260)
390 int prt_8260_rsr (void);
393 /* $(CPU)/interrupts.c */
394 int interrupt_init (void);
395 void timer_interrupt (struct pt_regs *);
396 void external_interrupt (struct pt_regs *);
397 void irq_install_handler(int, interrupt_handler_t *, void *);
398 void irq_free_handler (int);
399 void reset_timer (void);
400 ulong get_timer (ulong base);
401 void set_timer (ulong t);
402 void enable_interrupts (void);
403 int disable_interrupts (void);
405 /* $(CPU)/.../commproc.c */
406 int dpram_init (void);
407 uint dpram_base(void);
408 uint dpram_base_align(uint align);
409 uint dpram_alloc(uint size);
410 uint dpram_alloc_align(uint size,uint align);
411 void post_word_store (ulong);
412 ulong post_word_load (void);
413 void bootcount_store (ulong);
414 ulong bootcount_load (void);
415 #define BOOTCOUNT_MAGIC 0xB001C041
417 /* $(CPU)/.../<eth> */
418 void mii_init (void);
420 /* $(CPU)/.../lcd.c */
421 ulong lcd_setmem (ulong);
423 /* $(CPU)/.../vfd.c */
424 ulong vfd_setmem (ulong);
426 /* $(CPU)/.../video.c */
427 ulong video_setmem (ulong);
430 void flush_cache (unsigned long, unsigned long);
433 /* lib_$(ARCH)/ticks.S */
434 unsigned long long get_ticks(void);
435 void wait_ticks (unsigned long);
437 /* lib_$(ARCH)/time.c */
438 void udelay (unsigned long);
439 ulong usec2ticks (unsigned long usec);
440 ulong ticks2usec (unsigned long ticks);
441 int init_timebase (void);
443 /* lib_generic/vsprintf.c */
444 ulong simple_strtoul(const char *cp,char **endp,unsigned int base);
445 long simple_strtol(const char *cp,char **endp,unsigned int base);
446 void panic(const char *fmt, ...);
447 int sprintf(char * buf, const char *fmt, ...);
448 int vsprintf(char *buf, const char *fmt, va_list args);
450 /* lib_generic/crc32.c */
451 ulong crc32 (ulong, const unsigned char *, uint);
452 ulong crc32_no_comp (ulong, const unsigned char *, uint);
454 /* common/console.c */
455 int console_init_f(void); /* Before relocation; uses the serial stuff */
456 int console_init_r(void); /* After relocation; uses the console stuff */
457 int console_assign (int file, char *devname); /* Assign the console */
459 int had_ctrlc (void); /* have we had a Control-C since last clear? */
460 void clear_ctrlc (void); /* clear the Control-C condition */
461 int disable_ctrlc (int); /* 1 to disable, 0 to enable Control-C detect */
464 * STDIO based functions (can always be used)
468 void serial_printf (const char *fmt, ...);
475 void putc(const char c);
476 void puts(const char *s);
477 void printf(const char *fmt, ...);
478 void vprintf(const char *fmt, va_list args);
481 #define eputc(c) fputc(stderr, c)
482 #define eputs(s) fputs(stderr, s)
483 #define eprintf(fmt,args...) fprintf(stderr,fmt ,##args)
486 * FILE based functions (can only be used AFTER relocation!)
494 void fprintf(int file, const char *fmt, ...);
495 void fputs(int file, const char *s);
496 void fputc(int file, const char c);
500 int pcmcia_init (void);
502 #ifdef CONFIG_SHOW_BOOT_PROGRESS
503 void show_boot_progress (int status);
506 #endif /* __COMMON_H_ */