blob: 7e54da93bfd11757bb155c722d6168db3ef3ebdd [file] [log] [blame]
wdenke2211742002-11-02 23:30:20 +00001/*
wdenkd4ca31c2004-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
wdenk180d3f72004-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;
wdenk180d3f72004-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
wdenk180d3f72004-01-04 16:28:35 +000044#if defined(CONFIG_8xx)
wdenke2211742002-11-02 23:30:20 +000045#include <asm/8xx_immap.h>
wdenkd4ca31c2004-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)
wdenk11142572004-06-06 21:35:06 +000051# define CONFIG_MPC866_FAMILY 1
wdenk180d3f72004-01-04 16:28:35 +000052#elif defined(CONFIG_MPC870) \
53 || defined(CONFIG_MPC875) \
54 || defined(CONFIG_MPC880) \
55 || defined(CONFIG_MPC885)
wdenk11142572004-06-06 21:35:06 +000056# define CONFIG_MPC885_FAMILY 1
wdenk180d3f72004-01-04 16:28:35 +000057#endif
58#if defined(CONFIG_MPC860) \
59 || defined(CONFIG_MPC860T) \
wdenk11142572004-06-06 21:35:06 +000060 || defined(CONFIG_MPC866_FAMILY) \
61 || defined(CONFIG_MPC885_FAMILY)
wdenk180d3f72004-01-04 16:28:35 +000062# define CONFIG_MPC86x 1
wdenk2535d602003-07-17 23:16:40 +000063#endif
wdenk0db5bca2003-03-31 17:27:09 +000064#elif defined(CONFIG_5xx)
65#include <asm/5xx_immap.h>
wdenk7e6bf352004-12-12 22:06:17 +000066#elif defined(CONFIG_MPC5xxx)
67#include <mpc5xxx.h>
wdenk983fda82004-10-28 00:09:35 +000068#elif defined(CONFIG_MPC8220)
69#include <asm/immap_8220.h>
wdenke2211742002-11-02 23:30:20 +000070#elif defined(CONFIG_8260)
wdenk04a85b32004-04-15 18:22:41 +000071#if defined(CONFIG_MPC8247) \
72 || defined(CONFIG_MPC8248) \
73 || defined(CONFIG_MPC8271) \
74 || defined(CONFIG_MPC8272)
75#define CONFIG_MPC8272_FAMILY 1
76#endif
77#if defined(CONFIG_MPC8272_FAMILY)
78#define CONFIG_MPC8260 1
79#endif
wdenke2211742002-11-02 23:30:20 +000080#include <asm/immap_8260.h>
81#endif
Jon Loeligerdebb7352006-04-26 17:58:56 -050082#ifdef CONFIG_MPC86xx
83#include <mpc86xx.h>
84#include <asm/immap_86xx.h>
85#endif
wdenk42d1f032003-10-15 23:53:47 +000086#ifdef CONFIG_MPC85xx
87#include <mpc85xx.h>
88#include <asm/immap_85xx.h>
89#endif
Eran Libertyf046ccd2005-07-28 10:08:46 -050090#ifdef CONFIG_MPC83XX
91#include <mpc83xx.h>
92#include <asm/immap_83xx.h>
93#endif
wdenke2211742002-11-02 23:30:20 +000094#ifdef CONFIG_4xx
95#include <ppc4xx.h>
96#endif
97#ifdef CONFIG_HYMOD
wdenk6dd652f2003-06-19 23:40:20 +000098#include <board/hymod/hymod.h>
wdenke2211742002-11-02 23:30:20 +000099#endif
100#ifdef CONFIG_ARM
101#define asmlinkage /* nothing */
102#endif
103
104#include <part.h>
105#include <flash.h>
106#include <image.h>
107
108#ifdef DEBUG
109#define debug(fmt,args...) printf (fmt ,##args)
wdenk52f52c12003-06-19 23:04:19 +0000110#define debugX(level,fmt,args...) if (DEBUG>=level) printf(fmt,##args);
wdenke2211742002-11-02 23:30:20 +0000111#else
112#define debug(fmt,args...)
wdenk52f52c12003-06-19 23:04:19 +0000113#define debugX(level,fmt,args...)
wdenke2211742002-11-02 23:30:20 +0000114#endif /* DEBUG */
115
wdenkc83bf6a2004-01-06 22:38:14 +0000116typedef void (interrupt_handler_t)(void *);
wdenke2211742002-11-02 23:30:20 +0000117
wdenkc83bf6a2004-01-06 22:38:14 +0000118#include <asm/u-boot.h> /* boot information for Linux kernel */
wdenke2211742002-11-02 23:30:20 +0000119#include <asm/global_data.h> /* global data used for startup functions */
120
wdenk71f95112003-06-15 22:40:42 +0000121/*
122 * enable common handling for all TQM8xxL/M boards:
123 * - CONFIG_TQM8xxM will be defined for all TQM8xxM boards
124 * - CONFIG_TQM8xxL will be defined for all TQM8xxL _and_ TQM8xxM boards
125 */
126#if defined(CONFIG_TQM823M) || defined(CONFIG_TQM850M) || \
127 defined(CONFIG_TQM855M) || defined(CONFIG_TQM860M) || \
wdenkd4ca31c2004-01-02 14:00:00 +0000128 defined(CONFIG_TQM862M) || defined(CONFIG_TQM866M)
wdenk71f95112003-06-15 22:40:42 +0000129# ifndef CONFIG_TQM8xxM
130# define CONFIG_TQM8xxM
131# endif
132#endif
wdenke2211742002-11-02 23:30:20 +0000133#if defined(CONFIG_TQM823L) || defined(CONFIG_TQM850L) || \
wdenkd126bfb2003-04-10 11:18:18 +0000134 defined(CONFIG_TQM855L) || defined(CONFIG_TQM860L) || \
wdenk71f95112003-06-15 22:40:42 +0000135 defined(CONFIG_TQM862L) || defined(CONFIG_TQM8xxM)
wdenke2211742002-11-02 23:30:20 +0000136# ifndef CONFIG_TQM8xxL
137# define CONFIG_TQM8xxL
138# endif
139#endif
140
wdenk281e00a2004-08-01 22:48:16 +0000141#ifndef CONFIG_SERIAL_MULTI
142
143#if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2) \
144 || defined(CONFIG_8xx_CONS_SCC1) || defined(CONFIG_8xx_CONS_SCC2) \
145 || defined(CONFIG_8xx_CONS_SCC3) || defined(CONFIG_8xx_CONS_SCC4)
146
147#define CONFIG_SERIAL_MULTI 1
148
149#endif
150
151#endif /* CONFIG_SERIAL_MULTI */
wdenke2211742002-11-02 23:30:20 +0000152
153/*
wdenkc7de8292002-11-19 11:04:11 +0000154 * General Purpose Utilities
155 */
156#define min(X, Y) \
157 ({ typeof (X) __x = (X), __y = (Y); \
158 (__x < __y) ? __x : __y; })
159
160#define max(X, Y) \
161 ({ typeof (X) __x = (X), __y = (Y); \
162 (__x > __y) ? __x : __y; })
163
164
165/*
wdenke2211742002-11-02 23:30:20 +0000166 * Function Prototypes
167 */
168
wdenk42dfe7a2004-03-14 22:25:36 +0000169#ifdef CONFIG_SERIAL_SOFTWARE_FIFO
wdenke2211742002-11-02 23:30:20 +0000170void serial_buffered_init (void);
171void serial_buffered_putc (const char);
172void serial_buffered_puts (const char *);
173int serial_buffered_getc (void);
174int serial_buffered_tstc (void);
175#endif /* CONFIG_SERIAL_SOFTWARE_FIFO */
176
wdenkc83bf6a2004-01-06 22:38:14 +0000177void hang (void) __attribute__ ((noreturn));
wdenke2211742002-11-02 23:30:20 +0000178
179/* */
180long int initdram (int);
wdenkc83bf6a2004-01-06 22:38:14 +0000181int display_options (void);
wdenke2211742002-11-02 23:30:20 +0000182void print_size (ulong, const char *);
183
184/* common/main.c */
185void main_loop (void);
186int run_command (const char *cmd, int flag);
187int readline (const char *const prompt);
wdenk6dd652f2003-06-19 23:40:20 +0000188void init_cmd_timeout(void);
wdenke2211742002-11-02 23:30:20 +0000189void reset_cmd_timeout(void);
190
wdenk15647dc2003-10-09 19:00:25 +0000191/* lib_$(ARCH)/board.c */
wdenke2211742002-11-02 23:30:20 +0000192void board_init_f (ulong);
193void board_init_r (gd_t *, ulong);
194int checkboard (void);
195int checkflash (void);
196int checkdram (void);
197char * strmhz(char *buf, long hz);
198int last_stage_init(void);
wdenk3b57fe02003-05-30 12:48:29 +0000199extern ulong monitor_flash_len;
Haiying Wangbea3f282006-07-12 10:48:05 -0400200#ifdef CFG_ID_EEPROM
201int mac_read_from_eeprom(void);
202#endif
wdenke2211742002-11-02 23:30:20 +0000203
204/* common/flash.c */
205void flash_perror (int);
206
wdenkb0fce992003-06-29 21:03:46 +0000207/* common/cmd_autoscript.c */
208int autoscript (ulong addr);
209
wdenke2211742002-11-02 23:30:20 +0000210/* common/cmd_bootm.c */
wdenkb0fce992003-06-29 21:03:46 +0000211void print_image_hdr (image_header_t *hdr);
wdenke2211742002-11-02 23:30:20 +0000212
wdenkc83bf6a2004-01-06 22:38:14 +0000213extern ulong load_addr; /* Default Load Address */
wdenke2211742002-11-02 23:30:20 +0000214
215/* common/cmd_nvedit.c */
216int env_init (void);
217void env_relocate (void);
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200218char *getenv (char *);
219int getenv_r (char *name, char *buf, unsigned len);
wdenkc83bf6a2004-01-06 22:38:14 +0000220int saveenv (void);
wdenke2211742002-11-02 23:30:20 +0000221#ifdef CONFIG_PPC /* ARM version to be fixed! */
222void inline setenv (char *, char *);
wdenk2262cfe2002-11-18 00:14:45 +0000223#else
wdenkc83bf6a2004-01-06 22:38:14 +0000224void setenv (char *, char *);
wdenke2211742002-11-02 23:30:20 +0000225#endif /* CONFIG_PPC */
226#ifdef CONFIG_ARM
wdenk96085e32004-12-13 09:49:01 +0000227# include <asm/mach-types.h>
wdenkb6e4c402004-01-02 16:05:07 +0000228# include <asm/setup.h>
wdenke2211742002-11-02 23:30:20 +0000229# include <asm/u-boot-arm.h> /* ARM version to be fixed! */
230#endif /* CONFIG_ARM */
wdenk2262cfe2002-11-18 00:14:45 +0000231#ifdef CONFIG_I386 /* x86 version to be fixed! */
wdenk8bde7f72003-06-27 21:31:46 +0000232# include <asm/u-boot-i386.h>
wdenk2262cfe2002-11-18 00:14:45 +0000233#endif /* CONFIG_I386 */
wdenke2211742002-11-02 23:30:20 +0000234
wdenk04a85b32004-04-15 18:22:41 +0000235#ifdef CONFIG_AUTO_COMPLETE
236int env_complete(char *var, int maxv, char *cmdv[], int maxsz, char *buf);
237#endif
238
wdenkc83bf6a2004-01-06 22:38:14 +0000239void pci_init (void);
240void pci_init_board(void);
241void pciinfo (int, int);
wdenke2211742002-11-02 23:30:20 +0000242
243#if defined(CONFIG_PCI) && defined(CONFIG_440)
244# if defined(CFG_PCI_PRE_INIT)
wdenkc83bf6a2004-01-06 22:38:14 +0000245 int pci_pre_init (struct pci_controller * );
wdenke2211742002-11-02 23:30:20 +0000246# endif
247# if defined(CFG_PCI_TARGET_INIT)
wdenkc83bf6a2004-01-06 22:38:14 +0000248 void pci_target_init (struct pci_controller *);
wdenke2211742002-11-02 23:30:20 +0000249# endif
250# if defined(CFG_PCI_MASTER_INIT)
wdenkc83bf6a2004-01-06 22:38:14 +0000251 void pci_master_init (struct pci_controller *);
wdenke2211742002-11-02 23:30:20 +0000252# endif
wdenkc83bf6a2004-01-06 22:38:14 +0000253 int is_pci_host (struct pci_controller *);
wdenke2211742002-11-02 23:30:20 +0000254#endif
255
256int misc_init_f (void);
257int misc_init_r (void);
258
wdenk27b207f2003-07-24 23:38:38 +0000259/* common/exports.c */
260void jumptable_init(void);
261
wdenkc83bf6a2004-01-06 22:38:14 +0000262/* common/memsize.c */
263int get_ram_size (volatile long *, long);
264
wdenke2211742002-11-02 23:30:20 +0000265/* $(BOARD)/$(BOARD).c */
266void reset_phy (void);
wdenkc83bf6a2004-01-06 22:38:14 +0000267void fdc_hw_init (void);
wdenke2211742002-11-02 23:30:20 +0000268
269/* $(BOARD)/eeprom.c */
270void eeprom_init (void);
wdenk6dd652f2003-06-19 23:40:20 +0000271#ifndef CONFIG_SPI
272int eeprom_probe (unsigned dev_addr, unsigned offset);
273#endif
wdenke2211742002-11-02 23:30:20 +0000274int eeprom_read (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt);
275int eeprom_write (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt);
276#ifdef CONFIG_LWMON
277extern uchar pic_read (uchar reg);
278extern void pic_write (uchar reg, uchar val);
279#endif
280
281/*
282 * Set this up regardless of board
283 * type, to prevent errors.
284 */
285#if defined(CONFIG_SPI) || !defined(CFG_I2C_EEPROM_ADDR)
286# define CFG_DEF_EEPROM_ADDR 0
287#else
288# define CFG_DEF_EEPROM_ADDR CFG_I2C_EEPROM_ADDR
289#endif /* CONFIG_SPI || !defined(CFG_I2C_EEPROM_ADDR) */
290
wdenkbdccc4f2003-08-05 17:43:17 +0000291#if defined(CONFIG_SPI)
wdenke2211742002-11-02 23:30:20 +0000292extern void spi_init_f (void);
293extern void spi_init_r (void);
wdenkc83bf6a2004-01-06 22:38:14 +0000294extern ssize_t spi_read (uchar *, int, uchar *, int);
wdenke2211742002-11-02 23:30:20 +0000295extern ssize_t spi_write (uchar *, int, uchar *, int);
296#endif
297
298#ifdef CONFIG_RPXCLASSIC
299void rpxclassic_init (void);
300#endif
301
wdenke63c8ee2004-06-09 21:04:48 +0000302void rpxlite_init (void);
303
wdenke2211742002-11-02 23:30:20 +0000304#ifdef CONFIG_MBX
305/* $(BOARD)/mbx8xx.c */
306void mbx_init (void);
307void board_serial_init (void);
308void board_ether_init (void);
309#endif
310
wdenkba56f622004-02-06 23:19:44 +0000311#if defined(CONFIG_RPXCLASSIC) || defined(CONFIG_MBX) || \
Stefan Roeseb79316f2005-08-15 12:31:23 +0200312 defined(CONFIG_IAD210) || defined(CONFIG_XPEDITE1K) || \
313 defined(CONFIG_METROBOX) || defined(CONFIG_KAREF)
wdenke2211742002-11-02 23:30:20 +0000314void board_get_enetaddr (uchar *addr);
315#endif
316
317#ifdef CONFIG_HERMES
318/* $(BOARD)/hermes.c */
319void hermes_start_lxt980 (int speed);
320#endif
321
322#ifdef CONFIG_EVB64260
323void evb64260_init(void);
324void debug_led(int, int);
325void display_mem_map(void);
326void perform_soft_reset(void);
327#endif
328
329void load_sernum_ethaddr (void);
330
331/* $(BOARD)/$(BOARD).c */
wdenkc837dcb2004-01-20 23:12:12 +0000332int board_early_init_f (void);
333int board_late_init (void);
wdenke2211742002-11-02 23:30:20 +0000334int board_postclk_init (void); /* after clocks/timebase, before env/serial */
wdenkc837dcb2004-01-20 23:12:12 +0000335int board_early_init_r (void);
wdenke2211742002-11-02 23:30:20 +0000336void board_poweroff (void);
337
338#if defined(CFG_DRAM_TEST)
339int testdram(void);
340#endif /* CFG_DRAM_TEST */
341
342/* $(CPU)/start.S */
wdenkc83bf6a2004-01-06 22:38:14 +0000343#if defined(CONFIG_5xx) || \
wdenk0db5bca2003-03-31 17:27:09 +0000344 defined(CONFIG_8xx)
wdenke2211742002-11-02 23:30:20 +0000345uint get_immr (uint);
346#endif
wdenkc83bf6a2004-01-06 22:38:14 +0000347uint get_pir (void);
wdenk36c72872004-06-09 17:45:32 +0000348#if defined(CONFIG_MPC5xxx)
349uint get_svr (void);
350#endif
wdenke2211742002-11-02 23:30:20 +0000351uint get_pvr (void);
wdenk547b4cb2004-06-09 00:51:50 +0000352uint get_svr (void);
wdenke2211742002-11-02 23:30:20 +0000353uint rd_ic_cst (void);
354void wr_ic_cst (uint);
355void wr_ic_adr (uint);
356uint rd_dc_cst (void);
357void wr_dc_cst (uint);
358void wr_dc_adr (uint);
359int icache_status (void);
360void icache_enable (void);
361void icache_disable(void);
362int dcache_status (void);
363void dcache_enable (void);
364void dcache_disable(void);
365void relocate_code (ulong, gd_t *, ulong);
366ulong get_endaddr (void);
367void trap_init (ulong);
368#if defined (CONFIG_4xx) || \
wdenkeeb1b772004-03-23 22:53:55 +0000369 defined (CONFIG_MPC5xxx) || \
wdenke2211742002-11-02 23:30:20 +0000370 defined (CONFIG_74xx_7xx) || \
371 defined (CONFIG_74x) || \
372 defined (CONFIG_75x) || \
wdenk0ac6f8b2004-07-09 23:27:13 +0000373 defined (CONFIG_74xx) || \
wdenk983fda82004-10-28 00:09:35 +0000374 defined (CONFIG_MPC8220) || \
Marian Balakowiczcd94ba32006-03-14 16:02:31 +0100375 defined (CONFIG_MPC85xx) || \
Jon Loeligerdebb7352006-04-26 17:58:56 -0500376 defined (CONFIG_MPC86xx) || \
Marian Balakowiczcd94ba32006-03-14 16:02:31 +0100377 defined (CONFIG_MPC83XX)
wdenkc83bf6a2004-01-06 22:38:14 +0000378unsigned char in8(unsigned int);
379void out8(unsigned int, unsigned char);
380unsigned short in16(unsigned int);
381unsigned short in16r(unsigned int);
382void out16(unsigned int, unsigned short value);
383void out16r(unsigned int, unsigned short value);
384unsigned long in32(unsigned int);
385unsigned long in32r(unsigned int);
386void out32(unsigned int, unsigned long value);
387void out32r(unsigned int, unsigned long value);
388void ppcDcbf(unsigned long value);
389void ppcDcbi(unsigned long value);
390void ppcSync(void);
wdenk0ac6f8b2004-07-09 23:27:13 +0000391void ppcDcbz(unsigned long value);
wdenke2211742002-11-02 23:30:20 +0000392#endif
393
394/* $(CPU)/cpu.c */
395int checkcpu (void);
396int checkicache (void);
397int checkdcache (void);
398void upmconfig (unsigned int, unsigned int *, unsigned int);
399ulong get_tbclk (void);
wdenk3ec924a2005-04-03 17:23:39 +0000400void reset_cpu (ulong addr);
wdenke2211742002-11-02 23:30:20 +0000401
402/* $(CPU)/serial.c */
403int serial_init (void);
wdenk756f5862005-04-03 15:51:42 +0000404void serial_addr (unsigned int);
wdenke2211742002-11-02 23:30:20 +0000405void serial_setbrg (void);
406void serial_putc (const char);
wdenk756f5862005-04-03 15:51:42 +0000407void serial_putc_raw(const char);
wdenke2211742002-11-02 23:30:20 +0000408void serial_puts (const char *);
wdenke2211742002-11-02 23:30:20 +0000409int serial_getc (void);
410int serial_tstc (void);
411
wdenk756f5862005-04-03 15:51:42 +0000412void _serial_setbrg (const int);
413void _serial_putc (const char, const int);
414void _serial_putc_raw(const char, const int);
415void _serial_puts (const char *, const int);
416int _serial_getc (const int);
417int _serial_tstc (const int);
418
wdenke2211742002-11-02 23:30:20 +0000419/* $(CPU)/speed.c */
420int get_clocks (void);
wdenkc178d3d2004-01-24 20:25:54 +0000421int get_clocks_866 (void);
422int sdram_adjust_866 (void);
wdenke9132ea2004-04-24 23:23:30 +0000423int adjust_sdram_tbs_8xx (void);
wdenke2211742002-11-02 23:30:20 +0000424#if defined(CONFIG_8260)
425int prt_8260_clks (void);
Eran Libertyf046ccd2005-07-28 10:08:46 -0500426#elif defined(CONFIG_MPC83XX)
427int print_clock_conf(void);
428#elif defined(CONFIG_MPC5xxx)
wdenk945af8d2003-07-16 21:53:01 +0000429int prt_mpc5xxx_clks (void);
430#endif
wdenk983fda82004-10-28 00:09:35 +0000431#if defined(CONFIG_MPC8220)
432int prt_mpc8220_clks (void);
433#endif
wdenke2211742002-11-02 23:30:20 +0000434#ifdef CONFIG_4xx
435ulong get_OPB_freq (void);
436ulong get_PCI_freq (void);
437#endif
wdenkf39748a2004-06-09 13:37:52 +0000438#if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) || defined(CONFIG_LH7A40X)
wdenke2211742002-11-02 23:30:20 +0000439ulong get_FCLK (void);
440ulong get_HCLK (void);
441ulong get_PCLK (void);
442ulong get_UCLK (void);
443#endif
wdenkf39748a2004-06-09 13:37:52 +0000444#if defined(CONFIG_LH7A40X)
445ulong get_PLLCLK (void);
446#endif
wdenk7cb22f92003-12-27 19:24:54 +0000447#if defined CONFIG_INCA_IP
wdenkc83bf6a2004-01-06 22:38:14 +0000448uint incaip_get_cpuclk (void);
wdenk7cb22f92003-12-27 19:24:54 +0000449#endif
wdenk281e00a2004-08-01 22:48:16 +0000450#if defined(CONFIG_IMX)
451ulong get_systemPLLCLK(void);
452ulong get_FCLK(void);
453ulong get_HCLK(void);
454ulong get_BCLK(void);
455ulong get_PERCLK1(void);
456ulong get_PERCLK2(void);
457ulong get_PERCLK3(void);
458#endif
wdenke2211742002-11-02 23:30:20 +0000459ulong get_bus_freq (ulong);
460
wdenk42d1f032003-10-15 23:53:47 +0000461#if defined(CONFIG_MPC85xx)
462typedef MPC85xx_SYS_INFO sys_info_t;
wdenkc83bf6a2004-01-06 22:38:14 +0000463void get_sys_info ( sys_info_t * );
wdenk42d1f032003-10-15 23:53:47 +0000464#endif
Jon Loeligerdebb7352006-04-26 17:58:56 -0500465#if defined(CONFIG_MPC86xx)
466typedef MPC86xx_SYS_INFO sys_info_t;
467void get_sys_info ( sys_info_t * );
468#endif
wdenk42d1f032003-10-15 23:53:47 +0000469
wdenke2211742002-11-02 23:30:20 +0000470#if defined(CONFIG_4xx) || defined(CONFIG_IOP480)
471# if defined(CONFIG_440)
472 typedef PPC440_SYS_INFO sys_info_t;
473# else
474 typedef PPC405_SYS_INFO sys_info_t;
475# endif
wdenkc83bf6a2004-01-06 22:38:14 +0000476void get_sys_info ( sys_info_t * );
wdenke2211742002-11-02 23:30:20 +0000477#endif
478
479/* $(CPU)/cpu_init.c */
480#if defined(CONFIG_8xx) || defined(CONFIG_8260)
481void cpu_init_f (volatile immap_t *immr);
482#endif
Jon Loeligerdebb7352006-04-26 17:58:56 -0500483#if defined(CONFIG_4xx) || defined(CONFIG_MPC85xx) || defined(CONFIG_MCF52x2) ||defined(CONFIG_MPC86xx)
wdenke2211742002-11-02 23:30:20 +0000484void cpu_init_f (void);
485#endif
wdenkbf9e3b32004-02-12 00:47:09 +0000486
wdenke2211742002-11-02 23:30:20 +0000487int cpu_init_r (void);
488#if defined(CONFIG_8260)
489int prt_8260_rsr (void);
490#endif
491
492/* $(CPU)/interrupts.c */
wdenkc83bf6a2004-01-06 22:38:14 +0000493int interrupt_init (void);
494void timer_interrupt (struct pt_regs *);
wdenke2211742002-11-02 23:30:20 +0000495void external_interrupt (struct pt_regs *);
496void irq_install_handler(int, interrupt_handler_t *, void *);
497void irq_free_handler (int);
498void reset_timer (void);
499ulong get_timer (ulong base);
500void set_timer (ulong t);
501void enable_interrupts (void);
502int disable_interrupts (void);
503
504/* $(CPU)/.../commproc.c */
505int dpram_init (void);
506uint dpram_base(void);
507uint dpram_base_align(uint align);
508uint dpram_alloc(uint size);
509uint dpram_alloc_align(uint size,uint align);
510void post_word_store (ulong);
511ulong post_word_load (void);
wdenkbdccc4f2003-08-05 17:43:17 +0000512void bootcount_store (ulong);
513ulong bootcount_load (void);
514#define BOOTCOUNT_MAGIC 0xB001C041
wdenke2211742002-11-02 23:30:20 +0000515
516/* $(CPU)/.../<eth> */
517void mii_init (void);
518
519/* $(CPU)/.../lcd.c */
520ulong lcd_setmem (ulong);
521
522/* $(CPU)/.../vfd.c */
523ulong vfd_setmem (ulong);
524
525/* $(CPU)/.../video.c */
526ulong video_setmem (ulong);
527
wdenkfabd46a2004-07-10 23:11:10 +0000528/* lib_$(ARCH)/cache.c */
wdenke2211742002-11-02 23:30:20 +0000529void flush_cache (unsigned long, unsigned long);
530
wdenk0db5bca2003-03-31 17:27:09 +0000531
wdenk15647dc2003-10-09 19:00:25 +0000532/* lib_$(ARCH)/ticks.S */
wdenke2211742002-11-02 23:30:20 +0000533unsigned long long get_ticks(void);
534void wait_ticks (unsigned long);
535
wdenk15647dc2003-10-09 19:00:25 +0000536/* lib_$(ARCH)/time.c */
wdenke2211742002-11-02 23:30:20 +0000537void udelay (unsigned long);
538ulong usec2ticks (unsigned long usec);
539ulong ticks2usec (unsigned long ticks);
540int init_timebase (void);
541
wdenk15647dc2003-10-09 19:00:25 +0000542/* lib_generic/vsprintf.c */
wdenke2211742002-11-02 23:30:20 +0000543ulong simple_strtoul(const char *cp,char **endp,unsigned int base);
wdenk42dfe7a2004-03-14 22:25:36 +0000544#ifdef CFG_64BIT_VSPRINTF
wdenkc40b2952004-03-13 23:29:43 +0000545unsigned long long simple_strtoull(const char *cp,char **endp,unsigned int base);
546#endif
wdenke2211742002-11-02 23:30:20 +0000547long simple_strtol(const char *cp,char **endp,unsigned int base);
548void panic(const char *fmt, ...);
549int sprintf(char * buf, const char *fmt, ...);
wdenkc83bf6a2004-01-06 22:38:14 +0000550int vsprintf(char *buf, const char *fmt, va_list args);
wdenke2211742002-11-02 23:30:20 +0000551
wdenk15647dc2003-10-09 19:00:25 +0000552/* lib_generic/crc32.c */
wdenke2211742002-11-02 23:30:20 +0000553ulong crc32 (ulong, const unsigned char *, uint);
554ulong crc32_no_comp (ulong, const unsigned char *, uint);
555
556/* common/console.c */
wdenke2211742002-11-02 23:30:20 +0000557int console_init_f(void); /* Before relocation; uses the serial stuff */
558int console_init_r(void); /* After relocation; uses the console stuff */
559int console_assign (int file, char *devname); /* Assign the console */
560int ctrlc (void);
561int had_ctrlc (void); /* have we had a Control-C since last clear? */
562void clear_ctrlc (void); /* clear the Control-C condition */
563int disable_ctrlc (int); /* 1 to disable, 0 to enable Control-C detect */
564
565/*
566 * STDIO based functions (can always be used)
567 */
568
569/* serial stuff */
570void serial_printf (const char *fmt, ...);
571
572/* stdin */
573int getc(void);
574int tstc(void);
575
576/* stdout */
577void putc(const char c);
578void puts(const char *s);
579void printf(const char *fmt, ...);
wdenk6dd652f2003-06-19 23:40:20 +0000580void vprintf(const char *fmt, va_list args);
wdenke2211742002-11-02 23:30:20 +0000581
582/* stderr */
583#define eputc(c) fputc(stderr, c)
584#define eputs(s) fputs(stderr, s)
585#define eprintf(fmt,args...) fprintf(stderr,fmt ,##args)
586
587/*
588 * FILE based functions (can only be used AFTER relocation!)
589 */
590
591#define stdin 0
592#define stdout 1
593#define stderr 2
594#define MAX_FILES 3
595
596void fprintf(int file, const char *fmt, ...);
597void fputs(int file, const char *s);
598void fputc(int file, const char c);
599int ftstc(int file);
600int fgetc(int file);
601
602int pcmcia_init (void);
603
604#ifdef CONFIG_SHOW_BOOT_PROGRESS
605void show_boot_progress (int status);
606#endif
607
wdenk8aa1a2d2005-04-04 12:44:11 +0000608#ifdef CONFIG_INIT_CRITICAL
609#error CONFIG_INIT_CRITICAL is depracted!
610#error Read section CONFIG_SKIP_LOWLEVEL_INIT in README.
611#endif
612
wdenke2211742002-11-02 23:30:20 +0000613#endif /* __COMMON_H_ */