2 * (C) Copyright 2000-2002
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
87 #if CONFIG_SERIAL_SOFTWARE_FIFO
88 void serial_buffered_init (void);
89 void serial_buffered_putc (const char);
90 void serial_buffered_puts (const char *);
91 int serial_buffered_getc (void);
92 int serial_buffered_tstc (void);
93 #endif /* CONFIG_SERIAL_SOFTWARE_FIFO */
95 void hang (void) __attribute__ ((noreturn));
98 long int initdram (int);
99 int display_options (void);
100 void print_size (ulong, const char *);
103 void main_loop (void);
104 int run_command (const char *cmd, int flag);
105 int readline (const char *const prompt);
106 void reset_cmd_timeout(void);
109 void board_init_f (ulong);
110 void board_init_r (gd_t *, ulong);
111 int checkboard (void);
112 int checkflash (void);
113 int checkdram (void);
114 char * strmhz(char *buf, long hz);
115 int last_stage_init(void);
118 void flash_perror (int);
120 /* common/cmd_bootm.c */
121 void print_image_hdr (image_header_t *hdr);
123 extern ulong load_addr; /* Default Load Address */
125 /* common/cmd_nvedit.c */
127 void env_relocate (void);
128 char *getenv (uchar *);
129 int getenv_r (uchar *name, uchar *buf, unsigned len);
131 #ifdef CONFIG_PPC /* ARM version to be fixed! */
132 void inline setenv (char *, char *);
134 void setenv (char *, char *);
135 #endif /* CONFIG_PPC */
137 # include <asm/u-boot-arm.h> /* ARM version to be fixed! */
138 #endif /* CONFIG_ARM */
139 #ifdef CONFIG_I386 /* x86 version to be fixed! */
140 # include <asm/ppcboot-i386.h>
141 #endif /* CONFIG_I386 */
143 void pci_init (void);
144 void pciinfo (int, int);
146 #if defined(CONFIG_PCI) && defined(CONFIG_440)
147 # if defined(CFG_PCI_PRE_INIT)
148 int pci_pre_init (struct pci_controller * );
150 # if defined(CFG_PCI_TARGET_INIT)
151 void pci_target_init (struct pci_controller *);
153 # if defined(CFG_PCI_MASTER_INIT)
154 void pci_master_init (struct pci_controller *);
156 int is_pci_host (struct pci_controller *);
159 int misc_init_f (void);
160 int misc_init_r (void);
162 /* $(BOARD)/$(BOARD).c */
163 void reset_phy (void);
164 void fdc_hw_init (void);
166 /* $(BOARD)/eeprom.c */
167 void eeprom_init (void);
168 int eeprom_read (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt);
169 int eeprom_write (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt);
171 extern uchar pic_read (uchar reg);
172 extern void pic_write (uchar reg, uchar val);
176 * Set this up regardless of board
177 * type, to prevent errors.
179 #if defined(CONFIG_SPI) || !defined(CFG_I2C_EEPROM_ADDR)
180 # define CFG_DEF_EEPROM_ADDR 0
182 # define CFG_DEF_EEPROM_ADDR CFG_I2C_EEPROM_ADDR
183 #endif /* CONFIG_SPI || !defined(CFG_I2C_EEPROM_ADDR) */
185 #if defined(CONFIG_PCU_E) || defined(CONFIG_CCM)
186 extern void spi_init_f (void);
187 extern void spi_init_r (void);
188 extern ssize_t spi_read (uchar *, int, uchar *, int);
189 extern ssize_t spi_write (uchar *, int, uchar *, int);
192 #ifdef CONFIG_RPXCLASSIC
193 void rpxclassic_init (void);
197 /* $(BOARD)/mbx8xx.c */
198 void mbx_init (void);
199 void board_serial_init (void);
200 void board_ether_init (void);
203 #if defined(CONFIG_RPXCLASSIC) || defined(CONFIG_MBX) || defined(CONFIG_IAD210)
204 void board_get_enetaddr (uchar *addr);
208 /* $(BOARD)/hermes.c */
209 void hermes_start_lxt980 (int speed);
212 #ifdef CONFIG_EVB64260
213 void evb64260_init(void);
214 void debug_led(int, int);
215 void display_mem_map(void);
216 void perform_soft_reset(void);
219 void load_sernum_ethaddr (void);
221 /* $(BOARD)/$(BOARD).c */
222 int board_pre_init (void);
223 int board_postclk_init (void); /* after clocks/timebase, before env/serial */
224 void board_poweroff (void);
226 #if defined(CFG_DRAM_TEST)
228 #endif /* CFG_DRAM_TEST */
232 uint get_immr (uint);
235 uint rd_ic_cst (void);
236 void wr_ic_cst (uint);
237 void wr_ic_adr (uint);
238 uint rd_dc_cst (void);
239 void wr_dc_cst (uint);
240 void wr_dc_adr (uint);
241 int icache_status (void);
242 void icache_enable (void);
243 void icache_disable(void);
244 int dcache_status (void);
245 void dcache_enable (void);
246 void dcache_disable(void);
247 void relocate_code (ulong, gd_t *, ulong);
248 ulong get_endaddr (void);
249 void trap_init (ulong);
250 #if defined (CONFIG_4xx) || \
251 defined (CONFIG_74xx_7xx) || \
252 defined (CONFIG_74x) || \
253 defined (CONFIG_75x) || \
254 defined (CONFIG_74xx)
255 unsigned char in8(unsigned int);
256 void out8(unsigned int, unsigned char);
257 unsigned short in16(unsigned int);
258 unsigned short in16r(unsigned int);
259 void out16(unsigned int, unsigned short value);
260 void out16r(unsigned int, unsigned short value);
261 unsigned long in32(unsigned int);
262 unsigned long in32r(unsigned int);
263 void out32(unsigned int, unsigned long value);
264 void out32r(unsigned int, unsigned long value);
265 void ppcDcbf(unsigned long value);
266 void ppcDcbi(unsigned long value);
272 int checkicache (void);
273 int checkdcache (void);
274 void upmconfig (unsigned int, unsigned int *, unsigned int);
275 ulong get_tbclk (void);
277 /* $(CPU)/serial.c */
278 int serial_init (void);
279 void serial_setbrg (void);
280 void serial_putc (const char);
281 void serial_puts (const char *);
282 void serial_addr (unsigned int);
283 int serial_getc (void);
284 int serial_tstc (void);
287 int get_clocks (void);
288 #if defined(CONFIG_8260)
289 int prt_8260_clks (void);
292 ulong get_OPB_freq (void);
293 ulong get_PCI_freq (void);
295 #if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410)
296 ulong get_FCLK (void);
297 ulong get_HCLK (void);
298 ulong get_PCLK (void);
299 ulong get_UCLK (void);
301 ulong get_bus_freq (ulong);
303 #if defined(CONFIG_4xx) || defined(CONFIG_IOP480)
304 # if defined(CONFIG_440)
305 typedef PPC440_SYS_INFO sys_info_t;
307 typedef PPC405_SYS_INFO sys_info_t;
309 void get_sys_info ( sys_info_t * );
312 /* $(CPU)/cpu_init.c */
313 #if defined(CONFIG_8xx) || defined(CONFIG_8260)
314 void cpu_init_f (volatile immap_t *immr);
317 void cpu_init_f (void);
319 int cpu_init_r (void);
320 #if defined(CONFIG_8260)
321 int prt_8260_rsr (void);
324 /* $(CPU)/interrupts.c */
325 int interrupt_init (void);
326 void timer_interrupt (struct pt_regs *);
327 void external_interrupt (struct pt_regs *);
328 void irq_install_handler(int, interrupt_handler_t *, void *);
329 void irq_free_handler (int);
330 void reset_timer (void);
331 ulong get_timer (ulong base);
332 void set_timer (ulong t);
333 void enable_interrupts (void);
334 int disable_interrupts (void);
336 /* $(CPU)/.../commproc.c */
337 int dpram_init (void);
338 uint dpram_base(void);
339 uint dpram_base_align(uint align);
340 uint dpram_alloc(uint size);
341 uint dpram_alloc_align(uint size,uint align);
342 void post_word_store (ulong);
343 ulong post_word_load (void);
345 /* $(CPU)/.../<eth> */
346 void mii_init (void);
348 /* $(CPU)/.../lcd.c */
349 ulong lcd_setmem (ulong);
351 /* $(CPU)/.../vfd.c */
352 ulong vfd_setmem (ulong);
354 /* $(CPU)/.../video.c */
355 ulong video_setmem (ulong);
358 void flush_cache (unsigned long, unsigned long);
361 unsigned long long get_ticks(void);
362 void wait_ticks (unsigned long);
365 void udelay (unsigned long);
366 ulong usec2ticks (unsigned long usec);
367 ulong ticks2usec (unsigned long ticks);
368 int init_timebase (void);
371 ulong simple_strtoul(const char *cp,char **endp,unsigned int base);
372 long simple_strtol(const char *cp,char **endp,unsigned int base);
373 void panic(const char *fmt, ...);
374 int sprintf(char * buf, const char *fmt, ...);
375 int vsprintf(char *buf, const char *fmt, va_list args);
378 ulong crc32 (ulong, const unsigned char *, uint);
379 ulong crc32_no_comp (ulong, const unsigned char *, uint);
381 /* common/console.c */
382 extern void **syscall_tbl;
384 int console_init_f(void); /* Before relocation; uses the serial stuff */
385 int console_init_r(void); /* After relocation; uses the console stuff */
386 int console_assign (int file, char *devname); /* Assign the console */
388 int had_ctrlc (void); /* have we had a Control-C since last clear? */
389 void clear_ctrlc (void); /* clear the Control-C condition */
390 int disable_ctrlc (int); /* 1 to disable, 0 to enable Control-C detect */
393 * STDIO based functions (can always be used)
397 void serial_printf (const char *fmt, ...);
404 void putc(const char c);
405 void puts(const char *s);
406 void printf(const char *fmt, ...);
409 #define eputc(c) fputc(stderr, c)
410 #define eputs(s) fputs(stderr, s)
411 #define eprintf(fmt,args...) fprintf(stderr,fmt ,##args)
414 * FILE based functions (can only be used AFTER relocation!)
422 void fprintf(int file, const char *fmt, ...);
423 void fputs(int file, const char *s);
424 void fputc(int file, const char c);
428 int pcmcia_init (void);
430 #ifdef CONFIG_SHOW_BOOT_PROGRESS
431 void show_boot_progress (int status);
434 #endif /* __COMMON_H_ */