diff options
-rw-r--r-- | include/cfi_flash.h | 2 | ||||
-rw-r--r-- | include/common.h | 214 | ||||
-rw-r--r-- | include/driver.h | 4 | ||||
-rw-r--r-- | include/net.h | 26 | ||||
-rw-r--r-- | include/pci.h | 21 | ||||
-rw-r--r-- | include/ppc.h | 93 | ||||
-rw-r--r-- | include/serial.h | 54 | ||||
-rw-r--r-- | include/stdio.h | 43 |
8 files changed, 183 insertions, 274 deletions
diff --git a/include/cfi_flash.h b/include/cfi_flash.h index ceff6223a7..b8d02a6058 100644 --- a/include/cfi_flash.h +++ b/include/cfi_flash.h @@ -91,7 +91,7 @@ extern int flash_sect_protect (int flag, ulong addr_first, ulong addr_last); extern void flash_protect (int flag, ulong from, ulong to, flash_info_t *info); extern int flash_write (char *, ulong, ulong); extern flash_info_t *addr2info (ulong); -extern int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt); +extern int write_buff (flash_info_t *info, const uchar *src, ulong addr, ulong cnt); /* board/?/flash.c */ #if defined(CFG_FLASH_PROTECTION) diff --git a/include/common.h b/include/common.h index d1f9cdc292..6ad9edbdae 100644 --- a/include/common.h +++ b/include/common.h @@ -24,6 +24,8 @@ #ifndef __COMMON_H_ #define __COMMON_H_ 1 +#include <stdio.h> + #undef _LINUX_CONFIG_H #define _LINUX_CONFIG_H 1 /* avoid reading Linux autoconf.h file */ @@ -32,71 +34,14 @@ typedef volatile unsigned long vu_long; typedef volatile unsigned short vu_short; typedef volatile unsigned char vu_char; +typedef unsigned long IPaddr_t; + #include <config.h> #include <linux/bitops.h> #include <linux/types.h> #include <linux/string.h> #include <asm/ptrace.h> -#include <stdarg.h> -#if defined(CONFIG_PCI) && defined(CONFIG_440) -#include <pci.h> -#endif -#if defined(CONFIG_8xx) -#include <asm/8xx_immap.h> -#if defined(CONFIG_MPC852) || defined(CONFIG_MPC852T) || \ - defined(CONFIG_MPC859) || defined(CONFIG_MPC859T) || \ - defined(CONFIG_MPC859DSL) || \ - defined(CONFIG_MPC866) || defined(CONFIG_MPC866T) || \ - defined(CONFIG_MPC866P) -# define CONFIG_MPC866_FAMILY 1 -#elif defined(CONFIG_MPC870) \ - || defined(CONFIG_MPC875) \ - || defined(CONFIG_MPC880) \ - || defined(CONFIG_MPC885) -# define CONFIG_MPC885_FAMILY 1 -#endif -#if defined(CONFIG_MPC860) \ - || defined(CONFIG_MPC860T) \ - || defined(CONFIG_MPC866_FAMILY) \ - || defined(CONFIG_MPC885_FAMILY) -# define CONFIG_MPC86x 1 -#endif -#elif defined(CONFIG_5xx) -#include <asm/5xx_immap.h> -#elif defined(CONFIG_MPC5xxx) -#include <mpc5xxx.h> -#elif defined(CONFIG_MPC8220) -#include <asm/immap_8220.h> -#elif defined(CONFIG_8260) -#if defined(CONFIG_MPC8247) \ - || defined(CONFIG_MPC8248) \ - || defined(CONFIG_MPC8271) \ - || defined(CONFIG_MPC8272) -#define CONFIG_MPC8272_FAMILY 1 -#endif -#if defined(CONFIG_MPC8272_FAMILY) -#define CONFIG_MPC8260 1 -#endif -#include <asm/immap_8260.h> -#endif -#ifdef CONFIG_MPC86xx -#include <mpc86xx.h> -#include <asm/immap_86xx.h> -#endif -#ifdef CONFIG_MPC85xx -#include <mpc85xx.h> -#include <asm/immap_85xx.h> -#endif -#ifdef CONFIG_MPC83XX -#include <mpc83xx.h> -#include <asm/immap_83xx.h> -#endif -#ifdef CONFIG_4xx -#include <ppc4xx.h> -#endif -#ifdef CONFIG_HYMOD -#include <board/hymod/hymod.h> -#endif + #ifdef CONFIG_ARM #define asmlinkage /* nothing */ #endif @@ -124,39 +69,6 @@ typedef void (interrupt_handler_t)(void *); #include <asm/global_data.h> /* global data used for startup functions */ /* - * enable common handling for all TQM8xxL/M boards: - * - CONFIG_TQM8xxM will be defined for all TQM8xxM and TQM885D boards - * - CONFIG_TQM8xxL will be defined for all TQM8xxL _and_ TQM8xxM boards - */ -#if defined(CONFIG_TQM823M) || defined(CONFIG_TQM850M) || \ - defined(CONFIG_TQM855M) || defined(CONFIG_TQM860M) || \ - defined(CONFIG_TQM862M) || defined(CONFIG_TQM866M) || \ - defined(CONFIG_TQM885D) -# ifndef CONFIG_TQM8xxM -# define CONFIG_TQM8xxM -# endif -#endif -#if defined(CONFIG_TQM823L) || defined(CONFIG_TQM850L) || \ - defined(CONFIG_TQM855L) || defined(CONFIG_TQM860L) || \ - defined(CONFIG_TQM862L) || defined(CONFIG_TQM8xxM) -# ifndef CONFIG_TQM8xxL -# define CONFIG_TQM8xxL -# endif -#endif - -#ifndef CONFIG_SERIAL_MULTI - -#if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2) \ - || defined(CONFIG_8xx_CONS_SCC1) || defined(CONFIG_8xx_CONS_SCC2) \ - || defined(CONFIG_8xx_CONS_SCC3) || defined(CONFIG_8xx_CONS_SCC4) - -#define CONFIG_SERIAL_MULTI 1 - -#endif - -#endif /* CONFIG_SERIAL_MULTI */ - -/* * General Purpose Utilities */ #define min(X, Y) \ @@ -203,12 +115,6 @@ int checkdram (void); char * strmhz(char *buf, long hz); int last_stage_init(void); extern ulong monitor_flash_len; -#ifdef CFG_ID_EEPROM -int mac_read_from_eeprom(void); -#endif - -/* common/flash.c */ -void flash_perror (int); /* common/cmd_autoscript.c */ int autoscript (ulong addr); @@ -238,26 +144,6 @@ void setenv (const char *, const char *); int env_complete(char *var, int maxv, char *cmdv[], int maxsz, char *buf); #endif -void pci_init (void); -void pci_init_board(void); -void pciinfo (int, int); - -#if defined(CONFIG_PCI) && defined(CONFIG_440) -# if defined(CFG_PCI_PRE_INIT) - int pci_pre_init (struct pci_controller * ); -# endif -# if defined(CFG_PCI_TARGET_INIT) - void pci_target_init (struct pci_controller *); -# endif -# if defined(CFG_PCI_MASTER_INIT) - void pci_master_init (struct pci_controller *); -# endif - int is_pci_host (struct pci_controller *); -#if defined(CONFIG_440SPE) - void pcie_setup_hoses(void); -#endif -#endif - int misc_init_f (void); int misc_init_r (void); @@ -313,34 +199,6 @@ void board_serial_init (void); void board_ether_init (void); #endif -#if defined(CONFIG_RPXCLASSIC) || defined(CONFIG_MBX) || \ - defined(CONFIG_IAD210) || defined(CONFIG_XPEDITE1K) || \ - defined(CONFIG_METROBOX) || defined(CONFIG_KAREF) || \ - defined(CONFIG_V38B) -void board_get_enetaddr (uchar *addr); -#endif - -#ifdef CONFIG_HERMES -/* $(BOARD)/hermes.c */ -void hermes_start_lxt980 (int speed); -#endif - -#ifdef CONFIG_EVB64260 -void evb64260_init(void); -void debug_led(int, int); -void display_mem_map(void); -void perform_soft_reset(void); -#endif - -void load_sernum_ethaddr (void); - -/* $(BOARD)/$(BOARD).c */ -int board_early_init_f (void); -int board_late_init (void); -int board_postclk_init (void); /* after clocks/timebase, before env/serial */ -int board_early_init_r (void); -void board_poweroff (void); - #if defined(CFG_DRAM_TEST) int testdram(void); #endif /* CFG_DRAM_TEST */ @@ -397,11 +255,6 @@ void ppcSync(void); void ppcDcbz(unsigned long value); #endif -#if defined (CONFIG_MPC83XX) -void ppcDWload(unsigned int *addr, unsigned int *ret); -void ppcDWstore(unsigned int *addr, unsigned int *value); -#endif - /* $(CPU)/cpu.c */ int checkcpu (void); int checkicache (void); @@ -410,23 +263,6 @@ void upmconfig (unsigned int, unsigned int *, unsigned int); ulong get_tbclk (void); void reset_cpu (ulong addr); -/* $(CPU)/serial.c */ -int serial_init (void); -void serial_addr (unsigned int); -void serial_setbrg (void); -void serial_putc (const char); -void serial_putc_raw(const char); -void serial_puts (const char *); -int serial_getc (void); -int serial_tstc (void); - -void _serial_setbrg (const int); -void _serial_putc (const char, const int); -void _serial_putc_raw(const char, const int); -void _serial_puts (const char *, const int); -int _serial_getc (const int); -int _serial_tstc (const int); - /* $(CPU)/speed.c */ int get_clocks (void); int get_clocks_866 (void); @@ -564,45 +400,6 @@ int had_ctrlc (void); /* have we had a Control-C since last clear? */ void clear_ctrlc (void); /* clear the Control-C condition */ int disable_ctrlc (int); /* 1 to disable, 0 to enable Control-C detect */ -/* - * STDIO based functions (can always be used) - */ - -/* serial stuff */ -void serial_printf (const char *fmt, ...); - -/* stdin */ -int getc(void); -int tstc(void); - -/* stdout */ -void putc(const char c); -void puts(const char *s); -void printf(const char *fmt, ...); -void vprintf(const char *fmt, va_list args); - -/* stderr */ -#define eputc(c) fputc(stderr, c) -#define eputs(s) fputs(stderr, s) -#define eprintf(fmt,args...) fprintf(stderr,fmt ,##args) - -/* - * FILE based functions (can only be used AFTER relocation!) - */ - -#define stdin 0 -#define stdout 1 -#define stderr 2 -#define MAX_FILES 16 - -void fprintf(int file, const char *fmt, ...); -void fputs(int file, const char *s); -void fputc(int file, const char c); -int ftstc(int file); -int fgetc(int file); - -int pcmcia_init (void); - #ifdef CONFIG_SHOW_BOOT_PROGRESS void show_boot_progress (int status); #endif @@ -628,6 +425,7 @@ struct memarea_info { }; int spec_str_to_info(const char *str, struct memarea_info *info); +int parse_area_spec(const char *str, ulong *start, ulong *size); /* Just like simple_strtoul(), but this one honors a K/M/G suffix */ unsigned long strtoul_suffix(const char *str, char **endp, int base); diff --git a/include/driver.h b/include/driver.h index 22860f258b..0a4e71ca79 100644 --- a/include/driver.h +++ b/include/driver.h @@ -80,11 +80,11 @@ struct device_d *get_device_by_id(const char *id); struct driver_d *get_driver_by_name(char *name); ssize_t dev_read(struct device_d *dev, void *buf, size_t count, ulong offset, ulong flags); -ssize_t dev_write(struct device_d *dev, void *buf, size_t count, ulong offset, ulong flags); +ssize_t dev_write(struct device_d *dev, const void *buf, size_t count, ulong offset, ulong flags); ssize_t dev_erase(struct device_d *dev, size_t count, unsigned long offset); ssize_t mem_read(struct device_d *dev, void *buf, size_t count, ulong offset, ulong flags); -ssize_t mem_write(struct device_d *dev, void *buf, size_t count, ulong offset, ulong flags); +ssize_t mem_write(struct device_d *dev, const void *buf, size_t count, ulong offset, ulong flags); int dummy_probe(struct device_d *); diff --git a/include/net.h b/include/net.h index e3e6319f78..4aed649dc9 100644 --- a/include/net.h +++ b/include/net.h @@ -12,28 +12,7 @@ #ifndef __NET_H__ #define __NET_H__ -#if !defined(CONFIG_NET_MULTI) && defined(CONFIG_CPM2) -#include <config.h> -#if defined(CONFIG_ETHER_ON_FCC) -#if defined(CONFIG_ETHER_ON_SCC) -#error "Ethernet not correctly defined" -#endif /* CONFIG_ETHER_ON_SCC */ -#define CONFIG_NET_MULTI -#if (CONFIG_ETHER_INDEX == 1) -#define CONFIG_ETHER_ON_FCC1 -# define CFG_CMXFCR_MASK1 CFG_CMXFCR_MASK -# define CFG_CMXFCR_VALUE1 CFG_CMXFCR_VALUE -#elif (CONFIG_ETHER_INDEX == 2) -#define CONFIG_ETHER_ON_FCC2 -# define CFG_CMXFCR_MASK2 CFG_CMXFCR_MASK -# define CFG_CMXFCR_VALUE2 CFG_CMXFCR_VALUE -#elif (CONFIG_ETHER_INDEX == 3) -#define CONFIG_ETHER_ON_FCC3 -# define CFG_CMXFCR_MASK3 CFG_CMXFCR_MASK -# define CFG_CMXFCR_VALUE3 CFG_CMXFCR_VALUE -#endif /* CONFIG_ETHER_INDEX */ -#endif /* CONFIG_ETHER_ON_FCC */ -#endif /* !CONFIG_NET_MULTI && CONFIG_8260 */ +#include <common.h> #include <asm/byteorder.h> /* for nton* / ntoh* stuff */ @@ -52,9 +31,6 @@ #define PKTALIGN 32 -typedef ulong IPaddr_t; - - /* * The current receive packet handler. Called with a pointer to the * application packet, and a protocol type (PORT_BOOTPC or PORT_TFTP). diff --git a/include/pci.h b/include/pci.h index 7c9a0e3441..250954707e 100644 --- a/include/pci.h +++ b/include/pci.h @@ -504,4 +504,25 @@ extern void pci_mpc824x_init (struct pci_controller *hose); #ifdef CONFIG_MPC85xx extern void pci_mpc85xx_init (struct pci_controller *hose); #endif + +void pci_init (void); +void pci_init_board(void); +void pciinfo (int, int); + +#if defined(CONFIG_PCI) && defined(CONFIG_440) +# if defined(CFG_PCI_PRE_INIT) + int pci_pre_init (struct pci_controller * ); +# endif +# if defined(CFG_PCI_TARGET_INIT) + void pci_target_init (struct pci_controller *); +# endif +# if defined(CFG_PCI_MASTER_INIT) + void pci_master_init (struct pci_controller *); +# endif + int is_pci_host (struct pci_controller *); +#if defined(CONFIG_440SPE) + void pcie_setup_hoses(void); +#endif +#endif + #endif /* _PCI_H */ diff --git a/include/ppc.h b/include/ppc.h new file mode 100644 index 0000000000..cbd44ff8fa --- /dev/null +++ b/include/ppc.h @@ -0,0 +1,93 @@ + +#if defined(CONFIG_PCI) && defined(CONFIG_440) +#include <pci.h> +#endif +#if defined(CONFIG_8xx) +#include <asm/8xx_immap.h> +#if defined(CONFIG_MPC852) || defined(CONFIG_MPC852T) || \ + defined(CONFIG_MPC859) || defined(CONFIG_MPC859T) || \ + defined(CONFIG_MPC859DSL) || \ + defined(CONFIG_MPC866) || defined(CONFIG_MPC866T) || \ + defined(CONFIG_MPC866P) +# define CONFIG_MPC866_FAMILY 1 +#elif defined(CONFIG_MPC870) \ + || defined(CONFIG_MPC875) \ + || defined(CONFIG_MPC880) \ + || defined(CONFIG_MPC885) +# define CONFIG_MPC885_FAMILY 1 +#endif +#if defined(CONFIG_MPC860) \ + || defined(CONFIG_MPC860T) \ + || defined(CONFIG_MPC866_FAMILY) \ + || defined(CONFIG_MPC885_FAMILY) +# define CONFIG_MPC86x 1 +#endif +#elif defined(CONFIG_5xx) +#include <asm/5xx_immap.h> +#elif defined(CONFIG_MPC5xxx) +#include <mpc5xxx.h> +#elif defined(CONFIG_MPC8220) +#include <asm/immap_8220.h> +#elif defined(CONFIG_8260) +#if defined(CONFIG_MPC8247) \ + || defined(CONFIG_MPC8248) \ + || defined(CONFIG_MPC8271) \ + || defined(CONFIG_MPC8272) +#define CONFIG_MPC8272_FAMILY 1 +#endif +#if defined(CONFIG_MPC8272_FAMILY) +#define CONFIG_MPC8260 1 +#endif +#include <asm/immap_8260.h> +#endif +#ifdef CONFIG_MPC86xx +#include <mpc86xx.h> +#include <asm/immap_86xx.h> +#endif +#ifdef CONFIG_MPC85xx +#include <mpc85xx.h> +#include <asm/immap_85xx.h> +#endif +#ifdef CONFIG_MPC83XX +#include <mpc83xx.h> +#include <asm/immap_83xx.h> +#endif +#ifdef CONFIG_4xx +#include <ppc4xx.h> +#endif +#ifdef CONFIG_HYMOD +#include <board/hymod/hymod.h> +#endif + +/* + * enable common handling for all TQM8xxL/M boards: + * - CONFIG_TQM8xxM will be defined for all TQM8xxM and TQM885D boards + * - CONFIG_TQM8xxL will be defined for all TQM8xxL _and_ TQM8xxM boards + */ +#if defined(CONFIG_TQM823M) || defined(CONFIG_TQM850M) || \ + defined(CONFIG_TQM855M) || defined(CONFIG_TQM860M) || \ + defined(CONFIG_TQM862M) || defined(CONFIG_TQM866M) || \ + defined(CONFIG_TQM885D) +# ifndef CONFIG_TQM8xxM +# define CONFIG_TQM8xxM +# endif +#endif +#if defined(CONFIG_TQM823L) || defined(CONFIG_TQM850L) || \ + defined(CONFIG_TQM855L) || defined(CONFIG_TQM860L) || \ + defined(CONFIG_TQM862L) || defined(CONFIG_TQM8xxM) +# ifndef CONFIG_TQM8xxL +# define CONFIG_TQM8xxL +# endif +#endif + +#ifndef CONFIG_SERIAL_MULTI + +#if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2) \ + || defined(CONFIG_8xx_CONS_SCC1) || defined(CONFIG_8xx_CONS_SCC2) \ + || defined(CONFIG_8xx_CONS_SCC3) || defined(CONFIG_8xx_CONS_SCC4) + +#define CONFIG_SERIAL_MULTI 1 + +#endif + +#endif /* CONFIG_SERIAL_MULTI */ diff --git a/include/serial.h b/include/serial.h index 48800595d7..d1173ebf7c 100644 --- a/include/serial.h +++ b/include/serial.h @@ -1,44 +1,22 @@ #ifndef __SERIAL_H__ #define __SERIAL_H__ -#define NAMESIZE 16 -#define CTLRSIZE 8 +/* $(CPU)/serial.c */ +int serial_init (void); +void serial_addr (unsigned int); +void serial_setbrg (void); +void serial_putc (const char); +void serial_putc_raw(const char); +void serial_puts (const char *); +int serial_getc (void); +int serial_tstc (void); + +void _serial_setbrg (const int); +void _serial_putc (const char, const int); +void _serial_putc_raw(const char, const int); +void _serial_puts (const char *, const int); +int _serial_getc (const int); +int _serial_tstc (const int); -struct serial_device { - char name[NAMESIZE]; - char ctlr[CTLRSIZE]; - - int (*init) (void); - void (*setbrg) (void); - int (*getc) (void); - int (*tstc) (void); - void (*putc) (const char c); - void (*puts) (const char *s); - - struct serial_device *next; -}; - -extern struct serial_device serial_smc_device; -extern struct serial_device serial_scc_device; -extern struct serial_device * default_serial_console (void); - -#if defined(CONFIG_405GP) || defined(CONFIG_405CR) || defined(CONFIG_440) \ - || defined(CONFIG_405EP) || defined(CONFIG_MPC5xxx) -extern struct serial_device serial0_device; -extern struct serial_device serial1_device; -#if defined(CFG_NS16550_SERIAL) -extern struct serial_device eserial1_device; -extern struct serial_device eserial2_device; -extern struct serial_device eserial3_device; -extern struct serial_device eserial4_device; -#endif /* CFG_NS16550_SERIAL */ - -#endif - - -extern void serial_initialize(void); -extern void serial_devices_init(void); -extern int serial_assign(char * name); -extern void serial_reinit_all(void); #endif diff --git a/include/stdio.h b/include/stdio.h new file mode 100644 index 0000000000..f641952d84 --- /dev/null +++ b/include/stdio.h @@ -0,0 +1,43 @@ +#ifndef __STDIO_H +#define __STDIO_H + +#include <stdarg.h> + +/* + * STDIO based functions (can always be used) + */ + +/* serial stuff */ +void serial_printf (const char *fmt, ...); + +/* stdin */ +int getc(void); +int tstc(void); + +/* stdout */ +void putc(const char c); +void puts(const char *s); +void printf(const char *fmt, ...); +void vprintf(const char *fmt, va_list args); + +/* stderr */ +#define eputc(c) fputc(stderr, c) +#define eputs(s) fputs(stderr, s) +#define eprintf(fmt,args...) fprintf(stderr,fmt ,##args) + +/* + * FILE based functions (can only be used AFTER relocation!) + */ + +#define stdin 0 +#define stdout 1 +#define stderr 2 +#define MAX_FILES 16 + +void fprintf(int file, const char *fmt, ...); +void fputs(int file, const char *s); +void fputc(int file, const char c); +int ftstc(int file); +int fgetc(int file); + +#endif /* __STDIO_H */ |