5a66a8ff | 23-Jul-2014 |
Simon Glass <sjg@chromium.org> |
dm: Introduce device sequence numbering
In U-Boot it is pretty common to number devices from 0 and access them on the command line using this numbering. While it may come to pass that we will move a
dm: Introduce device sequence numbering
In U-Boot it is pretty common to number devices from 0 and access them on the command line using this numbering. While it may come to pass that we will move away from this numbering, the possibility seems remote at present.
Given that devices within a uclass will have an implied numbering, it makes sense to build this into driver model as a core feature. The cost is fairly small in terms of code and data space.
With each uclass having numbered devices we can ask for SPI port 0 or serial port 1 and receive a single device.
Devices typically request a sequence number using aliases in the device tree. These are resolved when the device is probed, to deal with conflicts. Sequence numbers need not be sequential and holes are permitted.
At present there is no support for sequence numbers using static platform data. It could easily be added to 'struct driver_info' if needed, but it seems better to add features as we find a use for them, and the use of -1 to mean 'no sequence' makes the default value somewhat painful.
Signed-off-by: Simon Glass <sjg@chromium.org>
show more ...
|
4e8bc211 | 23-Jul-2014 |
Simon Glass <sjg@chromium.org> |
dm: Avoid activating devices in 'dm uclass' command
This command currently activates devices as it lists them. This is not desirable since it changes the system state. Fix it and avoid printing a ne
dm: Avoid activating devices in 'dm uclass' command
This command currently activates devices as it lists them. This is not desirable since it changes the system state. Fix it and avoid printing a newline if there are no devices in a uclass.
Signed-off-by: Simon Glass <sjg@chromium.org>
show more ...
|
00606d7e | 23-Jul-2014 |
Simon Glass <sjg@chromium.org> |
dm: Allow drivers to be marked 'before relocation'
Driver model currently only operates after relocation is complete. In this state U-Boot typically has a small amount of memory available. In adding
dm: Allow drivers to be marked 'before relocation'
Driver model currently only operates after relocation is complete. In this state U-Boot typically has a small amount of memory available. In adding support for driver model prior to relocation we must try to use as little memory as possible.
In addition, on some machines the memory has not be inited and/or the CPU is not running at full speed or the data cache is off. These can reduce execution performance, so the less initialisation that is done before relocation the better.
An immediately-obvious improvement is to only initialise drivers which are actually going to be used before relocation. On many boards the only such driver is a serial UART, so this provides a very large potential benefit.
Allow drivers to mark themselves as 'pre-reloc' which means that they will be initialised prior to relocation. This can be done either with a driver flag or with a 'dm,pre-reloc' device tree property.
To support this, the various dm scanning function now take a 'pre_reloc_only' parameter which indicates that only drivers marked pre-reloc should be bound.
Signed-off-by: Simon Glass <sjg@chromium.org>
show more ...
|
4d907025 | 12-Jun-2014 |
Stephen Warren <swarren@nvidia.com> |
sandbox: restore ability to access host fs through standard commands
Commit 95fac6ab4589 "sandbox: Use os functions to read host device tree" removed the ability for get_device_and_partition() to ha
sandbox: restore ability to access host fs through standard commands
Commit 95fac6ab4589 "sandbox: Use os functions to read host device tree" removed the ability for get_device_and_partition() to handle the "host" device type, and redirect accesses to it to the host filesystem. This broke some unit tests that use this feature. So, revert that change. The code added back by this patch is slightly different to pacify checkpatch.
However, we're then left with "host" being both: - A pseudo device that accesses the hosts real filesystem. - An emulated block device, which accesses "sectors" inside a file stored on the host.
In order to resolve this discrepancy, rename the pseudo device from host to hostfs, and adjust the unit-tests for this change.
The "help sb" output is modified to reflect this rename, and state where the host and hostfs devices should be used.
Signed-off-by: Stephen Warren <swarren@nvidia.com> Tested-by: Josh Wu <josh.wu@atmel.com> Acked-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
show more ...
|
cfd13e8d | 01-Mar-2014 |
Stephen Warren <swarren@wwwdotorg.org> |
unit-test: make "test -e" test independent of $CWD
The unit-test for hush's "test -e" currently relies upon being run in the U-Boot build directory, because it tests for the existence of a file that
unit-test: make "test -e" test independent of $CWD
The unit-test for hush's "test -e" currently relies upon being run in the U-Boot build directory, because it tests for the existence of a file that exists in that directory.
Fix this by explicitly creating the file we use for the existence test, and deleting it afterwards so that multiple successive unit-test invocations succeed. This required adding an os.c function to erase files.
Reported-by: Simon Glass <sjg@chromium.org> Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
show more ...
|
fe9ca3d3 | 01-Mar-2014 |
Stephen Warren <swarren@wwwdotorg.org> |
hush: fix some quoted variable expansion issues
The following shell command fails:
if test -z "$x"; then echo "zero"; else echo "non-zero"; fi
(assuming $x does not exist, it prints "non-zero" rat
hush: fix some quoted variable expansion issues
The following shell command fails:
if test -z "$x"; then echo "zero"; else echo "non-zero"; fi
(assuming $x does not exist, it prints "non-zero" rather than "zero").
... since "$x" expands to nothing, and the argument is completely dropped, causing too few to be passed to -z, causing cmd_test() to error out early.
This is because when variable expansions are processed by make_string(), the expanded results are concatenated back into a new string. However, no quoting is applied when doing so, so any empty variables simply don't generate any parameter when the combined string is parsed again.
Fix this by explicitly replacing quoting any argument that was originally quoted when re-generating a string from the already-parsed argument list.
This also fixes loss of whitespace in commands such as:
setenv space " " setenv var " 1${space}${space} 2 " echo ">>${var}<<"
Reported-by: Russell King <linux@arm.linux.org.uk> Acked-by: Simon Glass <sjg@chromium.org> Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
show more ...
|
96495d90 | 26-Feb-2014 |
Simon Glass <sjg@chromium.org> |
dm: Add GPIO support and tests
Add driver model support for GPIOs. Since existing GPIO drivers do not use driver model, this feature must be enabled by CONFIG_DM_GPIO. After all GPO drivers are conv
dm: Add GPIO support and tests
Add driver model support for GPIOs. Since existing GPIO drivers do not use driver model, this feature must be enabled by CONFIG_DM_GPIO. After all GPO drivers are converted over we can perhaps remove this config.
Tests are provided for the sandbox implementation, and are a sufficient sanity check for basic operation.
The GPIO uclass understands the concept of named banks of GPIOs, with each GPIO device providing a single bank. Within each bank the GPIOs are numbered using an offset from 0 to n-1. For example a bank named 'b' with 20 offsets will provide GPIOs named b0 to b19.
Anonymous GPIO banks are also supported, and are just numbered without any prefix.
Each time a GPIO driver is added to the uclass, the GPIOs are renumbered accordinging, so there is always a global GPIO numbering order.
Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Marek Vasut <marex@denx.de> Signed-off-by: Pavel Herrmann <morpheus.ibis@gmail.com> Signed-off-by: Viktor Křivák <viktor.krivak@gmail.com> Signed-off-by: Tomas Hlavacek <tmshlvck@gmail.com>
show more ...
|
06811959 | 26-Feb-2014 |
Simon Glass <sjg@chromium.org> |
dm: Add a 'dm' command for testing
This command is not required for driver model operation, but can be useful for testing. It provides simple dumps of internal data structures.
Signed-off-by: Simon
dm: Add a 'dm' command for testing
This command is not required for driver model operation, but can be useful for testing. It provides simple dumps of internal data structures.
Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Marek Vasut <marex@denx.de> Signed-off-by: Pavel Herrmann <morpheus.ibis@gmail.com> Signed-off-by: Viktor Křivák <viktor.krivak@gmail.com> Signed-off-by: Tomas Hlavacek <tmshlvck@gmail.com>
show more ...
|