2 * (C) Copyright 2000-2004
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_MPC852) || defined(CONFIG_MPC852T) || \
53 defined(CONFIG_MPC859) || defined(CONFIG_MPC859T) || \
54 defined(CONFIG_MPC859DSL) || \
55 defined(CONFIG_MPC866) || defined(CONFIG_MPC866T) || \
56 defined(CONFIG_MPC866P)
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) || defined(CONFIG_TQM866M)
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/setup.h>
189 # include <asm/u-boot-arm.h> /* ARM version to be fixed! */
190 #endif /* CONFIG_ARM */
191 #ifdef CONFIG_I386 /* x86 version to be fixed! */
192 # include <asm/u-boot-i386.h>
193 #endif /* CONFIG_I386 */
195 void pci_init (void);
196 void pci_init_board(void);
197 void pciinfo (int, int);
199 #if defined(CONFIG_PCI) && defined(CONFIG_440)
200 # if defined(CFG_PCI_PRE_INIT)
201 int pci_pre_init (struct pci_controller * );
203 # if defined(CFG_PCI_TARGET_INIT)
204 void pci_target_init (struct pci_controller *);
206 # if defined(CFG_PCI_MASTER_INIT)
207 void pci_master_init (struct pci_controller *);
209 int is_pci_host (struct pci_controller *);
212 int misc_init_f (void);
213 int misc_init_r (void);
215 /* common/exports.c */
216 void jumptable_init(void);
218 /* $(BOARD)/$(BOARD).c */
219 void reset_phy (void);
220 void fdc_hw_init (void);
222 /* $(BOARD)/eeprom.c */
223 void eeprom_init (void);
225 int eeprom_probe (unsigned dev_addr, unsigned offset);
227 int eeprom_read (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt);
228 int eeprom_write (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt);
230 extern uchar pic_read (uchar reg);
231 extern void pic_write (uchar reg, uchar val);
235 * Set this up regardless of board
236 * type, to prevent errors.
238 #if defined(CONFIG_SPI) || !defined(CFG_I2C_EEPROM_ADDR)
239 # define CFG_DEF_EEPROM_ADDR 0
241 # define CFG_DEF_EEPROM_ADDR CFG_I2C_EEPROM_ADDR
242 #endif /* CONFIG_SPI || !defined(CFG_I2C_EEPROM_ADDR) */
244 #if defined(CONFIG_SPI)
245 extern void spi_init_f (void);
246 extern void spi_init_r (void);
247 extern ssize_t spi_read (uchar *, int, uchar *, int);
248 extern ssize_t spi_write (uchar *, int, uchar *, int);
251 #ifdef CONFIG_RPXCLASSIC
252 void rpxclassic_init (void);
256 /* $(BOARD)/mbx8xx.c */
257 void mbx_init (void);
258 void board_serial_init (void);
259 void board_ether_init (void);
262 #if defined(CONFIG_RPXCLASSIC) || defined(CONFIG_MBX) || defined(CONFIG_IAD210)
263 void board_get_enetaddr (uchar *addr);
267 /* $(BOARD)/hermes.c */
268 void hermes_start_lxt980 (int speed);
271 #ifdef CONFIG_EVB64260
272 void evb64260_init(void);
273 void debug_led(int, int);
274 void display_mem_map(void);
275 void perform_soft_reset(void);
278 void load_sernum_ethaddr (void);
280 /* $(BOARD)/$(BOARD).c */
281 int board_pre_init (void);
282 int board_post_init (void);
283 int board_postclk_init (void); /* after clocks/timebase, before env/serial */
284 void board_poweroff (void);
286 #if defined(CFG_DRAM_TEST)
288 #endif /* CFG_DRAM_TEST */
291 #if defined(CONFIG_5xx) || \
293 uint get_immr (uint);
297 uint rd_ic_cst (void);
298 void wr_ic_cst (uint);
299 void wr_ic_adr (uint);
300 uint rd_dc_cst (void);
301 void wr_dc_cst (uint);
302 void wr_dc_adr (uint);
303 int icache_status (void);
304 void icache_enable (void);
305 void icache_disable(void);
306 int dcache_status (void);
307 void dcache_enable (void);
308 void dcache_disable(void);
309 void relocate_code (ulong, gd_t *, ulong);
310 ulong get_endaddr (void);
311 void trap_init (ulong);
312 #if defined (CONFIG_4xx) || \
313 defined (CONFIG_74xx_7xx) || \
314 defined (CONFIG_74x) || \
315 defined (CONFIG_75x) || \
316 defined (CONFIG_74xx)
317 unsigned char in8(unsigned int);
318 void out8(unsigned int, unsigned char);
319 unsigned short in16(unsigned int);
320 unsigned short in16r(unsigned int);
321 void out16(unsigned int, unsigned short value);
322 void out16r(unsigned int, unsigned short value);
323 unsigned long in32(unsigned int);
324 unsigned long in32r(unsigned int);
325 void out32(unsigned int, unsigned long value);
326 void out32r(unsigned int, unsigned long value);
327 void ppcDcbf(unsigned long value);
328 void ppcDcbi(unsigned long value);
334 int checkicache (void);
335 int checkdcache (void);
336 void upmconfig (unsigned int, unsigned int *, unsigned int);
337 ulong get_tbclk (void);
339 /* $(CPU)/serial.c */
340 int serial_init (void);
341 void serial_setbrg (void);
342 void serial_putc (const char);
343 void serial_puts (const char *);
344 void serial_addr (unsigned int);
345 int serial_getc (void);
346 int serial_tstc (void);
349 int get_clocks (void);
350 #if defined(CONFIG_8260)
351 int prt_8260_clks (void);
353 #if defined(CONFIG_MPC5XXX)
354 int prt_mpc5xxx_clks (void);
357 ulong get_OPB_freq (void);
358 ulong get_PCI_freq (void);
360 #if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410)
361 ulong get_FCLK (void);
362 ulong get_HCLK (void);
363 ulong get_PCLK (void);
364 ulong get_UCLK (void);
366 #if defined CONFIG_INCA_IP
367 uint incaip_get_cpuclk (void);
369 ulong get_bus_freq (ulong);
371 #if defined(CONFIG_MPC85xx)
372 typedef MPC85xx_SYS_INFO sys_info_t;
373 void get_sys_info ( sys_info_t * );
376 #if defined(CONFIG_4xx) || defined(CONFIG_IOP480)
377 # if defined(CONFIG_440)
378 typedef PPC440_SYS_INFO sys_info_t;
380 typedef PPC405_SYS_INFO sys_info_t;
382 void get_sys_info ( sys_info_t * );
385 /* $(CPU)/cpu_init.c */
386 #if defined(CONFIG_8xx) || defined(CONFIG_8260)
387 void cpu_init_f (volatile immap_t *immr);
389 #if defined(CONFIG_4xx) || defined(CONFIG_MPC85xx)
390 void cpu_init_f (void);
392 int cpu_init_r (void);
393 #if defined(CONFIG_8260)
394 int prt_8260_rsr (void);
397 /* $(CPU)/interrupts.c */
398 int interrupt_init (void);
399 void timer_interrupt (struct pt_regs *);
400 void external_interrupt (struct pt_regs *);
401 void irq_install_handler(int, interrupt_handler_t *, void *);
402 void irq_free_handler (int);
403 void reset_timer (void);
404 ulong get_timer (ulong base);
405 void set_timer (ulong t);
406 void enable_interrupts (void);
407 int disable_interrupts (void);
409 /* $(CPU)/.../commproc.c */
410 int dpram_init (void);
411 uint dpram_base(void);
412 uint dpram_base_align(uint align);
413 uint dpram_alloc(uint size);
414 uint dpram_alloc_align(uint size,uint align);
415 void post_word_store (ulong);
416 ulong post_word_load (void);
417 void bootcount_store (ulong);
418 ulong bootcount_load (void);
419 #define BOOTCOUNT_MAGIC 0xB001C041
421 /* $(CPU)/.../<eth> */
422 void mii_init (void);
424 /* $(CPU)/.../lcd.c */
425 ulong lcd_setmem (ulong);
427 /* $(CPU)/.../vfd.c */
428 ulong vfd_setmem (ulong);
430 /* $(CPU)/.../video.c */
431 ulong video_setmem (ulong);
434 void flush_cache (unsigned long, unsigned long);
437 /* lib_$(ARCH)/ticks.S */
438 unsigned long long get_ticks(void);
439 void wait_ticks (unsigned long);
441 /* lib_$(ARCH)/time.c */
442 void udelay (unsigned long);
443 ulong usec2ticks (unsigned long usec);
444 ulong ticks2usec (unsigned long ticks);
445 int init_timebase (void);
447 /* lib_generic/vsprintf.c */
448 ulong simple_strtoul(const char *cp,char **endp,unsigned int base);
449 long simple_strtol(const char *cp,char **endp,unsigned int base);
450 void panic(const char *fmt, ...);
451 int sprintf(char * buf, const char *fmt, ...);
452 int vsprintf(char *buf, const char *fmt, va_list args);
454 /* lib_generic/crc32.c */
455 ulong crc32 (ulong, const unsigned char *, uint);
456 ulong crc32_no_comp (ulong, const unsigned char *, uint);
458 /* common/console.c */
459 int console_init_f(void); /* Before relocation; uses the serial stuff */
460 int console_init_r(void); /* After relocation; uses the console stuff */
461 int console_assign (int file, char *devname); /* Assign the console */
463 int had_ctrlc (void); /* have we had a Control-C since last clear? */
464 void clear_ctrlc (void); /* clear the Control-C condition */
465 int disable_ctrlc (int); /* 1 to disable, 0 to enable Control-C detect */
468 * STDIO based functions (can always be used)
472 void serial_printf (const char *fmt, ...);
479 void putc(const char c);
480 void puts(const char *s);
481 void printf(const char *fmt, ...);
482 void vprintf(const char *fmt, va_list args);
485 #define eputc(c) fputc(stderr, c)
486 #define eputs(s) fputs(stderr, s)
487 #define eprintf(fmt,args...) fprintf(stderr,fmt ,##args)
490 * FILE based functions (can only be used AFTER relocation!)
498 void fprintf(int file, const char *fmt, ...);
499 void fputs(int file, const char *s);
500 void fputc(int file, const char c);
504 int pcmcia_init (void);
506 #ifdef CONFIG_SHOW_BOOT_PROGRESS
507 void show_boot_progress (int status);
510 #endif /* __COMMON_H_ */