1
0
Fork 0
Commit Graph

134 Commits (158a5196a5aed4cc5dc28348471e3cc641ee1cc9)

Author SHA1 Message Date
Tom Rini f09144a220 test/dm/core.c: Make pre-reloc test use pre-reloc struct
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-14 11:51:39 -06:00
Mateusz Kulikowski d33776e43d spmi: Add sandbox test driver
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>
2016-04-01 17:18:12 -04:00
Simon Glass e4fb863f6d dm: blk: Add tests for block devices
Add some tests to check that block devices work as expected.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>
2016-03-17 21:27:39 -06:00
Simon Glass 61ccd886e2 dm: usb: Clean up USB after each test
The USB subsystem has a few counters that need to be reset since they are
stored in static variables rather than driver-model data. An example is
usb_max_devs. Ultimately we should move this data into the USB uclass.

For now, make sure that USB is reset after each test, so that the counters
go back to zero.

Note: this is not a perfect solution: It a USB test fails it will exit
immediately and leave USB un-reset. The impact here is that it may cause
subsequence test failures in the same run.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-03-14 15:34:50 -06:00
Simon Glass 2a981dc2c6 dm: block: Adjust device calls to go through helpers function
To ease conversion to driver model, add helper functions which deal with
calling each block device method. With driver model we can reimplement these
functions with the same arguments.

Use inline functions to avoid increasing code size on some boards.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
2016-03-14 15:34:50 -06:00
Simon Glass ebac37cfbf dm: blk: Rename get_device() to blk_get_device_by_str()
The current name is too generic. The function returns a block device based
on a provided string. Rename it to aid searching and make its purpose
clearer. Also add a few comments.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
2016-03-14 15:34:50 -06:00
Simon Glass 4101f68792 dm: Drop the block_dev_desc_t typedef
Use 'struct' instead of a typdef. Also since 'struct block_dev_desc' is long
and causes 80-column violations, rename it to struct blk_desc.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
2016-03-14 15:34:50 -06:00
Simon Glass f8025b58f8 spi: Re-enable the SPI flash tests
These are working correctly again, so re-enable them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jagan Teki <jteki@openedev.com>
Tested-by: Jagan Teki <jteki@openedev.com>
2016-02-26 08:53:10 -07:00
Stephen Warren 1cd85f571d test/py: run all "ut" subtests
Invoke each "ut"-based unit test as a separate pytest.

Now that the DM unit test runs under test/py, remove the manual shell
script that invokes it.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org> # v2, on sandbox
2016-02-15 20:58:26 +00:00
Simon Glass a108082d4d video: test: Adjust order of file closure
Close the file earlier to hopefully fix a Coverity error.

Reported-by: Coverity (CID: 134901)

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-02-06 13:57:15 +01:00
Simon Glass 5674ead7d2 video: test: Add console tests for truetype
This adds tests for the different character types, line wrap, scrolling and
backspace.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-01-30 10:58:37 +01:00
Simon Glass 8df8dad528 video: sandbox: Enable truetype fonts for sandbox
Enable this feature so that truetype fonts can be used on the sandbox
console. Update the tests to select the normal/rotated console when needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
2016-01-30 10:58:26 +01:00
Simon Glass 5508f10ac9 video: Handle the 'bell' character
This can be sent when to many characters are entered. Make sure it is
ignored and does not cause a character to be displayed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-01-30 10:55:02 +01:00
Simon Glass f266178698 video: Use fractional units for X coordinates
With anti-aliased fonts we need a more fine-grained horizontal position
than a single pixel. Characters can be positioned to start part-way through
a pixel, with anti-aliasing (greyscale edges) taking care of the visual
effect.

To cope with this, use fractional units (1/256 pixel) for horizontal
positions in the text console.

