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>
46 #elif defined(CONFIG_5xx)
47 #include <asm/5xx_immap.h>
48 #elif defined(CONFIG_8260)
49 #include <asm/immap_8260.h>
55 #include <board/hymod/hymod.h>
58 #define asmlinkage /* nothing */
66 #define debug(fmt,args...) printf (fmt ,##args)
67 #define debugX(level,fmt,args...) if (DEBUG>=level) printf(fmt,##args);
69 #define debug(fmt,args...)
70 #define debugX(level,fmt,args...)
73 typedef void (interrupt_handler_t
)(void *);
75 #include <asm/u-boot.h> /* boot information for Linux kernel */
76 #include <asm/global_data.h> /* global data used for startup functions */
79 * enable common handling for all TQM8xxL/M boards:
80 * - CONFIG_TQM8xxM will be defined for all TQM8xxM boards
81 * - CONFIG_TQM8xxL will be defined for all TQM8xxL _and_ TQM8xxM boards
83 #if defined(CONFIG_TQM823M) || defined(CONFIG_TQM850M) || \
84 defined(CONFIG_TQM855M) || defined(CONFIG_TQM860M) || \
85 defined(CONFIG_TQM862M)
86 # ifndef CONFIG_TQM8xxM
87 # define CONFIG_TQM8xxM
90 #if defined(CONFIG_TQM823L) || defined(CONFIG_TQM850L) || \
91 defined(CONFIG_TQM855L) || defined(CONFIG_TQM860L) || \
92 defined(CONFIG_TQM862L) || defined(CONFIG_TQM8xxM)
93 # ifndef CONFIG_TQM8xxL
94 # define CONFIG_TQM8xxL
100 * General Purpose Utilities
103 ({ typeof (X) __x = (X), __y = (Y); \
104 (__x < __y) ? __x : __y; })
107 ({ typeof (X) __x = (X), __y = (Y); \
108 (__x > __y) ? __x : __y; })
112 * Function Prototypes
115 #if CONFIG_SERIAL_SOFTWARE_FIFO
116 void serial_buffered_init (void);
117 void serial_buffered_putc (const char);
118 void serial_buffered_puts (const char *);
119 int serial_buffered_getc (void);
120 int serial_buffered_tstc (void);
121 #endif /* CONFIG_SERIAL_SOFTWARE_FIFO */
123 void hang (void) __attribute__ ((noreturn
));
126 long int initdram (int);
127 int display_options (void);
128 void print_size (ulong
, const char *);
131 void main_loop (void);
132 int run_command (const char *cmd
, int flag
);
133 int readline (const char *const prompt
);
134 void init_cmd_timeout(void);
135 void reset_cmd_timeout(void);
138 void board_init_f (ulong
);
139 void board_init_r (gd_t
*, ulong
);
140 int checkboard (void);
141 int checkflash (void);
142 int checkdram (void);
143 char * strmhz(char *buf
, long hz
);
144 int last_stage_init(void);
145 extern ulong monitor_flash_len
;
148 void flash_perror (int);
150 /* common/cmd_bootm.c */
151 void print_image_hdr (image_header_t
*hdr
);
153 extern ulong load_addr
; /* Default Load Address */
155 /* common/cmd_nvedit.c */
157 void env_relocate (void);
158 char *getenv (uchar
*);
159 int getenv_r (uchar
*name
, uchar
*buf
, unsigned len
);
161 #ifdef CONFIG_PPC /* ARM version to be fixed! */
162 void inline setenv (char *, char *);
164 void setenv (char *, char *);
165 #endif /* CONFIG_PPC */
167 # include <asm/u-boot-arm.h> /* ARM version to be fixed! */
168 #endif /* CONFIG_ARM */
169 #ifdef CONFIG_I386 /* x86 version to be fixed! */
170 # include <asm/u-boot-i386.h>
171 #endif /* CONFIG_I386 */
173 void pci_init (void);
174 void pci_init_board(void);
175 void pciinfo (int, int);
177 #if defined(CONFIG_PCI) && defined(CONFIG_440)
178 # if defined(CFG_PCI_PRE_INIT)
179 int pci_pre_init (struct pci_controller
* );
181 # if defined(CFG_PCI_TARGET_INIT)
182 void pci_target_init (struct pci_controller
*);
184 # if defined(CFG_PCI_MASTER_INIT)
185 void pci_master_init (struct pci_controller
*);
187 int is_pci_host (struct pci_controller
*);
190 int misc_init_f (void);
191 int misc_init_r (void);
193 /* $(BOARD)/$(BOARD).c */
194 void reset_phy (void);
195 void fdc_hw_init (void);
197 /* $(BOARD)/eeprom.c */
198 void eeprom_init (void);
200 int eeprom_probe (unsigned dev_addr
, unsigned offset
);
202 int eeprom_read (unsigned dev_addr
, unsigned offset
, uchar
*buffer
, unsigned cnt
);
203 int eeprom_write (unsigned dev_addr
, unsigned offset
, uchar
*buffer
, unsigned cnt
);
205 extern uchar
pic_read (uchar reg
);
206 extern void pic_write (uchar reg
, uchar val
);
210 * Set this up regardless of board
211 * type, to prevent errors.
213 #if defined(CONFIG_SPI) || !defined(CFG_I2C_EEPROM_ADDR)
214 # define CFG_DEF_EEPROM_ADDR 0
216 # define CFG_DEF_EEPROM_ADDR CFG_I2C_EEPROM_ADDR
217 #endif /* CONFIG_SPI || !defined(CFG_I2C_EEPROM_ADDR) */
219 #if defined(CONFIG_PCU_E) || defined(CONFIG_CCM) || defined(CONFIG_ATC)
220 extern void spi_init_f (void);
221 extern void spi_init_r (void);
222 extern ssize_t
spi_read (uchar
*, int, uchar
*, int);
223 extern ssize_t
spi_write (uchar
*, int, uchar
*, int);
226 #ifdef CONFIG_RPXCLASSIC
227 void rpxclassic_init (void);
231 /* $(BOARD)/mbx8xx.c */
232 void mbx_init (void);
233 void board_serial_init (void);
234 void board_ether_init (void);
237 #if defined(CONFIG_RPXCLASSIC) || defined(CONFIG_MBX) || defined(CONFIG_IAD210)
238 void board_get_enetaddr (uchar
*addr
);
242 /* $(BOARD)/hermes.c */
243 void hermes_start_lxt980 (int speed
);
246 #ifdef CONFIG_EVB64260
247 void evb64260_init(void);
248 void debug_led(int, int);
249 void display_mem_map(void);
250 void perform_soft_reset(void);
253 void load_sernum_ethaddr (void);
255 /* $(BOARD)/$(BOARD).c */
256 int board_pre_init (void);
257 int board_post_init (void);
258 int board_postclk_init (void); /* after clocks/timebase, before env/serial */
259 void board_poweroff (void);
261 #if defined(CFG_DRAM_TEST)
263 #endif /* CFG_DRAM_TEST */
266 #if defined(CONFIG_5xx) || \
268 uint
get_immr (uint
);
271 uint
rd_ic_cst (void);
272 void wr_ic_cst (uint
);
273 void wr_ic_adr (uint
);
274 uint
rd_dc_cst (void);
275 void wr_dc_cst (uint
);
276 void wr_dc_adr (uint
);
277 int icache_status (void);
278 void icache_enable (void);
279 void icache_disable(void);
280 int dcache_status (void);
281 void dcache_enable (void);
282 void dcache_disable(void);
283 void relocate_code (ulong
, gd_t
*, ulong
);
284 ulong
get_endaddr (void);
285 void trap_init (ulong
);
286 #if defined (CONFIG_4xx) || \
287 defined (CONFIG_74xx_7xx) || \
288 defined (CONFIG_74x) || \
289 defined (CONFIG_75x) || \
290 defined (CONFIG_74xx)
291 unsigned char in8(unsigned int);
292 void out8(unsigned int, unsigned char);
293 unsigned short in16(unsigned int);
294 unsigned short in16r(unsigned int);
295 void out16(unsigned int, unsigned short value
);
296 void out16r(unsigned int, unsigned short value
);
297 unsigned long in32(unsigned int);
298 unsigned long in32r(unsigned int);
299 void out32(unsigned int, unsigned long value
);
300 void out32r(unsigned int, unsigned long value
);
301 void ppcDcbf(unsigned long value
);
302 void ppcDcbi(unsigned long value
);
308 int checkicache (void);
309 int checkdcache (void);
310 void upmconfig (unsigned int, unsigned int *, unsigned int);
311 ulong
get_tbclk (void);
313 /* $(CPU)/serial.c */
314 int serial_init (void);
315 void serial_setbrg (void);
316 void serial_putc (const char);
317 void serial_puts (const char *);
318 void serial_addr (unsigned int);
319 int serial_getc (void);
320 int serial_tstc (void);
323 int get_clocks (void);
324 #if defined(CONFIG_8260)
325 int prt_8260_clks (void);
328 ulong
get_OPB_freq (void);
329 ulong
get_PCI_freq (void);
331 #if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410)
332 ulong
get_FCLK (void);
333 ulong
get_HCLK (void);
334 ulong
get_PCLK (void);
335 ulong
get_UCLK (void);
337 ulong
get_bus_freq (ulong
);
339 #if defined(CONFIG_4xx) || defined(CONFIG_IOP480)
340 # if defined(CONFIG_440)
341 typedef PPC440_SYS_INFO sys_info_t
;
343 typedef PPC405_SYS_INFO sys_info_t
;
345 void get_sys_info ( sys_info_t
* );
348 /* $(CPU)/cpu_init.c */
349 #if defined(CONFIG_8xx) || defined(CONFIG_8260)
350 void cpu_init_f (volatile immap_t
*immr
);
353 void cpu_init_f (void);
355 int cpu_init_r (void);
356 #if defined(CONFIG_8260)
357 int prt_8260_rsr (void);
360 /* $(CPU)/interrupts.c */
361 int interrupt_init (void);
362 void timer_interrupt (struct pt_regs
*);
363 void external_interrupt (struct pt_regs
*);
364 void irq_install_handler(int, interrupt_handler_t
*, void *);
365 void irq_free_handler (int);
366 void reset_timer (void);
367 ulong
get_timer (ulong base
);
368 void set_timer (ulong t
);
369 void enable_interrupts (void);
370 int disable_interrupts (void);
372 /* $(CPU)/.../commproc.c */
373 int dpram_init (void);
374 uint
dpram_base(void);
375 uint
dpram_base_align(uint align
);
376 uint
dpram_alloc(uint size
);
377 uint
dpram_alloc_align(uint size
,uint align
);
378 void post_word_store (ulong
);
379 ulong
post_word_load (void);
381 /* $(CPU)/.../<eth> */
382 void mii_init (void);
384 /* $(CPU)/.../lcd.c */
385 ulong
lcd_setmem (ulong
);
387 /* $(CPU)/.../vfd.c */
388 ulong
vfd_setmem (ulong
);
390 /* $(CPU)/.../video.c */
391 ulong
video_setmem (ulong
);
394 void flush_cache (unsigned long, unsigned long);
398 unsigned long long get_ticks(void);
399 void wait_ticks (unsigned long);
402 void udelay (unsigned long);
403 ulong
usec2ticks (unsigned long usec
);
404 ulong
ticks2usec (unsigned long ticks
);
405 int init_timebase (void);
408 ulong
simple_strtoul(const char *cp
,char **endp
,unsigned int base
);
409 long simple_strtol(const char *cp
,char **endp
,unsigned int base
);
410 void panic(const char *fmt
, ...);
411 int sprintf(char * buf
, const char *fmt
, ...);
412 int vsprintf(char *buf
, const char *fmt
, va_list args
);
415 ulong
crc32 (ulong
, const unsigned char *, uint
);
416 ulong
crc32_no_comp (ulong
, const unsigned char *, uint
);
418 /* common/console.c */
419 extern void **syscall_tbl
;
421 int console_init_f(void); /* Before relocation; uses the serial stuff */
422 int console_init_r(void); /* After relocation; uses the console stuff */
423 int console_assign (int file
, char *devname
); /* Assign the console */
425 int had_ctrlc (void); /* have we had a Control-C since last clear? */
426 void clear_ctrlc (void); /* clear the Control-C condition */
427 int disable_ctrlc (int); /* 1 to disable, 0 to enable Control-C detect */
430 * STDIO based functions (can always be used)
434 void serial_printf (const char *fmt
, ...);
441 void putc(const char c
);
442 void puts(const char *s
);
443 void printf(const char *fmt
, ...);
444 void vprintf(const char *fmt
, va_list args
);
447 #define eputc(c) fputc(stderr, c)
448 #define eputs(s) fputs(stderr, s)
449 #define eprintf(fmt,args...) fprintf(stderr,fmt ,##args)
452 * FILE based functions (can only be used AFTER relocation!)
460 void fprintf(int file
, const char *fmt
, ...);
461 void fputs(int file
, const char *s
);
462 void fputc(int file
, const char c
);
466 int pcmcia_init (void);
468 #ifdef CONFIG_SHOW_BOOT_PROGRESS
469 void show_boot_progress (int status
);
472 #endif /* __COMMON_H_ */