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 <asm/hymod.h>
58 #define asmlinkage /* nothing */
66 #define debug(fmt,args...) printf (fmt ,##args)
68 #define debug(fmt,args...)
71 typedef void (interrupt_handler_t
)(void *);
73 #include <asm/u-boot.h> /* boot information for Linux kernel */
74 #include <asm/global_data.h> /* global data used for startup functions */
77 * enable common handling for all TQM8xxL/M boards:
78 * - CONFIG_TQM8xxM will be defined for all TQM8xxM boards
79 * - CONFIG_TQM8xxL will be defined for all TQM8xxL _and_ TQM8xxM boards
81 #if defined(CONFIG_TQM823M) || defined(CONFIG_TQM850M) || \
82 defined(CONFIG_TQM855M) || defined(CONFIG_TQM860M) || \
83 defined(CONFIG_TQM862M)
84 # ifndef CONFIG_TQM8xxM
85 # define CONFIG_TQM8xxM
88 #if defined(CONFIG_TQM823L) || defined(CONFIG_TQM850L) || \
89 defined(CONFIG_TQM855L) || defined(CONFIG_TQM860L) || \
90 defined(CONFIG_TQM862L) || defined(CONFIG_TQM8xxM)
91 # ifndef CONFIG_TQM8xxL
92 # define CONFIG_TQM8xxL
98 * General Purpose Utilities
101 ({ typeof (X) __x = (X), __y = (Y); \
102 (__x < __y) ? __x : __y; })
105 ({ typeof (X) __x = (X), __y = (Y); \
106 (__x > __y) ? __x : __y; })
110 * Function Prototypes
113 #if CONFIG_SERIAL_SOFTWARE_FIFO
114 void serial_buffered_init (void);
115 void serial_buffered_putc (const char);
116 void serial_buffered_puts (const char *);
117 int serial_buffered_getc (void);
118 int serial_buffered_tstc (void);
119 #endif /* CONFIG_SERIAL_SOFTWARE_FIFO */
121 void hang (void) __attribute__ ((noreturn
));
124 long int initdram (int);
125 int display_options (void);
126 void print_size (ulong
, const char *);
129 void main_loop (void);
130 int run_command (const char *cmd
, int flag
);
131 int readline (const char *const prompt
);
132 void reset_cmd_timeout(void);
135 void board_init_f (ulong
);
136 void board_init_r (gd_t
*, ulong
);
137 int checkboard (void);
138 int checkflash (void);
139 int checkdram (void);
140 char * strmhz(char *buf
, long hz
);
141 int last_stage_init(void);
142 extern ulong monitor_flash_len
;
145 void flash_perror (int);
147 /* common/cmd_bootm.c */
148 void print_image_hdr (image_header_t
*hdr
);
150 extern ulong load_addr
; /* Default Load Address */
152 /* common/cmd_nvedit.c */
154 void env_relocate (void);
155 char *getenv (uchar
*);
156 int getenv_r (uchar
*name
, uchar
*buf
, unsigned len
);
158 #ifdef CONFIG_PPC /* ARM version to be fixed! */
159 void inline setenv (char *, char *);
161 void setenv (char *, char *);
162 #endif /* CONFIG_PPC */
164 # include <asm/u-boot-arm.h> /* ARM version to be fixed! */
165 #endif /* CONFIG_ARM */
166 #ifdef CONFIG_I386 /* x86 version to be fixed! */
167 # include <asm/u-boot-i386.h>
168 #endif /* CONFIG_I386 */
170 void pci_init (void);
171 void pci_init_board(void);
172 void pciinfo (int, int);
174 #if defined(CONFIG_PCI) && defined(CONFIG_440)
175 # if defined(CFG_PCI_PRE_INIT)
176 int pci_pre_init (struct pci_controller
* );
178 # if defined(CFG_PCI_TARGET_INIT)
179 void pci_target_init (struct pci_controller
*);
181 # if defined(CFG_PCI_MASTER_INIT)
182 void pci_master_init (struct pci_controller
*);
184 int is_pci_host (struct pci_controller
*);
187 int misc_init_f (void);
188 int misc_init_r (void);
190 /* $(BOARD)/$(BOARD).c */
191 void reset_phy (void);
192 void fdc_hw_init (void);
194 /* $(BOARD)/eeprom.c */
195 void eeprom_init (void);
196 int eeprom_read (unsigned dev_addr
, unsigned offset
, uchar
*buffer
, unsigned cnt
);
197 int eeprom_write (unsigned dev_addr
, unsigned offset
, uchar
*buffer
, unsigned cnt
);
199 extern uchar
pic_read (uchar reg
);
200 extern void pic_write (uchar reg
, uchar val
);
204 * Set this up regardless of board
205 * type, to prevent errors.
207 #if defined(CONFIG_SPI) || !defined(CFG_I2C_EEPROM_ADDR)
208 # define CFG_DEF_EEPROM_ADDR 0
210 # define CFG_DEF_EEPROM_ADDR CFG_I2C_EEPROM_ADDR
211 #endif /* CONFIG_SPI || !defined(CFG_I2C_EEPROM_ADDR) */
213 #if defined(CONFIG_PCU_E) || defined(CONFIG_CCM) || defined(CONFIG_ATC)
214 extern void spi_init_f (void);
215 extern void spi_init_r (void);
216 extern ssize_t
spi_read (uchar
*, int, uchar
*, int);
217 extern ssize_t
spi_write (uchar
*, int, uchar
*, int);
220 #ifdef CONFIG_RPXCLASSIC
221 void rpxclassic_init (void);
225 /* $(BOARD)/mbx8xx.c */
226 void mbx_init (void);
227 void board_serial_init (void);
228 void board_ether_init (void);
231 #if defined(CONFIG_RPXCLASSIC) || defined(CONFIG_MBX) || defined(CONFIG_IAD210)
232 void board_get_enetaddr (uchar
*addr
);
236 /* $(BOARD)/hermes.c */
237 void hermes_start_lxt980 (int speed
);
240 #ifdef CONFIG_EVB64260
241 void evb64260_init(void);
242 void debug_led(int, int);
243 void display_mem_map(void);
244 void perform_soft_reset(void);
247 void load_sernum_ethaddr (void);
249 /* $(BOARD)/$(BOARD).c */
250 int board_pre_init (void);
251 int board_post_init (void);
252 int board_postclk_init (void); /* after clocks/timebase, before env/serial */
253 void board_poweroff (void);
255 #if defined(CFG_DRAM_TEST)
257 #endif /* CFG_DRAM_TEST */
260 #if defined(CONFIG_5xx) || \
262 uint
get_immr (uint
);
265 uint
rd_ic_cst (void);
266 void wr_ic_cst (uint
);
267 void wr_ic_adr (uint
);
268 uint
rd_dc_cst (void);
269 void wr_dc_cst (uint
);
270 void wr_dc_adr (uint
);
271 int icache_status (void);
272 void icache_enable (void);
273 void icache_disable(void);
274 int dcache_status (void);
275 void dcache_enable (void);
276 void dcache_disable(void);
277 void relocate_code (ulong
, gd_t
*, ulong
);
278 ulong
get_endaddr (void);
279 void trap_init (ulong
);
280 #if defined (CONFIG_4xx) || \
281 defined (CONFIG_74xx_7xx) || \
282 defined (CONFIG_74x) || \
283 defined (CONFIG_75x) || \
284 defined (CONFIG_74xx)
285 unsigned char in8(unsigned int);
286 void out8(unsigned int, unsigned char);
287 unsigned short in16(unsigned int);
288 unsigned short in16r(unsigned int);
289 void out16(unsigned int, unsigned short value
);
290 void out16r(unsigned int, unsigned short value
);
291 unsigned long in32(unsigned int);
292 unsigned long in32r(unsigned int);
293 void out32(unsigned int, unsigned long value
);
294 void out32r(unsigned int, unsigned long value
);
295 void ppcDcbf(unsigned long value
);
296 void ppcDcbi(unsigned long value
);
302 int checkicache (void);
303 int checkdcache (void);
304 void upmconfig (unsigned int, unsigned int *, unsigned int);
305 ulong
get_tbclk (void);
307 /* $(CPU)/serial.c */
308 int serial_init (void);
309 void serial_setbrg (void);
310 void serial_putc (const char);
311 void serial_puts (const char *);
312 void serial_addr (unsigned int);
313 int serial_getc (void);
314 int serial_tstc (void);
317 int get_clocks (void);
318 #if defined(CONFIG_8260)
319 int prt_8260_clks (void);
322 ulong
get_OPB_freq (void);
323 ulong
get_PCI_freq (void);
325 #if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410)
326 ulong
get_FCLK (void);
327 ulong
get_HCLK (void);
328 ulong
get_PCLK (void);
329 ulong
get_UCLK (void);
331 ulong
get_bus_freq (ulong
);
333 #if defined(CONFIG_4xx) || defined(CONFIG_IOP480)
334 # if defined(CONFIG_440)
335 typedef PPC440_SYS_INFO sys_info_t
;
337 typedef PPC405_SYS_INFO sys_info_t
;
339 void get_sys_info ( sys_info_t
* );
342 /* $(CPU)/cpu_init.c */
343 #if defined(CONFIG_8xx) || defined(CONFIG_8260)
344 void cpu_init_f (volatile immap_t
*immr
);
347 void cpu_init_f (void);
349 int cpu_init_r (void);
350 #if defined(CONFIG_8260)
351 int prt_8260_rsr (void);
354 /* $(CPU)/interrupts.c */
355 int interrupt_init (void);
356 void timer_interrupt (struct pt_regs
*);
357 void external_interrupt (struct pt_regs
*);
358 void irq_install_handler(int, interrupt_handler_t
*, void *);
359 void irq_free_handler (int);
360 void reset_timer (void);
361 ulong
get_timer (ulong base
);
362 void set_timer (ulong t
);
363 void enable_interrupts (void);
364 int disable_interrupts (void);
366 /* $(CPU)/.../commproc.c */
367 int dpram_init (void);
368 uint
dpram_base(void);
369 uint
dpram_base_align(uint align
);
370 uint
dpram_alloc(uint size
);
371 uint
dpram_alloc_align(uint size
,uint align
);
372 void post_word_store (ulong
);
373 ulong
post_word_load (void);
375 /* $(CPU)/.../<eth> */
376 void mii_init (void);
378 /* $(CPU)/.../lcd.c */
379 ulong
lcd_setmem (ulong
);
381 /* $(CPU)/.../vfd.c */
382 ulong
vfd_setmem (ulong
);
384 /* $(CPU)/.../video.c */
385 ulong
video_setmem (ulong
);
388 void flush_cache (unsigned long, unsigned long);
392 unsigned long long get_ticks(void);
393 void wait_ticks (unsigned long);
396 void udelay (unsigned long);
397 ulong
usec2ticks (unsigned long usec
);
398 ulong
ticks2usec (unsigned long ticks
);
399 int init_timebase (void);
402 ulong
simple_strtoul(const char *cp
,char **endp
,unsigned int base
);
403 long simple_strtol(const char *cp
,char **endp
,unsigned int base
);
404 void panic(const char *fmt
, ...);
405 int sprintf(char * buf
, const char *fmt
, ...);
406 int vsprintf(char *buf
, const char *fmt
, va_list args
);
409 ulong
crc32 (ulong
, const unsigned char *, uint
);
410 ulong
crc32_no_comp (ulong
, const unsigned char *, uint
);
412 /* common/console.c */
413 extern void **syscall_tbl
;
415 int console_init_f(void); /* Before relocation; uses the serial stuff */
416 int console_init_r(void); /* After relocation; uses the console stuff */
417 int console_assign (int file
, char *devname
); /* Assign the console */
419 int had_ctrlc (void); /* have we had a Control-C since last clear? */
420 void clear_ctrlc (void); /* clear the Control-C condition */
421 int disable_ctrlc (int); /* 1 to disable, 0 to enable Control-C detect */
424 * STDIO based functions (can always be used)
428 void serial_printf (const char *fmt
, ...);
435 void putc(const char c
);
436 void puts(const char *s
);
437 void printf(const char *fmt
, ...);
440 #define eputc(c) fputc(stderr, c)
441 #define eputs(s) fputs(stderr, s)
442 #define eprintf(fmt,args...) fprintf(stderr,fmt ,##args)
445 * FILE based functions (can only be used AFTER relocation!)
453 void fprintf(int file
, const char *fmt
, ...);
454 void fputs(int file
, const char *s
);
455 void fputc(int file
, const char c
);
459 int pcmcia_init (void);
461 #ifdef CONFIG_SHOW_BOOT_PROGRESS
462 void show_boot_progress (int status
);
465 #endif /* __COMMON_H_ */