Signed-off-by: Simon Glass <sjg@chromium.org>
[agust: rebased]
Signed-off-by: Anatolij Gustschin <agust@denx.de>
2016-01-30 10:53:26 +01:00
Stephen Warren 26e1beccbe test/dm: clear unit test failure count each run
The ut command prints a test failure count each time it is executed.
This is stored in a global variable which is never reset. Consequently,
the printed failure count accumulates across runs. Fix this by clearing
the counter each time "ut" is invoked.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
2016-01-28 21:01:24 -07:00
Simon Glass ac94b7bcbe dm: syscon: Allow finding devices by driver data
We have a way to find a regmap by its syscon driver data value. Add the same
for syscon itself.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2016-01-24 12:07:19 +08:00
Simon Glass 747440d0fa dm: video: test: Test that bitmap display works correctly
Add a test for the 'bmp' command. Test both the uncompressed and compressed
versions of the file, since they use different code paths.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
2016-01-20 19:10:16 -07:00
Simon Glass 85e08db85b dm: video: test: Add tests for rotated consoles
Test that text is displayed correctly when the console is rotated.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
2016-01-20 19:10:16 -07:00
Simon Glass 3c97c4fb52 dm: video: test: Add tests for the video uclass
Add tests that check that the video console is working correcty. Also check
that text output produces the expected result. Test coverage includes
character output, wrapping and scrolling.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Anatolij Gustschin <agust@denx.de>
2016-01-20 19:10:16 -07:00
Stephen Warren 7c4213f6a5 block: pass block dev not num to read/write/erase()
This will allow the implementation to make use of data in the block_dev
structure beyond the base device number. This will be useful so that eMMC
block devices can encompass the HW partition ID rather than treating this
out-of-band. Equally, the existence of the priv field is crying out for
this patch to exist.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-01-13 21:05:18 -05:00
Simon Glass c032241234 dm: test: Convert PCI tests to use the DM PCI API
Update these tests to use driver model API functions.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-01-12 10:19:09 -07:00
Simon Glass a57a817406 dm: test: usb: Update the USB tests so that they all pass
Due to a limitation removed in an earlier patch, USB tests were not seeing
all the devices. Update the tests to pass now that all devices are visible.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-01-11 15:29:31 -05:00
Simon Glass b042566dcf dm: Disable all SPI and SPI flash tests
This subsystem has been broken since commit:

  4efad20a  sf: Update status reg check in spi_flash_cmd_wait_ready

There has so far been no response from the maintainer, and a release is
imminent. For now, let's just disable the tests.

Signed-off-by: Simon Glass <sjg@chromium.org>
2016-01-07 10:27:07 -07:00
Tom Rini cbb2df2018 CONFIG_NEEDS_MANUAL_RELOC: Fix warnings when not set
Now that we may compile (but not link) code calling fixup_cmdtable when
this is not set, we need to always have the declaration available.  We
should also make sure that anyone calling the function includes
<command.h> as that's where the function declaration is.

Signed-off-by: Tom Rini <trini@konsulko.com>
2015-12-07 08:35:23 -05:00
Michal Simek d6df048bca dm: cmd: Relocate subcommands when MANUAL_RELOC
Subcommands contain pointers to functions which are not updated when
MANUAL_RELOC is enabled. This patch fix it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2015-12-07 10:14:30 +01:00
Simon Glass bff1a71ede dm: test: usb: sandbox: Add keyboard tests for sandbox
Add a test that verifies that USB keyboards work correctly on sandbox.
This verifies some additional parts of the USB stack.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-11-19 20:27:52 -07:00
Simon Glass cd716372b3 dm: test: usb: Add a test for device reordering
Add tests that 'usb tree' produces the right output when a device changes
order on the bus.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-11-19 20:27:52 -07:00
Simon Glass 431cbd6d82 dm: test: usb: Add tests for the 'usb tree' command
Add tests that this command produces the right output, even when a rescan
results in a device disappearing from the bus.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-11-19 20:27:52 -07:00
Simon Glass 9ce8b40206 test: Record and silence console in tests
When running sandbox tests, silence the console to avoid unwanted output.
Also, record the console in case tests want to check it.

The -v option can be used to enable stdout during tests.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-11-19 20:27:51 -07:00
Simon Glass 24b852a7a2 Move console definitions into a new console.h file
The console includes a global variable and several functions that are only
used by a small subset of U-Boot files. Before adding more functions, move
the definitions into their own header file.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-11-19 20:27:50 -07:00
Simon Glass 3884c98c32 dm: usb: Avoid time delays in sandbox tests
Currently the USB tests take around two seconds to run. Remove these
unnecessary time delays so that the tests run quickly.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-11-19 20:27:50 -07:00
Thomas Chou 9961a0b6fb sandbox: add a sandbox timer and basic test
Add a sandbox timer which get time from host os and a basic
test.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Reviewed-by: Simon Glass <sjg@chromium.org>
2015-11-19 20:13:41 -07:00
Przemyslaw Marczak c48cb7ebfb sandbox: add ADC unit tests
This commit adds unit tests for ADC uclass's methods using sandbox ADC.

Testing proper ADC binding:
- dm_test_adc_bind()                    - device binding
- dm_test_adc_wrong_channel_selection() - checking wrong channel selection

Testing ADC supply operations:
- dm_test_adc_supply():
  - Vdd/Vss values validating
  - Vdd regulator updated value validating
  - Vdd regulator's auto enable state validating

