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_8260)
47 #include <asm/immap_8260.h>
53 #include <asm/hymod.h>
56 #define asmlinkage /* nothing */
64 #define debug(fmt,args...) printf (fmt ,##args)
66 #define debug(fmt,args...)
69 typedef void (interrupt_handler_t)(void *);
71 #include <asm/u-boot.h> /* boot information for Linux kernel */
72 #include <asm/global_data.h> /* global data used for startup functions */
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
84 * General Purpose Utilities
87 ({ typeof (X) __x = (X), __y = (Y); \
88 (__x < __y) ? __x : __y; })
91 ({ typeof (X) __x = (X), __y = (Y); \
92 (__x > __y) ? __x : __y; })
99 #if CONFIG_SERIAL_SOFTWARE_FIFO
100 void serial_buffered_init (void);
101 void serial_buffered_putc (const char);
102 void serial_buffered_puts (const char *);
103 int serial_buffered_getc (void);
104 int serial_buffered_tstc (void);
105 #endif /* CONFIG_SERIAL_SOFTWARE_FIFO */
107 void hang (void) __attribute__ ((noreturn));
110 long int initdram (int);
111 int display_options (void);
112 void print_size (ulong, const char *);
115 void main_loop (void);
116 int run_command (const char *cmd, int flag);
117 int readline (const char *const prompt);
118 void reset_cmd_timeout(void);
121 void board_init_f (ulong);
122 void board_init_r (gd_t *, ulong);
123 int checkboard (void);
124 int checkflash (void);
125 int checkdram (void);
126 char * strmhz(char *buf, long hz);
127 int last_stage_init(void);
130 void flash_perror (int);
132 /* common/cmd_bootm.c */
133 void print_image_hdr (image_header_t *hdr);
135 extern ulong load_addr; /* Default Load Address */
137 /* common/cmd_nvedit.c */
139 void env_relocate (void);
140 char *getenv (uchar *);
141 int getenv_r (uchar *name, uchar *buf, unsigned len);
143 #ifdef CONFIG_PPC /* ARM version to be fixed! */
144 void inline setenv (char *, char *);
146 void setenv (char *, char *);
147 #endif /* CONFIG_PPC */
149 # include <asm/u-boot-arm.h> /* ARM version to be fixed! */
150 #endif /* CONFIG_ARM */
151 #ifdef CONFIG_I386 /* x86 version to be fixed! */
152 # include <asm/u-boot-i386.h>
153 #endif /* CONFIG_I386 */
155 void pci_init (void);
156 void pci_init_board(void);
157 void pciinfo (int, int);
159 #if defined(CONFIG_PCI) && defined(CONFIG_440)
160 # if defined(CFG_PCI_PRE_INIT)
161 int pci_pre_init (struct pci_controller * );
163 # if defined(CFG_PCI_TARGET_INIT)
164 void pci_target_init (struct pci_controller *);
166 # if defined(CFG_PCI_MASTER_INIT)
167 void pci_master_init (struct pci_controller *);
169 int is_pci_host (struct pci_controller *);
172 int misc_init_f (void);
173 int misc_init_r (void);
175 /* $(BOARD)/$(BOARD).c */
176 void reset_phy (void);
177 void fdc_hw_init (void);
179 /* $(BOARD)/eeprom.c */
180 void eeprom_init (void);
181 int eeprom_read (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt);
182 int eeprom_write (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt);
184 extern uchar pic_read (uchar reg);
185 extern void pic_write (uchar reg, uchar val);
189 * Set this up regardless of board
190 * type, to prevent errors.
192 #if defined(CONFIG_SPI) || !defined(CFG_I2C_EEPROM_ADDR)
193 # define CFG_DEF_EEPROM_ADDR 0
195 # define CFG_DEF_EEPROM_ADDR CFG_I2C_EEPROM_ADDR
196 #endif /* CONFIG_SPI || !defined(CFG_I2C_EEPROM_ADDR) */
198 #if defined(CONFIG_PCU_E) || defined(CONFIG_CCM)
199 extern void spi_init_f (void);
200 extern void spi_init_r (void);
201 extern ssize_t spi_read (uchar *, int, uchar *, int);
202 extern ssize_t spi_write (uchar *, int, uchar *, int);
205 #ifdef CONFIG_RPXCLASSIC
206 void rpxclassic_init (void);
210 /* $(BOARD)/mbx8xx.c */
211 void mbx_init (void);
212 void board_serial_init (void);
213 void board_ether_init (void);
216 #if defined(CONFIG_RPXCLASSIC) || defined(CONFIG_MBX) || defined(CONFIG_IAD210)
217 void board_get_enetaddr (uchar *addr);
221 /* $(BOARD)/hermes.c */
222 void hermes_start_lxt980 (int speed);
225 #ifdef CONFIG_EVB64260
226 void evb64260_init(void);
227 void debug_led(int, int);
228 void display_mem_map(void);
229 void perform_soft_reset(void);
232 void load_sernum_ethaddr (void);
234 /* $(BOARD)/$(BOARD).c */
235 int board_pre_init (void);
236 int board_postclk_init (void); /* after clocks/timebase, before env/serial */
237 void board_poweroff (void);
239 #if defined(CFG_DRAM_TEST)
241 #endif /* CFG_DRAM_TEST */
245 uint get_immr (uint);
248 uint rd_ic_cst (void);
249 void wr_ic_cst (uint);
250 void wr_ic_adr (uint);
251 uint rd_dc_cst (void);
252 void wr_dc_cst (uint);
253 void wr_dc_adr (uint);
254 int icache_status (void);
255 void icache_enable (void);
256 void icache_disable(void);
257 int dcache_status (void);
258 void dcache_enable (void);
259 void dcache_disable(void);
260 void relocate_code (ulong, gd_t *, ulong);
261 ulong get_endaddr (void);
262 void trap_init (ulong);
263 #if defined (CONFIG_4xx) || \
264 defined (CONFIG_74xx_7xx) || \
265 defined (CONFIG_74x) || \
266 defined (CONFIG_75x) || \
267 defined (CONFIG_74xx)
268 unsigned char in8(unsigned int);
269 void out8(unsigned int, unsigned char);
270 unsigned short in16(unsigned int);
271 unsigned short in16r(unsigned int);
272 void out16(unsigned int, unsigned short value);
273 void out16r(unsigned int, unsigned short value);
274 unsigned long in32(unsigned int);
275 unsigned long in32r(unsigned int);
276 void out32(unsigned int, unsigned long value);
277 void out32r(unsigned int, unsigned long value);
278 void ppcDcbf(unsigned long value);
279 void ppcDcbi(unsigned long value);
285 int checkicache (void);
286 int checkdcache (void);
287 void upmconfig (unsigned int, unsigned int *, unsigned int);
288 ulong get_tbclk (void);
290 /* $(CPU)/serial.c */
291 int serial_init (void);
292 void serial_setbrg (void);
293 void serial_putc (const char);
294 void serial_puts (const char *);
295 void serial_addr (unsigned int);
296 int serial_getc (void);
297 int serial_tstc (void);
300 int get_clocks (void);
301 #if defined(CONFIG_8260)
302 int prt_8260_clks (void);
305 ulong get_OPB_freq (void);
306 ulong get_PCI_freq (void);
308 #if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410)
309 ulong get_FCLK (void);
310 ulong get_HCLK (void);
311 ulong get_PCLK (void);
312 ulong get_UCLK (void);
314 ulong get_bus_freq (ulong);
316 #if defined(CONFIG_4xx) || defined(CONFIG_IOP480)
317 # if defined(CONFIG_440)
318 typedef PPC440_SYS_INFO sys_info_t;
320 typedef PPC405_SYS_INFO sys_info_t;
322 void get_sys_info ( sys_info_t * );
325 /* $(CPU)/cpu_init.c */
326 #if defined(CONFIG_8xx) || defined(CONFIG_8260)
327 void cpu_init_f (volatile immap_t *immr);
330 void cpu_init_f (void);
332 int cpu_init_r (void);
333 #if defined(CONFIG_8260)
334 int prt_8260_rsr (void);
337 /* $(CPU)/interrupts.c */
338 int interrupt_init (void);
339 void timer_interrupt (struct pt_regs *);
340 void external_interrupt (struct pt_regs *);
341 void irq_install_handler(int, interrupt_handler_t *, void *);
342 void irq_free_handler (int);
343 void reset_timer (void);
344 ulong get_timer (ulong base);
345 void set_timer (ulong t);
346 void enable_interrupts (void);
347 int disable_interrupts (void);
349 /* $(CPU)/.../commproc.c */
350 int dpram_init (void);
351 uint dpram_base(void);
352 uint dpram_base_align(uint align);
353 uint dpram_alloc(uint size);
354 uint dpram_alloc_align(uint size,uint align);
355 void post_word_store (ulong);
356 ulong post_word_load (void);
358 /* $(CPU)/.../<eth> */
359 void mii_init (void);
361 /* $(CPU)/.../lcd.c */
362 ulong lcd_setmem (ulong);
364 /* $(CPU)/.../vfd.c */
365 ulong vfd_setmem (ulong);
367 /* $(CPU)/.../video.c */
368 ulong video_setmem (ulong);
371 void flush_cache (unsigned long, unsigned long);
374 unsigned long long get_ticks(void);
375 void wait_ticks (unsigned long);
378 void udelay (unsigned long);
379 ulong usec2ticks (unsigned long usec);
380 ulong ticks2usec (unsigned long ticks);
381 int init_timebase (void);
384 ulong simple_strtoul(const char *cp,char **endp,unsigned int base);
385 long simple_strtol(const char *cp,char **endp,unsigned int base);
386 void panic(const char *fmt, ...);
387 int sprintf(char * buf, const char *fmt, ...);
388 int vsprintf(char *buf, const char *fmt, va_list args);
391 ulong crc32 (ulong, const unsigned char *, uint);
392 ulong crc32_no_comp (ulong, const unsigned char *, uint);
394 /* common/console.c */
395 extern void **syscall_tbl;
397 int console_init_f(void); /* Before relocation; uses the serial stuff */
398 int console_init_r(void); /* After relocation; uses the console stuff */
399 int console_assign (int file, char *devname); /* Assign the console */
401 int had_ctrlc (void); /* have we had a Control-C since last clear? */
402 void clear_ctrlc (void); /* clear the Control-C condition */
403 int disable_ctrlc (int); /* 1 to disable, 0 to enable Control-C detect */
406 * STDIO based functions (can always be used)
410 void serial_printf (const char *fmt, ...);
417 void putc(const char c);
418 void puts(const char *s);
419 void printf(const char *fmt, ...);
422 #define eputc(c) fputc(stderr, c)
423 #define eputs(s) fputs(stderr, s)
424 #define eprintf(fmt,args...) fprintf(stderr,fmt ,##args)
427 * FILE based functions (can only be used AFTER relocation!)
435 void fprintf(int file, const char *fmt, ...);
436 void fputs(int file, const char *s);
437 void fputc(int file, const char c);
441 int pcmcia_init (void);
443 #ifdef CONFIG_SHOW_BOOT_PROGRESS
444 void show_boot_progress (int status);
447 #endif /* __COMMON_H_ */