summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* dm: test: Add a size to each reg propertySimon Glass2015-07-211-12/+15
| | | | | | | | Each sandbox peripheral should have a size as well as a base address. This is required for regmaps to work, so make this change for all nodes that have an address. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: test: Add a test for the system controller uclassSimon Glass2015-07-217-0/+79
| | | | | | | Add a test to confirm that we can access system controllers and find their driver data. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: test: Add a test for the LED uclassSimon Glass2015-07-215-0/+95
| | | | | | Add a test to confirm that we can adjust LEDs using the led_gpio driver. Signed-off-by: Simon Glass <sjg@chromium.org>
* led: Return -ENODEV if the LED device cannot be foundSimon Glass2015-07-212-3/+4
| | | | | | | | | | We normally use -ENODEV for a missing device, rather than -ENOENT. The latter is reserved for when we have a device but cannot find something within it. Also avoid looking at the root LED device since it is only a container. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: test: Add a test for the mmc uclassSimon Glass2015-07-216-0/+59
| | | | | | | Add a test to confirm that we can probe this device. Since there is no MMC stack support in sandbox at present, this is as far as the test goes. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: test: Add a test for the ram uclassSimon Glass2015-07-216-0/+73
| | | | | | | Add a test to confirm that we can probe this device and get information on the available RAM. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: test: Add a test for the reset uclassSimon Glass2015-07-212-0/+75
| | | | | | | Add tests that confirm that the drivers work as expected, and we can walk through the available reset types trying to reset the board. Signed-off-by: Simon Glass <sjg@chromium.org>
* sandbox: Use the reset driver to handle resetSimon Glass2015-07-215-9/+14
| | | | | | | Move sandbox over to use the reset uclass for reset, instead of a direct call to do_reset(). This allows us to add tests. Signed-off-by: Simon Glass <sjg@chromium.org>
* sandbox: Add a warm and cold reset driverSimon Glass2015-07-212-0/+101
| | | | | | | | Add drivers for sandbox. One can only perform a warm reset (which does nothing). The other can perform a cold reset or a power reset (the latter will quit U-Boot). These can be used for testing the reset uclass. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: reset: Allow reset_walk() to returnSimon Glass2015-07-212-7/+35
| | | | | | | | | | Add a new reset_walk_halt() function to cause a reset and then halt on failure. The reset_walk() function returns an error code. This is needed for testing since otherwise U-Boot will halt in the middle of a test. Signed-off-by: Simon Glass <sjg@chromium.org>
* sandbox: Support multiple reset typesSimon Glass2015-07-212-0/+7
| | | | | | | Add settings for the last reset generated, and the types of resets which are permitted. This will be used for testing. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: test: Add tests for the clk uclassSimon Glass2015-07-217-0/+162
| | | | | | Add tests of each API call using a sandbox clock device. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: test: Allow test names to leave out the dm_test_ prefixSimon Glass2015-07-211-2/+13
| | | | | | | | | | | | | | All driver model tests have a dm_test_ prefix. Ignore it when matching a test name. This makes it easier to run individual tests, like this: ./sandbox/u-boot -d ./sandbox/arch/sandbox/dts/test.dtb \ -c "ut dm clk_periph" We can use 'clk_periph' instead of 'dm_test_clk_periph'. Also print a message if the requested test is not found. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: Add platform data advice and admonishmentSimon Glass2015-07-212-2/+24
| | | | | | | | We should guide people more strongly towards device tree to avoid the proliferation of platform data structures. Add documentation to the driver model README, and also the platform data header file. Signed-off-by: Simon Glass <sjg@chromium.org>
* power: pmic: Use trailing_strtol() instead of a local functionSimon Glass2015-07-211-18/+5
| | | | | | | | | Use the common function to obtain the number from the end of the string, instead of a local function. Also tweak the position of a debug() statement. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Przemyslaw Marczak <p.marczak@samsung.com> Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>
* dm: Add a clock uclassSimon Glass2015-07-218-0/+170
| | | | | | | | | | | | | | | | | | | | | | | Clocks are an important feature of platforms and have become increasing complex with time. Most modern SoCs have multiple PLLs and dozens of clock dividers which distribute clocks to on-chip peripherals. Some SoC implementations have a clock API which is private to that SoC family, e.g. Tegra and Exynos. This is useful but it would be better to have a common API that can be understood and used throughout U-Boot. Add a simple clock API as a starting point. It supports querying and setting the rate of a clock. Each clock is a device. To reduce memory and processing overhead the concept of peripheral clocks is provided. These do not need to be explicit devices - it is possible to write a driver that can adjust the I2C clock (for example) without an explicit I2C clock device. This can dramatically reduce the number of devices (and associated overhead) in a complex SoC. Clocks are referenced by a number, and it is expected that SoCs will define that numbering themselves via an enum. Signed-off-by: Simon Glass <sjg@chromium.org>
* zynq: Rename struct clk_ops to zynq_clk_opsSimon Glass2015-07-211-3/+3
| | | | | | | Since we want clk_ops to be used in U-Boot as a whole, rename the Zynq version until it can be converted to driver model. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: Add a system reset uclassSimon Glass2015-07-215-0/+135
| | | | | | | | | | | | | | | | It is common for system reset to be available at multiple levels in modern hardware. For example, an SoC may provide a reset option, and a board may provide its own reset for reasons of security or thoroughness. It is useful to be able to model this hardware without hard-coding the behaviour in the SoC or board. Also there is a distinction sometimes between resetting just the CPU (leaving GPIO state alone) and resetting all the PMICs, just cutting power. To achieve this, add a simple system reset uclass. It allows multiple devices to provide reset functionality and provides a way to walk through them, requesting a particular reset type until is it provided. Signed-off-by: Simon Glass <sjg@chromium.org>
* mkimage: Set up a file size parameter and keep it updatedSimon Glass2015-07-212-0/+19
| | | | | | | | | | | Some functions called by mkimage would like to know the output file size. Initially this is the same as the input file size, but it may be affected by adding headers, etc. Add this information to the image parameters. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* spl: Add a debug string before the jump to U-BootSimon Glass2015-07-211-0/+1
| | | | | | | As a debug option, add positive confirmation that SPL has completed execution. This can help with diagnosing the location of unexpected hangs. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: spl: Allow device tree/driver model in board_init_f()Simon Glass2015-07-213-11/+37
| | | | | | | | | | | | Add an spl_init() function that does basic init such that board_init_f() can use simple malloc(), device tree and driver model. Each one is set up only if enabled for SPL. Note: We really should refactor SPL such that there is a single board_init_f() and rename the existing weak board_init_f() functions provided by boards, calling them from the single board_init_f(). Signed-off-by: Simon Glass <sjg@chromium.org>
* fdt: Provide debug info when a device tree cannot be foundSimon Glass2015-07-211-0/+7
| | | | | | | It can be quite confusing with a new platform to figure out why the device tree cannot be located. Add some debug information for this case. Signed-off-by: Simon Glass <sjg@chromium.org>
* lib: Add function to extract a number from the end of a stringSimon Glass2015-07-213-8/+51
| | | | | | | Split out the code in fdtdec which finds a number at the end of a string. It can be useful in other situations. Signed-off-by: Simon Glass <sjg@chromium.org>
* Add rivest cipher 4 (rc4) implementationSimon Glass2015-07-213-0/+71
| | | | | | | Add an implementation of RC4. This will be used by Rockchip booting but may be useful in other situations. Signed-off-by: Simon Glass <sjg@chromium.org>
* ns16550: Improve debug UART so it can work with 32-bit accessSimon Glass2015-07-211-15/+21
| | | | | | | Since Rockchip requires 32-bit serial access, add this to the driver. Refactor a little to make this easier. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: spi: Make local functions staticSimon Glass2015-07-211-4/+4
| | | | | | Several functions in this file should be marked as static. Update them. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: Add support for RAM driversSimon Glass2015-07-218-0/+96
| | | | | | | | Add support for a driver which sets up DRAM and can return information about the amount of RAM available. This is a first step towards moving RAM init to driver model. Signed-off-by: Simon Glass <sjg@chromium.org>
* Drop CONFIG_ERRNO_STR from SPLSimon Glass2015-07-211-1/+1
| | | | | | | | | This bloats the code size quite a bit and is less useful in SPL where there is no command line. Avoid including this code in SPL. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: power: Allow use of regulators in SPLSimon Glass2015-07-211-0/+1
| | | | | | | This functionality may be useful for setting up regulators early during boot. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: pmic: Add functions to adjust PMIC registersSimon Glass2015-07-212-0/+66
| | | | | | | | | It is a common requirement to update some PMIC registers. Provide some simple convenience functions to do this. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Przemyslaw Marczak <p.marczak@samsung.com> Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>
* dm: power: Use debug() for errors in regulator uclassSimon Glass2015-07-211-1/+1
| | | | | | | | | To reduce unnecessary code size in an uncommon code path, use debug() where possible(). The driver returns an error which indicates failure. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Przemyslaw Marczak <p.marczak@samsung.com> Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>
* dm: power: Add a function to set up all regulatorsSimon Glass2015-07-212-0/+33
| | | | | | | | | The device tree provides information about which regulators should be on at boot, or always on. Use this to set them up automatically. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Przemyslaw Marczak <p.marczak@samsung.com> Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>
* dm: pmic: Split output from functionSimon Glass2015-07-214-75/+63
| | | | | | | | | | | | | | | The regulator_autoset() function mixes printf() output and PMIC adjustment code. It provides a boolean to control the output. It is better to avoid missing logic and output, and this permits a smaller SPL code size. So split the output into a separate function. Also rename the function to have a by_name() suffix, since we would like to be able to pass a device when we know it, and thus avoid the name search. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Przemyslaw Marczak <p.marczak@samsung.com> Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>
* dm: power: Add regulator flags to centralise auto-set logicSimon Glass2015-07-212-0/+20
| | | | | | | | | Decide when the regulator is set up whether we want to auto-set the voltage or current. This avoids the complex logic spilling into the processing code. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Przemyslaw Marczak <p.marczak@samsung.com> Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>
* dm: power: Avoid case-insensitve match for child namesSimon Glass2015-07-211-1/+1
| | | | | | | | | | This is not user input (i.e. from the command line). It should be possible to get the case correct and avoid the case-insensitive match. This will help avoid sloppy device tree setups. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Przemyslaw Marczak <p.marczak@samsung.com> Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>
* mmc: Add structure comments for dwmmcSimon Glass2015-07-211-1/+17
| | | | | | | It took a little while to figure this out, so this patch adds documentation to help the next person who needs to do this. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: mmc: Allow driver model to be used for MMC in SPLSimon Glass2015-07-211-2/+15
| | | | | | Enable MMC using driver model in SPL for consistency with U-Boot proper. Signed-off-by: Simon Glass <sjg@chromium.org>
* mmc: Add debug() output on read errorsSimon Glass2015-07-211-2/+6
| | | | | | Allow read errors to be diagnosed more easily. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: mmc: Add an MMC uclassSimon Glass2015-07-216-0/+71
| | | | | | | Add basic support for MMC, providing a uclass which can set up an MMC device. This allows MMC drivers to move to using driver model. Signed-off-by: Simon Glass <sjg@chromium.org>
* spl: Add debugging info for spl_mmc bootSimon Glass2015-07-211-2/+7
| | | | | | Add a few messages to indicate progress and failure. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: led: Add a driver for GPIO-controlled LEDsSimon Glass2015-07-214-0/+163
| | | | | | | Add a simple driver which allows use of LEDs attached to GPIOs. The linux device tree binding is used. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: Add support for LEDsSimon Glass2015-07-219-0/+152
| | | | | | | | | Add a simple uclass for LEDs, so that these can be controlled by the device tree and activated when needed. LEDs are referred to by their label. This implementation requires a driver for each type of LED (e.g GPIO, I2C). Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: Add support for generic system controllers (syscon)Simon Glass2015-07-214-0/+131
| | | | | | | | | | | Many SoCs have a number of system controllers which are dealt with as a group by a single driver. It is a pain to have to add lots of compatible strings and/or separate drivers for each. Instead we can identify the controllers by a number and request the address of the one we want. Add a simple implementation of this which can be used by SoC driver code. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: Add support for register maps (regmap)Simon Glass2015-07-213-0/+159
| | | | | | | | | | | Add a simple implementaton of register maps, supporting only direct I/O for now. This can be enhanced later to support buses which have registers, such as I2C, SPI and PCI. It allows drivers which can operate with multiple buses to avoid dealing with the particulars of register access on that bus. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: gpio: Add dm_gpio_request() to manually request a GPIOSimon Glass2015-07-212-1/+13
| | | | | | | This function can be used for testing to manually request a GPIO for use, without resorting to the legacy GPIO API. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: gpio: Add dm_gpio_lookup_name() to look up a GPIO nameSimon Glass2015-07-212-8/+39
| | | | | | | Provide a driver-model function to look up a GPIO name. Make the standard function use it. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: gpio: Allow GPIO uclass to be used in SPLSimon Glass2015-07-211-4/+0
| | | | | | | Now that we support driver model in SPL, allow GPIO drivers to be used there also. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Correct device_get_child_by_of_offset() parameterSimon Glass2015-07-212-3/+3
| | | | | | This parameter is named 'seq' but should be named 'of_offset'. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Add a function to find any device from device treeSimon Glass2015-07-212-0/+39
| | | | | | | | | | | | In some rare cases it is useful to be able to locate a device given a device tree node offset. An example is when you have an alias that points to a node and you want to find the associated device. The device may be SPI, MMC or something else, but you don't need to know the uclass to find it. Add a function to do a global search for a device, given its device tree offset. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Use debug() instead of printf() for failuresSimon Glass2015-07-211-3/+3
| | | | | | | | To avoid bloating SPL code, use debug() where possible in the driver model core code. The error code is already returned, and can be investigated as needed. Signed-off-by: Simon Glass <sjg@chromium.org>
OpenPOWER on IntegriCloud