summaryrefslogtreecommitdiff
path: root/test/dm
AgeCommit message (Collapse)Author
2017-10-09Merge git://git.denx.de/u-boot-videoTom Rini
2017-10-06test/dm: Fix string handling issues in the eth testTom Rini
Coverity scan has identified potential buffer overruns in these tests. Correct this by zeroing our buffer and using strncpy not strcpy. Reported-by: Coverity (CID: 155462, 155463) Cc: Joe Hershberger <joe.hershberger@ni.com> Cc: Simon Glass <sjg@chromium.org> Cc: Bin Meng <bmeng.cn@gmail.com> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2017-10-01test: dm: usb: Update test cases for USBBin Meng
Now that we have changed to remove all devices under the root hub in usb_stop(), and corrected the USB emulator select logic, it makes no sense to do various tests based on 'usb tree' output since the order of devices is no longer fixed. Remove these USB test cases related to 'usb tree'. For the USB remove test, ideally we should remove an emulator device node from the device tree, but this is so far not working. Change to test the 'usb stop' only. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2017-09-29video: test: Add ANSI escape sequence testsRob Clark
This adds tests for clear, set-cursor and color escape sequences. Signed-off-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Anatolij Gustschin <agust@denx.de>
2017-09-29video: test: Helper for writing stringsRob Clark
I'll need some more of this, let's not just copy-pasta the vidconsole_put_char() loop. Named to match vidconsole_put_char() in case that is ever useful outside of the tests. Signed-off-by: Rob Clark <robdclark@gmail.com>
2017-09-11dm: test: replace dm_scan_dt() by of dm_extended_scan_fdt() in dm_do_testPatrice Chotard
This allows to scan the DT including all "clocks" node's sub-nodes in which fixed-clock are defined. All fixed-clock should be defined inside a clocks node which collect all external oscillators. Until now, all clocks sub-nodes can't be binded except if the "simple-bus" compatible string is added which is a hack. Update test.dts by moving clk_fixed node inside clocks. Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-09-11blk: dm: make blk_create_device() take a number of block instead of a sizeJean-Jacques Hiblot
There is an overflow problem when taking the size instead of the number of blocks in blk_create_device(). This results in a wrong device size: the device apparent size is its real size modulo 4GB. Using the number of blocks instead of the device size fixes the problem and is more coherent with the internals of the block layer. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-08-16env: Rename getenv/_f() to env_get()Simon Glass
We are now using an env_ prefix for environment functions. Rename these two functions for consistency. Also add function comments in common.h. Quite a few places use getenv() in a condition context, provoking a warning from checkpatch. These are fixed up in this patch also. Suggested-by: Wolfgang Denk <wd@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org>
2017-08-16env: Rename setenv() to env_set()Simon Glass
We are now using an env_ prefix for environment functions. Rename setenv() for consistency. Also add function comments in common.h. Suggested-by: Wolfgang Denk <wd@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org>
2017-07-11dm: core: Add uclass_first/next_device_check()Simon Glass
Sometimes it is useful to iterate through all devices in a uclass and skip over those which do not work correctly (e.g fail to probe). Add two new functions to provide this feature. The caller must check the return value each time to make sure that the device is valid. But the device pointer is always returned. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-07-11dm: core: Test uclass_first/next_device() on probe failureSimon Glass
Add some tests which check the behaviour of uclass_first_device() and uclass_next_device() when probing of a device fails. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-12test: bus: Add a check that dev is not NULLSimon Glass
We know that uclass_get_device() and device_find_child_by_of_offset() do not return NULL for dev when they succeeds but coverity does not. Add an extra check to hopefully keep it happy. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Coverity (CID: 163246) Fixes: 0753bc2 (dm: Simple Watchdog uclass)
2017-06-12test: wdt: Add a check that dev is not NULLSimon Glass
We know that uclass_get_device() does not return NULL for dev when it succeeds but coverity does not. Add an extra check to hopefully keep it happy. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Coverity (CID: 163247) Fixes: 0753bc2 (dm: Simple Watchdog uclass)
2017-06-12test: pwm: Add a check that dev is not NULLSimon Glass
We know that uclass_get_device() does not return NULL for dev when it succeeds but coverity does not. Add an extra check to hopefully keep it happy. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Coverity (CID: 161690) Fixes: 43b4156 (dm: sandbox: pwm: Add a basic pwm test)
2017-06-09dm: blk: Add a way to obtain a block device from its parentSimon Glass
Many devices support a child block device (e.g. MMC, USB). Add a convenient way to get this device given the parent device. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2017-06-01dm: phy: Update tests to use ut_asserteq()Simon Glass
Use ut_asserteq() to test equality since this gives a better error message on failure. Also make a few of the tests more specific. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-01dm: test: Disable the fdt_offset test with livetreeSimon Glass
We cannot run this test with livetree since it uses device tree offsets. Mark it as flat tree only. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-01dm: test: Separate out the bus DT offset testSimon Glass
We cannot access the device tree via an offset when running in livetree mode. Separate out that part of the bus' children tests and mark it as for the flat tree only. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-01dm: core: Run tests with both livetree and flat treeSimon Glass
Some tests require either livetree or flat tree. Add flags to allow the tests to specify this. Adjust the test runner to run with livetree (if supported) and then flat tree. Some video tests are quite slow and running on flat tree adds little extra test value, so run these on livetree only. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-01dm: test: Add support for running tests with livetreeSimon Glass
It is useful to run the driver model tests with both livetree and flat tree in case something is different between the two. Add this feature to the test runner. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-01dm: test: Show the test filename when runningSimon Glass
Show the filename of the test being run. Skip the path and show just the base name. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-01dm: test: Move test running code into a separate functionSimon Glass
We want to run the same test on flat and live trees. In preparation for this, create a new function which handles running a test. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-01sandbox: Add a way to reset sandbox state for testsSimon Glass
Running a new test should reset the sandbox state to avoid tests interferring with each other. Move the existing state-reset code into a function so it can be used from tests. Also update the code to reset the SPI devices and adjust the test code to call it. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-01dm: core: Scan the live tree when setting up driver modelSimon Glass
When starting up driver model with a live tree we need to scan the tree for devices. Add code to handle this. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-01dm: blk: Improve block device claimingSimon Glass
The intention with block devices is that the device number (devnum field in its descriptor) matches the alias of its parent device. For example, with: aliases { mmc0 = "/sdhci@700b0600"; mmc1 = "/sdhci@700b0400"; } we expect that the block devices for mmc0 and mmc1 would have device numbers of 0 and 1 respectively. Unfortunately this does not currently always happen. If there is another MMC device earlier in the driver model data structures its block device will be created first. It will therefore get device number 0 and mmc0 will therefore miss out. In this case the MMC device will have sequence number 0 but its block device will not. To avoid this, allow a device to request a device number and bump any existing device number that is using it. This all happens during the binding phase so it is safe to change these numbers around. This allows device numbers to match the aliases in all circumstances. Add a test to verify the behaviour. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-01dm: blk: Allow finding block devices without probingSimon Glass
Sometimes it is useful to be able to find a block device without also probing it. Add a function for this as well as the associated test. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-05-10dm: sandbox: pwm: add test for pwm_set_invert()Kever Yang
Add test case for new interface set_invert(). Signed-off-by: Kever Yang <kever.yang@rock-chips.com> Acked-by: Simon Glass <sjg@chromium.org> Fix typo in subject and build error in sandbox_pwm_set_invert(): Signed-off-by: Simon Glass <sjg@chromium.org>
2017-05-09dm: test: Add tests for the generic PHY uclassJean-Jacques Hiblot
Those tests check: - the ability for a phy-user to get a phy based on its name or its index - the ability of a phy device (provider) to manage multiple ports - the ability to perform operations on the phy (init,deinit,on,off) - the behavior of the uclass when optional operations are not implemented Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-05-08dm: Simple Watchdog uclassmaxims@google.com
This is a simple uclass for Watchdog Timers. It has four operations: start, restart, reset, stop. Drivers must implement start, restart and stop operations, while implementing reset is optional: It's default implementation expires watchdog timer in one clock tick. Signed-off-by: Maxim Sloyko <maxims@google.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-04-27dm: sandbox: pwm: Add a basic pwm testSimon Glass
Unfortunately a test for the PWM uclass was not included when it was submitted. This was noticed when trying to add more functionality: http://patchwork.ozlabs.org/patch/748172/ Add a simple test to get us started. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-04-14dm: led: Add support for blinking LEDsSimon Glass
Allow LEDs to be blinked if the driver supports it. Enable this for sandbox so that the tests run. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Ziping Chen <techping.chan@gmail.com>
2017-04-14dm: led: Support toggling LEDsSimon Glass
Add support for toggling an LED into the uclass interface. This can be efficiently implemented by the driver. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Ziping Chen <techping.chan@gmail.com>
2017-04-14dm: led: Add support for getting the state of an LEDSimon Glass
It is useful to be able to read the LED as well as write it. Add this to the uclass and update the GPIO driver. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Ziping Chen <techping.chan@gmail.com>
2017-04-14dm: led: Adjust the LED uclassSimon Glass
At present this is very simple, supporting only on and off. We want to also support toggling and blinking. As a first step, change the name of the main method and use an enum to indicate the state. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Ziping Chen <techping.chan@gmail.com>
2017-04-04dm: test: Add test for device removalStefan Roese
Add a test for the correct device removal. Currently two different ways for device removal are supported: - Normal device removal via the device_remove() API - Removal via selective device driver flags (DM_FLAG_ACTIVE_DMA) This new test "remove_active_dma" adds tests cases for those both ways of removal. This is done by adding a new test driver, which has this flag set. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Simon Glass <sjg@chromium.org>
2017-04-04dm: core: Add flags parameter to device_remove()Stefan Roese
This patch adds the flags parameter to device_remove() and changes all calls to this function to provide the default value of DM_REMOVE_NORMAL for "normal" device removal. This is in preparation for the driver specific pre-OS (e.g. DMA cancelling) remove support. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Simon Glass <sjg@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
2017-02-08dm: core: Replace of_offset with accessorSimon Glass
At present devices use a simple integer offset to record the device tree node associated with the device. In preparation for supporting a live device tree, which uses a node pointer instead, refactor existing code to access this field through an inline function. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-07-27Add a power domain framework/uclassStephen Warren
Many SoCs allow power to be applied to or removed from portions of the SoC (power domains). This may be used to save power. This API provides the means to control such power management hardware. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org>
2016-07-27dm: Use dm_scan_fdt_dev() directly where possibleSimon Glass
Quite a few places have a bind() method which just calls dm_scan_fdt_dev(). We may as well call dm_scan_fdt_dev() directly. Update the code to do this. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-07-27dm: Convert users from dm_scan_fdt_node() to dm_scan_fdt_dev()Simon Glass
This new function is more convenient for callers, and handles pre-relocation situations automatically. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-06-19clk: convert API to match reset/mailbox styleStephen Warren
The following changes are made to the clock API: * The concept of "clocks" and "peripheral clocks" are unified; each clock provider now implements a single set of clocks. This provides a simpler conceptual interface to clients, and better aligns with device tree clock bindings. * Clocks are now identified with a single "struct clk", rather than requiring clients to store the clock provider device and clock identity values separately. For simple clock consumers, this isolates clients from internal details of the clock API. * clk.h is split so it only contains the client/consumer API, whereas clk-uclass.h contains the provider API. This aligns with the recently added reset and mailbox APIs. * clk_ops .of_xlate(), .request(), and .free() are added so providers can customize these operations if needed. This also aligns with the recently added reset and mailbox APIs. * clk_disable() is added. * All users of the current clock APIs are updated. * Sandbox clock tests are updated to exercise clock lookup via DT, and clock enable/disable. * rkclk_get_clk() is removed and replaced with standard APIs. Buildman shows no clock-related errors for any board for which buildman can download a toolchain. test/py passes for sandbox (which invokes the dm clk test amongst others). Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org>
2016-06-19reset: implement a reset testStephen Warren
This adds a sandbox reset implementation (provider), a test client device, instantiates them both from Sandbox's DT, and adds a DM test that excercises everything. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org>
2016-06-03dm: test: Add GPIO open drain testsmario.six@gdsys.cc
Add some tests for the new open drain setting feature of the GPIO uclass, and extend the capabilities of the sandbox GPIO driver accordingly. Signed-off-by: Mario Six <mario.six@gdsys.cc> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: York Sun <york.sun@nxp.com>
2016-05-26mailbox: implement a sandbox testStephen Warren
This adds a sandbox mailbox implementation (provider), a test client device, instantiates them both from Sandbox's DT, and adds a DM test that excercises everything. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org> # v1
2016-05-26Rename reset to sysresetStephen Warren
The current reset API implements a method to reset the entire system. In the near future, I'd like to introduce code that implements the device tree reset bindings; i.e. the equivalent of the Linux kernel's reset API. This controls resets to individual HW blocks or external chips with reset signals. It doesn't make sense to merge the two APIs into one since they have different semantic purposes. Resolve the naming conflict by renaming the existing reset API to sysreset instead, so the new reset API can be called just reset. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org>
2016-05-17dm: mmc: test: Add tests for MMCSimon Glass
Add a simple test which checks that a sandbox-emulated SD card can be used correctly. This tests plumbing through the MMC stack's block-device implementaion. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17dm: sandbox: mmc: Enable building MMC code for sandboxSimon Glass
Enable building the MMC code for sandbox. This increases build coverage for sandbox. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-17dm: sandbox: Only enable the sandbox MMC driver when validSimon Glass
This driver will require generic MMC and block-device support in a future commit. To avoid test errors, make this change now. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-04-14test/dm/core.c: Make pre-reloc test use pre-reloc structTom Rini
LLVM 3.5 noted: test/dm/core.c:41:35: warning: unused variable 'test_pdata_pre_reloc' [-Wunused-const-variable] static const struct dm_test_pdata test_pdata_pre_reloc = { And the correct fix here is that the driver_info_pre_reloc test should use the test_pdata_pre_reloc not test_pdata_manual variable Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2016-04-01spmi: Add sandbox test driverMateusz Kulikowski
This patch adds emulated spmi bus controller with part of pm8916 pmic on it to sandbox and tests validating SPMI uclass. Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>