blob: 83ccf7c9877cd1cee7c780601614ffffc80de039 [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;
wdenke2211742002-11-02 23:30:20 +0000200
201/* common/flash.c */
202void flash_perror (int);
203
wdenkb0fce992003-06-29 21:03:46 +0000204/* common/cmd_autoscript.c */
205int autoscript (ulong addr);
206
wdenke2211742002-11-02 23:30:20 +0000207/* common/cmd_bootm.c */
wdenkb0fce992003-06-29 21:03:46 +0000208void print_image_hdr (image_header_t *hdr);
wdenke2211742002-11-02 23:30:20 +0000209
wdenkc83bf6a2004-01-06 22:38:14 +0000210extern ulong load_addr; /* Default Load Address */
wdenke2211742002-11-02 23:30:20 +0000211
212/* common/cmd_nvedit.c */
213int env_init (void);
214void env_relocate (void);
Wolfgang Denk77ddac92005-10-13 16:45:02 +0200215char *getenv (char *);
216int getenv_r (char *name, char *buf, unsigned len);
wdenkc83bf6a2004-01-06 22:38:14 +0000217int saveenv (void);
wdenke2211742002-11-02 23:30:20 +0000218#ifdef CONFIG_PPC /* ARM version to be fixed! */
219void inline setenv (char *, char *);
wdenk2262cfe2002-11-18 00:14:45 +0000220#else
wdenkc83bf6a2004-01-06 22:38:14 +0000221void setenv (char *, char *);
wdenke2211742002-11-02 23:30:20 +0000222#endif /* CONFIG_PPC */
223#ifdef CONFIG_ARM
wdenk96085e32004-12-13 09:49:01 +0000224# include <asm/mach-types.h>
wdenkb6e4c402004-01-02 16:05:07 +0000225# include <asm/setup.h>
wdenke2211742002-11-02 23:30:20 +0000226# include <asm/u-boot-arm.h> /* ARM version to be fixed! */
227#endif /* CONFIG_ARM */
wdenk2262cfe2002-11-18 00:14:45 +0000228#ifdef CONFIG_I386 /* x86 version to be fixed! */
wdenk8bde7f72003-06-27 21:31:46 +0000229# include <asm/u-boot-i386.h>
wdenk2262cfe2002-11-18 00:14:45 +0000230#endif /* CONFIG_I386 */
wdenke2211742002-11-02 23:30:20 +0000231
wdenk04a85b32004-04-15 18:22:41 +0000232#ifdef CONFIG_AUTO_COMPLETE
233int env_complete(char *var, int maxv, char *cmdv[], int maxsz, char *buf);
234#endif
235
wdenkc83bf6a2004-01-06 22:38:14 +0000236void pci_init (void);
237void pci_init_board(void);
238void pciinfo (int, int);
wdenke2211742002-11-02 23:30:20 +0000239
240#if defined(CONFIG_PCI) && defined(CONFIG_440)
241# if defined(CFG_PCI_PRE_INIT)
wdenkc83bf6a2004-01-06 22:38:14 +0000242 int pci_pre_init (struct pci_controller * );
wdenke2211742002-11-02 23:30:20 +0000243# endif
244# if defined(CFG_PCI_TARGET_INIT)
wdenkc83bf6a2004-01-06 22:38:14 +0000245 void pci_target_init (struct pci_controller *);
wdenke2211742002-11-02 23:30:20 +0000246# endif
247# if defined(CFG_PCI_MASTER_INIT)
wdenkc83bf6a2004-01-06 22:38:14 +0000248 void pci_master_init (struct pci_controller *);
wdenke2211742002-11-02 23:30:20 +0000249# endif
wdenkc83bf6a2004-01-06 22:38:14 +0000250 int is_pci_host (struct pci_controller *);
wdenke2211742002-11-02 23:30:20 +0000251#endif
252
253int misc_init_f (void);
254int misc_init_r (void);
255
wdenk27b207f2003-07-24 23:38:38 +0000256/* common/exports.c */
257void jumptable_init(void);
258
wdenkc83bf6a2004-01-06 22:38:14 +0000259/* common/memsize.c */
260int get_ram_size (volatile long *, long);
261
wdenke2211742002-11-02 23:30:20 +0000262/* $(BOARD)/$(BOARD).c */
263void reset_phy (void);
wdenkc83bf6a2004-01-06 22:38:14 +0000264void fdc_hw_init (void);
wdenke2211742002-11-02 23:30:20 +0000265
266/* $(BOARD)/eeprom.c */
267void eeprom_init (void);
wdenk6dd652f2003-06-19 23:40:20 +0000268#ifndef CONFIG_SPI
269int eeprom_probe (unsigned dev_addr, unsigned offset);
270#endif
wdenke2211742002-11-02 23:30:20 +0000271int eeprom_read (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt);
272int eeprom_write (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt);
273#ifdef CONFIG_LWMON
274extern uchar pic_read (uchar reg);
275extern void pic_write (uchar reg, uchar val);
276#endif
277
278/*
279 * Set this up regardless of board
280 * type, to prevent errors.
281 */
282#if defined(CONFIG_SPI) || !defined(CFG_I2C_EEPROM_ADDR)
283# define CFG_DEF_EEPROM_ADDR 0
284#else
285# define CFG_DEF_EEPROM_ADDR CFG_I2C_EEPROM_ADDR
286#endif /* CONFIG_SPI || !defined(CFG_I2C_EEPROM_ADDR) */
287
wdenkbdccc4f2003-08-05 17:43:17 +0000288#if defined(CONFIG_SPI)
wdenke2211742002-11-02 23:30:20 +0000289extern void spi_init_f (void);
290extern void spi_init_r (void);
wdenkc83bf6a2004-01-06 22:38:14 +0000291extern ssize_t spi_read (uchar *, int, uchar *, int);
wdenke2211742002-11-02 23:30:20 +0000292extern ssize_t spi_write (uchar *, int, uchar *, int);
293#endif
294
295#ifdef CONFIG_RPXCLASSIC
296void rpxclassic_init (void);
297#endif
298
wdenke63c8ee2004-06-09 21:04:48 +0000299void rpxlite_init (void);
300
wdenke2211742002-11-02 23:30:20 +0000301#ifdef CONFIG_MBX
302/* $(BOARD)/mbx8xx.c */
303void mbx_init (void);
304void board_serial_init (void);
305void board_ether_init (void);
306#endif
307
wdenkba56f622004-02-06 23:19:44 +0000308#if defined(CONFIG_RPXCLASSIC) || defined(CONFIG_MBX) || \
Stefan Roeseb79316f2005-08-15 12:31:23 +0200309 defined(CONFIG_IAD210) || defined(CONFIG_XPEDITE1K) || \
310 defined(CONFIG_METROBOX) || defined(CONFIG_KAREF)
wdenke2211742002-11-02 23:30:20 +0000311void board_get_enetaddr (uchar *addr);
312#endif
313
314#ifdef CONFIG_HERMES
315/* $(BOARD)/hermes.c */
316void hermes_start_lxt980 (int speed);
317#endif
318
319#ifdef CONFIG_EVB64260
320void evb64260_init(void);
321void debug_led(int, int);
322void display_mem_map(void);
323void perform_soft_reset(void);
324#endif
325
326void load_sernum_ethaddr (void);
327
328/* $(BOARD)/$(BOARD).c */
wdenkc837dcb2004-01-20 23:12:12 +0000329int board_early_init_f (void);
330int board_late_init (void);
wdenke2211742002-11-02 23:30:20 +0000331int board_postclk_init (void); /* after clocks/timebase, before env/serial */
wdenkc837dcb2004-01-20 23:12:12 +0000332int board_early_init_r (void);
wdenke2211742002-11-02 23:30:20 +0000333void board_poweroff (void);
334
335#if defined(CFG_DRAM_TEST)
336int testdram(void);
337#endif /* CFG_DRAM_TEST */
338
339/* $(CPU)/start.S */
wdenkc83bf6a2004-01-06 22:38:14 +0000340#if defined(CONFIG_5xx) || \
wdenk0db5bca2003-03-31 17:27:09 +0000341 defined(CONFIG_8xx)
wdenke2211742002-11-02 23:30:20 +0000342uint get_immr (uint);
343#endif
wdenkc83bf6a2004-01-06 22:38:14 +0000344uint get_pir (void);
wdenk36c72872004-06-09 17:45:32 +0000345#if defined(CONFIG_MPC5xxx)
346uint get_svr (void);
347#endif
wdenke2211742002-11-02 23:30:20 +0000348uint get_pvr (void);
wdenk547b4cb2004-06-09 00:51:50 +0000349uint get_svr (void);
wdenke2211742002-11-02 23:30:20 +0000350uint rd_ic_cst (void);
351void wr_ic_cst (uint);
352void wr_ic_adr (uint);
353uint rd_dc_cst (void);
354void wr_dc_cst (uint);
355void wr_dc_adr (uint);
356int icache_status (void);
357void icache_enable (void);
358void icache_disable(void);
359int dcache_status (void);
360void dcache_enable (void);
361void dcache_disable(void);
362void relocate_code (ulong, gd_t *, ulong);
363ulong get_endaddr (void);
364void trap_init (ulong);
365#if defined (CONFIG_4xx) || \
wdenkeeb1b772004-03-23 22:53:55 +0000366 defined (CONFIG_MPC5xxx) || \
wdenke2211742002-11-02 23:30:20 +0000367 defined (CONFIG_74xx_7xx) || \
368 defined (CONFIG_74x) || \
369 defined (CONFIG_75x) || \
wdenk0ac6f8b2004-07-09 23:27:13 +0000370 defined (CONFIG_74xx) || \
wdenk983fda82004-10-28 00:09:35 +0000371 defined (CONFIG_MPC8220) || \
Marian Balakowiczcd94ba32006-03-14 16:02:31 +0100372 defined (CONFIG_MPC85xx) || \
Jon Loeligerdebb7352006-04-26 17:58:56 -0500373 defined (CONFIG_MPC86xx) || \
Marian Balakowiczcd94ba32006-03-14 16:02:31 +0100374 defined (CONFIG_MPC83XX)
wdenkc83bf6a2004-01-06 22:38:14 +0000375unsigned char in8(unsigned int);
376void out8(unsigned int, unsigned char);
377unsigned short in16(unsigned int);
378unsigned short in16r(unsigned int);
379void out16(unsigned int, unsigned short value);
380void out16r(unsigned int, unsigned short value);
381unsigned long in32(unsigned int);
382unsigned long in32r(unsigned int);
383void out32(unsigned int, unsigned long value);
384void out32r(unsigned int, unsigned long value);
385void ppcDcbf(unsigned long value);
386void ppcDcbi(unsigned long value);
387void ppcSync(void);
wdenk0ac6f8b2004-07-09 23:27:13 +0000388void ppcDcbz(unsigned long value);
wdenke2211742002-11-02 23:30:20 +0000389#endif
390
391/* $(CPU)/cpu.c */
392int checkcpu (void);
393int checkicache (void);
394int checkdcache (void);
395void upmconfig (unsigned int, unsigned int *, unsigned int);
396ulong get_tbclk (void);
wdenk3ec924a2005-04-03 17:23:39 +0000397void reset_cpu (ulong addr);
wdenke2211742002-11-02 23:30:20 +0000398
399/* $(CPU)/serial.c */
400int serial_init (void);
wdenk756f5862005-04-03 15:51:42 +0000401void serial_addr (unsigned int);
wdenke2211742002-11-02 23:30:20 +0000402void serial_setbrg (void);
403void serial_putc (const char);
wdenk756f5862005-04-03 15:51:42 +0000404void serial_putc_raw(const char);
wdenke2211742002-11-02 23:30:20 +0000405void serial_puts (const char *);
wdenke2211742002-11-02 23:30:20 +0000406int serial_getc (void);
407int serial_tstc (void);
408
wdenk756f5862005-04-03 15:51:42 +0000409void _serial_setbrg (const int);
410void _serial_putc (const char, const int);
411void _serial_putc_raw(const char, const int);
412void _serial_puts (const char *, const int);
413int _serial_getc (const int);
414int _serial_tstc (const int);
415
wdenke2211742002-11-02 23:30:20 +0000416/* $(CPU)/speed.c */
417int get_clocks (void);
wdenkc178d3d2004-01-24 20:25:54 +0000418int get_clocks_866 (void);
419int sdram_adjust_866 (void);
wdenke9132ea2004-04-24 23:23:30 +0000420int adjust_sdram_tbs_8xx (void);
wdenke2211742002-11-02 23:30:20 +0000421#if defined(CONFIG_8260)
422int prt_8260_clks (void);
Eran Libertyf046ccd2005-07-28 10:08:46 -0500423#elif defined(CONFIG_MPC83XX)
424int print_clock_conf(void);
425#elif defined(CONFIG_MPC5xxx)
wdenk945af8d2003-07-16 21:53:01 +0000426int prt_mpc5xxx_clks (void);
427#endif
wdenk983fda82004-10-28 00:09:35 +0000428#if defined(CONFIG_MPC8220)
429int prt_mpc8220_clks (void);
430#endif
wdenke2211742002-11-02 23:30:20 +0000431#ifdef CONFIG_4xx
432ulong get_OPB_freq (void);
433ulong get_PCI_freq (void);
434#endif
wdenkf39748a2004-06-09 13:37:52 +0000435#if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) || defined(CONFIG_LH7A40X)
wdenke2211742002-11-02 23:30:20 +0000436ulong get_FCLK (void);
437ulong get_HCLK (void);
438ulong get_PCLK (void);
439ulong get_UCLK (void);
440#endif
wdenkf39748a2004-06-09 13:37:52 +0000441#if defined(CONFIG_LH7A40X)
442ulong get_PLLCLK (void);
443#endif
wdenk7cb22f92003-12-27 19:24:54 +0000444#if defined CONFIG_INCA_IP
wdenkc83bf6a2004-01-06 22:38:14 +0000445uint incaip_get_cpuclk (void);
wdenk7cb22f92003-12-27 19:24:54 +0000446#endif
wdenk281e00a2004-08-01 22:48:16 +0000447#if defined(CONFIG_IMX)
448ulong get_systemPLLCLK(void);
449ulong get_FCLK(void);
450ulong get_HCLK(void);
451ulong get_BCLK(void);
452ulong get_PERCLK1(void);
453ulong get_PERCLK2(void);
454ulong get_PERCLK3(void);
455#endif
wdenke2211742002-11-02 23:30:20 +0000456ulong get_bus_freq (ulong);
457
wdenk42d1f032003-10-15 23:53:47 +0000458#if defined(CONFIG_MPC85xx)
459typedef MPC85xx_SYS_INFO sys_info_t;
wdenkc83bf6a2004-01-06 22:38:14 +0000460void get_sys_info ( sys_info_t * );
wdenk42d1f032003-10-15 23:53:47 +0000461#endif
Jon Loeligerdebb7352006-04-26 17:58:56 -0500462#if defined(CONFIG_MPC86xx)
463typedef MPC86xx_SYS_INFO sys_info_t;
464void get_sys_info ( sys_info_t * );
465#endif
wdenk42d1f032003-10-15 23:53:47 +0000466
wdenke2211742002-11-02 23:30:20 +0000467#if defined(CONFIG_4xx) || defined(CONFIG_IOP480)
468# if defined(CONFIG_440)
469 typedef PPC440_SYS_INFO sys_info_t;
470# else
471 typedef PPC405_SYS_INFO sys_info_t;
472# endif
wdenkc83bf6a2004-01-06 22:38:14 +0000473void get_sys_info ( sys_info_t * );
wdenke2211742002-11-02 23:30:20 +0000474#endif
475
476/* $(CPU)/cpu_init.c */
477#if defined(CONFIG_8xx) || defined(CONFIG_8260)
478void cpu_init_f (volatile immap_t *immr);
479#endif
Jon Loeligerdebb7352006-04-26 17:58:56 -0500480#if defined(CONFIG_4xx) || defined(CONFIG_MPC85xx) || defined(CONFIG_MCF52x2) ||defined(CONFIG_MPC86xx)
wdenke2211742002-11-02 23:30:20 +0000481void cpu_init_f (void);
482#endif
wdenkbf9e3b32004-02-12 00:47:09 +0000483
wdenke2211742002-11-02 23:30:20 +0000484int cpu_init_r (void);
485#if defined(CONFIG_8260)
486int prt_8260_rsr (void);
487#endif
488
489/* $(CPU)/interrupts.c */
wdenkc83bf6a2004-01-06 22:38:14 +0000490int interrupt_init (void);
491void timer_interrupt (struct pt_regs *);
wdenke2211742002-11-02 23:30:20 +0000492void external_interrupt (struct pt_regs *);
493void irq_install_handler(int, interrupt_handler_t *, void *);
494void irq_free_handler (int);
495void reset_timer (void);
496ulong get_timer (ulong base);
497void set_timer (ulong t);
498void enable_interrupts (void);
499int disable_interrupts (void);
500
501/* $(CPU)/.../commproc.c */
502int dpram_init (void);
503uint dpram_base(void);
504uint dpram_base_align(uint align);
505uint dpram_alloc(uint size);
506uint dpram_alloc_align(uint size,uint align);
507void post_word_store (ulong);
508ulong post_word_load (void);
wdenkbdccc4f2003-08-05 17:43:17 +0000509void bootcount_store (ulong);
510ulong bootcount_load (void);
511#define BOOTCOUNT_MAGIC 0xB001C041
wdenke2211742002-11-02 23:30:20 +0000512
513/* $(CPU)/.../<eth> */
514void mii_init (void);
515
516/* $(CPU)/.../lcd.c */
517ulong lcd_setmem (ulong);
518
519/* $(CPU)/.../vfd.c */
520ulong vfd_setmem (ulong);
521
522/* $(CPU)/.../video.c */
523ulong video_setmem (ulong);
524
wdenkfabd46a2004-07-10 23:11:10 +0000525/* lib_$(ARCH)/cache.c */
wdenke2211742002-11-02 23:30:20 +0000526void flush_cache (unsigned long, unsigned long);
527
wdenk0db5bca2003-03-31 17:27:09 +0000528
wdenk15647dc2003-10-09 19:00:25 +0000529/* lib_$(ARCH)/ticks.S */
wdenke2211742002-11-02 23:30:20 +0000530unsigned long long get_ticks(void);
531void wait_ticks (unsigned long);
532
wdenk15647dc2003-10-09 19:00:25 +0000533/* lib_$(ARCH)/time.c */
wdenke2211742002-11-02 23:30:20 +0000534void udelay (unsigned long);
535ulong usec2ticks (unsigned long usec);
536ulong ticks2usec (unsigned long ticks);
537int init_timebase (void);
538
wdenk15647dc2003-10-09 19:00:25 +0000539/* lib_generic/vsprintf.c */
wdenke2211742002-11-02 23:30:20 +0000540ulong simple_strtoul(const char *cp,char **endp,unsigned int base);
wdenk42dfe7a2004-03-14 22:25:36 +0000541#ifdef CFG_64BIT_VSPRINTF
wdenkc40b2952004-03-13 23:29:43 +0000542unsigned long long simple_strtoull(const char *cp,char **endp,unsigned int base);
543#endif
wdenke2211742002-11-02 23:30:20 +0000544long simple_strtol(const char *cp,char **endp,unsigned int base);
545void panic(const char *fmt, ...);
546int sprintf(char * buf, const char *fmt, ...);
wdenkc83bf6a2004-01-06 22:38:14 +0000547int vsprintf(char *buf, const char *fmt, va_list args);
wdenke2211742002-11-02 23:30:20 +0000548
wdenk15647dc2003-10-09 19:00:25 +0000549/* lib_generic/crc32.c */
wdenke2211742002-11-02 23:30:20 +0000550ulong crc32 (ulong, const unsigned char *, uint);
551ulong crc32_no_comp (ulong, const unsigned char *, uint);
552
553/* common/console.c */
wdenke2211742002-11-02 23:30:20 +0000554int console_init_f(void); /* Before relocation; uses the serial stuff */
555int console_init_r(void); /* After relocation; uses the console stuff */
556int console_assign (int file, char *devname); /* Assign the console */
557int ctrlc (void);
558int had_ctrlc (void); /* have we had a Control-C since last clear? */
559void clear_ctrlc (void); /* clear the Control-C condition */
560int disable_ctrlc (int); /* 1 to disable, 0 to enable Control-C detect */
561
562/*
563 * STDIO based functions (can always be used)
564 */
565
566/* serial stuff */
567void serial_printf (const char *fmt, ...);
568
569/* stdin */
570int getc(void);
571int tstc(void);
572
573/* stdout */
574void putc(const char c);
575void puts(const char *s);
576void printf(const char *fmt, ...);
wdenk6dd652f2003-06-19 23:40:20 +0000577void vprintf(const char *fmt, va_list args);
wdenke2211742002-11-02 23:30:20 +0000578
579/* stderr */
580#define eputc(c) fputc(stderr, c)
581#define eputs(s) fputs(stderr, s)
582#define eprintf(fmt,args...) fprintf(stderr,fmt ,##args)
583
584/*
585 * FILE based functions (can only be used AFTER relocation!)
586 */
587
588#define stdin 0
589#define stdout 1
590#define stderr 2
591#define MAX_FILES 3
592
593void fprintf(int file, const char *fmt, ...);
594void fputs(int file, const char *s);
595void fputc(int file, const char c);
596int ftstc(int file);
597int fgetc(int file);
598
599int pcmcia_init (void);
600
601#ifdef CONFIG_SHOW_BOOT_PROGRESS
602void show_boot_progress (int status);
603#endif
604
wdenk8aa1a2d2005-04-04 12:44:11 +0000605#ifdef CONFIG_INIT_CRITICAL
606#error CONFIG_INIT_CRITICAL is depracted!
607#error Read section CONFIG_SKIP_LOWLEVEL_INIT in README.
608#endif
609
wdenke2211742002-11-02 23:30:20 +0000610#endif /* __COMMON_H_ */