summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeLines
* Add crc8 routineSimon Glass2014-01-08-0/+26
| | | | | | | | | | Add an implementation of the CRC8 algorithm. This is required by the TPM emulation, but is probably useful to U-Boot in general. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* time: fix usec_to_tick()Stephen Warren2013-12-13-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 8dfafdde88eb ("Introduce common timer functions") created a common definition of usec_to_tick() which had a couple problems: static unsigned long long usec_to_tick(unsigned long usec) { uint64_t tick = usec * get_tbclk(); That likely overflows. usec *= get_tbclk(); That was an attempt to fix it by performing the multiply after the promotion of usec to 64-bit, but was applied to the wrong variable, which was never used. This patch fixes these issues. A user-visible symptom of the problem was the e.g. "dhcp zImage" using an ASIX USB Ethernet dongle would print: Waiting for Ethernet connection... unable to connect. ... with no delay before "unable to connect". There are likely other symptoms. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Rob Herring <rob.herring@calxeda.com>
* Merge branch 'sandbox1' of http://git.denx.de/u-boot-x86Tom Rini2013-11-25-4/+4
|\
| * sandbox: Correct data sizes and printf() strings in fdtdec.cSimon Glass2013-11-21-4/+4
| | | | | | | | | | | | | | | | | | | | There are a few wwrnings in this file when building for sandbox. Addresses coming from the device tree need to be treated as ulong as elsewhere in U-Boot and we must use map_sysmem() to convert to a pointer when needed. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Hung-ying Tyan <tyanh@chromium.org>
* | Makefile: move some libraries to lib/MakefileMasahiro Yamada2013-11-25-0/+7
|/ | | | Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
* lib: descend into sub directories only when it is necessaryMasahiro Yamada2013-11-17-6/+4
| | | | Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
* time: fix gcc warnings on MIPS64Daniel Schwierzeck2013-11-11-2/+2
| | | | | | | | | | | | | | | | | | Commit 8dfafdde88eb3e71d5569846396ae67a91017232 introduced new gcc warnings on MIPS64: time.c: In function 'tick_to_time': time.c:59:2: warning: comparison of distinct pointer types lacks a cast [enabled by default] time.c:59:2: warning: passing argument 1 of '__div64_32' from incompatible pointer type [enabled by default] In file included from time.c:10:0: ./u-boot-mips/include/div64.h:22:17: note: expected 'uint64_t *' but argument is of type 'long long unsigned int *' time.c: In function 'usec_to_tick': time.c:76:2: warning: comparison of distinct pointer types lacks a cast [enabled by default] time.c:76:2: warning: passing argument 1 of '__div64_32' from incompatible pointer type [enabled by default] In file included from time.c:10:0: ./u-boot-mips/include/div64.h:22:17: note: expected 'uint64_t *' but argument is of type 'long long unsigned int *' Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
* time: add weak annotation to timer_read_counter declarationRob Herring2013-11-08-1/+1
| | | | | | | A weak annotation is needed in order to prevent link errors when get_ticks is overridden. This fixes sandbox build. Signed-off-by: Rob Herring <rob.herring@calxeda.com>
* env: fix the env export varnamePierre Aubert2013-11-08-1/+1
| | | | | | | | The env export command doesn't export the first variable of the list since commit 5a31ea04c9ee5544fbb70ad7597ea4b294840eab "env grep" - reimplement command using hexport_r() Signed-off-by: Pierre Aubert <p.aubert@staubli.com>
* Introduce common timer functionsRob Herring2013-11-04-0/+73
| | | | | | | | | | | | | | | Many platforms duplicate pretty much the same timer code yet they all have a 32-bit freerunning counter register. Create a common implementation that minimally requires 2 or 3 defines to add timer support: CONFIG_SYS_TIMER_RATE - Clock rate of the timer counter CONFIG_SYS_TIMER_COUNTER - Address of 32-bit counter CONFIG_SYS_TIMER_COUNTS_DOWN - Define if counter counts down All functions are weak or ifdef'ed so they can still be overriden by any platform. Signed-off-by: Rob Herring <rob.herring@calxeda.com>
* config: consolidate CONFIG_SYS_HZ definitionRob Herring2013-11-04-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | According to the README, CONFIG_SYS_HZ must be 1000 and most platforms follow that. In preparation to remove CONFIG_SYS_HZ from all these platforms, provide a common definition. The platforms which use a value other than 1000 will get build warning now. These configs are: include/configs/M5271EVB.h:#define CONFIG_SYS_HZ 1000000 include/configs/balloon3.h:#define CONFIG_SYS_HZ 3250000 /* Timer @ 3250000 Hz */ include/configs/idmr.h:#define CONFIG_SYS_HZ (50000000 / 64) include/configs/mini2440.h:#define CONFIG_SYS_HZ 1562500 include/configs/mx1ads.h:#define CONFIG_SYS_HZ 3686400 include/configs/omap3_zoom2.h:#define CONFIG_SYS_HZ ((V_SCLK) / (2 << CONFIG_SYS_PTV)) include/configs/omap730p2.h:#define CONFIG_SYS_HZ ((CONFIG_SYS_CLK_FREQ)/(2 << CONFIG_SYS_PTV)) include/configs/palmld.h:#define CONFIG_SYS_HZ 3250000 /* Timer @ 3250000 Hz */ include/configs/palmtc.h:#define CONFIG_SYS_HZ 3686400 /* Timer @ 3686400 Hz */ include/configs/rsk7203.h:#define CONFIG_SYS_HZ (CONFIG_SYS_CLK_FREQ / CMT_CLK_DIVIDER) include/configs/rsk7264.h:#define CONFIG_SYS_HZ (CONFIG_SYS_CLK_FREQ / CMT_CLK_DIVIDER) include/configs/rsk7269.h:#define CONFIG_SYS_HZ (CONFIG_SYS_CLK_FREQ / CMT_CLK_DIVIDER) include/configs/scb9328.h:#define CONFIG_SYS_HZ 3686400 /* incrementer freq: 3.6864 MHz */ include/configs/versatile.h:#define CONFIG_SYS_HZ (1000000 / 256) include/configs/zipitz2.h:#define CONFIG_SYS_HZ 3250000 /* Timer @ 3250000 Hz */ Signed-off-by: Rob Herring <rob.herring@calxeda.com>
* lib: convert makefiles to Kbuild styleMasahiro Yamada2013-10-31-203/+54
| | | | Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
* exynos5: dts: Add COMPAT string data for USB 3.0 PHY and XHCIVivek Gautam2013-10-20-0/+2
| | | | | | | | | | | | | Adding required compatible string for xHCI host controller as well as USB 3.0 PHY to enable dt support for usb 3.0 on exynos5. Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com> Cc: Julius Werner <jwerner@chromium.org> Cc: Simon Glass <sjg@chromium.org> Cc: Minkyu Kang <mk7.kang@samsung.com> Cc: Dan Murphy <dmurphy@ti.com> Cc: Marek Vasut <marex@denx.de>
* Coding Style cleanup: remove trailing empty linesWolfgang Denk2013-10-14-2/+0
| | | | Signed-off-by: Wolfgang Denk <wd@denx.de>
* Coding Style cleanup: remove trailing white spaceWolfgang Denk2013-10-14-1/+1
| | | | Signed-off-by: Wolfgang Denk <wd@denx.de>
* Cosmetic: Fix a number of typos, no functional changes.Robert P. J. Day2013-09-20-1/+1
| | | | | | | Fix various misspellings of things like "environment", "kernel", "default" and "volatile", and throw in a couple grammar fixes. Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
* lzo: correctly bounds-check output bufferKees Cook2013-09-03-1/+7
| | | | | | | | This checks the size of the output buffer and fails if it was going to overflow the buffer during lzo decompression. Signed-off-by: Kees Cook <keescook@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
* lzma: correctly bounds-check output bufferKees Cook2013-09-03-2/+6
| | | | | | | | | | The output buffer size must be correctly passed to the lzma decoder or there is a risk of overflowing memory during decompression. Switching to the LZMA_FINISH_END mode means nothing is left in an unknown state once the buffer becomes full. Signed-off-by: Kees Cook <keescook@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
* gzip: correctly bounds-check output bufferKees Cook2013-09-03-2/+2
| | | | | | | | The output buffer size must not be reset by the gzip decoder or there is a risk of overflowing memory during decompression. Signed-off-by: Kees Cook <keescook@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
* libfdt: SPDX-License-Identifier: GPL-2.0+ BSD-2-ClauseRoger Meier2013-08-10-368/+8
| | | | | Signed-off-by: Roger Meier <roger@bufferoverflow.ch> Acked-by: Wolfgang Denk <wd@denx.de>
* Merge branch 'master' of git://git.denx.de/u-boot-i2cTom Rini2013-07-24-0/+1
|\ | | | | | | | | | | | | | | | | | | | | The sandburst-specific i2c drivers have been deleted, conflict was just over the SPDX conversion. Conflicts: board/sandburst/common/ppc440gx_i2c.c board/sandburst/common/ppc440gx_i2c.h Signed-off-by: Tom Rini <trini@ti.com>
| * fdtdec: Add compatible string for High speed i2cnaveen krishna chatradhi2013-07-23-0/+1
| | | | | | | | | | | | | | Adds a new COMPAT string exynos5-hsi2c for high speed i2c controller available on exynos5 SoCs from Samsung. Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
* | Add eCos-2.0 SPDX-License-Identifier to source filesWolfgang Denk2013-07-24-33/+1
| | | | | | | | Signed-off-by: Wolfgang Denk <wd@denx.de>
* | Add LGPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk2013-07-24-14/+2
| | | | | | | | Signed-off-by: Wolfgang Denk <wd@denx.de>
* | Add LGPL-2.1+ SPDX-License-Identifier to source filesWolfgang Denk2013-07-24-14/+1
| | | | | | | | Signed-off-by: Wolfgang Denk <wd@denx.de>
* | Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk2013-07-24-545/+36
|/ | | | | | Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
* tpm: add AUTH1 cmds for LoadKey2 and GetPubKeyReinhard Pfau2013-07-16-1/+350
| | | | | | | | | | | | | | | | | | | | | | Extend the tpm library with support for single authorized (AUTH1) commands as specified in the TCG Main Specification 1.2. (The internally used helper functions are implemented in a way that they could also be used for double authorized commands if someone needs it.) Provide enums with the return codes from the TCG Main specification. For now only a single OIAP session is supported. OIAP authorized version of the commands TPM_LoadKey2 and TPM_GetPubKey are provided. Both features are available using the 'tpm' command, too. Authorized commands are enabled with CONFIG_TPM_AUTH_SESSIONS. (Note that this also requires CONFIG_SHA1 to be enabled.) Signed-off-by: Reinhard Pfau <reinhard.pfau@gdsys.cc> Signed-off-by: Dirk Eibach <dirk.eibach@gdsys.cc> Acked-by: Che-Liang Chiou <clchiou@chromium.org> Signed-off-by: Andy Fleming <afleming@freescale.com>
* Merge branch 'master' of git://git.denx.de/u-boot-armTom Rini2013-07-12-0/+3
|\ | | | | | | | | | | | | | | | | | | Fix a trivial conflict in arch/arm/dts/exynos5250.dtsi about gpio and serial. Conflicts: arch/arm/dts/exynos5250.dtsi Signed-off-by: Tom Rini <trini@ti.com>
| * ARM: Tegra: USB: EHCI: Add support for Tegra30/Tegra114Jim Lin2013-07-11-0/+2
| | | | | | | | | | | | | | | | | | | | Tegra30 and Tegra114 are compatible except PLL parameters. Tested on Tegra30 Cardhu, and Tegra114 Dalmore platforms. All works well. Signed-off-by: Jim Lin <jilin@nvidia.com> Signed-off-by: Tom Warren <twarren@nvidia.com>
| * EXYNOS5: FDT: Add compatible strings for SerialRajeshwari Shinde2013-06-24-0/+1
| | | | | | | | | | | | | | | | Add required compatible information for s5p serial driver Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com> Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
* | lib/rsa/rsa-sig.c: compile on OS XAndreas Bießmann2013-07-03-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Interfaces exposed by error.h seems not to be used in rsa-sig.c, remove it. This also fixes an compile error on OS X: ---8<--- u-boot/lib/rsa/rsa-sign.c:23:19: error: error.h: No such file or directory --->8--- Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com> Acked-by: Jeroen Hofstee <jeroen@myspectrum.nl> Tested-by: Lubomir Popov <lpopov@mm-sol.com>
* | libfdt: Add fdt_find_regions()Simon Glass2013-06-26-0/+129
| | | | | | | | | | | | | | | | | | Add a function to find regions in device tree given a list of nodes to include and properties to exclude. See the header file for full documentation. Signed-off-by: Simon Glass <sjg@chromium.org>
* | image: Add RSA support for image signingSimon Glass2013-06-26-0/+893
| | | | | | | | | | | | | | | | | | | | | | | | | | | | RSA provides a public key encryption facility which is ideal for image signing and verification. Images are signed using a private key by mkimage. Then at run-time, the images are verified using a private key. This implementation uses openssl for the host part (mkimage). To avoid bringing large libraries into the U-Boot binary, the RSA public key is encoded using a simple numeric representation in the device tree. Signed-off-by: Simon Glass <sjg@chromium.org>
* | Add trace librarySimon Glass2013-06-26-0/+380
| | | | | | | | | | | | | | | | | | Add a library which supports tracing of execution using built-in gcc features and a microsecond timer. This can be used to record a list of function which are executed, along with a timestamp for each. Later this information can be sent to the host for processing. Signed-off-by: Simon Glass <sjg@chromium.org>
* | Add function to print a number with grouped digitsSimon Glass2013-06-26-0/+16
| | | | | | | | | | | | | | Move bootstage's numbering printing code into a generic place so that it can be used by tracing also. Signed-off-by: Simon Glass <sjg@chromium.org>
* | cros: adds cros_ec keyboard driverHung-ying Tyan2013-06-26-0/+1
| | | | | | | | | | | | | | | | | | | | This patch adds the driver for keyboard that's controlled by ChromeOS EC. Signed-off-by: Randall Spangler <rspangler@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Vincent Palatin <vpalatin@chromium.org> Signed-off-by: Hung-ying Tyan <tyanh@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
* | cros: add cros_ec driverHung-ying Tyan2013-06-26-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the cros_ec driver that implements the protocol for communicating with Google's ChromeOS embedded controller. Signed-off-by: Bernie Thompson <bhthompson@chromium.org> Signed-off-by: Bill Richardson <wfrichar@chromium.org> Signed-off-by: Che-Liang Chiou <clchiou@chromium.org> Signed-off-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Gabe Black <gabeblack@chromium.org> Signed-off-by: Hung-ying Tyan <tyanh@chromium.org> Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org> Signed-off-by: Randall Spangler <rspangler@chromium.org> Signed-off-by: Sean Paul <seanpaul@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Vincent Palatin <vpalatin@chromium.org> Acked-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
* | Merge branch 'master' of git://git.denx.de/u-boot-armTom Rini2013-06-22-0/+1
|\ \ | |/
| * Merge branch 'u-boot-samsung/master' into 'u-boot-arm/master'Albert ARIBAUD2013-06-19-0/+1
| |\ | | | | | | | | | | | | Conflicts: spl/Makefile
| | * FDT: Add compatible string for DWMMCAmar2013-06-13-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add required compatible information for DWMMC driver. Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com> Signed-off-by: Amar <amarendra.xt@samsung.com> Acked-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
* | | Makefile: move the common makefile line to public areaYing Zhang2013-06-20-10/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the common makefile line shared by the SPL and non-SPL to the public area, so that we can avoid excessive SPL symbols. Some of them will be used by the SPL later. This patch is on top of the patch "common/Makefile: Add new symbol CONFIG_SPL_ENV_SUPPORT for environment in SPL". Signed-off-by: Ying Zhang <b40530@freescale.com> Acked-by: Tom Rini <trini@ti.com> Acked-by: Tom Rini <trini@ti.com> Signed-off-by: Andy Fleming <afleming@freescale.com>
* | | tpm: Add support for new Infineon I2C TPM (SLB 9645 TT 1.2 I2C)Vincent Palatin2013-06-03-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for Infineon's new SLB 9645 TT 1.2 I2C TPMs, which supports clockstretching, combined reads and a bus speed of up to 400khz. The device also has a new device id. This is based on the kernel patch provided by Infineon : https://gerrit.chromium.org/gerrit/42332 Signed-off-by: Vincent Palatin <vpalatin@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Luigi Semenzato <semenzato@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Tested-by: Tom Wai-Hong Tam <waihong@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* | | Merge branch 'master' of git://git.denx.de/u-boot-nand-flashTom Rini2013-05-31-0/+59
|\ \ \ | |/ / |/| |
| * | mtd: resync with Linux-3.7.1Sergey Lapin2013-05-31-0/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | | Merge branch 'u-boot/master' into 'u-boot-arm/master'Albert ARIBAUD2013-05-30-3/+36
|\ \ \ | |/ / | | / | |/ |/| | | Conflicts: common/cmd_fpga.c drivers/usb/host/ohci-at91.c
| * libfdt: Add fdt_next_subnode() to permit easy subnode iterationSimon Glass2013-05-14-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Iterating through subnodes with libfdt is a little painful to write as we need something like this: for (depth = 0, count = 0, offset = fdt_next_node(fdt, parent_offset, &depth); (offset >= 0) && (depth > 0); offset = fdt_next_node(fdt, offset, &depth)) { if (depth == 1) { /* code body */ } } Using fdt_next_subnode() we can instead write this, which is shorter and easier to get right: for (offset = fdt_first_subnode(fdt, parent_offset); offset >= 0; offset = fdt_next_subnode(fdt, offset)) { /* code body */ } Also, it doesn't require two levels of indentation for the loop body. Signed-off-by: Simon Glass <sjg@chromium.org> (Cherry-picked from dtc commit 4e76ec79) Acked-by: Gerald Van Baren <vanbaren@cideas.com>
| * Export fdt_stringlist_contains()Simon Glass2013-05-10-3/+2
| | | | | | | | | | | | | | | | | | This function is useful outside libfdt, so export it. Ref: DTC commit b7aa300e Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: David Gibson <david@gibson.dropbear.id.au>
| * env: throw an error when an empty key is usedLucian Cojocar2013-05-09-0/+6
| | | | | | | | | | | | | | | | If the environment contains an entry like "=value" "\0" we should throw an error when parsing the environment. Otherwise, U-Boot will enter in an infinite loop. Signed-off-by: Lucian Cojocar <cojocar@gmail.com>
* | lib: import bitrev library from the linux kernelMike Dunn2013-05-05-0/+60
|/ | | | | | | | | | | This patch adds the bitrev library from the linux kernel. This is a simple algorithm that uses an 8 bit look-up table to reverse the bits in data types of 8, 16, or 32 bit widths. The docg4 nand flash driver uses it. [port from linux kernel v3.9 commit 7ee32a6d30d1c8a3b7a07a6269da8f0a08662927] [originally added: v2.6.20 by commit a5cfc1ec58a07074dacb6aa8c79eff864c966d12] Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
* lib: consolidate hang()Andreas Bießmann2013-05-01-0/+48
| | | | | | | | | Delete all occurrences of hang() and provide a generic function. Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com> Acked-by: Albert ARIBAUD <albert.u.boot@aribaud.net> [trini: Modify check around puts() in hang.c slightly] Signed-off-by: Tom Rini <trini@ti.com>