summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2014-10-27Tidy up data sizes and function comment in display_optionsSimon Glass
Use inttypes.h and uint64_t to correct the code so that it will not issue warnings on 64-bit machines where 'uint64_t' is 'unsigned long'. Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-27Use uint64_t instead of u64 in put_dec()Simon Glass
Use the correct type required by do_div(). Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-27Use uint64_t for time typesSimon Glass
Unfortunately 'unsigned long long' and 'uint64_t' are not necessarily compatible on 64-bit machines. Use the correct typedef instead of writing the supposed type out in full. Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-25lmb: make local functions staticJeroen Hofstee
Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
2014-10-23kconfig: move CONFIG_USE_PRIVATE_LIBGCC to KconfigMasahiro Yamada
The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86. Those architectures should "select" HAVE_PRIVATE_LIBGCC and CONFIG_USE_PRIVATE_LIBGCC should depend on it. Currently, this option is enabled on Tegra boards and x86 architecture. Move the definition from header files to Kconfig. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Tested-by: Simon Glass <sjg@chromium.org> Acked-by: Simon Glass <sjg@chromium.org> Cc: Stephen Warren <swarren@nvidia.com> Cc: Tom Warren <twarren@nvidia.com>
2014-10-23kconfig: move CONFIG_SYS_HZ to lib/KconfigMasahiro Yamada
CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h (but some boards still have redundant definitions). This commit moves the definition and the document in README to Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000, the sanity check in lib/time.c should be removed. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Reviewed-by: Marek Vasut <marex@denx.de>
2014-10-23Merge git://git.denx.de/u-boot-x86Tom Rini
2014-10-23Merge git://git.denx.de/u-boot-fdtTom Rini
2014-10-23x86: dts: Add device tree compatible string for Intel IPCSimon Glass
Add this to the table so that it can be recognised. Signed-off-by: Simon Glass <sjg@chromium.org>
2014-10-22fdt: Add a function to return PCI BDF tripletThierry Reding
The fdtdec_pci_get_bdf() function returns the bus, device, function triplet of a PCI device by parsing the "reg" property according to the PCI device tree binding. Acked-by: Simon Glass <sjg@chromium.org> Signed-off-by: Thierry Reding <treding@nvidia.com>
2014-10-22fdt: Add resource parsing functionsThierry Reding
Add the fdt_get_resource() and fdt_get_named_resource() functions which can be used to parse resources (memory regions) from an FDT. A helper to compute the size of a region is also provided. Signed-off-by: Thierry Reding <treding@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org>
2014-10-22fdt: Add functions to retrieve stringsThierry Reding
Given a device tree node, a property name and an index, the new function fdt_get_string_index() will return in an output argument a pointer to the index'th string in the property's value. The fdt_get_string() is a shortcut for the above with the index being 0. Signed-off-by: Thierry Reding <treding@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org>
2014-10-22fdt: Add a function to get the index of a stringThierry Reding
Given a device tree node and a property name, the new fdt_find_string() function will look up a given string in the string list contained in the property's value and return its index. Signed-off-by: Thierry Reding <treding@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org>
2014-10-22fdt: Add a function to count stringsThierry Reding
Given a device tree node and a property name, the fdt_count_strings() function counts the number of strings found in the property value. Signed-off-by: Thierry Reding <treding@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org>
2014-10-22initcall: Display error number when an error occursSimon Glass
Now that some initcall functions return a useful error number, display it when something goes wrong. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Igor Grinberg <grinberg@compulab.co.il>
2014-09-24kconfig: move CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED to KconfigMasahiro Yamada
If this option is enabled, the objects under lib/ directory are compiled with speed optimization, not size optimization. (Currently, only used by some Blackfin boards.) Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Acked-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
2014-09-24kconfig: add blank Kconfig filesMasahiro Yamada
This would be useful to start moving various config options. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Acked-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
2014-09-16kbuild: force to define __UBOOT__ in all the C sourcesMasahiro Yamada
U-Boot has imported various source files from other projects, mostly Linux. Something like #ifdef __UBOOT__ [ modification for U-Boot ] #else [ original code ] #endif is an often used strategy for clarification of adjusted parts, that is, easier re-sync in future. Instead of defining __UBOOT__ in each source file, passing it from the top Makefile would be easier. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Acked-by: Marek Vasut <marex@denx.de> Acked-by: Heiko Schocher <hs@denx.de>
2014-09-13Merge branch 'master' of git://git.denx.de/u-boot-dmTom Rini
2014-09-10dm: fdt: Add a function to look up a chosen nodeSimon Glass
Within /chosen we may have a node which points to another node, similar to how /aliases works. Add a helper function to do this lookup. Signed-off-by: Simon Glass <sjg@chromium.org>
2014-09-05video: Add driver for Parade PS8625 dP to LVDS bridgeVadim Bendebury
The initialization table comes from the "Illustration of I2C command for initialing PS8625" document supplied by Parade. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com> Acked-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2014-09-05video: exynos_fimd: Add framework to disable FIMD sysmmuAjay Kumar
On Exynos5420 and newer versions, the FIMD sysmmus are in "on state" by default. We have to disable them in order to make FIMD DMA work. This patch adds the required framework to exynos_fimd driver, and disables FIMD sysmmu on Exynos5420. Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2014-08-25lib, linux: move linux specific defines to linux/compat.hHeiko Schocher
- move linux specific defines from usb and video code into linux/compat.h - move common linux specific defines from include/ubi_uboot.h to linux/compat.h - add for new mtd/ubi/ubifs sync new needed linux specific defines to linux/compat.h Signed-off-by: Heiko Schocher <hs@denx.de> Cc: Marek Vasut <marex@denx.de> Cc: Anatolij Gustschin <agust@denx.de> [trini: Add spin_lock_irqsave/spin_unlock_irqrestore dummies from usb/lin_gadet_compat.h] Signed-off-by: Tom Rini <trini@ti.com>
2014-08-25lib, list_sort: add list_sort from linux 3.14Heiko Schocher
from linux 3.14: commit 455c6fdbd219161bd09b1165f11699d6d73de11c Author: Linus Torvalds <torvalds@linux-foundation.org> Date: Sun Mar 30 20:40:15 2014 -0700 Linux 3.14 Needed for the MTD/UBI/UBIFS resync Just copied the files from Linux, and added in the c-file the "#define __UBOOT__" for adding U-Boot special code. In this case we use this just for adding including U-Boot headers. Signed-off-by: Heiko Schocher <hs@denx.de> Cc: Marek Vasut <marex@denx.de> Cc: Sergey Lapin <slapin@ossfans.org> Cc: Scott Wood <scottwood@freescale.com> Cc: Tom Rini <trini@ti.com>
2014-08-25lib, rbtree: resync with Linux-3.14Heiko Schocher
resync with linux: commit 455c6fdbd219161bd09b1165f11699d6d73de11c Author: Linus Torvalds <torvalds@linux-foundation.org> Date: Sun Mar 30 20:40:15 2014 -0700 Linux 3.14 Needed for the MTD/UBI/UBIFS resync Just copied the files from Linux, changed the license file header, and add in the c-file: +#define __UBOOT__ #include <linux/rbtree_augmented.h> +#ifndef __UBOOT__ #include <linux/export.h> +#else +#include <ubi_uboot.h> +#endif so, it compiles for U-Boot. Signed-off-by: Heiko Schocher <hs@denx.de> Cc: Marek Vasut <marex@denx.de> Cc: Sergey Lapin <slapin@ossfans.org> Cc: Scott Wood <scottwood@freescale.com> Cc: Tom Rini <trini@ti.com>
2014-08-09lib: lmb: fix overflow in __lmb_alloc_base w/ large RAMStephen Warren
If a 32-bit system has 2GB of RAM, and the base address of that RAM is 2GB, then start+size will overflow a 32-bit value (to a value of 0). __lmb_alloc_base is affected by this; it calculates the minimum of (start+size of RAM) and max_addr. However, when start+size is 0, it is always less than max_addr, which causes the value of max_addr not to be taken into account when restricting the allocation's location. Fix this by calculating start+size separately, and if that calculation underflows, using -1 (interpreted as the max unsigned value) as the value instead, and then taking the min of that and max_addr. Now that start+size doesn't overflow, it's typically large, and max_addr dominates the min() call, and is taken into account. The user-visible symptom of this bug is that CONFIG_BOOTMAP_SZ is ignored on Tegra124 systems with 2GB of RAM, which in turn causes the DT to be relocated at the very end of RAM, which the ARM Linux kernel doesn't map during early boot, and which causes boot failures. With this fix, CONFIG_BOOTMAP_SZ correctly restricts the relocated DT to a much lower address, and everything works. Signed-off-by: Stephen Warren <swarren@nvidia.com>
2014-08-09rsa: Fix two errors in the implementationSimon Glass
1. Failure to set the return code correctly 2. Failure to detect the loop end condition when the value is equal to the modulus. Reported-by: Jeroen Hofstee <jeroen@myspectrum.nl> Signed-off-by: Simon Glass <sjg@chromium.org>
2014-08-09fdt: Sync up with libfdtSimon Glass
This brings in changes up to commit f9e91a48 in the libfdt repo. Mostly this is whitespace/minor changes. But there are a few new features: - fdt_size_cells() and fdt_address_cells() - fdt_resize() Signed-off-by: Simon Glass <sjg@chromium.org>
2014-08-09Implement generalised RSA public exponents for verified bootMichael van der Westhuizen
Remove the verified boot limitation that only allows a single RSA public exponent of 65537 (F4). This change allows use with existing PKI infrastructure and has been tested with HSM-based PKI. Change the configuration OF tree format to store the RSA public exponent as a 64 bit integer and implement backward compatibility for verified boot configuration trees without this extra field. Parameterise vboot_test.sh to test different public exponents. Mathematics and other hard work by Andrew Bott. Tested with the following public exponents: 3, 5, 17, 257, 39981, 50457, 65537 and 4294967297. Signed-off-by: Andrew Bott <Andrew.Bott@ipaccess.com> Signed-off-by: Andrew Wishart <Andrew.Wishart@ipaccess.com> Signed-off-by: Neil Piercy <Neil.Piercy@ipaccess.com> Signed-off-by: Michael van der Westhuizen <michael@smart-africa.com> Cc: Simon Glass <sjg@chromium.org>
2014-07-23fdt: Add a function to get the node offset of an aliasSimon Glass
This simple function returns the node offset of a named alias. Signed-off-by: Simon Glass <sjg@chromium.org>
2014-07-23fdt: Add a function to get the alias sequence of a nodeSimon Glass
Aliases are used to provide U-Boot's numbering of devices, such as: aliases { spi0 = "/spi@12330000"; } spi@12330000 { ... } This tells us that the SPI controller at 12330000 is considered to be the first SPI controller (SPI 0). So we have a numbering for the SPI node. Add a function that returns the numbering for a node assume that it exists in the list of aliases. Signed-off-by: Simon Glass <sjg@chromium.org>
2014-07-23Add a simple malloc() implementation for pre-relocationSimon Glass
If we are to have driver model before relocation we need to support some way of calling memory allocation routines. The standard malloc() is pretty complicated: 1. It uses some BSS memory for its state, and BSS is not available before relocation 2. It supports algorithms for reducing memory fragmentation and improving performace of free(). Before relocation we could happily just not support free(). 3. It includes about 4KB of code (Thumb 2) and 1KB of data. However since this has been loaded anyway this is not really a problem. The simplest way to support pre-relocation malloc() is to reserve an area of memory and allocate it in increasing blocks as needed. This implementation does this. To enable it, you need to define the size of the malloc() pool as described in the README. It will be located above the pre-relocation stack on supported architectures. Note that this implementation is only useful on machines which have some memory available before dram_init() is called - this includes those that do no DRAM init (like tegra) and those that do it in SPL (quite a few boards). Enabling driver model preior to relocation for the rest of the boards is left for a later exercise. Signed-off-by: Simon Glass <sjg@chromium.org>
2014-07-22Add option -r to env import to allow import of text files with CRLF as line ↵Alexander Holler
endings When this option is enabled, CRLF is treated like LF when importing environments from text files, which means CRs ('\r') in front of LFs ('\n') are just ignored. Drawback of enabling this option is that (maybe exported) variables which have a trailing CR in their content will get imported without that CR. But this drawback is very unlikely and the big advantage of letting Windows user create a *working* uEnv.txt too is likely more welcome. Signed-off-by: Alexander Holler <holler@ahsoftware.de>
2014-07-22lib/time.c cleanupsPavel Machek
As I initially suspected overflow in time handling, I took a detailed look at lib/time.c. This adds comments about units being used, reduces amount of type casting being done, and makes __udelay() always wait at least one tick. (Current code could do no delaying at all for short delays). Signed-off-by: Pavel Machek <pavel@denx.de>
2014-07-18lib:vsprintf: reduce scope of pack_hex_byteJeroen Hofstee
pack_hex_byte is only used when CONFIG_CMD_NET is defined so limit it to that scope. This prevents a clang warning. Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
2014-07-18lib:sha1: remove unused constantJeroen Hofstee
This prevents a clang warning. Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
2014-07-18lib:lmb: use __weakJeroen Hofstee
This not only looks a bit better it also prevents a warning with W=1 (no previous prototype). Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
2014-07-18lib: div64: add missing includeJeroen Hofstee
Include the function its prototype to prevent the warning that it has no prototype. Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
2014-06-23lib, fdt: move fdtdec_get_int() out of lib/fdtdec.cHeiko Schocher
move fdtdec_get_int() out of lib/fdtdec.c into lib/fdtdec_common.c as this function is also used, if CONFIG_OF_CONTROL is not used. Poped up on the ids8313 board using signed FIT images, and activating CONFIG_SYS_GENERIC_BOARD. Without this patch it shows on boot: No valid FDT found - please append one to U-Boot binary, use u-boot-dtb.bin or define CONFIG_OF_EMBED. For sandbox, use -d <file.dtb> With this patch, it boots again with CONFIG_SYS_GENERIC_BOARD enabled. Signed-off-by: Heiko Schocher <hs@denx.de> Acked-by: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@ti.com>
2014-06-19includes: move openssl headers to include/u-bootJeroen Hofstee
commit 18b06652cd "tools: include u-boot version of sha256.h" unconditionally forced the sha256.h from u-boot to be used for tools instead of the host version. This is fragile though as it will also include the host version. Therefore move it to include/u-boot to join u-boot/md5.h etc which were renamed for the same reason. cc: Simon Glass <sjg@chromium.org> Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
2014-06-19mkimage: Automatically expand FDT in more casesSimon Glass
The original code did not cover every case and there was a missing negative sign in one case. Expand the coverage and fix the bug. Signed-off-by: Simon Glass <sjg@chromium.org>
2014-06-19libfdt: Fix segfault when calling fit_check_format() on corrupt FIT imagesJon Nalley
It has been observed that fit_check_format() will fail when passed a corrupt FIT image. This was tracked down to _fdt_string_eq(): return (strlen(p) == len) && (memcmp(p, s, len) == 0); In the case of a corrupt FIT image one can't depend on 'p' being NULL terminated. I changed it to use strnlen() to fix the issue. Signed-off-by: Tom Rini <trini@ti.com>
2014-06-11LzmaTools: don't self assign valuesJeroen Hofstee
It seems the code tries to trick the compiler the argument is actually used. However compilers became too smart to fool them so easily an now warn. Gcc and clang don't seem to emit a warning when the argument is unused. If so it should be decorated with unused / (void). Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
2014-06-11fdt: Update functions which write to an FDT to return -ENOSPCSimon Glass
When writing values into an FDT it is possible that there will be insufficient space. If the caller gets a useful error then it can potentially deal with the situation. Adjust these functions to return -ENOSPC when the FDT is full. Signed-off-by: Simon Glass <sjg@chromium.org>
2014-06-02Merge branch 'u-boot-samsung/master' into 'u-boot-arm/master'Albert ARIBAUD
2014-05-28initcall: Improve debugging supportSimon Glass
Add the ability to display the code offset of an initcall even after it is relocated. This makes it much easier to relate initcalls back to the U-Boot System.map file. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2014-05-28exynos: Enable the LCD backlight for snowSimon Glass
The backlight uses FETs on the TPS65090. Enable this so that the display is visible. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2014-05-28power: Add support for TPS65090 PMU chip.Tom Wai-Hong Tam
This adds driver support for the TPS65090 PMU. Support includes hooking into the pmic infrastructure so that the pmic commands can be used on the console. The TPS65090 supports the following functionality: - fet enable/disable/querying - getting and setting of charge state Even though it is connected to the pmic infrastructure it does not hook into the pmic charging charging infrastructure. The device tree binding is from Linux, but only a small subset of functionality is supported. Signed-off-by: Tom Wai-Hong Tam <waihong@chromium.org> Signed-off-by: Hatim Ali <hatim.rv@samsung.com> Signed-off-by: Katie Roberts-Hoffman <katierh@chromium.org> Signed-off-by: Rong Chang <rongchang@chromium.org> Signed-off-by: Sean Paul <seanpaul@chromium.org> Signed-off-by: Vincent Palatin <vpalatin@chromium.org> Signed-off-by: Aaron Durbin <adurbin@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2014-05-23eMMC: add support for operations in RPMB partitionPierre Aubert
This patch adds functions for read, write and authentication key programming for the Replay Protected Memory Block partition in the eMMC. Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com> Signed-off-by: Pierre Aubert <p.aubert@staubli.com>
2014-05-16ARM: dts: exynos: rename from EXYNOS5_DWMMC to EXYNOS_DWMMCJaehoon Chung
Exynos serise can be supported the dw-mmc controller. So, it's good that used the general prefix as "_EXYNOS_DWMMC". Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>