blob: 43a90495522c4d1f07d9c26d80492f0d11cac187 [file] [log] [blame]
wdenke2211742002-11-02 23:30:20 +00001/*
wdenk1ebf41e2004-01-02 14:00:00 +00002 * (C) Copyright 2000-2004
wdenke2211742002-11-02 23:30:20 +00003 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
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.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
wdenkad276f22004-01-04 16:28:35 +000015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
wdenke2211742002-11-02 23:30:20 +000016 * GNU General Public License for more details.
17 *
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,
21 * MA 02111-1307 USA
22 */
23
24#ifndef __COMMON_H_
25#define __COMMON_H_ 1
26
27#undef _LINUX_CONFIG_H
28#define _LINUX_CONFIG_H 1 /* avoid reading Linux autoconf.h file */
29
30typedef unsigned char uchar;
31typedef volatile unsigned long vu_long;
wdenkad276f22004-01-04 16:28:35 +000032typedef volatile unsigned short vu_short;
wdenke2211742002-11-02 23:30:20 +000033typedef volatile unsigned char vu_char;
34
35#include <config.h>
36#include <linux/bitops.h>
37#include <linux/types.h>
38#include <linux/string.h>
39#include <asm/ptrace.h>
40#include <stdarg.h>
41#if defined(CONFIG_PCI) && defined(CONFIG_440)
42#include <pci.h>
43#endif
wdenkad276f22004-01-04 16:28:35 +000044#if defined(CONFIG_8xx)
wdenke2211742002-11-02 23:30:20 +000045#include <asm/8xx_immap.h>
wdenk1ebf41e2004-01-02 14:00:00 +000046#if defined(CONFIG_MPC852) || defined(CONFIG_MPC852T) || \
47 defined(CONFIG_MPC859) || defined(CONFIG_MPC859T) || \
48 defined(CONFIG_MPC859DSL) || \
49 defined(CONFIG_MPC866) || defined(CONFIG_MPC866T) || \
50 defined(CONFIG_MPC866P)
wdenka7556b22004-06-06 21:35:06 +000051# define CONFIG_MPC866_FAMILY 1
wdenkad276f22004-01-04 16:28:35 +000052#elif defined(CONFIG_MPC870) \
53 || defined(CONFIG_MPC875) \
54 || defined(CONFIG_MPC880) \
55 || defined(CONFIG_MPC885)
wdenka7556b22004-06-06 21:35:06 +000056# define CONFIG_MPC885_FAMILY 1
wdenkad276f22004-01-04 16:28:35 +000057#endif
58#if defined(CONFIG_MPC860) \
59 || defined(CONFIG_MPC860T) \
wdenka7556b22004-06-06 21:35:06 +000060 || defined(CONFIG_MPC866_FAMILY) \
61 || defined(CONFIG_MPC885_FAMILY)
wdenkad276f22004-01-04 16:28:35 +000062# define CONFIG_MPC86x 1
wdenk2bb11052003-07-17 23:16:40 +000063#endif
wdenk359733b2003-03-31 17:27:09 +000064#elif defined(CONFIG_5xx)
65#include <asm/5xx_immap.h>
wdenke2211742002-11-02 23:30:20 +000066#elif defined(CONFIG_8260)
wdenk3902d702004-04-15 18:22:41 +000067#if defined(CONFIG_MPC8247) \
68 || defined(CONFIG_MPC8248) \
69 || defined(CONFIG_MPC8271) \
70 || defined(CONFIG_MPC8272)
71#define CONFIG_MPC8272_FAMILY 1
72#endif
73#if defined(CONFIG_MPC8272_FAMILY)
74#define CONFIG_MPC8260 1
75#endif
wdenke2211742002-11-02 23:30:20 +000076#include <asm/immap_8260.h>
77#endif
wdenk9c53f402003-10-15 23:53:47 +000078#ifdef CONFIG_MPC85xx
79#include <mpc85xx.h>
80#include <asm/immap_85xx.h>
81#endif
wdenke2211742002-11-02 23:30:20 +000082#ifdef CONFIG_4xx
83#include <ppc4xx.h>
84#endif
85#ifdef CONFIG_HYMOD
wdenkb00ec162003-06-19 23:40:20 +000086#include <board/hymod/hymod.h>
wdenke2211742002-11-02 23:30:20 +000087#endif
88#ifdef CONFIG_ARM
89#define asmlinkage /* nothing */
90#endif
91
92#include <part.h>
93#include <flash.h>
94#include <image.h>
95
96#ifdef DEBUG
97#define debug(fmt,args...) printf (fmt ,##args)
wdenk88e72a32003-06-19 23:04:19 +000098#define debugX(level,fmt,args...) if (DEBUG>=level) printf(fmt,##args);
wdenke2211742002-11-02 23:30:20 +000099#else
100#define debug(fmt,args...)
wdenk88e72a32003-06-19 23:04:19 +0000101#define debugX(level,fmt,args...)
wdenke2211742002-11-02 23:30:20 +0000102#endif /* DEBUG */
103
wdenk87249ba2004-01-06 22:38:14 +0000104typedef void (interrupt_handler_t)(void *);
wdenke2211742002-11-02 23:30:20 +0000105
wdenk87249ba2004-01-06 22:38:14 +0000106#include <asm/u-boot.h> /* boot information for Linux kernel */
wdenke2211742002-11-02 23:30:20 +0000107#include <asm/global_data.h> /* global data used for startup functions */
108
wdenk7a428cc2003-06-15 22:40:42 +0000109/*
110 * enable common handling for all TQM8xxL/M boards:
111 * - CONFIG_TQM8xxM will be defined for all TQM8xxM boards
112 * - CONFIG_TQM8xxL will be defined for all TQM8xxL _and_ TQM8xxM boards
113 */
114#if defined(CONFIG_TQM823M) || defined(CONFIG_TQM850M) || \
115 defined(CONFIG_TQM855M) || defined(CONFIG_TQM860M) || \
wdenk1ebf41e2004-01-02 14:00:00 +0000116 defined(CONFIG_TQM862M) || defined(CONFIG_TQM866M)
wdenk7a428cc2003-06-15 22:40:42 +0000117# ifndef CONFIG_TQM8xxM
118# define CONFIG_TQM8xxM
119# endif
120#endif
wdenke2211742002-11-02 23:30:20 +0000121#if defined(CONFIG_TQM823L) || defined(CONFIG_TQM850L) || \
wdenk6bd14892003-04-10 11:18:18 +0000122 defined(CONFIG_TQM855L) || defined(CONFIG_TQM860L) || \
wdenk7a428cc2003-06-15 22:40:42 +0000123 defined(CONFIG_TQM862L) || defined(CONFIG_TQM8xxM)
wdenke2211742002-11-02 23:30:20 +0000124# ifndef CONFIG_TQM8xxL
125# define CONFIG_TQM8xxL
126# endif
127#endif
128
129
130/*
wdenk452cfd62002-11-19 11:04:11 +0000131 * General Purpose Utilities
132 */
133#define min(X, Y) \
134 ({ typeof (X) __x = (X), __y = (Y); \
135 (__x < __y) ? __x : __y; })
136
137#define max(X, Y) \
138 ({ typeof (X) __x = (X), __y = (Y); \
139 (__x > __y) ? __x : __y; })
140
141
142/*
wdenke2211742002-11-02 23:30:20 +0000143 * Function Prototypes
144 */
145
wdenkc35ba4e2004-03-14 22:25:36 +0000146#ifdef CONFIG_SERIAL_SOFTWARE_FIFO
wdenke2211742002-11-02 23:30:20 +0000147void serial_buffered_init (void);
148void serial_buffered_putc (const char);
149void serial_buffered_puts (const char *);
150int serial_buffered_getc (void);
151int serial_buffered_tstc (void);
152#endif /* CONFIG_SERIAL_SOFTWARE_FIFO */
153
wdenk87249ba2004-01-06 22:38:14 +0000154void hang (void) __attribute__ ((noreturn));
wdenke2211742002-11-02 23:30:20 +0000155
156/* */
157long int initdram (int);
wdenk87249ba2004-01-06 22:38:14 +0000158int display_options (void);
wdenke2211742002-11-02 23:30:20 +0000159void print_size (ulong, const char *);
160
161/* common/main.c */
162void main_loop (void);
163int run_command (const char *cmd, int flag);
164int readline (const char *const prompt);
wdenkb00ec162003-06-19 23:40:20 +0000165void init_cmd_timeout(void);
wdenke2211742002-11-02 23:30:20 +0000166void reset_cmd_timeout(void);
167
wdenk9f837932003-10-09 19:00:25 +0000168/* lib_$(ARCH)/board.c */
wdenke2211742002-11-02 23:30:20 +0000169void board_init_f (ulong);
170void board_init_r (gd_t *, ulong);
171int checkboard (void);
172int checkflash (void);
173int checkdram (void);
174char * strmhz(char *buf, long hz);
175int last_stage_init(void);
wdenkb9a83a92003-05-30 12:48:29 +0000176extern ulong monitor_flash_len;
wdenke2211742002-11-02 23:30:20 +0000177
178/* common/flash.c */
179void flash_perror (int);
180
wdenkf12e3962003-06-29 21:03:46 +0000181/* common/cmd_autoscript.c */
182int autoscript (ulong addr);
183
wdenke2211742002-11-02 23:30:20 +0000184/* common/cmd_bootm.c */
wdenkf12e3962003-06-29 21:03:46 +0000185void print_image_hdr (image_header_t *hdr);
wdenke2211742002-11-02 23:30:20 +0000186
wdenk87249ba2004-01-06 22:38:14 +0000187extern ulong load_addr; /* Default Load Address */
wdenke2211742002-11-02 23:30:20 +0000188
189/* common/cmd_nvedit.c */
190int env_init (void);
191void env_relocate (void);
wdenk87249ba2004-01-06 22:38:14 +0000192char *getenv (uchar *);
wdenke2211742002-11-02 23:30:20 +0000193int getenv_r (uchar *name, uchar *buf, unsigned len);
wdenk87249ba2004-01-06 22:38:14 +0000194int saveenv (void);
wdenke2211742002-11-02 23:30:20 +0000195#ifdef CONFIG_PPC /* ARM version to be fixed! */
196void inline setenv (char *, char *);
wdenk591dda52002-11-18 00:14:45 +0000197#else
wdenk87249ba2004-01-06 22:38:14 +0000198void setenv (char *, char *);
wdenke2211742002-11-02 23:30:20 +0000199#endif /* CONFIG_PPC */
200#ifdef CONFIG_ARM
wdenkbc01dd52004-01-02 16:05:07 +0000201# include <asm/setup.h>
wdenke2211742002-11-02 23:30:20 +0000202# include <asm/u-boot-arm.h> /* ARM version to be fixed! */
203#endif /* CONFIG_ARM */
wdenk591dda52002-11-18 00:14:45 +0000204#ifdef CONFIG_I386 /* x86 version to be fixed! */
wdenk57b2d802003-06-27 21:31:46 +0000205# include <asm/u-boot-i386.h>
wdenk591dda52002-11-18 00:14:45 +0000206#endif /* CONFIG_I386 */
wdenke2211742002-11-02 23:30:20 +0000207
wdenk3902d702004-04-15 18:22:41 +0000208#ifdef CONFIG_AUTO_COMPLETE
209int env_complete(char *var, int maxv, char *cmdv[], int maxsz, char *buf);
210#endif
211
wdenk87249ba2004-01-06 22:38:14 +0000212void pci_init (void);
213void pci_init_board(void);
214void pciinfo (int, int);
wdenke2211742002-11-02 23:30:20 +0000215
216#if defined(CONFIG_PCI) && defined(CONFIG_440)
217# if defined(CFG_PCI_PRE_INIT)
wdenk87249ba2004-01-06 22:38:14 +0000218 int pci_pre_init (struct pci_controller * );
wdenke2211742002-11-02 23:30:20 +0000219# endif
220# if defined(CFG_PCI_TARGET_INIT)
wdenk87249ba2004-01-06 22:38:14 +0000221 void pci_target_init (struct pci_controller *);
wdenke2211742002-11-02 23:30:20 +0000222# endif
223# if defined(CFG_PCI_MASTER_INIT)
wdenk87249ba2004-01-06 22:38:14 +0000224 void pci_master_init (struct pci_controller *);
wdenke2211742002-11-02 23:30:20 +0000225# endif
wdenk87249ba2004-01-06 22:38:14 +0000226 int is_pci_host (struct pci_controller *);
wdenke2211742002-11-02 23:30:20 +0000227#endif
228
229int misc_init_f (void);
230int misc_init_r (void);
231
wdenk874ac262003-07-24 23:38:38 +0000232/* common/exports.c */
233void jumptable_init(void);
234
wdenk87249ba2004-01-06 22:38:14 +0000235/* common/memsize.c */
236int get_ram_size (volatile long *, long);
237
wdenke2211742002-11-02 23:30:20 +0000238/* $(BOARD)/$(BOARD).c */
239void reset_phy (void);
wdenk87249ba2004-01-06 22:38:14 +0000240void fdc_hw_init (void);
wdenke2211742002-11-02 23:30:20 +0000241
242/* $(BOARD)/eeprom.c */
243void eeprom_init (void);
wdenkb00ec162003-06-19 23:40:20 +0000244#ifndef CONFIG_SPI
245int eeprom_probe (unsigned dev_addr, unsigned offset);
246#endif
wdenke2211742002-11-02 23:30:20 +0000247int eeprom_read (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt);
248int eeprom_write (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt);
249#ifdef CONFIG_LWMON
250extern uchar pic_read (uchar reg);
251extern void pic_write (uchar reg, uchar val);
252#endif
253
254/*
255 * Set this up regardless of board
256 * type, to prevent errors.
257 */
258#if defined(CONFIG_SPI) || !defined(CFG_I2C_EEPROM_ADDR)
259# define CFG_DEF_EEPROM_ADDR 0
260#else
261# define CFG_DEF_EEPROM_ADDR CFG_I2C_EEPROM_ADDR
262#endif /* CONFIG_SPI || !defined(CFG_I2C_EEPROM_ADDR) */
263
wdenk0a658552003-08-05 17:43:17 +0000264#if defined(CONFIG_SPI)
wdenke2211742002-11-02 23:30:20 +0000265extern void spi_init_f (void);
266extern void spi_init_r (void);
wdenk87249ba2004-01-06 22:38:14 +0000267extern ssize_t spi_read (uchar *, int, uchar *, int);
wdenke2211742002-11-02 23:30:20 +0000268extern ssize_t spi_write (uchar *, int, uchar *, int);
269#endif
270
271#ifdef CONFIG_RPXCLASSIC
272void rpxclassic_init (void);
273#endif
274
275#ifdef CONFIG_MBX
276/* $(BOARD)/mbx8xx.c */
277void mbx_init (void);
278void board_serial_init (void);
279void board_ether_init (void);
280#endif
281
wdenk544e9732004-02-06 23:19:44 +0000282#if defined(CONFIG_RPXCLASSIC) || defined(CONFIG_MBX) || \
283 defined(CONFIG_IAD210) || defined(CONFIG_XPEDITE1K)
wdenke2211742002-11-02 23:30:20 +0000284void board_get_enetaddr (uchar *addr);
285#endif
286
287#ifdef CONFIG_HERMES
288/* $(BOARD)/hermes.c */
289void hermes_start_lxt980 (int speed);
290#endif
291
292#ifdef CONFIG_EVB64260
293void evb64260_init(void);
294void debug_led(int, int);
295void display_mem_map(void);
296void perform_soft_reset(void);
297#endif
298
299void load_sernum_ethaddr (void);
300
301/* $(BOARD)/$(BOARD).c */
wdenkda55c6e2004-01-20 23:12:12 +0000302int board_early_init_f (void);
303int board_late_init (void);
wdenke2211742002-11-02 23:30:20 +0000304int board_postclk_init (void); /* after clocks/timebase, before env/serial */
wdenkda55c6e2004-01-20 23:12:12 +0000305int board_early_init_r (void);
wdenke2211742002-11-02 23:30:20 +0000306void board_poweroff (void);
307
308#if defined(CFG_DRAM_TEST)
309int testdram(void);
310#endif /* CFG_DRAM_TEST */
311
312/* $(CPU)/start.S */
wdenk87249ba2004-01-06 22:38:14 +0000313#if defined(CONFIG_5xx) || \
wdenk359733b2003-03-31 17:27:09 +0000314 defined(CONFIG_8xx)
wdenke2211742002-11-02 23:30:20 +0000315uint get_immr (uint);
316#endif
wdenk87249ba2004-01-06 22:38:14 +0000317uint get_pir (void);
wdenk2d644822004-06-09 17:45:32 +0000318#if defined(CONFIG_MPC5xxx)
319uint get_svr (void);
320#endif
wdenke2211742002-11-02 23:30:20 +0000321uint get_pvr (void);
wdenkcc245992004-06-09 00:51:50 +0000322uint get_svr (void);
wdenke2211742002-11-02 23:30:20 +0000323uint rd_ic_cst (void);
324void wr_ic_cst (uint);
325void wr_ic_adr (uint);
326uint rd_dc_cst (void);
327void wr_dc_cst (uint);
328void wr_dc_adr (uint);
329int icache_status (void);
330void icache_enable (void);
331void icache_disable(void);
332int dcache_status (void);
333void dcache_enable (void);
334void dcache_disable(void);
335void relocate_code (ulong, gd_t *, ulong);
336ulong get_endaddr (void);
337void trap_init (ulong);
338#if defined (CONFIG_4xx) || \
wdenkaea86e42004-03-23 22:53:55 +0000339 defined (CONFIG_MPC5xxx) || \
wdenke2211742002-11-02 23:30:20 +0000340 defined (CONFIG_74xx_7xx) || \
341 defined (CONFIG_74x) || \
342 defined (CONFIG_75x) || \
343 defined (CONFIG_74xx)
wdenk87249ba2004-01-06 22:38:14 +0000344unsigned char in8(unsigned int);
345void out8(unsigned int, unsigned char);
346unsigned short in16(unsigned int);
347unsigned short in16r(unsigned int);
348void out16(unsigned int, unsigned short value);
349void out16r(unsigned int, unsigned short value);
350unsigned long in32(unsigned int);
351unsigned long in32r(unsigned int);
352void out32(unsigned int, unsigned long value);
353void out32r(unsigned int, unsigned long value);
354void ppcDcbf(unsigned long value);
355void ppcDcbi(unsigned long value);
356void ppcSync(void);
wdenke2211742002-11-02 23:30:20 +0000357#endif
358
359/* $(CPU)/cpu.c */
360int checkcpu (void);
361int checkicache (void);
362int checkdcache (void);
363void upmconfig (unsigned int, unsigned int *, unsigned int);
364ulong get_tbclk (void);
365
366/* $(CPU)/serial.c */
367int serial_init (void);
368void serial_setbrg (void);
369void serial_putc (const char);
370void serial_puts (const char *);
371void serial_addr (unsigned int);
372int serial_getc (void);
373int serial_tstc (void);
374
375/* $(CPU)/speed.c */
376int get_clocks (void);
wdenkb50cde52004-01-24 20:25:54 +0000377int get_clocks_866 (void);
378int sdram_adjust_866 (void);
wdenkc78bf132004-04-24 23:23:30 +0000379int adjust_sdram_tbs_8xx (void);
wdenke2211742002-11-02 23:30:20 +0000380#if defined(CONFIG_8260)
381int prt_8260_clks (void);
382#endif
wdenkbe9c1cb2004-02-24 02:00:03 +0000383#if defined(CONFIG_MPC5xxx)
wdenk21136db2003-07-16 21:53:01 +0000384int prt_mpc5xxx_clks (void);
385#endif
wdenke2211742002-11-02 23:30:20 +0000386#ifdef CONFIG_4xx
387ulong get_OPB_freq (void);
388ulong get_PCI_freq (void);
389#endif
wdenk3c711762004-06-09 13:37:52 +0000390#if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) || defined(CONFIG_LH7A40X)
wdenke2211742002-11-02 23:30:20 +0000391ulong get_FCLK (void);
392ulong get_HCLK (void);
393ulong get_PCLK (void);
394ulong get_UCLK (void);
395#endif
wdenk3c711762004-06-09 13:37:52 +0000396#if defined(CONFIG_LH7A40X)
397ulong get_PLLCLK (void);
398#endif
wdenk67f13362003-12-27 19:24:54 +0000399#if defined CONFIG_INCA_IP
wdenk87249ba2004-01-06 22:38:14 +0000400uint incaip_get_cpuclk (void);
wdenk67f13362003-12-27 19:24:54 +0000401#endif
wdenke2211742002-11-02 23:30:20 +0000402ulong get_bus_freq (ulong);
403
wdenk9c53f402003-10-15 23:53:47 +0000404#if defined(CONFIG_MPC85xx)
405typedef MPC85xx_SYS_INFO sys_info_t;
wdenk87249ba2004-01-06 22:38:14 +0000406void get_sys_info ( sys_info_t * );
wdenk9c53f402003-10-15 23:53:47 +0000407#endif
408
wdenke2211742002-11-02 23:30:20 +0000409#if defined(CONFIG_4xx) || defined(CONFIG_IOP480)
410# if defined(CONFIG_440)
411 typedef PPC440_SYS_INFO sys_info_t;
412# else
413 typedef PPC405_SYS_INFO sys_info_t;
414# endif
wdenk87249ba2004-01-06 22:38:14 +0000415void get_sys_info ( sys_info_t * );
wdenke2211742002-11-02 23:30:20 +0000416#endif
417
418/* $(CPU)/cpu_init.c */
419#if defined(CONFIG_8xx) || defined(CONFIG_8260)
420void cpu_init_f (volatile immap_t *immr);
421#endif
wdenke65527f2004-02-12 00:47:09 +0000422#if defined(CONFIG_4xx) || defined(CONFIG_MPC85xx) || defined(CONFIG_MCF52x2)
wdenke2211742002-11-02 23:30:20 +0000423void cpu_init_f (void);
424#endif
wdenke65527f2004-02-12 00:47:09 +0000425
wdenke2211742002-11-02 23:30:20 +0000426int cpu_init_r (void);
427#if defined(CONFIG_8260)
428int prt_8260_rsr (void);
429#endif
430
431/* $(CPU)/interrupts.c */
wdenk87249ba2004-01-06 22:38:14 +0000432int interrupt_init (void);
433void timer_interrupt (struct pt_regs *);
wdenke2211742002-11-02 23:30:20 +0000434void external_interrupt (struct pt_regs *);
435void irq_install_handler(int, interrupt_handler_t *, void *);
436void irq_free_handler (int);
437void reset_timer (void);
438ulong get_timer (ulong base);
439void set_timer (ulong t);
440void enable_interrupts (void);
441int disable_interrupts (void);
442
443/* $(CPU)/.../commproc.c */
444int dpram_init (void);
445uint dpram_base(void);
446uint dpram_base_align(uint align);
447uint dpram_alloc(uint size);
448uint dpram_alloc_align(uint size,uint align);
449void post_word_store (ulong);
450ulong post_word_load (void);
wdenk0a658552003-08-05 17:43:17 +0000451void bootcount_store (ulong);
452ulong bootcount_load (void);
453#define BOOTCOUNT_MAGIC 0xB001C041
wdenke2211742002-11-02 23:30:20 +0000454
455/* $(CPU)/.../<eth> */
456void mii_init (void);
457
458/* $(CPU)/.../lcd.c */
459ulong lcd_setmem (ulong);
460
461/* $(CPU)/.../vfd.c */
462ulong vfd_setmem (ulong);
463
464/* $(CPU)/.../video.c */
465ulong video_setmem (ulong);
466
467/* ppc/cache.c */
468void flush_cache (unsigned long, unsigned long);
469
wdenk359733b2003-03-31 17:27:09 +0000470
wdenk9f837932003-10-09 19:00:25 +0000471/* lib_$(ARCH)/ticks.S */
wdenke2211742002-11-02 23:30:20 +0000472unsigned long long get_ticks(void);
473void wait_ticks (unsigned long);
474
wdenk9f837932003-10-09 19:00:25 +0000475/* lib_$(ARCH)/time.c */
wdenke2211742002-11-02 23:30:20 +0000476void udelay (unsigned long);
477ulong usec2ticks (unsigned long usec);
478ulong ticks2usec (unsigned long ticks);
479int init_timebase (void);
480
wdenk9f837932003-10-09 19:00:25 +0000481/* lib_generic/vsprintf.c */
wdenke2211742002-11-02 23:30:20 +0000482ulong simple_strtoul(const char *cp,char **endp,unsigned int base);
wdenkc35ba4e2004-03-14 22:25:36 +0000483#ifdef CFG_64BIT_VSPRINTF
wdenkf602aa02004-03-13 23:29:43 +0000484unsigned long long simple_strtoull(const char *cp,char **endp,unsigned int base);
485#endif
wdenke2211742002-11-02 23:30:20 +0000486long simple_strtol(const char *cp,char **endp,unsigned int base);
487void panic(const char *fmt, ...);
488int sprintf(char * buf, const char *fmt, ...);
wdenk87249ba2004-01-06 22:38:14 +0000489int vsprintf(char *buf, const char *fmt, va_list args);
wdenke2211742002-11-02 23:30:20 +0000490
wdenk9f837932003-10-09 19:00:25 +0000491/* lib_generic/crc32.c */
wdenke2211742002-11-02 23:30:20 +0000492ulong crc32 (ulong, const unsigned char *, uint);
493ulong crc32_no_comp (ulong, const unsigned char *, uint);
494
495/* common/console.c */
wdenke2211742002-11-02 23:30:20 +0000496int console_init_f(void); /* Before relocation; uses the serial stuff */
497int console_init_r(void); /* After relocation; uses the console stuff */
498int console_assign (int file, char *devname); /* Assign the console */
499int ctrlc (void);
500int had_ctrlc (void); /* have we had a Control-C since last clear? */
501void clear_ctrlc (void); /* clear the Control-C condition */
502int disable_ctrlc (int); /* 1 to disable, 0 to enable Control-C detect */
503
504/*
505 * STDIO based functions (can always be used)
506 */
507
508/* serial stuff */
509void serial_printf (const char *fmt, ...);
510
511/* stdin */
512int getc(void);
513int tstc(void);
514
515/* stdout */
516void putc(const char c);
517void puts(const char *s);
518void printf(const char *fmt, ...);
wdenkb00ec162003-06-19 23:40:20 +0000519void vprintf(const char *fmt, va_list args);
wdenke2211742002-11-02 23:30:20 +0000520
521/* stderr */
522#define eputc(c) fputc(stderr, c)
523#define eputs(s) fputs(stderr, s)
524#define eprintf(fmt,args...) fprintf(stderr,fmt ,##args)
525
526/*
527 * FILE based functions (can only be used AFTER relocation!)
528 */
529
530#define stdin 0
531#define stdout 1
532#define stderr 2
533#define MAX_FILES 3
534
535void fprintf(int file, const char *fmt, ...);
536void fputs(int file, const char *s);
537void fputc(int file, const char c);
538int ftstc(int file);
539int fgetc(int file);
540
541int pcmcia_init (void);
542
543#ifdef CONFIG_SHOW_BOOT_PROGRESS
544void show_boot_progress (int status);
545#endif
546
547#endif /* __COMMON_H_ */