blob: 48e38b965dda66c275e23a10cfd1a36009d946c0 [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
wdenk7ac16102004-08-01 22:48:16 +0000129#ifndef CONFIG_SERIAL_MULTI
130
131#if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2) \
132 || defined(CONFIG_8xx_CONS_SCC1) || defined(CONFIG_8xx_CONS_SCC2) \
133 || defined(CONFIG_8xx_CONS_SCC3) || defined(CONFIG_8xx_CONS_SCC4)
134
135#define CONFIG_SERIAL_MULTI 1
136
137#endif
138
139#endif /* CONFIG_SERIAL_MULTI */
wdenke2211742002-11-02 23:30:20 +0000140
141/*
wdenk452cfd62002-11-19 11:04:11 +0000142 * General Purpose Utilities
143 */
144#define min(X, Y) \
145 ({ typeof (X) __x = (X), __y = (Y); \
146 (__x < __y) ? __x : __y; })
147
148#define max(X, Y) \
149 ({ typeof (X) __x = (X), __y = (Y); \
150 (__x > __y) ? __x : __y; })
151
152
153/*
wdenke2211742002-11-02 23:30:20 +0000154 * Function Prototypes
155 */
156
wdenkc35ba4e2004-03-14 22:25:36 +0000157#ifdef CONFIG_SERIAL_SOFTWARE_FIFO
wdenke2211742002-11-02 23:30:20 +0000158void serial_buffered_init (void);
159void serial_buffered_putc (const char);
160void serial_buffered_puts (const char *);
161int serial_buffered_getc (void);
162int serial_buffered_tstc (void);
163#endif /* CONFIG_SERIAL_SOFTWARE_FIFO */
164
wdenk87249ba2004-01-06 22:38:14 +0000165void hang (void) __attribute__ ((noreturn));
wdenke2211742002-11-02 23:30:20 +0000166
167/* */
168long int initdram (int);
wdenk87249ba2004-01-06 22:38:14 +0000169int display_options (void);
wdenke2211742002-11-02 23:30:20 +0000170void print_size (ulong, const char *);
171
172/* common/main.c */
173void main_loop (void);
174int run_command (const char *cmd, int flag);
175int readline (const char *const prompt);
wdenkb00ec162003-06-19 23:40:20 +0000176void init_cmd_timeout(void);
wdenke2211742002-11-02 23:30:20 +0000177void reset_cmd_timeout(void);
178
wdenk9f837932003-10-09 19:00:25 +0000179/* lib_$(ARCH)/board.c */
wdenke2211742002-11-02 23:30:20 +0000180void board_init_f (ulong);
181void board_init_r (gd_t *, ulong);
182int checkboard (void);
183int checkflash (void);
184int checkdram (void);
185char * strmhz(char *buf, long hz);
186int last_stage_init(void);
wdenkb9a83a92003-05-30 12:48:29 +0000187extern ulong monitor_flash_len;
wdenke2211742002-11-02 23:30:20 +0000188
189/* common/flash.c */
190void flash_perror (int);
191
wdenkf12e3962003-06-29 21:03:46 +0000192/* common/cmd_autoscript.c */
193int autoscript (ulong addr);
194
wdenke2211742002-11-02 23:30:20 +0000195/* common/cmd_bootm.c */
wdenkf12e3962003-06-29 21:03:46 +0000196void print_image_hdr (image_header_t *hdr);
wdenke2211742002-11-02 23:30:20 +0000197
wdenk87249ba2004-01-06 22:38:14 +0000198extern ulong load_addr; /* Default Load Address */
wdenke2211742002-11-02 23:30:20 +0000199
200/* common/cmd_nvedit.c */
201int env_init (void);
202void env_relocate (void);
wdenk87249ba2004-01-06 22:38:14 +0000203char *getenv (uchar *);
wdenke2211742002-11-02 23:30:20 +0000204int getenv_r (uchar *name, uchar *buf, unsigned len);
wdenk87249ba2004-01-06 22:38:14 +0000205int saveenv (void);
wdenke2211742002-11-02 23:30:20 +0000206#ifdef CONFIG_PPC /* ARM version to be fixed! */
207void inline setenv (char *, char *);
wdenk591dda52002-11-18 00:14:45 +0000208#else
wdenk87249ba2004-01-06 22:38:14 +0000209void setenv (char *, char *);
wdenke2211742002-11-02 23:30:20 +0000210#endif /* CONFIG_PPC */
211#ifdef CONFIG_ARM
wdenkbc01dd52004-01-02 16:05:07 +0000212# include <asm/setup.h>
wdenke2211742002-11-02 23:30:20 +0000213# include <asm/u-boot-arm.h> /* ARM version to be fixed! */
214#endif /* CONFIG_ARM */
wdenk591dda52002-11-18 00:14:45 +0000215#ifdef CONFIG_I386 /* x86 version to be fixed! */
wdenk57b2d802003-06-27 21:31:46 +0000216# include <asm/u-boot-i386.h>
wdenk591dda52002-11-18 00:14:45 +0000217#endif /* CONFIG_I386 */
wdenke2211742002-11-02 23:30:20 +0000218
wdenk3902d702004-04-15 18:22:41 +0000219#ifdef CONFIG_AUTO_COMPLETE
220int env_complete(char *var, int maxv, char *cmdv[], int maxsz, char *buf);
221#endif
222
wdenk87249ba2004-01-06 22:38:14 +0000223void pci_init (void);
224void pci_init_board(void);
225void pciinfo (int, int);
wdenke2211742002-11-02 23:30:20 +0000226
227#if defined(CONFIG_PCI) && defined(CONFIG_440)
228# if defined(CFG_PCI_PRE_INIT)
wdenk87249ba2004-01-06 22:38:14 +0000229 int pci_pre_init (struct pci_controller * );
wdenke2211742002-11-02 23:30:20 +0000230# endif
231# if defined(CFG_PCI_TARGET_INIT)
wdenk87249ba2004-01-06 22:38:14 +0000232 void pci_target_init (struct pci_controller *);
wdenke2211742002-11-02 23:30:20 +0000233# endif
234# if defined(CFG_PCI_MASTER_INIT)
wdenk87249ba2004-01-06 22:38:14 +0000235 void pci_master_init (struct pci_controller *);
wdenke2211742002-11-02 23:30:20 +0000236# endif
wdenk87249ba2004-01-06 22:38:14 +0000237 int is_pci_host (struct pci_controller *);
wdenke2211742002-11-02 23:30:20 +0000238#endif
239
240int misc_init_f (void);
241int misc_init_r (void);
242
wdenk874ac262003-07-24 23:38:38 +0000243/* common/exports.c */
244void jumptable_init(void);
245
wdenk87249ba2004-01-06 22:38:14 +0000246/* common/memsize.c */
247int get_ram_size (volatile long *, long);
248
wdenke2211742002-11-02 23:30:20 +0000249/* $(BOARD)/$(BOARD).c */
250void reset_phy (void);
wdenk87249ba2004-01-06 22:38:14 +0000251void fdc_hw_init (void);
wdenke2211742002-11-02 23:30:20 +0000252
253/* $(BOARD)/eeprom.c */
254void eeprom_init (void);
wdenkb00ec162003-06-19 23:40:20 +0000255#ifndef CONFIG_SPI
256int eeprom_probe (unsigned dev_addr, unsigned offset);
257#endif
wdenke2211742002-11-02 23:30:20 +0000258int eeprom_read (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt);
259int eeprom_write (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt);
260#ifdef CONFIG_LWMON
261extern uchar pic_read (uchar reg);
262extern void pic_write (uchar reg, uchar val);
263#endif
264
265/*
266 * Set this up regardless of board
267 * type, to prevent errors.
268 */
269#if defined(CONFIG_SPI) || !defined(CFG_I2C_EEPROM_ADDR)
270# define CFG_DEF_EEPROM_ADDR 0
271#else
272# define CFG_DEF_EEPROM_ADDR CFG_I2C_EEPROM_ADDR
273#endif /* CONFIG_SPI || !defined(CFG_I2C_EEPROM_ADDR) */
274
wdenk0a658552003-08-05 17:43:17 +0000275#if defined(CONFIG_SPI)
wdenke2211742002-11-02 23:30:20 +0000276extern void spi_init_f (void);
277extern void spi_init_r (void);
wdenk87249ba2004-01-06 22:38:14 +0000278extern ssize_t spi_read (uchar *, int, uchar *, int);
wdenke2211742002-11-02 23:30:20 +0000279extern ssize_t spi_write (uchar *, int, uchar *, int);
280#endif
281
282#ifdef CONFIG_RPXCLASSIC
283void rpxclassic_init (void);
284#endif
285
wdenkec432742004-06-09 21:04:48 +0000286void rpxlite_init (void);
287
wdenke2211742002-11-02 23:30:20 +0000288#ifdef CONFIG_MBX
289/* $(BOARD)/mbx8xx.c */
290void mbx_init (void);
291void board_serial_init (void);
292void board_ether_init (void);
293#endif
294
wdenk544e9732004-02-06 23:19:44 +0000295#if defined(CONFIG_RPXCLASSIC) || defined(CONFIG_MBX) || \
296 defined(CONFIG_IAD210) || defined(CONFIG_XPEDITE1K)
wdenke2211742002-11-02 23:30:20 +0000297void board_get_enetaddr (uchar *addr);
298#endif
299
300#ifdef CONFIG_HERMES
301/* $(BOARD)/hermes.c */
302void hermes_start_lxt980 (int speed);
303#endif
304
305#ifdef CONFIG_EVB64260
306void evb64260_init(void);
307void debug_led(int, int);
308void display_mem_map(void);
309void perform_soft_reset(void);
310#endif
311
312void load_sernum_ethaddr (void);
313
314/* $(BOARD)/$(BOARD).c */
wdenkda55c6e2004-01-20 23:12:12 +0000315int board_early_init_f (void);
316int board_late_init (void);
wdenke2211742002-11-02 23:30:20 +0000317int board_postclk_init (void); /* after clocks/timebase, before env/serial */
wdenkda55c6e2004-01-20 23:12:12 +0000318int board_early_init_r (void);
wdenke2211742002-11-02 23:30:20 +0000319void board_poweroff (void);
320
321#if defined(CFG_DRAM_TEST)
322int testdram(void);
323#endif /* CFG_DRAM_TEST */
324
325/* $(CPU)/start.S */
wdenk87249ba2004-01-06 22:38:14 +0000326#if defined(CONFIG_5xx) || \
wdenk359733b2003-03-31 17:27:09 +0000327 defined(CONFIG_8xx)
wdenke2211742002-11-02 23:30:20 +0000328uint get_immr (uint);
329#endif
wdenk87249ba2004-01-06 22:38:14 +0000330uint get_pir (void);
wdenk2d644822004-06-09 17:45:32 +0000331#if defined(CONFIG_MPC5xxx)
332uint get_svr (void);
333#endif
wdenke2211742002-11-02 23:30:20 +0000334uint get_pvr (void);
wdenkcc245992004-06-09 00:51:50 +0000335uint get_svr (void);
wdenke2211742002-11-02 23:30:20 +0000336uint rd_ic_cst (void);
337void wr_ic_cst (uint);
338void wr_ic_adr (uint);
339uint rd_dc_cst (void);
340void wr_dc_cst (uint);
341void wr_dc_adr (uint);
342int icache_status (void);
343void icache_enable (void);
344void icache_disable(void);
345int dcache_status (void);
346void dcache_enable (void);
347void dcache_disable(void);
348void relocate_code (ulong, gd_t *, ulong);
349ulong get_endaddr (void);
350void trap_init (ulong);
351#if defined (CONFIG_4xx) || \
wdenkaea86e42004-03-23 22:53:55 +0000352 defined (CONFIG_MPC5xxx) || \
wdenke2211742002-11-02 23:30:20 +0000353 defined (CONFIG_74xx_7xx) || \
354 defined (CONFIG_74x) || \
355 defined (CONFIG_75x) || \
wdenk13eb2212004-07-09 23:27:13 +0000356 defined (CONFIG_74xx) || \
357 defined(CONFIG_MPC85xx)
wdenk87249ba2004-01-06 22:38:14 +0000358unsigned char in8(unsigned int);
359void out8(unsigned int, unsigned char);
360unsigned short in16(unsigned int);
361unsigned short in16r(unsigned int);
362void out16(unsigned int, unsigned short value);
363void out16r(unsigned int, unsigned short value);
364unsigned long in32(unsigned int);
365unsigned long in32r(unsigned int);
366void out32(unsigned int, unsigned long value);
367void out32r(unsigned int, unsigned long value);
368void ppcDcbf(unsigned long value);
369void ppcDcbi(unsigned long value);
370void ppcSync(void);
wdenk13eb2212004-07-09 23:27:13 +0000371void ppcDcbz(unsigned long value);
wdenke2211742002-11-02 23:30:20 +0000372#endif
373
374/* $(CPU)/cpu.c */
375int checkcpu (void);
376int checkicache (void);
377int checkdcache (void);
378void upmconfig (unsigned int, unsigned int *, unsigned int);
379ulong get_tbclk (void);
380
381/* $(CPU)/serial.c */
382int serial_init (void);
383void serial_setbrg (void);
384void serial_putc (const char);
385void serial_puts (const char *);
386void serial_addr (unsigned int);
387int serial_getc (void);
388int serial_tstc (void);
389
390/* $(CPU)/speed.c */
391int get_clocks (void);
wdenkb50cde52004-01-24 20:25:54 +0000392int get_clocks_866 (void);
393int sdram_adjust_866 (void);
wdenkc78bf132004-04-24 23:23:30 +0000394int adjust_sdram_tbs_8xx (void);
wdenke2211742002-11-02 23:30:20 +0000395#if defined(CONFIG_8260)
396int prt_8260_clks (void);
397#endif
wdenkbe9c1cb2004-02-24 02:00:03 +0000398#if defined(CONFIG_MPC5xxx)
wdenk21136db2003-07-16 21:53:01 +0000399int prt_mpc5xxx_clks (void);
400#endif
wdenke2211742002-11-02 23:30:20 +0000401#ifdef CONFIG_4xx
402ulong get_OPB_freq (void);
403ulong get_PCI_freq (void);
404#endif
wdenk3c711762004-06-09 13:37:52 +0000405#if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) || defined(CONFIG_LH7A40X)
wdenke2211742002-11-02 23:30:20 +0000406ulong get_FCLK (void);
407ulong get_HCLK (void);
408ulong get_PCLK (void);
409ulong get_UCLK (void);
410#endif
wdenk3c711762004-06-09 13:37:52 +0000411#if defined(CONFIG_LH7A40X)
412ulong get_PLLCLK (void);
413#endif
wdenk67f13362003-12-27 19:24:54 +0000414#if defined CONFIG_INCA_IP
wdenk87249ba2004-01-06 22:38:14 +0000415uint incaip_get_cpuclk (void);
wdenk67f13362003-12-27 19:24:54 +0000416#endif
wdenk7ac16102004-08-01 22:48:16 +0000417#if defined(CONFIG_IMX)
418ulong get_systemPLLCLK(void);
419ulong get_FCLK(void);
420ulong get_HCLK(void);
421ulong get_BCLK(void);
422ulong get_PERCLK1(void);
423ulong get_PERCLK2(void);
424ulong get_PERCLK3(void);
425#endif
wdenke2211742002-11-02 23:30:20 +0000426ulong get_bus_freq (ulong);
427
wdenk9c53f402003-10-15 23:53:47 +0000428#if defined(CONFIG_MPC85xx)
429typedef MPC85xx_SYS_INFO sys_info_t;
wdenk87249ba2004-01-06 22:38:14 +0000430void get_sys_info ( sys_info_t * );
wdenk9c53f402003-10-15 23:53:47 +0000431#endif
432
wdenke2211742002-11-02 23:30:20 +0000433#if defined(CONFIG_4xx) || defined(CONFIG_IOP480)
434# if defined(CONFIG_440)
435 typedef PPC440_SYS_INFO sys_info_t;
436# else
437 typedef PPC405_SYS_INFO sys_info_t;
438# endif
wdenk87249ba2004-01-06 22:38:14 +0000439void get_sys_info ( sys_info_t * );
wdenke2211742002-11-02 23:30:20 +0000440#endif
441
442/* $(CPU)/cpu_init.c */
443#if defined(CONFIG_8xx) || defined(CONFIG_8260)
444void cpu_init_f (volatile immap_t *immr);
445#endif
wdenke65527f2004-02-12 00:47:09 +0000446#if defined(CONFIG_4xx) || defined(CONFIG_MPC85xx) || defined(CONFIG_MCF52x2)
wdenke2211742002-11-02 23:30:20 +0000447void cpu_init_f (void);
448#endif
wdenke65527f2004-02-12 00:47:09 +0000449
wdenke2211742002-11-02 23:30:20 +0000450int cpu_init_r (void);
451#if defined(CONFIG_8260)
452int prt_8260_rsr (void);
453#endif
454
455/* $(CPU)/interrupts.c */
wdenk87249ba2004-01-06 22:38:14 +0000456int interrupt_init (void);
457void timer_interrupt (struct pt_regs *);
wdenke2211742002-11-02 23:30:20 +0000458void external_interrupt (struct pt_regs *);
459void irq_install_handler(int, interrupt_handler_t *, void *);
460void irq_free_handler (int);
461void reset_timer (void);
462ulong get_timer (ulong base);
463void set_timer (ulong t);
464void enable_interrupts (void);
465int disable_interrupts (void);
466
467/* $(CPU)/.../commproc.c */
468int dpram_init (void);
469uint dpram_base(void);
470uint dpram_base_align(uint align);
471uint dpram_alloc(uint size);
472uint dpram_alloc_align(uint size,uint align);
473void post_word_store (ulong);
474ulong post_word_load (void);
wdenk0a658552003-08-05 17:43:17 +0000475void bootcount_store (ulong);
476ulong bootcount_load (void);
477#define BOOTCOUNT_MAGIC 0xB001C041
wdenke2211742002-11-02 23:30:20 +0000478
479/* $(CPU)/.../<eth> */
480void mii_init (void);
481
482/* $(CPU)/.../lcd.c */
483ulong lcd_setmem (ulong);
484
485/* $(CPU)/.../vfd.c */
486ulong vfd_setmem (ulong);
487
488/* $(CPU)/.../video.c */
489ulong video_setmem (ulong);
490
wdenkb5bb1392004-07-10 23:11:10 +0000491/* lib_$(ARCH)/cache.c */
wdenke2211742002-11-02 23:30:20 +0000492void flush_cache (unsigned long, unsigned long);
493
wdenk359733b2003-03-31 17:27:09 +0000494
wdenk9f837932003-10-09 19:00:25 +0000495/* lib_$(ARCH)/ticks.S */
wdenke2211742002-11-02 23:30:20 +0000496unsigned long long get_ticks(void);
497void wait_ticks (unsigned long);
498
wdenk9f837932003-10-09 19:00:25 +0000499/* lib_$(ARCH)/time.c */
wdenke2211742002-11-02 23:30:20 +0000500void udelay (unsigned long);
501ulong usec2ticks (unsigned long usec);
502ulong ticks2usec (unsigned long ticks);
503int init_timebase (void);
504
wdenk9f837932003-10-09 19:00:25 +0000505/* lib_generic/vsprintf.c */
wdenke2211742002-11-02 23:30:20 +0000506ulong simple_strtoul(const char *cp,char **endp,unsigned int base);
wdenkc35ba4e2004-03-14 22:25:36 +0000507#ifdef CFG_64BIT_VSPRINTF
wdenkf602aa02004-03-13 23:29:43 +0000508unsigned long long simple_strtoull(const char *cp,char **endp,unsigned int base);
509#endif
wdenke2211742002-11-02 23:30:20 +0000510long simple_strtol(const char *cp,char **endp,unsigned int base);
511void panic(const char *fmt, ...);
512int sprintf(char * buf, const char *fmt, ...);
wdenk87249ba2004-01-06 22:38:14 +0000513int vsprintf(char *buf, const char *fmt, va_list args);
wdenke2211742002-11-02 23:30:20 +0000514
wdenk9f837932003-10-09 19:00:25 +0000515/* lib_generic/crc32.c */
wdenke2211742002-11-02 23:30:20 +0000516ulong crc32 (ulong, const unsigned char *, uint);
517ulong crc32_no_comp (ulong, const unsigned char *, uint);
518
519/* common/console.c */
wdenke2211742002-11-02 23:30:20 +0000520int console_init_f(void); /* Before relocation; uses the serial stuff */
521int console_init_r(void); /* After relocation; uses the console stuff */
522int console_assign (int file, char *devname); /* Assign the console */
523int ctrlc (void);
524int had_ctrlc (void); /* have we had a Control-C since last clear? */
525void clear_ctrlc (void); /* clear the Control-C condition */
526int disable_ctrlc (int); /* 1 to disable, 0 to enable Control-C detect */
527
528/*
529 * STDIO based functions (can always be used)
530 */
531
532/* serial stuff */
533void serial_printf (const char *fmt, ...);
534
535/* stdin */
536int getc(void);
537int tstc(void);
538
539/* stdout */
540void putc(const char c);
541void puts(const char *s);
542void printf(const char *fmt, ...);
wdenkb00ec162003-06-19 23:40:20 +0000543void vprintf(const char *fmt, va_list args);
wdenke2211742002-11-02 23:30:20 +0000544
545/* stderr */
546#define eputc(c) fputc(stderr, c)
547#define eputs(s) fputs(stderr, s)
548#define eprintf(fmt,args...) fprintf(stderr,fmt ,##args)
549
550/*
551 * FILE based functions (can only be used AFTER relocation!)
552 */
553
554#define stdin 0
555#define stdout 1
556#define stderr 2
557#define MAX_FILES 3
558
559void fprintf(int file, const char *fmt, ...);
560void fputs(int file, const char *s);
561void fputc(int file, const char c);
562int ftstc(int file);
563int fgetc(int file);
564
565int pcmcia_init (void);
566
567#ifdef CONFIG_SHOW_BOOT_PROGRESS
568void show_boot_progress (int status);
569#endif
570
571#endif /* __COMMON_H_ */