X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=include%2Fcommon.h;h=45f190a600f58b39b140f3638ce6530e2636e4eb;hb=4125bbcef6a998ce8580a1f5c53c8c93a56a125b;hp=1563d649f01cd869c35fef7f2c2a160f42ee969c;hpb=9c3193f8d03d4074fa6ca6b783246b97d8dc2ff5;p=platform%2Fkernel%2Fu-boot.git diff --git a/include/common.h b/include/common.h index 1563d64..45f190a 100644 --- a/include/common.h +++ b/include/common.h @@ -15,9 +15,15 @@ typedef volatile unsigned long vu_long; typedef volatile unsigned short vu_short; typedef volatile unsigned char vu_char; +/* Allow sharing constants with type modifiers between C and assembly. */ +#define _AC(X, Y) (X##Y) + #include +#include +#include #include #include +#include #include #include #include @@ -70,9 +76,6 @@ typedef volatile unsigned char vu_char; #ifdef CONFIG_4xx #include #endif -#ifdef CONFIG_BLACKFIN -#include -#endif #ifdef CONFIG_SOC_DA8XX #include #endif @@ -100,6 +103,13 @@ typedef volatile unsigned char vu_char; #define _DEBUG 0 #endif +#ifdef CONFIG_SPL_BUILD +#define _SPL_BUILD 1 +#else +#define _SPL_BUILD 0 +#endif + +/* Define this at the top of a file to add a prefix to debug messages */ #ifndef pr_fmt #define pr_fmt(fmt) fmt #endif @@ -115,9 +125,14 @@ typedef volatile unsigned char vu_char; printf(pr_fmt(fmt), ##args); \ } while (0) +/* Show a message if DEBUG is defined in a file */ #define debug(fmt, args...) \ debug_cond(_DEBUG, fmt, ##args) +/* Show a message if not in SPL */ +#define warn_non_spl(fmt, args...) \ + debug_cond(!_SPL_BUILD, fmt, ##args) + /* * An assertion is run-time check done in debug mode only. If DEBUG is not * defined then it is skipped. If DEBUG is defined and the assertion fails, @@ -188,14 +203,28 @@ typedef void (interrupt_handler_t)(void *); */ int dram_init(void); +/** + * dram_init_banksize() - Set up DRAM bank sizes + * + * This can be implemented by boards to set up the DRAM bank information in + * gd->bd->bi_dram(). It is called just before relocation, after dram_init() + * is called. + * + * If this is not provided, a default implementation will try to set up a + * single bank. It will do this if CONFIG_NR_DRAM_BANKS and + * CONFIG_SYS_SDRAM_BASE are set. The bank will have a start address of + * CONFIG_SYS_SDRAM_BASE and the size will be determined by a call to + * get_effective_memsize(). + * + * @return 0 if OK, -ve on error + */ +int dram_init_banksize(void); + void hang (void) __attribute__ ((noreturn)); int timer_init(void); int cpu_init(void); -/* */ -phys_size_t initdram (int); - #include /* common/main.c */ @@ -266,17 +295,26 @@ int mac_read_from_eeprom(void); extern u8 __dtb_dt_begin[]; /* embedded device tree blob */ int set_cpu_clk_info(void); int mdm_init(void); -#if defined(CONFIG_DISPLAY_CPUINFO) int print_cpuinfo(void); -#else -static inline int print_cpuinfo(void) -{ - return 0; -} -#endif int update_flash_size(int flash_size); int arch_early_init_r(void); +/* + * setup_board_extra() - Fill in extra details in the bd_t structure + * + * @return 0 if OK, -ve on error + */ +int setup_board_extra(void); + +/** + * arch_fsp_init() - perform firmware support package init + * + * Where U-Boot relies on binary blobs to handle part of the system init, this + * function can be used to set up the blobs. This is used on some Intel + * platforms. + */ +int arch_fsp_init(void); + /** * arch_cpu_init_dm() - init CPU after driver model is available * @@ -335,9 +373,6 @@ extern ulong load_addr; /* Default Load Address */ extern ulong save_addr; /* Default Save Address */ extern ulong save_size; /* Default Save Size */ -/* common/cmd_doc.c */ -void doc_probe(unsigned long physadr); - /* common/cmd_net.c */ int do_tftpb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]); @@ -464,9 +499,19 @@ void reset_phy (void); void fdc_hw_init (void); /* $(BOARD)/eeprom.c */ +#ifdef CONFIG_CMD_EEPROM void eeprom_init (int bus); int eeprom_read (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt); int eeprom_write (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt); +#else +/* + * Some EEPROM code is depecated because it used the legacy I2C interface. Add + * some macros here so we don't have to touch every one of those uses + */ +#define eeprom_init(bus) +#define eeprom_read(dev_addr, offset, buffer, cnt) ((void)-ENOSYS) +#define eeprom_write(dev_addr, offset, buffer, cnt) ((void)-ENOSYS) +#endif /* * Set this up regardless of board @@ -489,6 +534,7 @@ extern ssize_t spi_write (uchar *, int, uchar *, int); /* $(BOARD)/$(BOARD).c */ int board_early_init_f (void); +int board_fix_fdt (void *rw_fdt_blob); /* manipulate the U-Boot fdt before its relocation */ int board_late_init (void); int board_postclk_init (void); /* after clocks/timebase, before env/serial */ int board_early_init_r (void); @@ -563,12 +609,6 @@ void ddr_enable_ecc(unsigned int dram_size); #endif #endif -/* - * Return the current value of a monotonically increasing microsecond timer. - * Granularity may be larger than 1us if hardware does not support this. - */ -ulong timer_get_us(void); - /* $(CPU)/cpu.c */ static inline int cpumask_next(int cpu, unsigned int mask) { @@ -588,7 +628,17 @@ int cpu_num_dspcores(void); u32 cpu_mask (void); u32 cpu_dsp_mask(void); int is_core_valid (unsigned int); -int probecpu (void); + +/** + * arch_cpu_init() - basic cpu-dependent setup for an architecture + * + * This is called after early malloc is available. It should handle any + * CPU- or SoC- specific init needed to continue the init sequence. See + * board_f.c for where it is called. If this is not provided, a default + * version (which does nothing) will be used. + */ +int arch_cpu_init(void); + int checkcpu (void); int checkicache (void); int checkdcache (void); @@ -596,12 +646,8 @@ void upmconfig (unsigned int, unsigned int *, unsigned int); ulong get_tbclk (void); void reset_misc (void); void reset_cpu (ulong addr); -#if defined (CONFIG_OF_LIBFDT) && defined (CONFIG_OF_BOARD_SETUP) void ft_cpu_setup(void *blob, bd_t *bd); -#ifdef CONFIG_PCI void ft_pci_setup(void *blob, bd_t *bd); -#endif -#endif void smp_set_core_boot_addr(unsigned long addr, int corenr); void smp_kick_all_cpus(void); @@ -622,12 +668,7 @@ int serial_stub_tstc(struct stdio_dev *sdev); /* $(CPU)/speed.c */ int get_clocks (void); -int get_clocks_866 (void); -int sdram_adjust_866 (void); -int adjust_sdram_tbs_8xx (void); -#if defined(CONFIG_MPC8260) -int prt_8260_clks (void); -#elif defined(CONFIG_MPC5xxx) +#if defined(CONFIG_MPC5xxx) int prt_mpc5xxx_clks (void); #endif #ifdef CONFIG_4xx @@ -660,10 +701,8 @@ int get_serial_clock(void); #if defined(CONFIG_MPC85xx) typedef MPC85xx_SYS_INFO sys_info_t; void get_sys_info ( sys_info_t * ); -# if defined(CONFIG_OF_LIBFDT) - void ft_fixup_cpu(void *, u64); - void ft_fixup_num_cores(void *); -# endif +void ft_fixup_cpu(void *, u64); +void ft_fixup_num_cores(void *); #endif #if defined(CONFIG_MPC86xx) typedef MPC86xx_SYS_INFO sys_info_t; @@ -700,11 +739,6 @@ ulong cpu_init_f(void); #endif int cpu_init_r (void); -#if defined(CONFIG_MPC8260) -int prt_8260_rsr (void); -#elif defined(CONFIG_MPC83xx) -int prt_83xx_rsr (void); -#endif /* $(CPU)/interrupts.c */ int interrupt_init (void); @@ -713,7 +747,6 @@ void external_interrupt (struct pt_regs *); void irq_install_handler(int, interrupt_handler_t *, void *); void irq_free_handler (int); void reset_timer (void); -ulong get_timer (ulong base); /* Return value of monotonic microsecond timer */ unsigned long timer_get_us(void); @@ -769,10 +802,8 @@ uint64_t get_ticks(void); void wait_ticks (unsigned long); /* arch/$(ARCH)/lib/time.c */ -void __udelay (unsigned long); ulong usec2ticks (unsigned long usec); ulong ticks2usec (unsigned long ticks); -int init_timebase (void); /* lib/gunzip.c */ int gunzip(void *, int, unsigned char *, unsigned long *); @@ -813,7 +844,7 @@ void gzwrite_progress_finish(int retcode, * for files under 4GiB */ int gzwrite(unsigned char *src, int len, - struct block_dev_desc *dev, + struct blk_desc *dev, unsigned long szwritebuf, u64 startoffs, u64 szexpected); @@ -826,10 +857,6 @@ void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)); int strcmp_compar(const void *, const void *); -/* lib/time.c */ -void udelay (unsigned long); -void mdelay(unsigned long); - /* lib/uuid.c */ #include @@ -859,17 +886,20 @@ int getc(void); int tstc(void); /* stdout */ -#if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_SERIAL_SUPPORT) -#define putc(...) do { } while (0) -#define puts(...) do { } while (0) -#define printf(...) do { } while (0) -#define vprintf(...) do { } while (0) -#else +#if !defined(CONFIG_SPL_BUILD) || \ + (defined(CONFIG_TPL_BUILD) && defined(CONFIG_TPL_SERIAL_SUPPORT)) || \ + (defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD) && \ + defined(CONFIG_SPL_SERIAL_SUPPORT)) void putc(const char c); void puts(const char *s); int printf(const char *fmt, ...) __attribute__ ((format (__printf__, 1, 2))); int vprintf(const char *fmt, va_list args); +#else +#define putc(...) do { } while (0) +#define puts(...) do { } while (0) +#define printf(...) do { } while (0) +#define vprintf(...) do { } while (0) #endif /* stderr */ @@ -908,7 +938,7 @@ static inline struct in_addr getenv_ip(char *var) int pcmcia_init (void); -#ifdef CONFIG_STATUS_LED +#ifdef CONFIG_LED_STATUS # include #endif @@ -926,7 +956,12 @@ int cpu_disable(int nr); int cpu_release(int nr, int argc, char * const argv[]); #endif -#endif /* __ASSEMBLY__ */ +#else /* __ASSEMBLY__ */ + +/* Drop a C type modifier (like in 3UL) for constants used in assembly. */ +#define _AC(X, Y) X + +#endif /* __ASSEMBLY__ */ #ifdef CONFIG_PPC /* @@ -938,6 +973,9 @@ int cpu_release(int nr, int argc, char * const argv[]); /* Put only stuff here that the assembler can digest */ +/* Declare an unsigned long constant digestable both by C and an assembler. */ +#define UL(x) _AC(x, UL) + #ifdef CONFIG_POST #define CONFIG_HAS_POST #ifndef CONFIG_POST_ALT_LIST