summaryrefslogtreecommitdiffstats
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* net: cosmetic: Change IPaddr_t to struct in_addrJoe Hershberger2015-04-181-5/+5
| | | | | | | | | This patch is simply clean-up to make the IPv4 type that is used match what Linux uses. It also attempts to move all variables that are IP addresses use good naming instead of CamelCase. No functional change. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* dm: usb: Add tests for the USB uclassSimon Glass2015-04-184-0/+95
| | | | | | | | This adds a simple test for probing and a functional test using the flash stick emulator, which tests a large chunk of the USB stack. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
* dm: test: Allow 'dm test' to select a particular test to runSimon Glass2015-04-182-5/+13
| | | | | | | As well as running all tests, it is useful to be able to run a selected test. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
* dm: test: Correct printf() output nit in 'dm uclass'Simon Glass2015-04-181-1/+1
| | | | | | | Neither the hyphen nor the equals sign is needed. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
* dm: core: Mark device as active before calling uclass probe() methodsSimon Glass2015-04-181-1/+2
| | | | | | | | | | The uclass pre-probe functions may end up calling back into the device in some circumstances. This can fail if recursion takes place. Adjust the ordering so that we mark the device as active early, then retract this later if needed. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
* dm: test: bus: Use a local variable to simplify codeSimon Glass2015-04-181-6/+10
| | | | | | | Adjust this test to avoid repeating the same code too often. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
* net: Improve error handlingJoe Hershberger2015-04-181-2/+2
| | | | | | | | | | | | Take a pass at plumbing errors through to the users of the network stack Currently only the start() function errors will be returned from NetLoop(). recv() tends not to have errors, so that is likely not worth adding. send() certainly can return errors, but this patch does not attempt to plumb them yet. halt() is not expected to error. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: dm: net: Add a test of the netretry behaviorJoe Hershberger2015-04-181-0/+32
| | | | | | | | The effect of the "netretry" env var was recently changed. This test checks that behavior. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: dm: eth: Add testing for ethrotate env varJoe Hershberger2015-04-181-0/+42
| | | | | | | Make sure that the ethrotate behavior occurs as expected. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* dm: eth: Add support for ethprime env varJoe Hershberger2015-04-181-0/+20
| | | | | | | | The ethprime env var is used to indicate the starting device if none is specified in ethact. Also support aliases specified in the ethprime var. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* dm: eth: Add support for aliasesJoe Hershberger2015-04-182-1/+27
| | | | | | | | | | Allow network devices to be referred to as "eth0" instead of "eth@12345678" when specified in ethact. Add tests to verify this behavior. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: dm: eth: Add tests for the eth dm implementationJoe Hershberger2015-04-183-0/+57
| | | | | | | | | Add a test for the eth uclass using the sandbox eth driver. Verify basic functionality of the network stack / eth uclass by exercising the ping function. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* common: Make sure arch-specific map_sysmem() is definedJoe Hershberger2015-04-182-0/+2
| | | | | | | | | | | In the case where the arch defines a custom map_sysmem(), make sure that including just mapmem.h is sufficient to have these functions as they are when the arch does not override it. Also split the non-arch specific functions out of common.h Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: dm: Reorder the objects to buildJoe Hershberger2015-04-181-2/+2
| | | | | Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* dm: pci: Add driver model tests for PCISimon Glass2015-04-183-0/+77
| | | | | | Add some basic tests to check that things work as expected with sandbox. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: Show both allocated and requested seq numbers in 'dm uclass'Simon Glass2015-04-161-2/+2
| | | | | | | | | | Both of these values are useful for understanding what is going on, so show them both. The requested number comes from a device tree alias. The allocated one is set up when the device is activated, and is unique throughout the uclass. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Add a uclass pre_probe() method for devicesSimon Glass2015-04-162-1/+18
| | | | | | | | | | | | Some uclasses want to set up a device before it is probed. Add a method for this. An example is with PCI, where a PCI uclass wants to set up its private data for later use. This allows the device's uclass() method to make calls whcih use that data (for example, read PCI memory regions from device tree, set up bus numbers). Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Add dev_get_uclass_priv() to access uclass private dataSimon Glass2015-04-162-3/+3
| | | | | | | | Add a convenience function to access the private data that a uclass stores for each of its devices. Convert over most existing uses for consistency and to provide an example for others. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: test: Add a Kconfig fileSimon Glass2015-02-122-0/+9
| | | | | | | Add a file to control driver model test features. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
* dm: i2c: Add a dm_ prefix to driver model bus speed functionsSimon Glass2015-02-121-3/+3
| | | | | | | | As with i2c_read() and i2c_write(), add a dm_ prefix to the driver model versions of these functions to avoid conflicts. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de>
* Merge branch 'master' of git://git.denx.de/u-boot-dmTom Rini2015-01-308-51/+411
|\
| * dm: spi: Move slave details to child platdataSimon Glass2015-01-291-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present we go through various contortions to store the SPI slave's chip select in its private data. This only exists when the slave is active so must be set up when it is probed. Until the device is probed we don't actually know what chip select it will appear on. However, now that we can support per-child platform data, we can use that instead. This allows us to set up the chip select when the child is bound, and avoid the messy contortions. Unfortunately this is a fairly large change and it seems to be difficult to break it down further. Signed-off-by: Simon Glass <sjg@chromium.org>
| * dm: core: Allow uclass to set up a device's child before it is probedSimon Glass2015-01-292-0/+53
| | | | | | | | | | | | | | | | | | Some buses need to set up their devices before they can be used. This setup may well be common to all buses in a particular uclass. Support a common pre-probe method for the uclass, called before any bus devices are probed. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
| * dm: core: Allow the uclass to set up a device's child after bindingSimon Glass2015-01-291-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | For buses, after a child is bound, allow the uclass to perform some processing. This can be used to figure out the address of the child (e.g. the chip select for SPI slaves) so that it is ready to be probed. This avoids bus drivers having to repeat the same process, which really should be done by the uclass, since it is common. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
| * dm: core: Allow uclasses to specify private data for a device's childrenSimon Glass2015-01-291-2/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In many cases the per-child private data for a device's children is defined by the uclass rather than the individual driver. For example, a SPI bus needs to store information about each of its children, but all SPI drivers store the same information. It makes sense to allow the uclass to define this data. If the driver provides a size value for its per-child private data, then use it. Failng that, fall back to that provided by the uclass. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
| * dm: core: Add a flag to control sequence numberingSimon Glass2015-01-293-5/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present we try to use the 'reg' property and device tree aliases to give devices a sequence number. The 'reg' property is often actually a memory address, so the sequence numbers thus-obtained are not useful. It would be better if the devices were just sequentially numbered in that case. In fact neither I2C nor SPI use this feature, so drop it. Some devices need us to look up an alias to number them within the uclass. Add a flag to control this, so it is not done unless it is needed. Adjust the tests to test this new behaviour. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
| * dm: core: Add a function to get a device's uclass IDSimon Glass2015-01-291-0/+11
| | | | | | | | | | | | | | This is useful to check which uclass a device is in. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
| * dm: core: Add a post_bind method for parentsSimon Glass2015-01-291-0/+35
| | | | | | | | | | | | | | | | Allow parent drivers to be called when a new child is bound to them. This allows a bus to set up information it needs for that child. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
| * dm: core: Allow uclasses to specify platdata for a device's childrenSimon Glass2015-01-291-2/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In many cases the child platform data for a device's children is defined by the uclass rather than the individual devices. For example, a SPI bus needs to know the chip select and speed for each of its children. It makes sense to allow this information to be defined the SPI uclass rather than each individual driver. If the device provides a size value for its child platdata, then use it. Failng that, fall back to that provided by the uclass. Reviewed-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Signed-off-by: Simon Glass <sjg@chromium.org>
| * dm: core: Allow parents to have platform data for their childrenSimon Glass2015-01-291-0/+81
| | | | | | | | | | | | | | | | | | | | | | | | For buses it is common for parents to need to know the address of the child on the bus, the bus speed to use for that child, and other information. This can be provided in platform data attached to each child. Add driver model support for this, including auto-allocation which can be requested using a new property to specify the size of the data. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
| * dm: core: Allocate platform data when binding a deviceSimon Glass2015-01-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | When using allocated platform data, allocate it when we bind the device. This makes it possible to fill in this information before the device is probed. This fits with the platform data model (when not using device tree), since platform data exists at bind-time. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
| * dm: Don't run tests if U-Boot cannot be builtSimon Glass2015-01-291-2/+7
| | | | | | | | | | | | | | There is no point in running the tests if U-Boot cannot be built. Abort in this case. Signed-off-by: Simon Glass <sjg@chromium.org>
| * dm: i2c: Provide an offset length parameter where neededSimon Glass2015-01-291-5/+5
| | | | | | | | | | | | | | | | | | | | Rather than assuming that the chip offset length is 1, allow it to be provided. This allows chips that don't use the default offset length to be used (at present they are only supported by the command line 'i2c' command which sets the offset length explicitly). Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de>
| * dm: i2c: Rename driver model I2C functions to permit compatibilitySimon Glass2015-01-291-30/+30
| | | | | | | | | | | | | | | | | | | | | | Add a dm_ prefix to driver model I2C functions so that we can keep the old ones around. This is a little unfortunate, but on reflection it is too difficult to change the API. We can undo this rename when most boards and drivers are converted to use driver model for I2C. Signed-off-by: Simon Glass <sjg@chromium.org>
| * dm: gpio: Add better functions to request GPIOsSimon Glass2015-01-292-2/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present U-Boot sort-of supports the standard way of reading GPIOs from device tree nodes, but the support is incomplete, a bit clunky and only works for GPIO bindings where #gpio-cells is 2. Add new functions to request GPIOs, taking full account of the device tree binding. These permit requesting a GPIO with a simple call like: gpio_request_by_name(dev, "cd-gpios", 0, &desc, GPIOD_IS_IN); This will request the GPIO, looking at the device's node which might be this, for example: cd-gpios = <&gpio TEGRA_GPIO(B, 3) GPIO_ACTIVE_LOW>; The GPIO will be set to input mode in this case and polarity will be honoured by the GPIO calls. It is also possible to request and free a list of GPIOs. Signed-off-by: Simon Glass <sjg@chromium.org>
* | dumpimage: fit: extract FIT imagesGuilherme Maciel Ferreira2015-01-291-1/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The dumpimage is able to extract components contained in a FIT image: $ ./dumpimage -T flat_dt -i CONTAINER.ITB -p INDEX FILE The CONTAINER.ITB is a regular FIT container file. The INDEX is the poisition of the sub-image to be retrieved, and FILE is the file (path+name) to save the extracted sub-image. For example, given the following kernel.its to build a kernel.itb: /dts-v1/; / { ... images { kernel@1 { description = "Kernel 2.6.32-34"; data = /incbin/("/boot/vmlinuz-2.6.32-34-generic"); type = "kernel"; arch = "ppc"; os = "linux"; compression = "gzip"; load = <00000000>; entry = <00000000>; hash@1 { algo = "md5"; }; }; ... }; ... }; The dumpimage can extract the 'kernel@1' node through the following command: $ ./dumpimage -T flat_dt -i kernel.itb -p 0 kernel Extracted: Image 0 (kernel@1) Description: Kernel 2.6.32-34 Created: Wed Oct 22 15:50:26 2014 Type: Kernel Image Compression: gzip compressed Data Size: 4040128 Bytes = 3945.44 kB = 3.85 MB Architecture: PowerPC OS: Linux Load Address: 0x00000000 Entry Point: 0x00000000 Hash algo: md5 Hash value: 22352ad39bdc03e2e50f9cc28c1c3652 Which results in the file 'kernel' being exactly the same as '/boot/vmlinuz-2.6.32-34-generic'. Signed-off-by: Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
* | dumpimage: add 'T' option to explicitly set the image typeGuilherme Maciel Ferreira2015-01-291-22/+26
|/ | | | | | | | | | Some image types, like "KeyStone GP", do not have magic numbers to distinguish them from other image types. Thus, the automatic image type discovery does not work correctly. This patch also fix some integer type mismatches. Signed-off-by: Guilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
* test: Add unit tests for bootm image decompressionSimon Glass2015-01-141-0/+84
| | | | | | | Use each compression method (including uncompressed). Test for normal operation, insufficient space and corrupted data. Signed-off-by: Simon Glass <sjg@chromium.org>
* test: Rename test_compression to ut_compressionSimon Glass2015-01-141-5/+4
| | | | | | Try to keep the names of the unit test commands consistent. Signed-off-by: Simon Glass <sjg@chromium.org>
* test: Add DEBUG output option to test-fit.pySimon Glass2015-01-141-0/+10
| | | | | | | Sometimes it is useful to see the output from U-Boot, so add an option to make this easier. Signed-off-by: Simon Glass <sjg@chromium.org>
* sandbox: Correct ordering of 'sb save' commandsSimon Glass2015-01-142-4/+4
| | | | | | | | Prior to commit d455d87 there was an inconsistency between the position of the 'address' parameter in 'sb load' and 'sb save'. This was corrected but it broke some tests. Fix the tests and also the help for 'sb save'. Signed-off-by: Simon Glass <sjg@chromium.org>
* Merge git://git.denx.de/u-boot-dmTom Rini2014-12-114-51/+286
|\
| * dm: i2c: Add tests for I2CSimon Glass2014-12-113-0/+234
| | | | | | | | | | | | | | Add some basic tests to check that the system works as expected. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de>
| * dm_test: improve the appearance shown by "dm tree" commandMasahiro Yamada2014-12-111-51/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The command "dm tree" lists devices in a tree-like format. This commit makes it look more like what the Unix command "tree" shows. => dm tree Class Probed Name ---------------------------------------- root [ + ] root_driver demo [ ] |-- demo_shape_drv demo [ ] |-- demo_simple_drv demo [ ] |-- demo_shape_drv demo [ ] |-- demo_simple_drv demo [ ] |-- demo_shape_drv test [ ] |-- test_drv test [ ] |-- test_drv test [ ] |-- test_drv gpio [ ] |-- gpio_sandbox serial [ ] |-- serial_sandbox serial [ + ] |-- serial demo [ ] |-- triangle demo [ ] |-- square demo [ ] |-- hexagon gpio [ ] |-- gpios spi [ ] |-- spi@0 spi_emul [ ] | `-- flash@0 cros_ec [ + ] `-- cros-ec@0 Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
* | Merge branch 'master' of git://git.denx.de/u-boot-usbTom Rini2014-12-111-1/+9
|\ \ | |/ |/| | | | | | | | | Conflicts: board/freescale/mx6sxsabresd/mx6sxsabresd.c Signed-off-by: Tom Rini <trini@ti.com>
| * test: ums: Add sleep before unmount directoryLukasz Majewski2014-11-141-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change helps to run script on machines with quite long uptime. Without this the following error emerges: File: ./dat_14M.img umount: /mnt/tmp-ums-test: device is busy. (In some cases useful info about processes that use the device is found by lsof(8) or fuser(1)) TX: md5sum:083d3d22b542d3ecba61b12d17e03f9f mount: /dev/sdd6 already mounted or /mnt/tmp-ums-test busy mount: according to mtab, /dev/sdd6 is already mounted on /mnt/tmp-ums-test Signed-off-by: Lukasz Majewski <l.majewski@samsung.com> Reviewed-by: Stephen Warren <swarren@nvidia.com>
* | sandbox: script for testing sandbox/ext4/fat/fs commandsSuriyan Ramasami2014-11-231-0/+561
|/ | | | | | | | Test size/read/write commands in a sandbox environment. Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
* hush: make run_command() return an error on parsing failureRabin Vincent2014-11-071-0/+2
| | | | | | | | run_command() returns success even if the command had a syntax error; correct this behaviour. Signed-off-by: Rabin Vincent <rabin@rab.in> Acked-by: Simon Glass <sjg@chromium.org)
* hush: return consistent codes from run_command()Rabin Vincent2014-11-071-0/+3
| | | | | | | | | | | | | Attempting to run: - an empty string - a string with just spaces returns different error codes, 1 for the empty string and 0 for the string with just spaces. Make both of them return 0 for consistency. Signed-off-by: Rabin Vincent <rabin@rab.in> Acked-by: Simon Glass <sjg@chromium.org)
* test: Add a simple test to detected warnings with uint64_t, uintptr_tSimon Glass2014-10-272-0/+71
| | | | | | | | | | | | | These types are problematic because they are typically declared in a non-standard way in U-Boot. For example, U-Boot uses 'long long' for int64_t even on a 64-bit machine whereas stdint.h uses 'long'. Similarly, U-Boot always uses 'long' for intptr_t whereas stdint.h mostly uses 'int'. This simple test script runs a few toolchains on a few archs to check for warnings. Signed-off-by: Simon Glass <sjg@chromium.org>
OpenPOWER on IntegriCloud