summaryrefslogtreecommitdiff
path: root/common
Commit message (Collapse)AuthorAgeLines
* fdt: remove unaligned access in fdt_fixup_ethernet()Stephen Warren2013-06-07-1/+2
| | | | | | | | | | | | | | | Some ARM compilers may emit code that makes unaligned accesses when faced with constructs such as: char mac[16] = "ethaddr"; Replace this with a strcpy() call instead to avoid this. strcpy() is used here, rather than replacing all usage of the mac variable with the string itself, since the loop itself sprintf()s to the variable each iteration, so strcpy() is doing basically the same thing. Reported-by: Florian Meier Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
* generic_board: reduce the redundancy of gd_t struct membersMasahiro Yamada2013-06-07-55/+55
| | | | | | | | | | | | | | | | | | | | | | This commit refactors common/board_f.c and common/board_r.c in order to delete the dest_addr and dest_addr_sp from gd_t struct. As mentioned as follows in include/asm-generic/global_data.h, /* TODO: is this the same as relocaddr, or something else? */ unsigned long dest_addr; /* Post-relocation address of U-Boot */ dest_addr is the same as relocaddr. Likewise, dest_addr_sp is the same as start_addr_sp. It seemed dest_addr/dest_addr_sp was used only as a scratch variable to calculate relocaddr/start_addr_sp, respectively. With a little refactoring, we can delete dest_addr and dest_addr_sp. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Cc: Simon Glass <sjg@chromium.org>
* spl_mmc: add Falcon mode support for raw variantPeter Korsgaard2013-06-07-0/+18
| | | | | | | | | | If Falcon mode support is enabled (and the system isn't directed into booting u-boot), it will instead try to load kernel from sector CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR and CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS of kernel argument parameters starting from sector CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR. Signed-off-by: Peter Korsgaard <peter.korsgaard@barco.com>
* spl_mmc: mmc_load_image_raw(): Add sector argumentPeter Korsgaard2013-06-07-9/+6
| | | | | | So we can use it for falcon mode as well. Signed-off-by: Peter Korsgaard <peter.korsgaard@barco.com>
* spl_mmc: add Falcon mode support for FAT variantPeter Korsgaard2013-06-07-0/+21
| | | | | | | | | If Falcon mode support is enabled (and the system isn't directed into booting u-boot), it will instead try to load kernel from CONFIG_SPL_FAT_LOAD_KERNEL_NAME file and kernel argument parameters from CONFIG_SPL_FAT_LOAD_ARGS_NAME, both from the same partition as u-boot. Signed-off-by: Peter Korsgaard <peter.korsgaard@barco.com>
* spl_mmc: mmc_load_image_fat(): Add filename argument and move fat init outPeter Korsgaard2013-06-07-14/+13
| | | | | | So we can use it for falcon mode as well. Signed-off-by: Peter Korsgaard <peter.korsgaard@barco.com>
* spl_mmc: return error from mmc_load_image_{raw, fat} rather than hangingPeter Korsgaard2013-06-07-10/+14
| | | | | | So we can instead fallback to doing something else on errors. Signed-off-by: Peter Korsgaard <peter.korsgaard@barco.com>
* Merge branch 'master' of git://git.denx.de/u-boot-videoTom Rini2013-06-07-0/+87
|\
| * lcd: add functions to set up simplefb device treeStephen Warren2013-06-05-0/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | simple-framebuffer is a new device tree binding that describes a pre- configured frame-buffer memory region and its format. The Linux kernel contains a driver that supports this binding. Implement functions to create a DT node (or fill in an existing node) with parameters that describe the framebuffer format that U-Boot is using. This will be immediately used by the Raspberry Pi board in U-Boot, and likely will be used by the Samsung ARM ChromeBook support soon too. It could well be used by many other boards (e.g. Tegra boards with built-in LCD panels, which aren't yet supported by the Linux kernel). Signed-off-by: Stephen Warren <swarren@wwwdotorg.org> Acked-by: Simon Glass <sjg@chromium.org>
* | fdt: allow bootdelay to be specified via device treeStephen Warren2013-06-04-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This can be useful to force bootcmd to execute as soon as U-Boot has started. My use-case is: An SoC-specific tool pushes U-Boot into RAM, along with an image to be written to device boot flash, with the DT config property "bootcmd" set to contain a command to write that image to flash. In this scenario, we don't want to allow any stale bootdelay value taken from the current flash content to affect how long it takes before the flashing process starts. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org> Acked-by: Gerald Van Baren <vanbaren@cideas.com>
* | common: board_f: Do not call board_postclk_init twiceMasahiro Yamada2013-06-04-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The generic-board board_init_f function called board_postclk_init twice. The first one came from arch/arm/lib/board.c, while the second one from arch/powerpc/lib/board.c. This commit deletes the first occurrence. In addition, the second get_clocks call is moved after board_postclk_init in order to keep the function call order both for ARM and PowerPC. ARM board calles get_clocks function after board_postclk_init. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
* | sandbox: image: Adjust FIT image printing to work with sandboxSimon Glass2013-06-04-3/+6
| | | | | | | | | | | | | | Use map_sysmem() to convert from address to pointer, so that sandbox can print FIT information without crashing. Signed-off-by: Simon Glass <sjg@chromium.org>
* | image: Use fit_image_load() to load kernelSimon Glass2013-06-04-152/+8
| | | | | | | | | | | | | | Use the new common code to load a kernel. The functionality should not change. Signed-off-by: Simon Glass <sjg@chromium.org>
* | sandbox: Adjust bootm command to work with sandboxSimon Glass2013-06-04-13/+12
| | | | | | | | | | | | | | Use map_sysmem() when converting from addresses to pointers, so that bootm can be used with sandbox. Signed-off-by: Simon Glass <sjg@chromium.org>
* | image: Use fit_image_load() to load FDTSimon Glass2013-06-04-199/+31
| | | | | | | | | | | | | | | | Use the new common code to load a flat device tree. Also fix up a few casts so that this code works with sandbox. Other than that the functionality should not change. Signed-off-by: Simon Glass <sjg@chromium.org>
* | image: Use fit_image_load() to load ramdiskSimon Glass2013-06-04-168/+16
| | | | | | | | | | | | | | Use the new common code to load a ramdisk. The functionality should not change. Signed-off-by: Simon Glass <sjg@chromium.org>
* | image: Introduce fit_image_load() to load images from FITsSimon Glass2013-06-04-0/+231
| | | | | | | | | | | | | | | | | | | | | | At present code to load an image from a FIT is duplicated in the three places where it is needed (kernel, fdt, ramdisk). The differences between these different code copies is fairly minor. Create a new function in the fit code which can handle any of the requirements of those cases. Signed-off-by: Simon Glass <sjg@chromium.org>
* | main: Add debug_bootkeys to avoid #ifdefsSimon Glass2013-06-04-12/+12
| | | | | | | | | | | | | | | | Define a simple debug condition at the top of the file, to avoid using lots of #ifdefs later on. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
* | main: Add debug_parser() to avoid #ifdefsSimon Glass2013-06-04-35/+23
| | | | | | | | | | | | | | | | Define a simple debug condition at the top of the file, to avoid using lots of #ifdefs later on. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
* | main: Correct header orderSimon Glass2013-06-04-15/+4
| | | | | | | | | | | | The headers are a bit out of order, so fix them. Signed-off-by: Simon Glass <sjg@chromium.org>
* | main: Fix typos and checkpatch warnings in command line readingSimon Glass2013-06-04-11/+11
| | | | | | | | | | | | | | | | There are a few over-long lines and other checkpatch problems in this area of the code. Prepare the ground for the next patch by tidying these up. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
* | main: Use get/setenv_ulong()Simon Glass2013-06-04-6/+2
| | | | | | | | | | | | | | These functions are now available, so use them to avoid extra code here. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
* | main: Move boot_delay code into its own functionSimon Glass2013-06-04-67/+70
| | | | | | | | | | | | Move this code into its own function, since it clutters up main_loop(). Signed-off-by: Simon Glass <sjg@chromium.org>
* | main: Separate out the two abortboot() functionsSimon Glass2013-06-04-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | There are two implementations of abortboot(). Turn these into two separate functions, and create a single abortboot() which calls either one or the other. Also it seems that nothing uses abortboot() outside main, so make it static. At this point there is no further use of CONFIG_MENU in main.c. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
* | net: Add prototype for update_tftpSimon Glass2013-06-04-6/+1
| | | | | | | | | | | | | | This function should be declared in net.h. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
* | Merge branch 'master' of git://git.denx.de/u-boot-nand-flashTom Rini2013-05-31-27/+62
|\ \
| * | mtd: resync with Linux-3.7.1Sergey Lapin2013-05-31-27/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is essentially an update of u-boot MTD subsystem to the state of Linux-3.7.1 with exclusion of some bits: - the update is concentrated on NAND, no onenand or CFI/NOR/SPI flashes interfaces are updated EXCEPT for API changes. - new large NAND chips support is there, though some updates have got in Linux-3.8.-rc1, (which will follow on top of this patch). To produce this update I used tag v3.7.1 of linux-stable repository. The update was made using application of relevant patches, with changes relevant to U-Boot-only stuff sticked together to keep bisectability. Then all changes were grouped together to this patch. Signed-off-by: Sergey Lapin <slapin@ossfans.org> [scottwood@freescale.com: some eccstrength and build fixes] Signed-off-by: Scott Wood <scottwood@freescale.com>
| * | nand: adjust erase/read/write partition/chip size for bad blocksHarvey Chapman2013-05-22-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | Adjust the sizes calculated for whole partition/chip operations by removing the size of bad blocks so we don't try to erase/read/write past a partition/chip boundary. Signed-off-by: Harvey Chapman <hchapman@3gfp.com>
* | | Merge branch 'u-boot/master' into 'u-boot-arm/master'Albert ARIBAUD2013-05-30-2595/+2982
|\ \ \ | | | | | | | | | | | | | | | | | | | | Conflicts: common/cmd_fpga.c drivers/usb/host/ohci-at91.c
| * | | common: Update cmd_bdinfo for PPCYork Sun2013-05-24-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add board detail function to print more individual board information. Signed-off-by: York Sun <yorksun@freescale.com> Signed-off-by: Andy Fleming <afleming@freescale.com>
| * | | cmd_mem: fix cp commandMasahiro Yamada2013-05-24-1/+1
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "cp" command has not worked since commit 0628ab8ec59834f98ede267edd21ddb8ba0bb57b, because of the following lines, which set the destination and the source to the same address. buf = map_sysmem(addr, bytes); src = map_sysmem(addr, bytes); Tested-by: Tom Rini <trini@ti.com> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
| * | fdt_support: Use CONFIG_NR_DRAM_BANKS if definedDoug Anderson2013-05-17-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | It appears that there are some cases where we have more than 4 banks of memory. Use CONFIG_NR_DRAM_BANKS if it's defined to handle this. This will take up a little extra stack space (64 bytes extra if we go up to 8 banks), but that seems OK. Signed-off-by: Doug Anderson <dianders@chromium.org>
| * | bootm: Avoid 256-byte overflow in fixup_silent_linux()Doug Anderson2013-05-17-12/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes fixup_silent_linux() use malloc() to allocate its working space, meaning that our maximum kernel command line should only be limited by malloc(). Previously it was silently overflowing the stack. Note that nothing about this change increases the kernel's maximum command line length. If you have a command line that is >256 bytes it's up to you to make sure that kernel can handle it. Signed-off-by: Doug Anderson <dianders@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
| * | Power: remove support for Freescale MPC8220Wolfgang Denk2013-05-15-31/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Freescale MPC8220 Power Architecture processors have long reached EOL; Freescale does not even list these any more on their web site. Remove the code to avoid wasting maitaining efforts on dead stuff. Signed-off-by: Wolfgang Denk <wd@denx.de> Cc: Andy Fleming <afleming@gmail.com>
| * | drivers/mmc: move spl_mmc.c to common/splYing Zhang2013-05-15-0/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The mpc85xx repuires a special layout on the memory device that is connected to the eSDHC controller interface. But the file spl_mmc.c didn't handle this specfic case, there needs a special treatmen, in the powerpc drictory. So, there is no longer to keep spl_mmc.c on mpc85xx, CONFIG_SPL_FRAMEWORK is not set. When CONFIG_SPL_MMC_SUPPORT is set and CONFIG_SPL_FRAMEWORK is not set, there was an error in drivers/mmc/spl_mmc.c: drivers/mmc/libmmc.o:(.got2+0x8): undefined reference to `spl_image'. Now, the solution is to move the file "spl_mmc.c" to directory "common/spl". Signed-off-by: Ying Zhang <b40530@freescale.com>
| * | arm: Refactor bootm to reduce #ifdefsSimon Glass2013-05-14-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | With fewer #ifdefs the code is more readable and more of the code is compiled for all boards. Add defines in the header file to control what features are enabled, and then use if() instead of #ifdef. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | image: Add device tree setup to image librarySimon Glass2013-05-14-0/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This seems to be a common function for several architectures, so create a common function rather than duplicating the code in each arch. Also make an attempt to avoid introducing #ifdefs in the new code, partly by removing useless #ifdefs around function declarations in the image.h header. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | image: Split libfdt code into image-fdt.cSimon Glass2013-05-14-566/+592
| | | | | | | | | | | | | | | | | | | | | The image file is still very large, and some of the code is only used when libfdt is in use. Move this code into a new file. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | image: Add CONFIG_FIT_SPL_PRINT to control FIT image printing in SPLSimon Glass2013-05-14-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | This code is very large, and in SPL it isn't always useful to print out image information (in fact there might not even be a console active). So disable this feature unless this option is set. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | image: Remove remaining #ifdefs in image-fit.cSimon Glass2013-05-14-13/+3
| | | | | | | | | | | | | | | | | | | | | There are only two left. One is unnecessary and the other can be moved to the header file. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | sandbox: image: Add support for booting images in sandboxSimon Glass2013-05-14-29/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Much of the image code uses addresses as ulongs and pointers interchangeably, casting between the two forms as needed. This doesn't work with sandbox, which has a U-Boot RAM buffer which is separate from the host machine's memory. Adjust the cost so that translating from a U-Boot address to a pointer uses map_sysmem(). This allows bootm to work correctly on sandbox. Note that there are no exhaustive tests for this code on sandbox, so it is possible that some dark corners remain. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de> (v1)
| * | image: Rename hash printing to fit_image_print_verification_data()Simon Glass2013-05-14-52/+79
| | | | | | | | | | | | | | | | | | | | | | | | This function will be used to print signatures as well as hashes, so rename it. Also make it static since it is not used outside this file. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
| * | image: Export fit_conf_get_prop_node()Simon Glass2013-05-14-4/+4
| | | | | | | | | | | | | | | | | | | | | This function will be needed by signature checking code, so export it, and also add docs. Signed-off-by: Simon Glass <sjg@chromium.org>
| * | image: Move error! string to common placeSimon Glass2013-05-14-11/+8
| | | | | | | | | | | | | | | | | | | | | | | | The string " error\n" appears in each error string. Move it out to a common place. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
| * | image: Move hash checking into its own functionSimon Glass2013-05-14-62/+66
| | | | | | | | | | | | | | | | | | | | | | | | The existing function is long and most of the code is indented a long way. Before adding yet more code, split this out into its own function. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de> (v1)
| * | image: Rename fit_image_check_hashes() to fit_image_verify()Simon Glass2013-05-14-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is the main entry point to the FIT image verification code. We will be using it to handle image verification with signatures, so rename the function. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
| * | image: Move HOSTCC image code to tools/Simon Glass2013-05-14-170/+1
| | | | | | | | | | | | | | | | | | | | | | | | This code is never compiled into U-Boot, so move it into a separate file in tools/ to avoid the large #ifdef. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
| * | image: Split FIT code into new image-fit.cSimon Glass2013-05-14-1602/+1637
| | | | | | | | | | | | | | | | | | | | | | | | The FIT code is about half the size of the >3000-line image.c. Split this code into its own file. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
| * | image: Export fit_check_ramdisk()Simon Glass2013-05-14-7/+2
| | | | | | | | | | | | | | | | | | | | | | | | One we split out the FIT code from image.c we will need this function. Export it in the header. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
| * | image: Move timestamp #ifdefs to header fileSimon Glass2013-05-14-29/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rather than repeat the line #if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE) || \ defined(USE_HOSTCC) everywhere, put this in a header file and #define IMAGE_ENABLE_TIMESTAMP to either 1 or 0. Then we can use a plain if() in most code and avoid the #ifdefs. The compiler's dead code elimination ensures that the result is the same. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Marek Vasut <marex@denx.de>