summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* test: Update test-imagetools.sh to match new syntaxMartyn Welch2019-03-081-8/+8
| | | | | | | | | | | | The syntax of dumpimage was simplified in commit 12b831879a76 ("tools: dumpimage: Simplify arguments"), but the test (test/image/test-imagetools.sh) was not updated and is now failing. Update the test to use the new syntax. Reported-by: Vagrant Cascadian <vagrant@debian.org> Signed-off-by: Martyn Welch <martyn.welch@collabora.com> Tested-by: Vagrant Cascadian <vagrant@debian.org>
* clk: Add fixed-factor clock driverAnup Patel2019-02-271-1/+4
| | | | | | | | | | This patch adds fixed-factor clock driver which derives clock rate by dividing (div) and multiplying (mult) fixed factors to a parent clock. Signed-off-by: Atish Patra <atish.patra@wdc.com> Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* sound: Add uclass operations for beepingSimon Glass2019-02-201-0/+21
| | | | | | | | | | Some audio codecs such as Intel HDA do not need to use digital data to play sounds, but instead have a way to emit beeps. Add this interface as an option. If the beep interface is not supported, then the sound uclass falls back to the I2S interface. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* pch: Add ioctl supportSimon Glass2019-02-201-0/+19
| | | | | | | | | | | | At present the PCH has 4 operations and these are reasonably widely used in the drivers. But sometimes we want to add rarely used operations, and each of these currently adds to the size of the PCH operations table. Add an ioctl() method which can be easily expanded without any more impact on the operations table. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* sandbox: pch: Add a test for the PCH uclassSimon Glass2019-02-202-0/+37
| | | | | | | | | | This uclass currently has no tests. Add a sandbox driver and some simple tests to provide basic coverage. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> [bmeng: Use "sandbox,pch" for the compatible string, for consistency] Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
* test: let use gdbserver for all sandbox targetsIgor Opaniuk2019-02-191-2/+2
| | | | | | | | | Enable usage of gdbserver for all sandbox targets (sandbox, sandbox_flattree etc.). Signed-off-by: Igor Opaniuk <igor.opaniuk@linaro.org> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: adjust names of Unicode test functionsHeinrich Schuchardt2019-02-161-49/+49
| | | | | | | | | | | In test/py/conftest.py the assumption is made that for if a test is called with `ut unicode` the test function name starts with 'unicode_test_'. As the Unicode tests did not follow this naming scheme they were not executed by `make tests`. Rename the Unicode test functions. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* test: tests for u16_strdup() and u16_strcpy()Heinrich Schuchardt2019-02-131-0/+23
| | | | | | | Provide unit tests for u16_strdup() and u16_strcpy(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
* test/py: use default load address for tftpHeinrich Schuchardt2019-02-121-4/+5
| | | | | | | | | | | On x86_64 the size of the file u-boot loaded by the tftp test has grown in size such that when loading the file to 0x200000 it overwrites a memory area reserved for PCI. If no load address is specified for tftp do not use the ram base address (or if zero 0x200000) but the default address. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* Merge branch 'master' of git://git.denx.de/u-boot-i2cTom Rini2019-02-111-0/+23
|\ | | | | | | - DM I2C improvements
| * dm: core: Add tests for dev_read_alias_highest_id()Michal Simek2019-02-081-0/+23
| | | | | | | | | | | | | | | | | | It is checking the highest alias ID for eth, gpio, pci, i2c and error code on non existing alias. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Heiko Schocher <hs@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
* | Merge tag 'dm-pull-10feb19' of git://git.denx.de/u-boot-dmTom Rini2019-02-101-0/+21
|\ \ | | | | | | | | | | | | | | | | | | Samsung sound patches (applied for Samsung maintainer) Common sound support buildman environment support of-platdata documentation improvements
| * | power: regulator: Introduce regulator_set_enable_if_allowed apiLokesh Vutla2019-02-091-0/+21
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | regulator_set_enable() api throws an error in the following three cases: - when requested to disable an always-on regulator - when set_enable() ops not provided by regulator driver - when enabling is actually failed.(Error returned by the regulator driver) Sometimes consumer drivers doesn't want to track the first two scenarios and just need to worry about the case where enabling is actually failed. But it is also a good practice to have an error value returned in the first two cases. So introduce an api regulator_set_enable_if_allowed() which ignores the first two error cases and returns an error as given by regulator driver. Consumer drivers can use this api need not worry about the first two error conditions. Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* | dm: device: fail uclass_find_first_device() if list_emptyMarcel Ziswiler2019-02-091-0/+4
| | | | | | | | | | | | | | | | | | | | While uclass_find_device() fails with -ENODEV in case of list_empty strangely uclass_find_first_device() returns 0. Fix uclass_find_first_device() to also fail with -ENODEV instead. Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* | hashtable: fix environment variable corruptionRoman Kapl2019-02-092-0/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only first previously deleted entry was recognized, leading hsearch_r to think that there was no previously deleted entry. It then conluded that a free entry was found, even if there were no free entries and it overwrote a random entry. This patch makes sure all deleted or free entries are always found and also introduces constants for the 0 and -1 numbers. Unit tests to excersise a simple hash table usage and catch the corruption were added. To trash your environment, simply run this loop: setenv i 0 while true; do setenv v_$i $i setenv v_$i setexpr i $i + 1 done Signed-off-by: Roman Kapl <rka@sysgo.com>
* | test: provide unit test for memory functionsHeinrich Schuchardt2019-02-095-0/+230
|/ | | | | | | | | | | | Memory functions may have architecture specific implementations. These should be tested. Provide unit tests for memset(), memcpy(), memmove(). Provide a 'ut lib' sub-command to execute the tests. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: lib: lmb: add lmb test for multiple RAM banksSimon Goldschmidt2019-02-021-19/+75
| | | | | | | | This adds one test case that checks that allocation with multiple DRAM banks works correctly. Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* lib: lmb: rename lmb_get_unreserved_size to lmb_get_free_sizeSimon Goldschmidt2019-01-261-11/+11
| | | | | | | | | | As a follow-up, change the name of the newly introduced function 'lmb_get_unreserved_size' to 'lmb_get_free_size', which is more appropriate. Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> [trini: Fix test/lib/lmb.c] Signed-off-by: Tom Rini <trini@konsulko.com>
* net: explicitly assign errno to return code in case of network failureThomas RIENOESSL2019-01-241-1/+1
| | | | | | | | | | | | | | | When dealing with two ethernet ports and having "netretry" set to "once", it could occur that the connection (e.g. an ARP request) failed, hence the status of the netloop was "NETLOOP_FAIL". Due to the setting of "netretry", the network logic would then switch to the other network interface, assigning "ret" with the return value of "net_start_again()". If this call succeeded we would return 0 (i.e. success) to the caller when in reality the network action failed. Signed-off-by: Thomas RIENOESSL <thomas.rienoessl@bachmann.info> Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* lib: lmb: extend lmb for checks at load timeSimon Goldschmidt2019-01-161-0/+202
| | | | | | | | | | | | | | | | | | | This adds two new functions, lmb_alloc_addr and lmb_get_unreserved_size. lmb_alloc_addr behaves like lmb_alloc, but it tries to allocate a pre-specified address range. Unlike lmb_reserve, this address range must be inside one of the memory ranges that has been set up with lmb_add. lmb_get_unreserved_size returns the number of bytes that can be used up to the next reserved region or the end of valid ram. This can be 0 if the address passed is reserved. Added test for these new functions. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
* lib: lmb: reserving overlapping regions should failSimon Goldschmidt2019-01-161-8/+87
| | | | | | | | | | | | | | | | | | | | lmb_add_region handles overlapping regions wrong: instead of merging or rejecting to add a new reserved region that overlaps an existing one, it just adds the new region. Since internally the same function is used for lmb_alloc, change lmb_add_region to reject overlapping regions. Also, to keep reserved memory correct after 'free', reserved entries created by allocating memory must not set their size to a multiple of alignment but to the original size. This ensures the reserved region is completely removed when the caller calls 'lmb_free', as this one takes the same size as passed to 'lmb_alloc' etc. Add test to assert this. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
* lmb: fix allocation at end of address rangeSimon Goldschmidt2019-01-161-3/+26
| | | | | | | | | | | | The lmb code fails if base + size of RAM overflows to zero. Fix this by calculating end as 'base + size - 1' instead of 'base + size' where appropriate. Added tests to assert this is fixed. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
* test: add test for lib/lmb.cSimon Goldschmidt2019-01-162-0/+298
| | | | | | | | Add basic tests for the lmb memory allocation code used to reserve and allocate memory during boot. Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* Merge tag 'dm-pull-15jan19' of git://git.denx.de/u-boot-dmTom Rini2019-01-153-12/+17
|\ | | | | | | | | | | | | | | Fix recent changes to serial API for driver model Buildman clang support and a few fixes Small fixes to 'dm tree' and regmap test Improve sandbox build compatibility A few other minor fixes
| * dm: serial: Adjust serial_getinfo() to use proper APISimon Glass2019-01-141-2/+2
| | | | | | | | | | | | | | | | All driver-model functions should have a device as the first parameter. Update this function accordingly. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
| * dm: serial: Adjust serial_setconfig() to use proper APISimon Glass2019-01-141-4/+7
| | | | | | | | | | | | | | | | All driver-model functions should have a device as the first parameter. Update this function accordingly. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
| * dm: serial: Adjust serial_getconfig() to use proper APISimon Glass2019-01-141-2/+2
| | | | | | | | | | | | | | | | All driver-model functions should have a device as the first parameter. Update this function accordingly. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
| * test: dm: regmap: Fix the long test delaySimon Glass2019-01-141-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present one of the regmap tests takes 5 seconds to run since it waits for a timeout. This should be handled using sandbox_timer_add_offset() which advances time for test purposes. This requires a little change to make the regmap_read_poll_timeout() testable. Update the macro and the test. Fixes: ebe3497c9c ("test: regmap: add regmap_read_poll_timeout test") Signed-off-by: Simon Glass <sjg@chromium.org>
| * dm: Tidy up 'dm tree' output when there are many devicesSimon Glass2019-01-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | At present the 'Index' column assumes there is only one digit. But on some devices (e.g. snow) there are a lot of regulators and GPIO banks. Adjust the output to allow for two digits without messing up the display. Also capatalise the heading to match. Fixes: 5197dafc42 (dm: core: Widen the dump tree to show more of the driver's name.) Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Liviu Dudau <liviu.dudau@foss.arm.com>
* | test: Use single quote consistentlySimon Glass2019-01-159-189/+189
| | | | | | | | | | | | | | | | Some tests have ended up using double quotes where single quotes could be used. Adjust this for consistency with the rest of U-Boot's Python code. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* | test: bootcount: add bootcount-uclass testPhilipp Tomsich2019-01-142-0/+31
|/ | | | | | | | Add a test for the bootcount uclass, which uses the RTC bootcount backend (i.e. drivers/bootcount/rtc.c is implictly also tested). Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* dm: video: fix test failures with enabled default TrueType fontAnatolij Gustschin2018-12-291-3/+3
| | | | | | | | With enabled default Nimbus font dm_test_video_truetype* tests fail. Update expected expressions to fix them. Signed-off-by: Anatolij Gustschin <agust@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
* tests: enable DT overlay tests by defaultHeinrich Schuchardt2018-12-261-4/+3
| | | | | | | | | | Enable device tree overlay tests by default if unit tests are selected and the runtime is configured via device tree. Overlays have been mainlined in the device tree compiler so there is no reason anymore to disable the tests by default. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* cmd: Move the "dm" command from test/dm/ to cmd/Tom Rini2018-12-152-89/+0
| | | | | | | The "dm" command under CONFIG_CMD_DM should live under cmd/ rather than test/dm/ so move it. Signed-off-by: Tom Rini <trini@konsulko.com>
* dm: sound: Complete migration to driver modelSimon Glass2018-12-131-3/+3
| | | | | | | All users of sound are converted to use driver model. Drop the old code and the CONFIG_DM_SOUND option. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Add a function to read into a unsigned intSimon Glass2018-12-131-0/+35
| | | | | | | | | | | The current dev_read...() functions use s32 and u32 which are convenient for device tree but not so useful for normal code, which often wants to use normal integers for values. Add a helper which supports returning an unsigned int. Also add signed versions of the unsigned readers. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: sound: Create a uclass for soundSimon Glass2018-12-132-0/+35
| | | | | | | | | | | The sound driver pulls together the audio codec and i2s drivers in order to actually make sounds. It supports setup() and play() methods. The sound_find_codec_i2s() function allows locating the linked codec and i2s devices. They can be referred to from uclass-private data. Add a uclass and a test for sound. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: sound: Create a uclass for i2sSimon Glass2018-12-132-0/+33
| | | | | | | | | | | The i2s bus is commonly used with audio codecs. It provides a way to stream digital data sychronously in both directions. U-Boot only supports audio output, so this uclass is very simple, with a single tx_data() method. Add a uclass and a test for i2s. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: sound: Create a uclass for audio codecsSimon Glass2018-12-132-0/+35
| | | | | | | | An audio codec provides a way to convert digital data to sound and vice versa. Add a simple uclass which just supports setting the parameters for the codec. Signed-off-by: Simon Glass <sjg@chromium.org>
* test: overlay: NULL passed as fdtHeinrich Schuchardt2018-12-121-19/+9
| | | | | | | | | | | The uts created in do_ut_overlay() is not the one used in cmd_ut_category(). Currently all tests are therefore called with uts->priv = NULL and fail. Using a static variable is the easiest fix here. Fixes: e93232e15ec9 ("test: overlay: Use cmd_ut_category()") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* test: hexdump: fix misplaced returnSimon Goldschmidt2018-12-121-2/+2
| | | | | | | | | | One of the hexdump tests in test/lib/hexdump.c returns right at the start of the function without testing anything. Fix this by moving the 'return 0;' statement to the end of the function. Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* Merge branch 'master' of git://git.denx.de/u-boot-usbTom Rini2018-12-101-0/+29
|\ | | | | | | - DWC3 and UDC cleanup
| * syscon: dm: Add a new method to get a regmap from DTSJean-Jacques Hiblot2018-12-071-0/+29
| | | | | | | | | | | | | | | | | | syscon_regmap_lookup_by_phandle() can be used to get the regmap of a syscon device from a reference in the DTS. It operates similarly to the linux version of the namesake function. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* | spl/tpl: change banner into upper caseHeiko Schocher2018-12-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | commit d6330064634a ("spl: Add a define for SPL_TPL_PROMPT") changes the SPL/TPL banner from upper case into lower case. As SPL and TPL are three-letter acronyms and they are written in upper case, change it back to upper case. Signed-off-by: Heiko Schocher <hs@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
* | test: dma: add dma-uclass testGrygorii Strashko2018-12-072-0/+124
| | | | | | | | | | | | | | | | | | | | Add a sandbox DMA driver implementation (provider) and corresponding DM test. Reviewed-by: Tom Rini <trini@konsulko.com> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Álvaro Fernández Rojas <noltari@gmail.com>
* | dm: Add Hardware Spinlock classBenjamin Gaignard2018-12-062-0/+41
|/ | | | | | | | | | This is uclass for Hardware Spinlocks. It implements two mandatory operations: lock and unlock and one optional relax operation. Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
* Merge tag 'dm-pull-5dec18' of git://git.denx.de/u-boot-dmTom Rini2018-12-053-4/+94
|\ | | | | | | | | | | | | Minor sandbox enhancements / fixes tpm improvements to clear up v1/v2 support buildman toolchain fixes New serial options to set/get config
| * dm: serial: Introduce ->getinfo() callbackAndy Shevchenko2018-12-051-0/+5
| | | | | | | | | | | | | | | | | | | | New callback will give a necessary information to fill up ACPI SPCR table, for example. Maybe used later for other purposes. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Simon Glass <sjg@chromium.org> Change ADR_SPACE_SYSTEM_IO to SERIAL_ADDRESS_SPACE_IO to fix build error: Signed-off-by: Simon Glass <sjg@chromium.org>
| * dm: serial: Add ->getconfig() callbackAndy Shevchenko2018-12-051-0/+7
| | | | | | | | | | | | | | | | | | In some cases it would be good to know the settings, such as parity, of current serial console. One example might be an ACPI SPCR table to generate using these parameters. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Simon Glass <sjg@chromium.org>
| * dm: core: add functions to get/remap I/O addresses by nameÁlvaro Fernández Rojas2018-12-051-2/+80
| | | | | | | | | | | | | | | | | | | | This functions allow us to get and remap I/O addresses by name, which is useful when there are multiple reg addresses indexed by reg-names property. This is needed in bmips dma/eth patch series, but can also be used on many other drivers. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>