summaryrefslogtreecommitdiffstats
path: root/lib/fdtdec.c
Commit message (Collapse)AuthorAgeFilesLines
...
* | | sf: Enable FDT-based configuration and memory mappingSimon Glass2013-03-191-0/+1
| | | | | | | | | | | | | | | | | | | | | Enable device tree control of SPI flash, and use this to implement memory-mapped SPI flash, which is supported on Intel chips. Signed-off-by: Simon Glass <sjg@chromium.org>
* | | fdt: Add fdtdec_get_addr_size() to read reg propertiesSimon Glass2013-03-191-6/+21
|/ / | | | | | | | | | | | | | | It is common to have a "reg = <address size>" property in the FDT. Add a function to handle this, similar to the existing fdtdec_get_addr(); Signed-off-by: Simon Glass <sjg@chromium.org>
* | Tegra30: mmc: Add Tegra30 SDMMC compatible entry to fdtdec & driverTom Warren2013-03-141-0/+1
| | | | | | | | | | | | | | | | | | Tegra30 SD/MMC controller differs enough from Tegra20 that it needs its own entry in the compat_names/compat_id tables and in the Tegra MMC driver. Signed-off-by: Tom Warren <twarren@nvidia.com> Reviewed-by: Stephen Warren <swarren@nvidia.com>
* | Tegra: MMC: Add DT support to MMC driver for all T20 boardsTom Warren2013-03-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | tegra_mmc_init() now parses the DT info for bus width, WP/CD GPIOs, etc. Tested on Seaboard, fully functional. Tamonten boards (medcom-wide, plutux, and tec) use a different/new dtsi file w/common settings. Signed-off-by: Tom Warren <twarren@nvidia.com> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de> Reviewed-by: Stephen Warren <swarren@nvidia.com>
* | Tegra: I2C: Add T114 clock support to tegra_i2c driverTom Warren2013-03-141-0/+1
|/ | | | | | | | | | | | | T114 has a slightly different I2C clock, with a new (extra) divisor in standard/fast mode and HS mode. Tested on my Dalmore, and the I2C clock is 100KHz +/- 3Hz on my Saleae Logic analyzer. Added a new entry in compat_names for T114 I2C since it differs from the previous Tegra SoCs. A flag is set when T114 I2C HW is found so new features like the extra clock divisor can be used. Signed-off-by: Tom Warren <twarren@nvidia.com> Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
* tegra: add SPI SLINK driverAllen Martin2013-02-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | Add driver for tegra SPI "SLINK" style driver. This controller is similar to the tegra20 SPI "SFLASH" controller. The difference is that the SLINK controller is a genernal purpose SPI controller and the SFLASH controller is special purpose and can only talk to FLASH devices. In addition there are potentially many instances of an SLINK controller on tegra and only a single instance of SFLASH. Tegra20 is currently ths only version of tegra that instantiates an SFLASH controller. This driver supports basic PIO mode of operation and is configurable (CONFIG_OF_CONTROL) to be driven off devicetree bindings. Up to 4 devices per controller may be attached, although typically only a single chip select line is exposed from tegra per controller so in reality this is usually limited to 1. To enable this driver, use CONFIG_TEGRA_SLINK Signed-off-by: Allen Martin <amartin@nvidia.com> Signed-off-by: Tom Warren <twarren@nvidia.com>
* tegra: spi: add fdt support to tegra SPI SFLASH driverAllen Martin2013-02-111-0/+1
| | | | | | | | | Add support for configuring tegra SPI driver from devicetree. Support is keyed off CONFIG_OF_CONTROL. Add entry in seaboard dts file for spi controller to describe seaboard spi. Signed-off-by: Allen Martin <amartin@nvidia.com> Signed-off-by: Tom Warren <twarren@nvidia.com>
* EXYNOS5: FDT: Add compatible strings for PMICRajeshwari Shinde2013-01-101-0/+1
| | | | | | | | Add required compatible information for PMIC Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com> Acked-by: Simon Glass <sjg@chromium.org> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
* EXYNOS5: FDT: Add compatible strings for USBRajeshwari Shinde2013-01-081-0/+2
| | | | | | | | Add required compatible information for USB Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com> Acked-by: Simon Glass <sjg@chromium.org> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
* EXYNOS5: FDT: Add compatible strings for SPIRajeshwari Shinde2013-01-081-0/+1
| | | | | | | | Add required compatible information for SPI driver. Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com> Acked-by: Simon Glass <sjg@chromium.org> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
* EXYNOS5: FDT: Add compatible strings for soundRajeshwari Shinde2013-01-081-0/+2
| | | | | | | | Add required compatible information for sound driver. Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com> Acked-by: Simon Glass <sjg@chromium.org> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
* FDT: Add compatible string for I2CRajeshwari Shinde2013-01-081-0/+1
| | | | | | | | | Add required compatible information for I2C driver. Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com> Acked-by: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
* fdt: exynos5: Add DT node definition for SROM and SMSC9215Hatim RV2012-12-261-0/+2
| | | | | | | | | Add the compatibility string and constant for the ethernet driver so the device tree parsing code can recognize it. Signed-off-by: Hatim Ali <hatim.rv@samsung.com> Acked-by: Simon Glass <sjg@chromium.org> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
* Merge branch 'master' of git://git.denx.de/u-boot into resolveMinkyu Kang2012-12-101-27/+98
|\ | | | | | | | | | | | | | | | | | | | | Conflicts: README board/samsung/universal_c210/universal.c drivers/misc/Makefile drivers/power/power_fsl.c include/configs/mx35pdk.h include/configs/mx53loco.h include/configs/seaboard.h
| * fdt: Remove fdtdec_find_alias_node() functionSimon Glass2012-11-121-23/+1
| | | | | | | | | | | | | | This function is not needed, since fdt_path_offset() performs the same service. Remove it. Signed-off-by: Simon Glass <sjg@chromium.org>
| * fdt: Add polarity-aware gpio functions to fdtdecSean Paul2012-11-121-0/+20
| | | | | | | | | | | | | | | | Add get and set gpio functions to fdtdec that take into account the polarity field in fdtdec_gpio_state.flags. Signed-off-by: Sean Paul <seanpaul@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
| * fdt: Add fdtdec_get_uint64 to decode a 64-bit value from a propertyChe-Liang Chiou2012-11-121-0/+13
| | | | | | | | | | | | | | | | It decodes a 64-bit value from a property that is at least 8 bytes long. Signed-off-by: Che-Liang Chiou <clchiou@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
| * fdt: Add function to read boolean propertyGabe Black2012-11-121-0/+14
| | | | | | | | | | | | | | | | Signed-off-by: Vincent Palatin <vpalatin@chromium.org> Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Commit-Ready: Gabe Black <gabeblack@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
| * fdt: Export fdtdec_lookup() and fix the nameGerald Van Baren2012-11-121-1/+1
| | | | | | | | | | | | | | The name of this function is not consistent, so fix it, and export the function for external use. Signed-off-by: Simon Glass <sjg@chromium.org>
| * fdt: Add function for decoding multiple gpios globally availableAbhilash Kesavan2012-11-121-3/+2
| | | | | | | | | | | | | | | | | | | | Samsung's SDHCI bindings require multiple gpios to be parsed and configured at a time. Export the already available fdtdec_decode_gpios for this purpose. Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com> Commit-Ready: Che-Liang Chiou <clchiou@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
| * fdt: Add fdtdec_decode_region() to decode memory regionSimon Glass2012-11-121-0/+17
| | | | | | | | | | | | | | | | A memory region has a start and a size and is often specified in a node by a 'reg' property. Add a function to decode this information from the fdt. Signed-off-by: Simon Glass <sjg@chromium.org>
| * fdt: Add function to get a config string from device treeSimon Glass2012-11-121-10/+18
| | | | | | | | | | | | | | Add a function to look up a configuration string such as board name and returns its value. We look in the "/config" node for this. Signed-off-by: Simon Glass <sjg@chromium.org>
| * fdt: Add function to get config int from device treeAbhilash Kesavan2012-11-121-0/+22
| | | | | | | | | | | | | | | | | | | | | | Add a function to look up a configuration item such as machine id and return its value. Note: The code has been taken as is from the Chromium u-boot development tree and needs Simon Glass' sign-off. Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com> Signed-off-by: Simon Glass <sjg@chromium.org>
* | tegra: Add SOC support for display/lcdWei Ni2012-11-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for the LCD peripheral at the Tegra2 SOC level. A separate LCD driver will use this functionality to configure the display. Signed-off-by: Mayuresh Kulkarni <mkulkarni@nvidia.com> Mayuresh Kulkarni: - changes to remove bitfields and clean up for submission Signed-off-by: Simon Glass <sjg@chromium.org> Simon Glass: - simplify code, move clock control into here, clean-up Signed-off-by: Tom Warren <twarren@nvidia.com>
* | tegra: Add support for PWMSimon Glass2012-11-191-0/+1
|/ | | | | | | | The pulse width/frequency modulation peripheral supports generating a repeating pulse. It is useful for controlling LCD brightness. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
* Merge branch 'agust@denx.de' of git://git.denx.de/u-boot-stagingTom Rini2012-09-211-8/+19
|\
| * fdt: Tidy debugging, add to fdtdec_get_int/addr()Simon Glass2012-09-211-8/+19
| | | | | | | | | | | | | | The new debugging shows the value of integers and addresses read from the device tree and tidy up GPIO output. Signed-off-by: Simon Glass <sjg@chromium.org>
* | tegra: nand: Add Tegra NAND driverJim Lin2012-09-071-0/+1
|/ | | | | | | | | | | | A device tree is used to configure the NAND, including memory timings and block/pages sizes. If this node is not present or is disabled, then NAND will not be initialized. Signed-off-by: Jim Lin <jilin@nvidia.com> Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
* fdt: Include arch specific gpio.h instead of asm-generic/gpio.hMichal Simek2012-08-101-2/+1
| | | | | | | | | | | | | Include arch specific gpio.h instead of asm-generic/gpio.h because several architectures (Microblaze, Blackfin, Nios2, OpenRISC) define gpio functions in header file. asm-generic/gpio.h can be included in arch specific gpio.h (For example: ARM) Signed-off-by: Michal Simek <monstr@monstr.eu> CC: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org> Acked-by: Simon Glass <sjg@chromium.org>
* 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>
* 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>
* 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 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>
* fdt: add decode helper librarySimon Glass2011-10-261-0/+147
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>
OpenPOWER on IntegriCloud