Testing ADC operations results:
- dm_test_adc_single_channel_conversion() - single channel start/data
- dm_test_adc_single_channel_shot()       - single channel shot
- dm_test_adc_multi_channel_conversion()  - multi channel start/data
- dm_test_adc_multi_channel_shot()        - multi channel single shot

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
2015-11-02 10:38:00 +09:00
Tom Rini 0eb4cf9c14 Merge branch 'master' of git://git.denx.de/u-boot-net 2015-10-29 16:30:33 -04:00
Bin Meng 6d9764c2a8 dm: test: Add a new test case against dm eth codes for NULL pointer access
U-Boot crashes when doing a 'ping' with the following test scenario:

  - All ethernet devices are not probed
  - "ethaddr" for all ethernet devices are not set
  - "ethact" is set to a valid ethernet device name

Add a new test case 'dm_test_eth_act' to hit such scenario.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2015-10-29 14:05:52 -05:00
Simon Glass bcbe3d1579 dm: Rename dev_get_parentdata() to dev_get_parent_priv()
The current name is inconsistent with other driver model data access
functions. Rename it and fix up all users.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2015-10-23 09:42:28 -06:00
Nishanth Menon bfaa2d99dc test: Add basic tests for remoteproc
Use the sandbox environment for the basic tests.

Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Nishanth Menon <nm@ti.com>
Acked-by: Simon Glass <sjg@chromium.org>
2015-10-22 14:18:40 -04:00
Simon Glass cbfc2ff9da dm: test: Show the amount of leaked memory on error
Adjust the memory leak tests to show the amount of memory leaked. This can
be a useful signal as to what is wrong.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-10-05 15:47:49 +01:00
Bin Meng 71d7971fac dm: test: Add a new test case for dm_test_eth_rotate
Add one more ethernet device node in the sandbox test device tree,
with name 'sbe5'. This is to support a new test case for testing
network device rotation.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2015-09-09 07:48:03 -06:00
Masahiro Yamada 40b6f2d020 devres: add debug command to dump device resources
This new command can dump all device resources associated to
each device.  The fields in every line shows:
  - The address of the resource
  - The size of the resource
  - The name of the release function
  - The stage in which the resource has been acquired (BIND/PROBE)

Currently, there is no driver using devres, but if such drivers are
implemented, the output of this command should look like this:

=> dm devres
- root_driver
- soc
- extbus
- serial@54006800
    bfb541e8 (8 byte) devm_kmalloc_release  BIND
    bfb54440 (4 byte) devm_kmalloc_release  PROBE
    bfb54460 (4 byte) devm_kmalloc_release  PROBE
- serial@54006900
    bfb54270 (8 byte) devm_kmalloc_release  BIND
- gpio@55000000
- i2c@58780000
    bfb5bce8 (12 byte) devm_kmalloc_release  PROBE
    bfb5bd10 (4 byte) devm_kmalloc_release  PROBE
- eeprom
    bfb54418 (12 byte) devm_kmalloc_release  BIND

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Simon Glass <sjg@chromium.org>
2015-08-06 07:44:29 -06:00
Simon Glass 86075bab27 test: Add a test for regmap
We use syscon to test that the regmap functions work as expected.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-07-21 17:39:33 -06:00
Simon Glass 04035fd36c dm: test: Add a test for the system controller uclass
Add a test to confirm that we can access system controllers and find their
driver data.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-07-21 17:39:33 -06:00
Simon Glass 3c43fba3d2 dm: test: Add a test for the LED uclass
Add a test to confirm that we can adjust LEDs using the led_gpio driver.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-07-21 17:39:32 -06:00
Simon Glass 8e6cc46178 dm: test: Add a test for the mmc uclass
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>
2015-07-21 17:39:32 -06:00
Simon Glass 64ce0cad9e dm: test: Add a test for the ram uclass
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>
2015-07-21 17:39:32 -06:00
Simon Glass 201c29a2d6 dm: test: Add a test for the reset uclass
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>
2015-07-21 17:39:31 -06:00
Simon Glass 6a1c7cef14 dm: test: Add tests for the clk uclass
Add tests of each API call using a sandbox clock device.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-07-21 17:39:30 -06:00
Simon Glass c02790ce12 dm: test: Allow test names to leave out the dm_test_ prefix
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>
2015-07-21 17:39:30 -06:00
Simon Glass 3b55d30f6f dm: pmic: Split output from function
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>
2015-07-21 17:39:26 -06:00
Simon Glass 304fbef156 dm: Move the tree/uclass dump code into its own file
In SPL it is sometimes useful to be able to obtain a dump of the current
driver model state. Since commands are not available, provide a way to
directly call the functions to output this information.

Adjust the existing commands to use these functions.

Signed-off-by: Simon Glass <sjg@chromium.org>
2015-07-21 17:39:22 -06:00