summaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* tegra: Add tegra keyboard driverRakesh Iyer2012-05-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Add support for internal matrix keyboard controller for Nvidia Tegra platforms. This driver uses the fdt decode function to obtain its key codes. Support for the Ctrl modifier is provided. The left and right ctrl keys are dealt with in the same way. This uses the new keyboard input library (drivers/input/input.c) to decode keys and handle most of the common input logic. The new key matrix library is also used to decode (row, column) key positions into key codes. The intent is to make this driver purely about dealing with the hardware. Key detection before the driver is loaded is supported. This key will be picked up when the keyboard driver is initialized. Modified by Bernie Thompson <bhthompson@chromium.org> and Simon Glass <sjg@chromium.org> for device tree, input layer, key matrix and various other things. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
* fdt: Add fdtdec functions to read byte arrayAnton Staff2012-05-151-0/+24
| | | | | | | | | Sometimes we don't need a full cell for each value. This provides a simple function to read a byte array, both with and without copying it. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
* tegra: Add EMC support for optimal memory timingsJimmy Zhang2012-05-151-0/+2
| | | | | | | | Add support for setting up the memory controller parameters. Boards can set up an appropriate table in the device tree. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
* Add AES crypto libraryYen Lin2012-05-152-0/+599
| | | | | | | | | | Add support for AES using an implementation from Karl Malbrain. This offers small code size (around 5KB on ARM) and supports 128-bit AES only. Signed-off-by: Yen Lin <yelin@nvidia.com> Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
* fdt: Add function to return next compatible subnodeSimon Glass2012-05-151-0/+15
| | | | | | | | We need to iterate through subnodes of a parent, looking only at compatible nodes. Add a utility function to do this for us. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
* fdt: Add function to locate an array in the device treeSimon Glass2012-05-151-0/+11
| | | | | | | | | | fdtdec_locate_array() locates an integer array but does not copy it. This saves the caller having to allocated wasted space. Access to array elements should be through the fdt32_to_cpu() macro. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
* gunzip: rename z{alloc, free} to gz{alloc, free}Mike Frysinger2012-04-301-7/+4
| | | | | | | This allows us to add a proper zalloc() func (one that does a zeroing alloc), and removes duplicate prototypes. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* GCC47: Fix warning in md5.cMarek Vasut2012-04-291-2/+2
| | | | | | | | | | md5.c: In function ‘MD5Final’: md5.c:156:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] md5.c:157:2: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] Signed-off-by: Marek Vasut <marex@denx.de> Cc: Wolfgang Denk <wd@denx.de> Acked-by: Mike Frysinger <vapier@gentoo.org>
* Move bootstage timer out of lib/time.cSimon Glass2012-04-101-17/+0
| | | | | | | | | | | | The standalone example does not have get_timer() defined, so we cannot rely on it being available. Move the timer function into boootstage.c to avoid this problem. This corrects a build breakage for the standalone example on some boards. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Matthias Fuchs <matthias.fuchs@esd.eu>
* Merge branch 'agust@denx.de' of git://git.denx.de/u-boot-stagingWolfgang Denk2012-03-301-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'agust@denx.de' of git://git.denx.de/u-boot-staging: lzma: fix printf warnings Remove CONFIG_SYS_EXTBDINFO from snapper9260.h cmd_pxe.c: fix strict-aliasing warnings net: smc91111: use mdelay() doc: Fix some typos in different files disk/part.c: Fix device enumeration through API mkenvimage: Really set the redundant byte when applicable mkenvimage: Don't try to detect comments in the input file mkenvimage: Use mmap() when reading from a regular file mkenvimage: Read/Write from/to stdin/out by default or if the filename is "-" mkenvimage: More error handling mkenvimage: Correct an include and add a missing one mkenvimage: correct and clarify comments and error messages MAKEALL: display SPL size if present ARMV7/Vexpress: add missing get_ticks() and get_tbclk() mkenvimage: fix usage message cmd_fat: add FAT write command fs/fat/fat_write.c: Fix GCC 4.6 warnings FAT write: Fix compile errors
| * lzma: fix printf warningsMike Frysinger2012-03-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Fix size_t printf format warnings: LzmaTools.c: In function 'lzmaBuffToBuffDecompress': LzmaTools.c:110:5: warning: format '%x' expects type 'unsigned int', but argument 2 has type 'SizeT' LzmaTools.c:111:5: warning: format '%x' expects type 'unsigned int', but argument 2 has type 'SizeT' Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* | tegra: i2c: Add I2C driverYen Lin2012-03-291-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Add basic i2c driver for Tegra2 with 8- and 16-bit address support. The driver requires CONFIG_OF_CONTROL to obtain its configuration from the device tree. (Simon Glass: sjg@chromium.org modified for upstream) Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de> Acked-by: Stephen Warren <swarren@wwwdotorg.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
* | fdt: Add function to allow aliases to refer to multiple nodesSimon Glass2012-03-291-4/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some devices can deal with multiple compatible properties. The devices need to know which nodes to bind to which features. For example an I2C driver which supports two different controller types will want to know which type it is dealing with in each case. The new fdtdec_add_aliases_for_id() function deals with this by allowing the driver to search for additional compatible nodes for a different ID. It can then detect the new ones and perform appropriate processing. Another option considered was to return a tuple (node offset, compat id) and have the function be passed a list of compatible IDs. This is more overhead for the common case though. We may add such a function later if more drivers in U-Boot require it. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
* | fdt: Avoid early panic() when there is no FDT presentSimon Glass2012-03-291-5/+19
| | | | | | | | | | | | | | | | | | | | | | | | CONFIG_OF_CONTROL requires a valid device tree. However, we cannot call panic() before the console is set up since the message does not appear, and we get a silent failure. Remove the panic from fdtdec_check_fdt() and provide a new function to prepare the fdt for use. This will be called after the console is ready. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
* | tegra: usb: Add support for Tegra USB peripheralSimon Glass2012-03-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds basic support for the Tegra2 USB controller. Board files should call board_usb_init() to set things up. Configuration is performed through the FDT, with aliases used to set the order of the ports, like this fragment: aliases { /* This defines the order of our USB ports */ usb0 = "/usb@0xc5008000"; usb1 = "/usb@0xc5000000"; }; drivers/usb/host files ONLY: Acked-by: Remy Bohmer <linux@bohmer.net> Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
* | fdt: Add basic support for decoding GPIO definitionsSimon Glass2012-03-291-0/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds some support into fdtdec for reading GPIO definitions from the fdt. We permit up to FDT_GPIO_MAX GPIOs in the system. Each GPIO is of the form: gpio-function-name = <phandle gpio_num flags>; where: phandle is a pointer to the GPIO node gpio_num is the number of the GPIO (0 to 223) flags is a flag, as follows: bit meaning 0 0=polarity normal, 1=active low (inverted) An example is: enable-propounder-gpios = <&gpio 43 0>; which means that GPIO 43 is used to enable the propounder (setting the GPIO high), or that you can detect that the propounder is enabled by checking if the GPIO is high (the fdt does not indicate input/output). Two main functions are provided: fdtdec_decode_gpio() reads a GPIO property from an fdt node and decodes it into a structure. fdtdec_setup_gpio() sets up the GPIO by calling gpio_request for you. Both functions can cope with the property being missing, which is taken to mean that that GPIO function is not available or is not needed. [For reference, from Stephen Warren <swarren@nvidia.com>. It may be that we add this extra complexity later if needed: The correct way to parse such a GPIO property in general is: * Read the first cell. * Find the node referenced by the phandle (the controller). * Ensure property gpio-controller is present in the controller node. * Read property #gpio-cells from the controller node. * Extract #gpio-cells from the original property. * Keep processing more cells from the original property; there may be multiple GPIOs listed. According to the binding documentation in the Linux kernel, Samsung Exynos4 doesn't use this format, and while all other chips do have a flags cell, about 50% of the controllers indicate the cell is unused. ] Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
* | fdt: Add functions to access phandles, arrays and boolsSimon Glass2012-03-291-0/+67
| | | | | | | | | | | | | | | | | | | | | | | | Add a function to look up a property which is a phandle in a node, and another to read a fixed-length integer array from an fdt property. Also add a function to read boolean properties, although there is no actual boolean type in U-Boot. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Gerald Van Baren <vanbaren@cideas.com> Acked-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Tom Warren <twarren@nvidia.com>
* | fdt: Tidy up a few fdtdec problemsSimon Glass2012-03-291-6/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes five trivial issues in fdtdec.c: 1. fdtdec_get_is_enabled() doesn't really need a default value 2. The fdt must be word-aligned, since otherwise it will fail on ARM 3. The compat_names[] array is missing its first element. This is needed only because the first fdt_compat_id is defined to be invalid. 4. Added a header prototype for fdtdec_next_compatible() 5. Change fdtdec_next_alias() to only increment its 'upto' parameter on success, to make the display error messages in the caller easier. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Gerald Van Baren <vanbaren@cideas.com> Acked-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Tom Warren <twarren@nvidia.com>
* | fdt: Add tests for fdtdecSimon Glass2012-03-292-0/+227
| | | | | | | | | | | | | | | | | | | | | | | | The fdtdec_find_aliases_for_id() function is complicated enough that it really should have some tests. This does not necessarily need to be committed to U-Boot, but it might be useful. (note there are a few minor inconsistencies with this patch which will be cleaned up when the USB series is applied) Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
* | fdt: Add fdtdec_find_aliases() to deal with alias nodesSimon Glass2012-03-291-0/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Stephen Warren pointed out that we should use nodes whether or not they have an alias in the /aliases section. The aliases section specifies the order so far as it can, but is not essential. Operating without alisses is useful when the enumerated order of nodes does not matter (admittedly rare in U-Boot). This is considerably more complex, and it is important to keep this complexity out of driver code. This patch creates a function fdtdec_find_aliases() which returns an ordered list of node offsets for a particular compatible ID, taking account of alias nodes. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
* | SPL: Add YMODEM over UART load supportMatt Porter2012-03-261-0/+3
|/ | | | | | | | | | Adds support for loading U-Boot from UART using YMODEM protocol. If YMODEM support is enabled in SPL and the romcode indicates that SPL loaded via UART then SPL will wait for start of a YMODEM transfer via the console port. Signed-off-by: Matt Porter <mporter@ti.com> Signed-off-by: Tom Rini <trini@ti.com>
* bootstage: Define an optional microsecond timerSimon Glass2012-03-181-0/+17
| | | | | | | | | | | | Define timer_get_boot_us() which returns the number of microseconds since boot. If undefined then we use get_timer() * 1000. We can fit this in a 32-bit register which keeps everyone happy on the efficiency side. It will wrap around after about an hour. If we are still looking at it after an hour then we had better not be timing the boot. Signed-off-by: Simon Glass <sjg@chromium.org>
* nand: Sanitize ONFI strings.Christian Hitz2012-01-261-0/+39
| | | | | | | | | | | [backport from linux commit 02f8c6aee8df3cdc935e9bdd4f2d020306035dbe] This is part of the synchronization with the nand driver to the Linux 3.0 state. Signed-off-by: Christian Hitz <christian.hitz@aizo.com> Cc: Scott Wood <scottwood@freescale.com> Signed-off-by: Scott Wood <scottwood@freescale.com>
* nand: Merge BCH code from Linux nand driverChristian Hitz2012-01-262-0/+1359
| | | | | | | | | | | | [backport from linux commit 02f8c6aee8df3cdc935e9bdd4f2d020306035dbe] This patch merges the BCH ECC algorithm from the 3.0 Linux kernel. This enables U-Boot to support modern NAND flash chips that require more than 1-bit of ECC in software. Signed-off-by: Christian Hitz <christian.hitz@aizo.com> Cc: Scott Wood <scottwood@freescale.com> Signed-off-by: Scott Wood <scottwood@freescale.com>
* spl: display_options.o is required for SPI flash support in SPLChristian Riesch2011-12-241-0/+2
| | | | | | Signed-off-by: Christian Riesch <christian.riesch@omicron.at> Cc: Heiko Schocher <hs@denx.de> Cc: Mike Frysinger <vapier@gentoo.org>
* vsprintf: Move function documentation into header fileSimon Glass2011-12-171-100/+0
| | | | | | | Now that this is not in common.h, perhaps it is acceptable to move this documentation into the header file. Signed-off-by: Simon Glass <sjg@chromium.org>
* Add safe vsnprintf and snprintf library functionsSonny Rao2011-12-171-52/+213
| | | | | | | | | | | | | | | | From: Sonny Rao <sonnyrao@chromium.org> These functions are useful in U-Boot because they allow a graceful failure rather than an unpredictable stack overflow when printf() buffers are exceeded. Mostly copied from the Linux kernel. I copied vscnprintf and scnprintf so we can change printf and vprintf to use the safe implementation but still return the correct values. (Simon Glass <sjg@chromium.org> modified this commit a little) Signed-off-by: Sonny Rao <sonnyrao@chromium.org>
* Include common.h in qsort.c to fix build warningSimon Glass2011-12-071-0/+1
| | | | | | | | | | | | exports.h no longer includes common.h, which contains assert(). qsort.c needs to be updated. This fixes this warning: qsort.c: In function 'qsort': qsort.c:30:3: warning: implicit declaration of function 'assert' [-Wimplicit-function-declaration] Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Kumar Gala <galak@kernel.crashing.org> Tested-by: Heiko Schocher <hs@denx.de>
* sandbox: Fix warnings in hashtable.cSimon Glass2011-11-221-5/+5
| | | | | | | | This fixes a few printf() strings for size_t which are missing the 'z' modifier. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
* env: allow to export only selected variablesWolfgang Denk2011-11-081-2/+13
| | | | | | | | | | | | | | New syntax: env export [-t | -b | -c] [-s size] addr [var ...] With this change it is possible to provide a list of variables names that shall be exported. Whenno arguments are given, the whole environment gets exported. NOTE: The new handling of the "size" argument means a change to the user API. Signed-off-by: Wolfgang Denk <wd@denx.de>
* zlib: Fix integer cast of pointerSimon Glass2011-10-281-1/+1
| | | | | | Fix to cast an integer to a pointer using uintptr_t. Signed-off-by: Simon Glass <sjg@chromium.org>
* GCC4.6: Squash warnings in LzmaTools.cMarek Vasut2011-10-271-7/+7
| | | | | | | | | | | | | | | | | | | | | | | LzmaTools.c: In function 'lzmaBuffToBuffDecompress': LzmaTools.c:70:5: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'unsigned char *' LzmaTools.c:71:5: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'unsigned char *' LzmaTools.c:72:5: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'unsigned char *' LzmaTools.c:73:5: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'unsigned char *' LzmaTools.c:74:5: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'unsigned char *' LzmaTools.c:110:5: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'SizeT' LzmaTools.c:111:5: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'SizeT' Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Cc: Wolfgang Denk <wd@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Mike Frysinger <vapier@gentoo.org>
* fdt: add decode helper librarySimon Glass2011-10-262-0/+148
| | | | | | | | | | | | | | | | | | This library provides useful functions to drivers which want to use the fdt to control their operation. Functions are provided to: - look up and enumerate a device type (for example assigning i2c bus 0, i2c bus 1, etc.) - decode basic types from the fdt, like addresses and integers While this library is not strictly necessary, it helps to minimise the changes to a driver, in order to make it work under fdt control. Less code is required, and so the barrier to switch drivers over is lower. Additional functions to read arrays and GPIOs could be made available here also. Signed-off-by: Simon Glass <sjg@chromium.org>
* Move simple_itoa to vsprintfSimon Glass2011-10-261-0/+16
| | | | | | | 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>
* consolidate mdelay by providing a common function for all usersAnatolij Gustschin2011-10-221-0/+6
| | | | | | | | | 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>
* lib: add uuid_str_to_bin for use with bootp and PXE uuidJason Hobbs2011-10-172-0/+86
| | | | Signed-off-by: Jason Hobbs <jason.hobbs@calxeda.com>
* Replace space and tab checks with isblankJason Hobbs2011-10-171-1/+3
| | | | | | | These are various places I found that checked for conditions equivalent to isblank. Signed-off-by: Jason Hobbs <jason.hobbs@calxeda.com>
* zlib: handle overflow while calculating available stream input sizeAnatolij Gustschin2011-10-171-0/+8
| | | | | | | | | | | | | | | | | | | | | If compressed data is located in sectors at the end of the flash and it's offset + input stream size > 0xFFFFFFFF, the uncompressing time is very long, since processing of the stream is done bytewise (and not blockwise) due to overflow in inflate_fast() while calculation and checking for enough input available. Check for this overflow condition and limit the available stream input size to the actually max. possible input size. This fixes the problem. The issue is easily reproduceable by placing a gziped bitmap in flash, e.g. at FFF80000, and running 'bmp' commands like 'bmp info FFF80000' or 'bmp display FFF80000'. The uncompressing can take up to 3 sec. whereas it should normaly take a fraction of a second. If the 'splashimage' environment variable points to this address, the booting time also increases significantly. Signed-off-by: Anatolij Gustschin <agust@denx.de>
* GCC4.6: Squash warning in lzo1x_decompress.cMarek Vasut2011-10-011-2/+1
| | | | | | | | | lzo1x_decompress.c: In function ‘parse_header’: lzo1x_decompress.c:35:5: warning: variable ‘level’ set but not used [-Wunused-but-set-variable] Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Acked-by: Mike Frysinger <vapier@gentoo.org>
* Add assert() for debug assertionsSimon Glass2011-09-102-5/+8
| | | | | | | | | | | | | | | 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>
* Convert ISO-8859 files to UTF-8Albert ARIBAUD2011-08-041-1/+1
| | | | | | | | There was a mix of UTF-8 and ISO-8859 files in the U-Boot source tree, which could cause issues with the patchwork review system. This commit converts all ISO-8859 files to UTF-8. Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
* Constify getenv(), setenv() and hash code functionsWolfgang Denk2011-07-301-3/+3
| | | | | | | | | | | 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>
* panic: remove warning "'noreturn' function does return"Heiko Schocher2011-07-281-0/+2
| | | | | | | | | | | | | | | | | | | | since commit commit d2e8b911c0a0661d395ccac72156040702ac842d Author: Mike Frysinger <vapier@gentoo.org> Date: Wed Jun 29 11:58:04 2011 +0000 panic: add noreturn attribute I see the following warnings: vsprintf.c: In function 'panic': vsprintf.c:730: warning: 'noreturn' function does return for nearly all boards. This patch fixes this warning. Signed-off-by: Heiko Schocher <hs@denx.de> cc: Mike Frysinger <vapier@gentoo.org>
* unify version_stringAndreas Bießmann2011-07-281-2/+1
| | | | | | | | | | | | This patch removes the architecture specific implementation of version_string where possible. Some architectures use a special place and therefore we provide U_BOOT_VERSION_STRING definition and a common weak symbol version_string. Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com> CC: Mike Frysinger <vapier@gentoo.org> CC: Peter Pan <pppeterpppan@gmail.com> Acked-by: Mike Frysinger <vapier@gentoo.org>
* scaled down version of generic libraries for SPLAneesh V2011-07-261-4/+7
| | | | Signed-off-by: Aneesh V <aneesh@ti.com>
* memcpy/memmove: Do not copy to same addressMatthias Weisser2011-07-261-0/+6
| | | | | | | | In some cases (e.g. bootm with a elf payload which is already at the right position) there is a in place copy of data to the same address. Catching this saves some ms while booting. Signed-off-by: Matthias Weisser <weisserm@arcor.de>
* libfdt: Implement property iteration functionsDavid Gibson2011-07-143-36/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | For ages, we've been talking about adding functions to libfdt to allow iteration through properties. So, finally, here are some. I got bogged down on this for a long time because I didn't want to expose offsets directly to properties to the callers. But without that, attempting to make reasonable iteration functions just became horrible. So eventually, I settled on an interface which does now expose property offsets. fdt_first_property_offset() and fdt_next_property_offset() are used to step through the offsets of the properties starting from a particularly node offset. The details of the property at each offset can then be retrieved with either fdt_get_property_by_offset() or fdt_getprop_by_offset() which have interfaces similar to fdt_get_property() and fdt_getprop() respectively. No explicit testcases are included, but we do use the new functions to reimplement the existing fdt_get_property() function. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> This was extracted from the DTC commit: 73dca9ae0b9abe6924ba640164ecce9f8df69c5a Mon Sep 17 00:00:00 2001 Signed-off-by: Gerald Van Baren <vanbaren@cideas.com>
* Support ePAPR compliant phandle propertiesDavid Gibson2011-07-141-6/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the Linux kernel, libfdt and dtc, when using flattened device trees encode a node's phandle into a property named "linux,phandle". The ePAPR specification, however - aiming as it is to not be a Linux specific spec - requires that phandles be encoded in a property named simply "phandle". This patch adds support for this newer approach to dtc and libfdt. Specifically: - fdt_get_phandle() will now return the correct phandle if it is supplied in either of these properties - fdt_node_offset_by_phandle() will correctly find a node with the given phandle encoded in either property. - By default, when auto-generating phandles, dtc will encode it into both properties for maximum compatibility. A new -H option allows either only old-style or only new-style properties to be generated. - If phandle properties are explicitly supplied in the dts file, dtc will not auto-generate ones in the alternate format. - If both properties are supplied, dtc will check that they have the same value. - Some existing testcases are updated to use a mix of old and new-style phandles, partially testing the changes. - A new phandle_format test further tests the libfdt support, and the -H option. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> This was extracted from the DTC commit: d75b33af676d0beac8398651a7f09037555a550b Mon Sep 17 00:00:00 2001 Signed-off-by: Gerald Van Baren <vanbaren@cideas.com>
* lib, vsprintf: introduce strict_strtoulHeiko Schocher2011-05-121-0/+51
| | | | | | | | | | | | | | | 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>
* zlib: fix DEBUG buildMike Frysinger2011-05-121-1/+2
| | | | | | | | The previous commit imported a little too much from upstream. We need to disable stdio.h when using U-Boot. Reported-by: Wolfgang Denk <wd@denx.de> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
OpenPOWER on IntegriCloud