wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 1 | /* |
wdenk | d4ca31c | 2004-01-02 14:00:00 +0000 | [diff] [blame] | 2 | * (C) Copyright 2000-2004 |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 3 | * 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 |
wdenk | 180d3f7 | 2004-01-04 16:28:35 +0000 | [diff] [blame] | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 16 | * 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 | |
| 30 | typedef unsigned char uchar; |
| 31 | typedef volatile unsigned long vu_long; |
wdenk | 180d3f7 | 2004-01-04 16:28:35 +0000 | [diff] [blame] | 32 | typedef volatile unsigned short vu_short; |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 33 | typedef 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 |
wdenk | 180d3f7 | 2004-01-04 16:28:35 +0000 | [diff] [blame] | 44 | #if defined(CONFIG_8xx) |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 45 | #include <asm/8xx_immap.h> |
wdenk | d4ca31c | 2004-01-02 14:00:00 +0000 | [diff] [blame] | 46 | #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) |
wdenk | 180d3f7 | 2004-01-04 16:28:35 +0000 | [diff] [blame] | 51 | # define CONFIG_MPC866_et_al 1 |
| 52 | #elif defined(CONFIG_MPC870) \ |
| 53 | || defined(CONFIG_MPC875) \ |
| 54 | || defined(CONFIG_MPC880) \ |
| 55 | || defined(CONFIG_MPC885) |
| 56 | # define CONFIG_DUET 1 |
| 57 | #endif |
| 58 | #if defined(CONFIG_MPC860) \ |
| 59 | || defined(CONFIG_MPC860T) \ |
| 60 | || defined(CONFIG_MPC866_et_al) \ |
| 61 | || defined(CONFIG_DUET) |
| 62 | # define CONFIG_MPC86x 1 |
wdenk | 2535d60 | 2003-07-17 23:16:40 +0000 | [diff] [blame] | 63 | #endif |
wdenk | 0db5bca | 2003-03-31 17:27:09 +0000 | [diff] [blame] | 64 | #elif defined(CONFIG_5xx) |
| 65 | #include <asm/5xx_immap.h> |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 66 | #elif defined(CONFIG_8260) |
| 67 | #include <asm/immap_8260.h> |
| 68 | #endif |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 69 | #ifdef CONFIG_MPC85xx |
| 70 | #include <mpc85xx.h> |
| 71 | #include <asm/immap_85xx.h> |
| 72 | #endif |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 73 | #ifdef CONFIG_4xx |
| 74 | #include <ppc4xx.h> |
| 75 | #endif |
| 76 | #ifdef CONFIG_HYMOD |
wdenk | 6dd652f | 2003-06-19 23:40:20 +0000 | [diff] [blame] | 77 | #include <board/hymod/hymod.h> |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 78 | #endif |
| 79 | #ifdef CONFIG_ARM |
| 80 | #define asmlinkage /* nothing */ |
| 81 | #endif |
| 82 | |
| 83 | #include <part.h> |
| 84 | #include <flash.h> |
| 85 | #include <image.h> |
| 86 | |
| 87 | #ifdef DEBUG |
| 88 | #define debug(fmt,args...) printf (fmt ,##args) |
wdenk | 52f52c1 | 2003-06-19 23:04:19 +0000 | [diff] [blame] | 89 | #define debugX(level,fmt,args...) if (DEBUG>=level) printf(fmt,##args); |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 90 | #else |
| 91 | #define debug(fmt,args...) |
wdenk | 52f52c1 | 2003-06-19 23:04:19 +0000 | [diff] [blame] | 92 | #define debugX(level,fmt,args...) |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 93 | #endif /* DEBUG */ |
| 94 | |
wdenk | c83bf6a | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 95 | typedef void (interrupt_handler_t)(void *); |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 96 | |
wdenk | c83bf6a | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 97 | #include <asm/u-boot.h> /* boot information for Linux kernel */ |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 98 | #include <asm/global_data.h> /* global data used for startup functions */ |
| 99 | |
wdenk | 71f9511 | 2003-06-15 22:40:42 +0000 | [diff] [blame] | 100 | /* |
| 101 | * enable common handling for all TQM8xxL/M boards: |
| 102 | * - CONFIG_TQM8xxM will be defined for all TQM8xxM boards |
| 103 | * - CONFIG_TQM8xxL will be defined for all TQM8xxL _and_ TQM8xxM boards |
| 104 | */ |
| 105 | #if defined(CONFIG_TQM823M) || defined(CONFIG_TQM850M) || \ |
| 106 | defined(CONFIG_TQM855M) || defined(CONFIG_TQM860M) || \ |
wdenk | d4ca31c | 2004-01-02 14:00:00 +0000 | [diff] [blame] | 107 | defined(CONFIG_TQM862M) || defined(CONFIG_TQM866M) |
wdenk | 71f9511 | 2003-06-15 22:40:42 +0000 | [diff] [blame] | 108 | # ifndef CONFIG_TQM8xxM |
| 109 | # define CONFIG_TQM8xxM |
| 110 | # endif |
| 111 | #endif |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 112 | #if defined(CONFIG_TQM823L) || defined(CONFIG_TQM850L) || \ |
wdenk | d126bfb | 2003-04-10 11:18:18 +0000 | [diff] [blame] | 113 | defined(CONFIG_TQM855L) || defined(CONFIG_TQM860L) || \ |
wdenk | 71f9511 | 2003-06-15 22:40:42 +0000 | [diff] [blame] | 114 | defined(CONFIG_TQM862L) || defined(CONFIG_TQM8xxM) |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 115 | # ifndef CONFIG_TQM8xxL |
| 116 | # define CONFIG_TQM8xxL |
| 117 | # endif |
| 118 | #endif |
| 119 | |
| 120 | |
| 121 | /* |
wdenk | c7de829 | 2002-11-19 11:04:11 +0000 | [diff] [blame] | 122 | * General Purpose Utilities |
| 123 | */ |
| 124 | #define min(X, Y) \ |
| 125 | ({ typeof (X) __x = (X), __y = (Y); \ |
| 126 | (__x < __y) ? __x : __y; }) |
| 127 | |
| 128 | #define max(X, Y) \ |
| 129 | ({ typeof (X) __x = (X), __y = (Y); \ |
| 130 | (__x > __y) ? __x : __y; }) |
| 131 | |
| 132 | |
| 133 | /* |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 134 | * Function Prototypes |
| 135 | */ |
| 136 | |
| 137 | #if CONFIG_SERIAL_SOFTWARE_FIFO |
| 138 | void serial_buffered_init (void); |
| 139 | void serial_buffered_putc (const char); |
| 140 | void serial_buffered_puts (const char *); |
| 141 | int serial_buffered_getc (void); |
| 142 | int serial_buffered_tstc (void); |
| 143 | #endif /* CONFIG_SERIAL_SOFTWARE_FIFO */ |
| 144 | |
wdenk | c83bf6a | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 145 | void hang (void) __attribute__ ((noreturn)); |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 146 | |
| 147 | /* */ |
| 148 | long int initdram (int); |
wdenk | c83bf6a | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 149 | int display_options (void); |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 150 | void print_size (ulong, const char *); |
| 151 | |
| 152 | /* common/main.c */ |
| 153 | void main_loop (void); |
| 154 | int run_command (const char *cmd, int flag); |
| 155 | int readline (const char *const prompt); |
wdenk | 6dd652f | 2003-06-19 23:40:20 +0000 | [diff] [blame] | 156 | void init_cmd_timeout(void); |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 157 | void reset_cmd_timeout(void); |
| 158 | |
wdenk | 15647dc | 2003-10-09 19:00:25 +0000 | [diff] [blame] | 159 | /* lib_$(ARCH)/board.c */ |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 160 | void board_init_f (ulong); |
| 161 | void board_init_r (gd_t *, ulong); |
| 162 | int checkboard (void); |
| 163 | int checkflash (void); |
| 164 | int checkdram (void); |
| 165 | char * strmhz(char *buf, long hz); |
| 166 | int last_stage_init(void); |
wdenk | 3b57fe0 | 2003-05-30 12:48:29 +0000 | [diff] [blame] | 167 | extern ulong monitor_flash_len; |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 168 | |
| 169 | /* common/flash.c */ |
| 170 | void flash_perror (int); |
| 171 | |
wdenk | b0fce99 | 2003-06-29 21:03:46 +0000 | [diff] [blame] | 172 | /* common/cmd_autoscript.c */ |
| 173 | int autoscript (ulong addr); |
| 174 | |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 175 | /* common/cmd_bootm.c */ |
wdenk | b0fce99 | 2003-06-29 21:03:46 +0000 | [diff] [blame] | 176 | void print_image_hdr (image_header_t *hdr); |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 177 | |
wdenk | c83bf6a | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 178 | extern ulong load_addr; /* Default Load Address */ |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 179 | |
| 180 | /* common/cmd_nvedit.c */ |
| 181 | int env_init (void); |
| 182 | void env_relocate (void); |
wdenk | c83bf6a | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 183 | char *getenv (uchar *); |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 184 | int getenv_r (uchar *name, uchar *buf, unsigned len); |
wdenk | c83bf6a | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 185 | int saveenv (void); |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 186 | #ifdef CONFIG_PPC /* ARM version to be fixed! */ |
| 187 | void inline setenv (char *, char *); |
wdenk | 2262cfe | 2002-11-18 00:14:45 +0000 | [diff] [blame] | 188 | #else |
wdenk | c83bf6a | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 189 | void setenv (char *, char *); |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 190 | #endif /* CONFIG_PPC */ |
| 191 | #ifdef CONFIG_ARM |
wdenk | b6e4c40 | 2004-01-02 16:05:07 +0000 | [diff] [blame] | 192 | # include <asm/setup.h> |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 193 | # include <asm/u-boot-arm.h> /* ARM version to be fixed! */ |
| 194 | #endif /* CONFIG_ARM */ |
wdenk | 2262cfe | 2002-11-18 00:14:45 +0000 | [diff] [blame] | 195 | #ifdef CONFIG_I386 /* x86 version to be fixed! */ |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 196 | # include <asm/u-boot-i386.h> |
wdenk | 2262cfe | 2002-11-18 00:14:45 +0000 | [diff] [blame] | 197 | #endif /* CONFIG_I386 */ |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 198 | |
wdenk | c83bf6a | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 199 | void pci_init (void); |
| 200 | void pci_init_board(void); |
| 201 | void pciinfo (int, int); |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 202 | |
| 203 | #if defined(CONFIG_PCI) && defined(CONFIG_440) |
| 204 | # if defined(CFG_PCI_PRE_INIT) |
wdenk | c83bf6a | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 205 | int pci_pre_init (struct pci_controller * ); |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 206 | # endif |
| 207 | # if defined(CFG_PCI_TARGET_INIT) |
wdenk | c83bf6a | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 208 | void pci_target_init (struct pci_controller *); |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 209 | # endif |
| 210 | # if defined(CFG_PCI_MASTER_INIT) |
wdenk | c83bf6a | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 211 | void pci_master_init (struct pci_controller *); |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 212 | # endif |
wdenk | c83bf6a | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 213 | int is_pci_host (struct pci_controller *); |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 214 | #endif |
| 215 | |
| 216 | int misc_init_f (void); |
| 217 | int misc_init_r (void); |
| 218 | |
wdenk | 27b207f | 2003-07-24 23:38:38 +0000 | [diff] [blame] | 219 | /* common/exports.c */ |
| 220 | void jumptable_init(void); |
| 221 | |
wdenk | c83bf6a | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 222 | /* common/memsize.c */ |
| 223 | int get_ram_size (volatile long *, long); |
| 224 | |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 225 | /* $(BOARD)/$(BOARD).c */ |
| 226 | void reset_phy (void); |
wdenk | c83bf6a | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 227 | void fdc_hw_init (void); |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 228 | |
| 229 | /* $(BOARD)/eeprom.c */ |
| 230 | void eeprom_init (void); |
wdenk | 6dd652f | 2003-06-19 23:40:20 +0000 | [diff] [blame] | 231 | #ifndef CONFIG_SPI |
| 232 | int eeprom_probe (unsigned dev_addr, unsigned offset); |
| 233 | #endif |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 234 | int eeprom_read (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt); |
| 235 | int eeprom_write (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt); |
| 236 | #ifdef CONFIG_LWMON |
| 237 | extern uchar pic_read (uchar reg); |
| 238 | extern void pic_write (uchar reg, uchar val); |
| 239 | #endif |
| 240 | |
| 241 | /* |
| 242 | * Set this up regardless of board |
| 243 | * type, to prevent errors. |
| 244 | */ |
| 245 | #if defined(CONFIG_SPI) || !defined(CFG_I2C_EEPROM_ADDR) |
| 246 | # define CFG_DEF_EEPROM_ADDR 0 |
| 247 | #else |
| 248 | # define CFG_DEF_EEPROM_ADDR CFG_I2C_EEPROM_ADDR |
| 249 | #endif /* CONFIG_SPI || !defined(CFG_I2C_EEPROM_ADDR) */ |
| 250 | |
wdenk | bdccc4f | 2003-08-05 17:43:17 +0000 | [diff] [blame] | 251 | #if defined(CONFIG_SPI) |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 252 | extern void spi_init_f (void); |
| 253 | extern void spi_init_r (void); |
wdenk | c83bf6a | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 254 | extern ssize_t spi_read (uchar *, int, uchar *, int); |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 255 | extern ssize_t spi_write (uchar *, int, uchar *, int); |
| 256 | #endif |
| 257 | |
| 258 | #ifdef CONFIG_RPXCLASSIC |
| 259 | void rpxclassic_init (void); |
| 260 | #endif |
| 261 | |
| 262 | #ifdef CONFIG_MBX |
| 263 | /* $(BOARD)/mbx8xx.c */ |
| 264 | void mbx_init (void); |
| 265 | void board_serial_init (void); |
| 266 | void board_ether_init (void); |
| 267 | #endif |
| 268 | |
| 269 | #if defined(CONFIG_RPXCLASSIC) || defined(CONFIG_MBX) || defined(CONFIG_IAD210) |
| 270 | void board_get_enetaddr (uchar *addr); |
| 271 | #endif |
| 272 | |
| 273 | #ifdef CONFIG_HERMES |
| 274 | /* $(BOARD)/hermes.c */ |
| 275 | void hermes_start_lxt980 (int speed); |
| 276 | #endif |
| 277 | |
| 278 | #ifdef CONFIG_EVB64260 |
| 279 | void evb64260_init(void); |
| 280 | void debug_led(int, int); |
| 281 | void display_mem_map(void); |
| 282 | void perform_soft_reset(void); |
| 283 | #endif |
| 284 | |
| 285 | void load_sernum_ethaddr (void); |
| 286 | |
| 287 | /* $(BOARD)/$(BOARD).c */ |
wdenk | c837dcb | 2004-01-20 23:12:12 +0000 | [diff] [blame] | 288 | int board_early_init_f (void); |
| 289 | int board_late_init (void); |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 290 | int board_postclk_init (void); /* after clocks/timebase, before env/serial */ |
wdenk | c837dcb | 2004-01-20 23:12:12 +0000 | [diff] [blame] | 291 | int board_early_init_r (void); |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 292 | void board_poweroff (void); |
| 293 | |
| 294 | #if defined(CFG_DRAM_TEST) |
| 295 | int testdram(void); |
| 296 | #endif /* CFG_DRAM_TEST */ |
| 297 | |
| 298 | /* $(CPU)/start.S */ |
wdenk | c83bf6a | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 299 | #if defined(CONFIG_5xx) || \ |
wdenk | 0db5bca | 2003-03-31 17:27:09 +0000 | [diff] [blame] | 300 | defined(CONFIG_8xx) |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 301 | uint get_immr (uint); |
| 302 | #endif |
wdenk | c83bf6a | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 303 | uint get_pir (void); |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 304 | uint get_pvr (void); |
| 305 | uint rd_ic_cst (void); |
| 306 | void wr_ic_cst (uint); |
| 307 | void wr_ic_adr (uint); |
| 308 | uint rd_dc_cst (void); |
| 309 | void wr_dc_cst (uint); |
| 310 | void wr_dc_adr (uint); |
| 311 | int icache_status (void); |
| 312 | void icache_enable (void); |
| 313 | void icache_disable(void); |
| 314 | int dcache_status (void); |
| 315 | void dcache_enable (void); |
| 316 | void dcache_disable(void); |
| 317 | void relocate_code (ulong, gd_t *, ulong); |
| 318 | ulong get_endaddr (void); |
| 319 | void trap_init (ulong); |
| 320 | #if defined (CONFIG_4xx) || \ |
| 321 | defined (CONFIG_74xx_7xx) || \ |
| 322 | defined (CONFIG_74x) || \ |
| 323 | defined (CONFIG_75x) || \ |
| 324 | defined (CONFIG_74xx) |
wdenk | c83bf6a | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 325 | unsigned char in8(unsigned int); |
| 326 | void out8(unsigned int, unsigned char); |
| 327 | unsigned short in16(unsigned int); |
| 328 | unsigned short in16r(unsigned int); |
| 329 | void out16(unsigned int, unsigned short value); |
| 330 | void out16r(unsigned int, unsigned short value); |
| 331 | unsigned long in32(unsigned int); |
| 332 | unsigned long in32r(unsigned int); |
| 333 | void out32(unsigned int, unsigned long value); |
| 334 | void out32r(unsigned int, unsigned long value); |
| 335 | void ppcDcbf(unsigned long value); |
| 336 | void ppcDcbi(unsigned long value); |
| 337 | void ppcSync(void); |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 338 | #endif |
| 339 | |
| 340 | /* $(CPU)/cpu.c */ |
| 341 | int checkcpu (void); |
| 342 | int checkicache (void); |
| 343 | int checkdcache (void); |
| 344 | void upmconfig (unsigned int, unsigned int *, unsigned int); |
| 345 | ulong get_tbclk (void); |
| 346 | |
| 347 | /* $(CPU)/serial.c */ |
| 348 | int serial_init (void); |
| 349 | void serial_setbrg (void); |
| 350 | void serial_putc (const char); |
| 351 | void serial_puts (const char *); |
| 352 | void serial_addr (unsigned int); |
| 353 | int serial_getc (void); |
| 354 | int serial_tstc (void); |
| 355 | |
| 356 | /* $(CPU)/speed.c */ |
| 357 | int get_clocks (void); |
wdenk | c178d3d | 2004-01-24 20:25:54 +0000 | [diff] [blame^] | 358 | int get_clocks_866 (void); |
| 359 | int sdram_adjust_866 (void); |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 360 | #if defined(CONFIG_8260) |
| 361 | int prt_8260_clks (void); |
| 362 | #endif |
wdenk | 945af8d | 2003-07-16 21:53:01 +0000 | [diff] [blame] | 363 | #if defined(CONFIG_MPC5XXX) |
| 364 | int prt_mpc5xxx_clks (void); |
| 365 | #endif |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 366 | #ifdef CONFIG_4xx |
| 367 | ulong get_OPB_freq (void); |
| 368 | ulong get_PCI_freq (void); |
| 369 | #endif |
| 370 | #if defined(CONFIG_S3C2400) || defined(CONFIG_S3C2410) |
| 371 | ulong get_FCLK (void); |
| 372 | ulong get_HCLK (void); |
| 373 | ulong get_PCLK (void); |
| 374 | ulong get_UCLK (void); |
| 375 | #endif |
wdenk | 7cb22f9 | 2003-12-27 19:24:54 +0000 | [diff] [blame] | 376 | #if defined CONFIG_INCA_IP |
wdenk | c83bf6a | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 377 | uint incaip_get_cpuclk (void); |
wdenk | 7cb22f9 | 2003-12-27 19:24:54 +0000 | [diff] [blame] | 378 | #endif |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 379 | ulong get_bus_freq (ulong); |
| 380 | |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 381 | #if defined(CONFIG_MPC85xx) |
| 382 | typedef MPC85xx_SYS_INFO sys_info_t; |
wdenk | c83bf6a | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 383 | void get_sys_info ( sys_info_t * ); |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 384 | #endif |
| 385 | |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 386 | #if defined(CONFIG_4xx) || defined(CONFIG_IOP480) |
| 387 | # if defined(CONFIG_440) |
| 388 | typedef PPC440_SYS_INFO sys_info_t; |
| 389 | # else |
| 390 | typedef PPC405_SYS_INFO sys_info_t; |
| 391 | # endif |
wdenk | c83bf6a | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 392 | void get_sys_info ( sys_info_t * ); |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 393 | #endif |
| 394 | |
| 395 | /* $(CPU)/cpu_init.c */ |
| 396 | #if defined(CONFIG_8xx) || defined(CONFIG_8260) |
| 397 | void cpu_init_f (volatile immap_t *immr); |
| 398 | #endif |
wdenk | 42d1f03 | 2003-10-15 23:53:47 +0000 | [diff] [blame] | 399 | #if defined(CONFIG_4xx) || defined(CONFIG_MPC85xx) |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 400 | void cpu_init_f (void); |
| 401 | #endif |
| 402 | int cpu_init_r (void); |
| 403 | #if defined(CONFIG_8260) |
| 404 | int prt_8260_rsr (void); |
| 405 | #endif |
| 406 | |
| 407 | /* $(CPU)/interrupts.c */ |
wdenk | c83bf6a | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 408 | int interrupt_init (void); |
| 409 | void timer_interrupt (struct pt_regs *); |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 410 | void external_interrupt (struct pt_regs *); |
| 411 | void irq_install_handler(int, interrupt_handler_t *, void *); |
| 412 | void irq_free_handler (int); |
| 413 | void reset_timer (void); |
| 414 | ulong get_timer (ulong base); |
| 415 | void set_timer (ulong t); |
| 416 | void enable_interrupts (void); |
| 417 | int disable_interrupts (void); |
| 418 | |
| 419 | /* $(CPU)/.../commproc.c */ |
| 420 | int dpram_init (void); |
| 421 | uint dpram_base(void); |
| 422 | uint dpram_base_align(uint align); |
| 423 | uint dpram_alloc(uint size); |
| 424 | uint dpram_alloc_align(uint size,uint align); |
| 425 | void post_word_store (ulong); |
| 426 | ulong post_word_load (void); |
wdenk | bdccc4f | 2003-08-05 17:43:17 +0000 | [diff] [blame] | 427 | void bootcount_store (ulong); |
| 428 | ulong bootcount_load (void); |
| 429 | #define BOOTCOUNT_MAGIC 0xB001C041 |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 430 | |
| 431 | /* $(CPU)/.../<eth> */ |
| 432 | void mii_init (void); |
| 433 | |
| 434 | /* $(CPU)/.../lcd.c */ |
| 435 | ulong lcd_setmem (ulong); |
| 436 | |
| 437 | /* $(CPU)/.../vfd.c */ |
| 438 | ulong vfd_setmem (ulong); |
| 439 | |
| 440 | /* $(CPU)/.../video.c */ |
| 441 | ulong video_setmem (ulong); |
| 442 | |
| 443 | /* ppc/cache.c */ |
| 444 | void flush_cache (unsigned long, unsigned long); |
| 445 | |
wdenk | 0db5bca | 2003-03-31 17:27:09 +0000 | [diff] [blame] | 446 | |
wdenk | 15647dc | 2003-10-09 19:00:25 +0000 | [diff] [blame] | 447 | /* lib_$(ARCH)/ticks.S */ |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 448 | unsigned long long get_ticks(void); |
| 449 | void wait_ticks (unsigned long); |
| 450 | |
wdenk | 15647dc | 2003-10-09 19:00:25 +0000 | [diff] [blame] | 451 | /* lib_$(ARCH)/time.c */ |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 452 | void udelay (unsigned long); |
| 453 | ulong usec2ticks (unsigned long usec); |
| 454 | ulong ticks2usec (unsigned long ticks); |
| 455 | int init_timebase (void); |
| 456 | |
wdenk | 15647dc | 2003-10-09 19:00:25 +0000 | [diff] [blame] | 457 | /* lib_generic/vsprintf.c */ |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 458 | ulong simple_strtoul(const char *cp,char **endp,unsigned int base); |
| 459 | long simple_strtol(const char *cp,char **endp,unsigned int base); |
| 460 | void panic(const char *fmt, ...); |
| 461 | int sprintf(char * buf, const char *fmt, ...); |
wdenk | c83bf6a | 2004-01-06 22:38:14 +0000 | [diff] [blame] | 462 | int vsprintf(char *buf, const char *fmt, va_list args); |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 463 | |
wdenk | 15647dc | 2003-10-09 19:00:25 +0000 | [diff] [blame] | 464 | /* lib_generic/crc32.c */ |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 465 | ulong crc32 (ulong, const unsigned char *, uint); |
| 466 | ulong crc32_no_comp (ulong, const unsigned char *, uint); |
| 467 | |
| 468 | /* common/console.c */ |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 469 | int console_init_f(void); /* Before relocation; uses the serial stuff */ |
| 470 | int console_init_r(void); /* After relocation; uses the console stuff */ |
| 471 | int console_assign (int file, char *devname); /* Assign the console */ |
| 472 | int ctrlc (void); |
| 473 | int had_ctrlc (void); /* have we had a Control-C since last clear? */ |
| 474 | void clear_ctrlc (void); /* clear the Control-C condition */ |
| 475 | int disable_ctrlc (int); /* 1 to disable, 0 to enable Control-C detect */ |
| 476 | |
| 477 | /* |
| 478 | * STDIO based functions (can always be used) |
| 479 | */ |
| 480 | |
| 481 | /* serial stuff */ |
| 482 | void serial_printf (const char *fmt, ...); |
| 483 | |
| 484 | /* stdin */ |
| 485 | int getc(void); |
| 486 | int tstc(void); |
| 487 | |
| 488 | /* stdout */ |
| 489 | void putc(const char c); |
| 490 | void puts(const char *s); |
| 491 | void printf(const char *fmt, ...); |
wdenk | 6dd652f | 2003-06-19 23:40:20 +0000 | [diff] [blame] | 492 | void vprintf(const char *fmt, va_list args); |
wdenk | e221174 | 2002-11-02 23:30:20 +0000 | [diff] [blame] | 493 | |
| 494 | /* stderr */ |
| 495 | #define eputc(c) fputc(stderr, c) |
| 496 | #define eputs(s) fputs(stderr, s) |
| 497 | #define eprintf(fmt,args...) fprintf(stderr,fmt ,##args) |
| 498 | |
| 499 | /* |
| 500 | * FILE based functions (can only be used AFTER relocation!) |
| 501 | */ |
| 502 | |
| 503 | #define stdin 0 |
| 504 | #define stdout 1 |
| 505 | #define stderr 2 |
| 506 | #define MAX_FILES 3 |
| 507 | |
| 508 | void fprintf(int file, const char *fmt, ...); |
| 509 | void fputs(int file, const char *s); |
| 510 | void fputc(int file, const char c); |
| 511 | int ftstc(int file); |
| 512 | int fgetc(int file); |
| 513 | |
| 514 | int pcmcia_init (void); |
| 515 | |
| 516 | #ifdef CONFIG_SHOW_BOOT_PROGRESS |
| 517 | void show_boot_progress (int status); |
| 518 | #endif |
| 519 | |
| 520 | #endif /* __COMMON_H_ */ |