summaryrefslogtreecommitdiff
path: root/include/common.h
Commit message (Collapse)AuthorAgeLines
* common: move extern char console_buffer[] to common.hIgor Grinberg2011-11-22-0/+1
| | | | | | | | | Extract all extern declarations for console_buffer[] out of c files into the common.h header. Signed-off-by: Igor Grinberg <grinberg@compulab.co.il> Cc: Frank Gottschling <fgottschling@eltec.de> Cc: Murray Jensen <Murray.Jensen@csiro.au>
* DEBUG: Fix debug macrosMarek Vasut2011-10-27-10/+16
| | | | | | | | | | | | | The current implementation of debug doesn't play well with GCC4.6. This implementation also fixes GCC4.6 complaints about unused variables while maintaining code size. Also, drop the debugX() as that's not used anywhere anymore. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Cc: Wolfgang Denk <wd@denx.de> Cc: Simon Glass <sjg@chromium.org>
* fdt: Add support for embedded device tree (CONFIG_OF_EMBED)Simon Glass2011-10-26-0/+1
| | | | | | | | | | | | | | | | | This new option allows U-Boot to embed a binary device tree into its image to allow run-time control of peripherals. This device tree is for U-Boot's own use and is not necessarily the same one as is passed to the kernel. The device tree compiler output should be placed in the $(obj) rooted tree. Since $(OBJCOPY) insists on adding the path to the generated symbol names, to ensure consistency it should be invoked from the directory where the .dtb file is located and given the input file name without the path. This commit contains my entry for the ugliest Makefile / shell interaction competition. Signed-off-by: Simon Glass <sjg@chromium.org>
* tftpput: add save_addr and save_size global variablesSimon Glass2011-10-26-0/+2
| | | | | | We need something akin to load_addr to handle saving data. Signed-off-by: Simon Glass <sjg@chromium.org>
* Add setenv_ulong() and setenv_addr()Simon Glass2011-10-26-0/+2
| | | | | | | It seems we put numbers and addresses into environment variables a lot. We should have some functions to do this. Signed-off-by: Simon Glass <sjg@chromium.org>
* Move simple_itoa to vsprintfSimon Glass2011-10-26-0/+1
| | | | | | | This function is generally useful and shouldn't hide away in hush. It has been moved as is. Signed-off-by: Simon Glass <sjg@chromium.org>
* cache: add ALLOC_CACHE_ALIGN_BUFFER macroAnton staaf2011-10-25-0/+58
| | | | | | | | | | | | | This macro is used to allocate cache line size aligned stack buffers for use with DMA hardware. Signed-off-by: Anton Staaf <robotboy@chromium.org> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Kyungmin Park <kyungmin.park@samsung.com> Cc: Mike Frysinger <vapier@gentoo.org> Cc: Aneesh V <aneesh@ti.com> Cc: Albert ARIBAUD <albert.u.boot@aribaud.net> Cc: Wolfgang Denk <wd@denx.de>
* Add getenv_ulong() to read an integer from an environment variableSimon Glass2011-10-23-0/+1
| | | | | | | | This is not an uncommon operation in U-Boot, so let's put it in a common function. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
* cache: include asm/cache.h for ARCH_DMA_MINALIGN definitionAnton Staaf2011-10-23-0/+8
| | | | | | | | | | | | | | | | | ARCH_DMA_MINALIGN will be used to allocate DMA buffers that are aligned correctly. In all current cases this means that the DMA buffer will be aligned to at least the L1 data cache line size of the configured architecture. If the board configuration file does not specify the architecture L1 data cache line size then the maximum line size of the architecture is used to align DMA buffers. Signed-off-by: Anton Staaf <robotboy@chromium.org> Cc: Mike Frysinger <vapier@gentoo.org> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Wolfgang Denk <wd@denx.de> Cc: Stefano Babic <sbabic@denx.de> Cc: Ilya Yanok <yanok@emcraft.com> Cc: Laurence Withers <lwithers@guralp.com>
* consolidate mdelay by providing a common function for all usersAnatolij Gustschin2011-10-22-0/+1
| | | | | | | | | There are several mdelay() definitions in the driver and board code. Remove them all and provide a common mdelay() in lib/time.c. Signed-off-by: Anatolij Gustschin <agust@denx.de> Acked-by: Mike Frysinger <vapier@gentoo.org>
* nds32: add NDS32 support into common header fileMacpaul Lin2011-10-22-0/+4
| | | | | | Add NDS32 support into common header file. Signed-off-by: Macpaul Lin <macpaul@andestech.com>
* sandbox: Add architecture header filesSimon Glass2011-10-17-0/+3
| | | | | | | This adds required header files for the sandbox architecture, and a basic description of what sandbox is (README.sandbox). Signed-off-by: Simon Glass <sjg@chromium.org>
* Add pxe commandJason Hobbs2011-10-17-0/+6
| | | | | | | | | | | | Add pxe command, which is intended to mimic PXELINUX functionality. 'pxe get' uses tftp to retrieve a file based on UUID, MAC address or IP address. 'pxe boot' interprets the contents of PXELINUX config like file to boot using a specific initrd, kernel and kernel command line. This patch also adds a README.pxe file - see it for more details on the pxe command. Signed-off-by: Jason Hobbs <jason.hobbs@calxeda.com>
* lib: add uuid_str_to_bin for use with bootp and PXE uuidJason Hobbs2011-10-17-0/+4
| | | | Signed-off-by: Jason Hobbs <jason.hobbs@calxeda.com>
* common, menu: use abortboot for menu timeoutJason Hobbs2011-10-17-0/+3
| | | | Signed-off-by: Jason Hobbs <jason.hobbs@calxeda.com>
* serial_exit: punt unused prototypeMike Frysinger2011-10-15-1/+0
| | | | | | | No code defines or calls this, so drop the prototype. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Acked-by: Simon Glass <sjg@chromium.org>
* ppc: Include <asm/cache.h> in common.hStefan Roese2011-10-09-0/+8
| | | | | | | | | | | | | | | This is needed for the patch "cache: add default setting for CONFIG_SYS_CACHELINE_SIZE" from Anton Staaf. As cache.h defines CONFIG_SYS_CACHELINE_SIZE for PPC targets. This will remove the following warnings/errors: include/common.h:819:2: warning: #warning CONFIG_SYS_CACHELINE_SIZE not defined, using __BIGGEST_ALIGNMENT__ cache.c:33: error: '__BIGGEST_ALIGNMENT__' undeclared (first use in this function) Signed-off-by: Stefan Roese <sr@denx.de> Cc: Anton Staaf <robotboy@chromium.org> Cc: Wolfgang Denk <wd@denx.de>
* powerpc/mpc83xx: Migrate from spd_sdram to unified DDR driverYork Sun2011-09-29-1/+3
| | | | | | | | | | | | | | | | | Unified DDR driver is maintained for better performance, robustness and bug fixes. Upgrading to use unified DDR driver for MPC83xx takes advantage of overall improvement. It requires changes for board files to customize platform-dependent parameters. To utilize the unified DDR driver, a board needs to define CONFIG_FSL_DDRx in the header file. No more boards will be accepted without such definition. Note: the workaround for erratum DDR6 for the very old MPC834x Rev 1.0/1.1 and MPC8360 Rev 1.1/1.2 parts is not migrated to unified driver. Signed-off-by: Kim Phillips <kim.phillips@freescale.com> Signed-off-by: York Sun <yorksun@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* powerpc/mp: add support for discontiguous coresTimur Tabi2011-09-29-0/+15
| | | | | | | | | | Some SOCs have discontiguously-numbered cores, and so we can't determine the valid core numbers via the FRR register any more. We define CPU_TYPE_ENTRY_MASK to specify a discontiguous core mask, and helper functions to process the mask and enumerate over the set of valid cores. Signed-off-by: Timur Tabi <timur@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* Add assert() for debug assertionsSimon Glass2011-09-10-0/+21
| | | | | | | | | | | | | | | assert() is like BUG_ON() but compiles to nothing unless DEBUG is defined. This is useful when a condition is an error but a board reset is unlikely to fix it, so it is better to soldier on in hope. Assertion failures should be caught during development/test. It turns out that assert() is defined separately in a few places in U-Boot with various meanings. This patch cleans up some of these. Build errors exposed by this change (and defining DEBUG) are also fixed in this patch. Signed-off-by: Simon Glass <sjg@chromium.org>
* common: fix behavior of ROUND macro when input is already roundedAnton Staaf2011-09-07-1/+1
| | | | | | | | | | | | | | | | | | | Currently when you call ROUND with a value that is already a multiple of the second parameter it will return a value that is one multiple larger, instead of returning the value passed in. There are only two types of usage of ROUND currently, one in various config files to round CONFIG_SYS_MALLOC_LEN to a multiple of 4096 bytes. The other in cmd_sf.c where the incorrect behavior of ROUND is worked around be subtracting one from the length argument before passing it to ROUND. This patch fixes ROUND and removes the workaround from cmd_sf. It also results in all of the malloc pools that use ROUND to compute their size shrinking by 4KB. Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Mike Frysinger <vapier@gentoo.org>
* arm: do not force d-cache enable on all boardsAneesh V2011-09-04-0/+1
| | | | | | | | | | | | c2dd0d45540397704de9b13287417d21049d34c6 added dcache_enable() to board_init_r(). This enables d-cache for all ARM boards. As a result some of the arm boards that are not cache-ready are broken. Revert this change and allow platform code to take the decision on d-cache enabling. Also add some documentation for cache usage in ARM. Signed-off-by: Aneesh V <aneesh@ti.com>
* Unify timer_init() and cpu_init() prototypesWolfgang Denk2011-08-01-0/+3
| | | | | | | | | | Clean up some duplicated prototype declarations. Get rid of now useless AVR32 initcalls.h file. Signed-off-by: Wolfgang Denk <wd@denx.de> Cc: Albert Aribaud <albert.aribaud@free.fr> Cc: Haavard Skinnemoen <haavard.skinnemoen@atmel.com> Cc: Graeme Russ <graeme.russ@gmail.com>
* Constify getenv(), setenv() and hash code functionsWolfgang Denk2011-07-30-4/+4
| | | | | | | | | | | This is needed to get rid of build warnings like main.c:311: warning: passing argument 2 of 'setenv' discards qualifiers from pointer target type which result from commit 09c2e90 "unify version_string". Signed-off-by: Wolfgang Denk <wd@denx.de> Cc: Andreas Bießmann <andreas.devel@googlemail.com>
* common: move BUILD_BUG_ON define to common.hHeiko Schocher2011-07-27-0/+3
| | | | | | | | | see discussion also here: http://patchwork.ozlabs.org/patch/75309/ Signed-off-by: Heiko Schocher <hs@denx.de> cc: Wolfgang Denk <wd@denx.de> cc: Holger Brunck <holger.brunck@keymile.com>
* panic: add noreturn attributeMike Frysinger2011-07-26-1/+1
| | | | | | | Since panic() never returns, we should add an appropriate attribute to let gcc improve optimization around it. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* env: allow people to force envcrc buildingMike Frysinger2011-07-26-0/+5
| | | | | | | | For people who want to manually extract the embedded environment so that it can be manually packed into the final u-boot image, add a config opt to force building of the envcrc tool. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Timer: Remove set_timer completelyGraeme Russ2011-07-26-1/+0
|
* Remove volatile qualifier in get_ram_size() callsAlbert ARIBAUD2011-07-17-1/+1
| | | | | | | | | Checkpatch.pl complains about the volatile qualifier in calls to get_ram_size(). Remove this qualifier in the prototype and in the calls where it is useless, and leave it only in the function body where it is needed. Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
* armv7: cache maintenance operations for armv7Aneesh V2011-07-04-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | - Add a framework for layered cache maintenance - separate out SOC specific outer cache maintenance from maintenance of caches known to CPU - Add generic ARMv7 cache maintenance operations that affect all caches known to ARMv7 CPUs. For instance in Cortex-A8 these opertions will affect both L1 and L2 caches. In Cortex-A9 these will affect only L1 cache - D-cache operations supported: - Invalidate entire D-cache - Invalidate D-cache range - Flush(clean & invalidate) entire D-cache - Flush D-cache range - I-cache operations supported: - Invalidate entire I-cache - Add maintenance functions for TLB, branch predictor array etc. - Enable -march=armv7-a so that armv7 assembly instructions can be used Signed-off-by: Aneesh V <aneesh@ti.com>
* ARM: drop unsupported 'trab' boardWolfgang Denk2011-06-22-3/+0
| | | | | | | | | | The 'trab' board configuration is broken, and there is nobody who is interested and willing to fix it. Drop it. This includes support for VFD displays which have always been used by this board only. Signed-off-by: Wolfgang Denk <wd@denx.de>
* lib, vsprintf: introduce strict_strtoulHeiko Schocher2011-05-12-0/+1
| | | | | | | | | | | | | | | as checkpatch proposes to use strict_strtoul instead of simple_strtoul, introduce it. Ported this function from Linux 2.6.38 commit ID: 521cb40b0c44418a4fd36dc633f575813d59a43d Signed-off-by: Heiko Schocher <hs@denx.de> cc: Wolfgang Denk <wd@denx.de> cc: Detlev Zundel <dzu@denx.de> cc: Valentin Longchamp <valentin.longchamp@keymile.com> cc: Holger Brunck <holger.brunck@keymile.com> Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
* powerpc, mpc83xx: add missing functions to include/common.hHeiko Schocher2011-04-30-0/+5
| | | | | | | | | | | | | | | | | add following functions to common.h, to prevent extern declarations: void disable_addr_trans(void); void enable_addr_trans(void); void ddr_enable_ecc(unsigned int dram_size); Signed-off-by: Heiko Schocher <hs@denx.de> Acked-by: Kim Phillips <kim.phillips@freescale.com> cc: Kim Phillips <kim.phillips@freescale.com> cc: Holger Brunck <holger.brunck@keymile.com> cc: Wolfgang Denk <wd@denx.de> cc: Detlev Zundel <dzu@denx.de> cc: Valentin Longchamp <valentin.longchamp@keymile.com>
* x86: Rename i386 to x86Graeme Russ2011-04-13-3/+3
| | | | Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
* Fix min/max macros in include/common.hAaron Williams2011-04-12-2/+4
| | | | | | | | | | There is a bug in the min and max macros in common.h which occurs if Y is a larger type than X. For example, if Y is a 64-bit value and X is a 32-bit value then Y will be truncated to 32-bits. This fix matches what is done in the Linux kernel but without the additional type checking present in the kernel version. Signed-off-by: Aaron Williams <aaron.williams@caviumnetworks.com>
* powerpc/8xxx: Replace fsl_ddr_get_mem_data_rate with get_ddr_freq()Kumar Gala2011-04-04-0/+4
| | | | | | | | | | Every 85xx board implements fsl_ddr_get_mem_data_rate via get_ddr_freq() and every 86xx board uses get_bus_freq(). If implement get_ddr_freq() as a static inline to call get_bus_freq() we can remove fsl_ddr_get_mem_data_rate altogether and just call get_ddr_freq() directly. Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* strmhz: Make hz unsigned to support greater than 2146 MHz clockEd Swarthout2011-03-22-1/+1
| | | | | | | | | For example, an input of 0x80000000 should print: 2147.484 instead of -2147.-483. Signed-off-by: Ed Swarthout <Ed.Swarthout@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* env: re-add support for auto-completionMike Frysinger2011-01-09-0/+1
| | | | | | | Currently, only basic completion is supported (no globs), but this is what we had previously. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* stdio: constify "name" arg in public apiMike Frysinger2010-11-28-1/+1
| | | | Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Replace CONFIG_SYS_GBL_DATA_SIZE by auto-generated valueWolfgang Denk2010-10-26-0/+1
| | | | | | | | | | | | | | | | | | CONFIG_SYS_GBL_DATA_SIZE has always been just a bad workarond for not being able to use "sizeof(struct global_data)" in assembler files. Recent experience has shown that manual synchronization is not reliable enough. This patch renames CONFIG_SYS_GBL_DATA_SIZE into GENERATED_GBL_DATA_SIZE which gets automatically generated by the asm-offsets tool. In the result, all definitions of this value can be deleted from the board config files. We have to make sure that all files that reference such data include the new <asm-offsets.h> file. No other changes have been done yet, but it is obvious that similar changes / simplifications can be done for other, related macro definitions as well. Signed-off-by: Wolfgang Denk <wd@denx.de> Acked-by: Kumar Gala <galak@kernel.crashing.org>
* Merge branch 'next' of /home/wd/git/u-boot/nextWolfgang Denk2010-09-28-12/+15
|\ | | | | | | | | | | | | Conflicts: include/ppc4xx.h Signed-off-by: Wolfgang Denk <wd@denx.de>
| * Remove unused CONFIG_SERIAL_SOFTWARE_FIFO featureStefan Roese2010-09-23-8/+0
| | | | | | | | | | | | | | | | | | This patch removes the completely unused CONFIG_SERIAL_SOFTWARE_FIFO feature from U-Boot. It has only been implemented for PPC4xx and was not used at all. So let's remove it and make the code smaller and cleaner. Signed-off-by: Stefan Roese <sr@denx.de> Acked-by: Detlev Zundel <dzu@denx.de>
| * ppc4xx: Use common NS16550 driver for PPC4xx UARTStefan Roese2010-09-23-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes the PPC4xx UART driver. Instead the common NS16550 driver is used, since all PPC4xx SoC's use this peripheral device. The file 4xx_uart.c now only implements the UART clock calculation function which also sets the SoC internal UART divisors. All PPC4xx board config headers are changed to use this common NS16550 driver now. Tested on these boards: acadia, canyonlands, katmai, kilauea, sequoia, zeus Signed-off-by: Stefan Roese <sr@denx.de>
| * ppc4xx: Move ppc4xx headers to powerpc include directoryStefan Roese2010-09-23-1/+1
| | | | | | | | | | | | | | | | | | This patch moves some ppc4xx related headers from the common include directory (include/) to the powerpc specific one (arch/powerpc/include/asm/). This way to common include directory is not so cluttered with files. Signed-off-by: Stefan Roese <sr@denx.de>
| * common: move TOTAL_MALLOC_LEN to include/common.hHeiko Schocher2010-09-19-0/+9
| | | | | | | | | | | | | | Portions of this work were supported by funding from the CE Linux Forum. Signed-off-by: Heiko Schocher <hs@denx.de>
| * Remove support for CONFIG_HAS_UID and "forceenv" commandWolfgang Denk2010-09-19-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | This (undocumented) concept was only in use for the MVSMR and davinci_schmoogie Sergey Kubushyn <ksi@koi8.net> boards. Drop it for now. If really needed, it should be reimplemented later in the context of the new environment command set. Signed-off-by: Wolfgang Denk <wd@denx.de> Cc: Andre Schwarz <andre.schwarz@matrix-vision.de> Cc: Sergey Kubushyn <ksi@koi8.net> Acked-by: Sergey Kubushyn <ksi@koi8.net>
| * Add qsort - add support for sorting data arraysWolfgang Denk2010-09-19-0/+4
| | | | | | | | | | | | Code adapted from uClibc-0.9.30.3 Signed-off-by: Wolfgang Denk <wd@denx.de>
* | POST cleanup.Michael Zaidman2010-09-21-2/+3
|/ | | | | | | | | | | | | | | | | | | | | | | | - Revives POST for blackfin arch; - Removes redundant code: arch/blackfin/lib/post.c arch/powerpc/cpu/ppc4xx/commproc.c arch/powerpc/cpu/mpc512x/common.c - fixes up the post_word_{load|store} usage. Signed-off-by: Michael Zaidman <michael.zaidman@gmail.com> Acked-by: Detlev Zundel <dzu@denx.de> Tested-by: Anatolij Gustschin <agust@denx.de> List of the maintainers of the affected by patch boards: Cc: Stephan Linz <linz@li-pro.net> Cc: Denis Peter <d.peter@mpl.ch> Cc: Matthias Fuchs <matthias.fuchs@esd-electronics.com> Cc: Peter Tyser <ptyser@xes-inc.com> Cc: Stefan Roese <sr@denx.de> Cc: Mike Frysinger <vapier@gentoo.org> Cc: Niklaus Giger <niklaus.giger@netstal.com> Cc: Larry Johnson <lrj@acm.org> Cc: Feng Kan <fkan@amcc.com>
* Rename getenv_r() into getenv_f()Wolfgang Denk2010-08-04-1/+1
| | | | | | | | | | | | | | | | | | | While running from flash, i. e. before relocation, we have only a limited C runtime environment without writable data segment. In this phase, some configurations (for example with environment in EEPROM) must not use the normal getenv(), but a special function. This function had been called getenv_r(), with the idea that the "_r" suffix would mean the same as in the _r_eentrant versions of some of the C library functions (for example getdate vs. getdate_r, getgrent vs. getgrent_r, etc.). Unfortunately this was a misleading name, as in U-Boot the "_r" generally means "running from RAM", i. e. _after_ relocation. To avoid confusion, rename into getenv_f() [as "running from flash"] Signed-off-by: Wolfgang Denk <wd@denx.de> Acked-by: Detlev Zundel <dzu@denx.de>
* Make sure that argv[] argument pointers are not modified.Wolfgang Denk2010-07-04-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The hush shell dynamically allocates (and re-allocates) memory for the argument strings in the "char *argv[]" argument vector passed to commands. Any code that modifies these pointers will cause serious corruption of the malloc data structures and crash U-Boot, so make sure the compiler can check that no such modifications are being done by changing the code into "char * const argv[]". This modification is the result of debugging a strange crash caused after adding a new command, which used the following argument processing code which has been working perfectly fine in all Unix systems since version 6 - but not so in U-Boot: int main (int argc, char **argv) { while (--argc > 0 && **++argv == '-') { /* ====> */ while (*++*argv) { switch (**argv) { case 'd': debug++; break; ... default: usage (); } } } ... } The line marked "====>" will corrupt the malloc data structures and usually cause U-Boot to crash when the next command gets executed by the shell. With the modification, the compiler will prevent this with an error: increment of read-only location '*argv' N.B.: The code above can be trivially rewritten like this: while (--argc > 0 && **++argv == '-') { char *arg = *argv; while (*++arg) { switch (*arg) { ... Signed-off-by: Wolfgang Denk <wd@denx.de> Acked-by: Mike Frysinger <vapier@gentoo.org>