blob: 83ccf7c9877cd1cee7c780601614ffffc80de039 [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>
wdenkdc130442004-12-12 22:06:17 +000066#elif defined(CONFIG_MPC5xxx)
67#include <mpc5xxx.h>
wdenk337f5652004-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)
wdenk3902d702004-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 Loeliger5c8aa972006-04-26 17:58:56 -050082#ifdef CONFIG_MPC86xx
83#include <mpc86xx.h>
84#include <asm/immap_86xx.h>
85#endif
wdenk9c53f402003-10-15 23:53:47 +000086#ifdef CONFIG_MPC85xx
87#include <mpc85xx.h>
88#include <asm/immap_85xx.h>
89#endif
Eran Liberty9095d4a2005-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
wdenkb00ec162003-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)
wdenk88e72a32003-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...)
wdenk88e72a32003-06-19 23:04:19 +0000113#define debugX(level,fmt,args...)
wdenke2211742002-11-02 23:30:20 +0000114#endif /* DEBUG */
115
wdenk87249ba2004-01-06 22:38:14 +0000116typedef void (interrupt_handler_t)(void *);
wdenke2211742002-11-02 23:30:20 +0000117
wdenk87249ba2004-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
wdenk7a428cc2003-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) || \
wdenk1ebf41e2004-01-02 14:00:00 +0000128 defined(CONFIG_TQM862M) || defined(CONFIG_TQM866M)
wdenk7a428cc2003-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) || \
wdenk6bd14892003-04-10 11:18:18 +0000134 defined(CONFIG_TQM855L) || defined(CONFIG_TQM860L) || \
wdenk7a428cc2003-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
wdenk7ac16102004-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/*
wdenk452cfd62002-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
wdenkc35ba4e2004-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
wdenk87249ba2004-01-06 22:38:14 +0000177void hang (void) __attribute__ ((noreturn));
wdenke2211742002-11-02 23:30:20 +0000178
179/* */
180long int initdram (int);
wdenk87249ba2004-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);
wdenkb00ec162003-06-19 23:40:20 +0000188void init_cmd_timeout(void);
wdenke2211742002-11-02 23:30:20 +0000189void reset_cmd_timeout(void);
190
wdenk9f837932003-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);
wdenkb9a83a92003-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
wdenkf12e3962003-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 */
wdenkf12e3962003-06-29 21:03:46 +0000208void print_image_hdr (image_header_t *hdr);
wdenke2211742002-11-02 23:30:20 +0000209
wdenk87249ba2004-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 Denk7fb52662005-10-13 16:45:02 +0200215char *getenv (char *);
216int getenv_r (char *name, char *buf, unsigned len);
wdenk87249ba2004-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 *);
wdenk591dda52002-11-18 00:14:45 +0000220#else
wdenk87249ba2004-01-06 22:38:14 +0000221void setenv (char *, char *);
wdenke2211742002-11-02 23:30:20 +0000222#endif /* CONFIG_PPC */
223#ifdef CONFIG_ARM
wdenk295ccfa2004-12-13 09:49:01 +0000224# include <asm/mach-types.h>
wdenkbc01dd52004-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 */
wdenk591dda52002-11-18 00:14:45 +0000228#ifdef CONFIG_I386 /* x86 version to be fixed! */
wdenk57b2d802003-06-27 21:31:46 +0000229# include <asm/u-boot-i386.h>
wdenk591dda52002-11-18 00:14:45 +0000230#endif /* CONFIG_I386 */
wdenke2211742002-11-02 23:30:20 +0000231
wdenk3902d702004-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
wdenk87249ba2004-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)
wdenk87249ba2004-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)
wdenk87249ba2004-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)
wdenk87249ba2004-01-06 22:38:14 +0000248 void pci_master_init (struct pci_controller *);
wdenke2211742002-11-02 23:30:20 +0000249# endif
wdenk87249ba2004-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
wdenk874ac262003-07-24 23:38:38 +0000256/* common/exports.c */
257void jumptable_init(void);
258
wdenk87249ba2004-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);
wdenk87249ba2004-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);
wdenkb00ec162003-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
wdenk0a658552003-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);
wdenk87249ba2004-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
wdenkec432742004-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
wdenk544e9732004-02-06 23:19:44 +0000308#if defined(CONFIG_RPXCLASSIC) || defined(CONFIG_MBX) || \
Stefan Roese5ff4c3f2005-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 */
wdenkda55c6e2004-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 */
wdenkda55c6e2004-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 */
wdenk87249ba2004-01-06 22:38:14 +0000340#if defined(CONFIG_5xx) || \
wdenk359733b2003-03-31 17:27:09 +0000341 defined(CONFIG_8xx)
wdenke2211742002-11-02 23:30:20 +0000342uint get_immr (uint);
343#endif
wdenk87249ba2004-01-06 22:38:14 +0000344uint get_pir (void);
wdenk2d644822004-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);
wdenkcc245992004-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) || \
wdenkaea86e42004-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) || \
wdenk13eb2212004-07-09 23:27:13 +0000370 defined (CONFIG_74xx) || \
wdenk337f5652004-10-28 00:09:35 +0000371 defined (CONFIG_MPC8220) || \
Marian Balakowiczaf03ecb2006-03-14 16:02:31 +0100372 defined (CONFIG_MPC85xx) || \
Jon Loeliger5c8aa972006-04-26 17:58:56 -0500373 defined (CONFIG_MPC86xx) || \
Marian Balakowiczaf03ecb2006-03-14 16:02:31 +0100374 defined (CONFIG_MPC83XX)
wdenk87249ba2004-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);
wdenk13eb2212004-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);
wdenk1e8d0c52005-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);
wdenke0c812a2005-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);
wdenke0c812a2005-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
wdenke0c812a2005-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);
wdenkb50cde52004-01-24 20:25:54 +0000418int get_clocks_866 (void);
419int sdram_adjust_866 (void);
wdenkc78bf132004-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 Liberty9095d4a2005-07-28 10:08:46 -0500423#elif defined(CONFIG_MPC83XX)
424int print_clock_conf(void);
425#elif defined(CONFIG_MPC5xxx)
wdenk21136db2003-07-16 21:53:01 +0000426int prt_mpc5xxx_clks (void);
427#endif
wdenk337f5652004-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
wdenk3c711762004-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
wdenk3c711762004-06-09 13:37:52 +0000441#if defined(CONFIG_LH7A40X)
442ulong get_PLLCLK (void);
443#endif
wdenk67f13362003-12-27 19:24:54 +0000444#if defined CONFIG_INCA_IP
wdenk87249ba2004-01-06 22:38:14 +0000445uint incaip_get_cpuclk (void);
wdenk67f13362003-12-27 19:24:54 +0000446#endif
wdenk7ac16102004-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
wdenk9c53f402003-10-15 23:53:47 +0000458#if defined(CONFIG_MPC85xx)
459typedef MPC85xx_SYS_INFO sys_info_t;
wdenk87249ba2004-01-06 22:38:14 +0000460void get_sys_info ( sys_info_t * );
wdenk9c53f402003-10-15 23:53:47 +0000461#endif
Jon Loeliger5c8aa972006-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
wdenk9c53f402003-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
wdenk87249ba2004-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 Loeliger5c8aa972006-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
wdenke65527f2004-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 */
wdenk87249ba2004-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);
wdenk0a658552003-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
wdenkb5bb1392004-07-10 23:11:10 +0000525/* lib_$(ARCH)/cache.c */
wdenke2211742002-11-02 23:30:20 +0000526void flush_cache (unsigned long, unsigned long);
527
wdenk359733b2003-03-31 17:27:09 +0000528
wdenk9f837932003-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
wdenk9f837932003-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
wdenk9f837932003-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);
wdenkc35ba4e2004-03-14 22:25:36 +0000541#ifdef CFG_64BIT_VSPRINTF
wdenkf602aa02004-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, ...);
wdenk87249ba2004-01-06 22:38:14 +0000547int vsprintf(char *buf, const char *fmt, va_list args);
wdenke2211742002-11-02 23:30:20 +0000548
wdenk9f837932003-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, ...);
wdenkb00ec162003-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
wdenk3d3d99f2005-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_ */