Simon Glass [Mon, 26 Oct 2020 23:40:21 +0000 (17:40 -0600)]
binman: Call CheckSize() from the section's Pack() method
At present CheckSize() is called from the function that packs the entries.
Move it up to the main Pack() function so that _PackEntries() can just
do the packing.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 23:40:20 +0000 (17:40 -0600)]
binman: Drop the Entry.CheckSize() method
This is only used by entry_Section and that class already calls it. Avoid
calling it twice. Also drop it from the documentation.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 23:40:19 +0000 (17:40 -0600)]
binman: Move sort and expand to the main Pack() function
At present sorting and expanding entries are side-effects of the
CheckEntries() function. This is a bit confusing, as 'checking' would
not normally involve making changes.
Move these steps into the Pack() function instead.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 23:40:18 +0000 (17:40 -0600)]
binman: Drop Entry.CheckOffset()
This function just calls CheckEntries() in the only non-trivial
implementation. Drop it and use CheckEntries() directly.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 23:40:17 +0000 (17:40 -0600)]
binman: Avoid reporting image-pos with compression
When a section is compressed, all entries within it are grouped together
into a compressed block of data. This obscures the start of each
individual child entry.
Avoid reporting bogus 'image-pos' properties in this case, since it is
not possible to access the entry at the location provided. The entire
section must be decompressed first.
CBFS does not support compressing whole sections, only individual files,
so needs no special handling here.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 23:40:16 +0000 (17:40 -0600)]
binman: Set section contents in GetData()
Section contents is not set up when ObtainContents() is called, since
packing often changes the layout of the contents. Ensure that the contents
are correctly recorded by making this function regenerate the section. It
is normally only called by the parent section (when packing) or by the
top-level image code, when writing out the image. So the performance
impact is fairly small.
Now that sections have their contents in their 'data' property, update
testSkipAtStartSectionPad() to check it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 23:40:15 +0000 (17:40 -0600)]
binman: Store the original data before compression
When compressing an entry, the original uncompressed data is overwritten.
Store it so it is available if needed.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 23:40:14 +0000 (17:40 -0600)]
binman: Make section padding consistent with other entries
At present padding of sections is inconsistent with other entry types, in
that different pad bytes are used.
When a normal entry is padded by its parent, the parent's pad byte is
used. But for sections, the section's pad byte is used.
Adjust logic to always do this the same way.
Note there is still a special case in entry_Section.GetPaddedData() where
an image is padded with the pad byte of the top-level section. This is
necessary since otherwise there would be no way to set the pad byte of
the image, without adding a top-level section to every image.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 23:40:13 +0000 (17:40 -0600)]
binman: Move section padding to the parent
Each section is padded up to its size, if the contents are not large
enough. Move this logic from _BuildSectionData() to
GetPaddedDataForEntry() so that all the padding is in one place.
With this, the testDual test is working again, so enable it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 23:40:12 +0000 (17:40 -0600)]
binman: Refactor _BuildSectionData()
At present this function does the padding needed around an entry. It is
easier to understand what is going on if we have a function that returns
the contents of an entry, with padding included.
Refactor the code accordingly, adding a new GetPaddedData() method.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 23:40:11 +0000 (17:40 -0600)]
binman: Move section-building code into a function
Create a new _BuildSectionData() to hold the code that is now in
GetData(), so that it is clearly separated from entry.GetData() base
function.
Separate out the 'pad-before' processing to make this easier to
understand.
Unfortunately this breaks the testDual test. Rather than squash several
patches into an un-reviewable glob, disable the test for now.
This also affects testSkipAtStartSectionPad(), although it still not
quite what it should be. Update that temporarily for now.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 23:40:10 +0000 (17:40 -0600)]
binman: Expand docs and test for alignment
Alignment does form part of the entry once the image is written out, but
within binman the entry contents does not include the padding. Add
documentation to make this clear, as well as a test.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 23:40:09 +0000 (17:40 -0600)]
binman: Expand docs and test for padding
Padding becomes part of the entry once the image is written out, but
within binman the entry contents does not include the padding. Add
documentation to make this clear, as well as a test.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 23:40:08 +0000 (17:40 -0600)]
binman: Update testPackExtra with more checks
Check the contents of each section to make sure it is actually in the
right place.
Also fix a whitespace error in the .dts file.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 23:40:07 +0000 (17:40 -0600)]
binman: Use 'files-compress' to set compression for files
At present we use 'compress' as the property to set the compression of
a 'files' entry. But this conflicts with the same property for entries,
of which Entry_section is a subclass.
Strictly speaking, since Entry_files is in fact a subclass of
Entry_section, the files can be compressed individually but also the
section (that contains all the files) can itself be compressed. With this
change, it is possible to express that.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 23:40:06 +0000 (17:40 -0600)]
binman: Move CompressData() into Entry base class
At present this is only used by blobs. To allow it to be used by other
entry types (such as sections), move it into the base class.
Also read the compression type in the base class.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 23:40:05 +0000 (17:40 -0600)]
binman: Expand the error message for breaching a section
Add in a few more details to this error message to make it easier to see
what is going on.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 23:40:04 +0000 (17:40 -0600)]
binman: Remove references to 'image' in entry_Section
While a section is the base class of Image, it is more correct to refer
to sections in most places in this file. Fix these comments.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 23:40:03 +0000 (17:40 -0600)]
binman: Fix return from u-boot-ucode if there is no DT
This should return empty contents, not leave it unset. Fix it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 23:40:02 +0000 (17:40 -0600)]
binman: Give a sensible error if no command is given
At present if 'binman' is typed on the command line, a strange error about
a missing argument is displayed. Fix this.
These does not seem to be standard way to add the 'required' argument in
all recent Python versions, so set it manually.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 23:40:01 +0000 (17:40 -0600)]
binman: Add tests for skip-at-start sections
At present this feature is tested view the end-at-4gb feature. Add some
tests of its own, including the operation of padding.
The third test here shows binman's current, inconsistent approach to
padding in the top-level section. Future patches in this series will
address this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 23:40:00 +0000 (17:40 -0600)]
binman: Drop unused return variable for _DoTestFile()
This function returns the exit code from binman, not any data. Fix up a
few callers in the tests.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 23:39:59 +0000 (17:39 -0600)]
binman: Update the entry docs
This has got out of sync with the entries. Regenerate it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Sat, 3 Oct 2020 17:31:42 +0000 (11:31 -0600)]
dm: doc: Update the of-platadata documentation
Update this to incorporate the parent feature as well as other recent
developments.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Sat, 3 Oct 2020 17:31:41 +0000 (11:31 -0600)]
dm: Don't allow U_BOOT_DEVICE() when of-platdata is used
With of-platdata, the devicetree is supposed to specify all the devices
in the system. So far this hasn't really mattered since of-platdata still
works correctly.
However, new of-platdata features rely on numbering the devices in a
particular order so that they can be referenced by a single integer. It is
tricky to implement this efficiently when other devices are present in the
build.
To address this, disable use of U_BOOT_DEVICE() when of-platdata is
enabled. This seems acceptable as it is not supposed to be used at all,
except in SPL/TPL, where of-platdata is the recommended approach.
This breaks one non-compliant boards at present: mx6cuboxi
Signed-off-by: Simon Glass <sjg@chromium.org>
(disable CONFIG_IMX_THERMAL for mx6cuboxi to avoid a build error)
Simon Glass [Thu, 29 Oct 2020 17:08:25 +0000 (11:08 -0600)]
imx: mx6cuboxi: Disable thermal driver in SPL
This feature is incompatble with of-platdata since it uses the
U_BOOT_DEVICE() macro. With of-platdata the only devices permitted are
those created by dtoc.
The driver is not used in SPL anyway, so exclude it from that build.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Simon Glass [Sat, 3 Oct 2020 17:31:40 +0000 (11:31 -0600)]
dm: Use driver_info index instead of pointer
At present we use a 'node' pointer in the of-platadata phandle_n_arg
structs. This is a pointer to the struct driver_info for a particular
device, and we can use it to obtain the struct udevice pointer itself.
Since we don't know the struct udevice pointer until it is allocated in
memory, we have to fix up the phandle_n_arg.node at runtime. This is
annoying since it requires that SPL's data is writable and adds a small
amount of extra (generated) code in the dm_populate_phandle_data()
function.
Now that we can find a driver_info by its index, it is easier to put the
index in the phandle_n_arg structures.
Update dtoc to do this, add a new device_get_by_driver_info_idx() to look
up a device by drive_info index and update the tests to match.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Sat, 3 Oct 2020 17:31:39 +0000 (11:31 -0600)]
x86: apl: Take advantage of the of-platdata parent support
Now that parent devices are supported with of-platadata, we don't need the
messy code to fix up the parent pointers and allocations on Apollo Lake.
Put the code behind a condition.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Sat, 3 Oct 2020 17:31:38 +0000 (11:31 -0600)]
x86: apl: Enable SPI flash in TPL with APL_SPI_FLASH_BOOT
At present, enabling CONFIG_APL_SPI_FLASH_BOOT does not build since SPI
and SPI flash are not enabled for TPL. Add a condition to fix this and
tidy up a build warning in the SPI-flash driver.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Sat, 3 Oct 2020 17:31:37 +0000 (11:31 -0600)]
dm: core: Convert #ifdef to if() in root.c
Convert a few conditions to use compile-time checks to reduce the number
of build paths.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Sat, 3 Oct 2020 17:31:36 +0000 (11:31 -0600)]
dm: Add a test for of-platdata parent information
Add a simple test that we can obtain the correct parent for an I2C
device. This requires updating the driver names to match the compatible
strings, adding them to the devicetree and enabling a few options.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Sat, 3 Oct 2020 17:31:35 +0000 (11:31 -0600)]
dm: Support parent devices with of-platdata
At present of-platdata does not provide parent information. But this is
useful for I2C devices, for example, since it allows them to determine
which bus they are on.
Add support for setting the parent correctly, by storing the parent
driver_info index in dtoc and reading this in lists_bind_drivers(). This
needs multiple passes since we must process children after their parents
already have been bound.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Sat, 3 Oct 2020 17:31:34 +0000 (11:31 -0600)]
sandbox: Fix up building for of-platdata
There is no devicetree with of-platdata. Update a few uclasses to allow
them to be built for sandbox_spl. Also drop the i2c-gpio from SPL to avoid
build errors, since it does not support of-platdata.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Sat, 3 Oct 2020 17:31:33 +0000 (11:31 -0600)]
dm: Use an allocated array for run-time device info
At present we update the driver_info struct with a pointer to the device
that it created (i.e. caused to be bound). This works fine when U-Boot SPL
is stored in read-write memory. But on some platforms, such as Intel
Apollo Lake, it is not possible to update the data memory.
In any case, it is bad form to put this information in a structure that is
in the data region, since it expands the size of the binary.
Create a new driver_rt structure which holds runtime information about
drivers. Update the code to store the device pointer in this instead.
Also update the test check that this works.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Sat, 3 Oct 2020 17:31:32 +0000 (11:31 -0600)]
dm: test: Add a test for of-platdata phandles
We have a test in dtoc for this feature, but not one in U-Boot itself.
Add a simple test that checks that the information comes through
correctly.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Sat, 3 Oct 2020 17:31:31 +0000 (11:31 -0600)]
dm: test: Add a check that all devices have a dev value
With of-platdata, the driver_info struct is updated with the device
pointer when it is bound. This makes it easy for a device to be found by
its driver info with the device_get_by_driver_info() function.
Add a test that all devices (except the root device) have such an entry.
Fix a bug that the function does not set *devp to NULL on failure, which
the documentation asserts.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Sat, 3 Oct 2020 17:31:28 +0000 (11:31 -0600)]
dm: Add a C test for of-platdata properties
At present properties are tested in a roundabout way. The driver's probe()
method writes out the values of the properties and the Python test checks
the output from U-Boot SPL.
Add a C test which checks these values more directly.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 02:38:36 +0000 (20:38 -0600)]
Azure/GitLab/Travis: Add SPL unit tests
Run SPL unit tests in all test environments.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 02:38:35 +0000 (20:38 -0600)]
dm: test: Drop of-platdata pytest
Now that we have a C version of this test, drop the Python implementation.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 02:38:34 +0000 (20:38 -0600)]
test: Run only the selected SPL test
Use the new -k option to select the test to run.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 02:38:33 +0000 (20:38 -0600)]
sandbox: Allow selection of SPL unit tests
Now that we have more than one test, add a way to select the test to run.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 02:38:32 +0000 (20:38 -0600)]
test: Run SPL unit tests
Update the 'run' script to include SPL unit tests.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 02:38:31 +0000 (20:38 -0600)]
pytest: Collect SPL unit tests
Add a new test_spl fixture to handle running SPL unit tests.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 02:38:30 +0000 (20:38 -0600)]
Makefile: Generate a symbol file for u-boot-spl
Add a rule to generate u-boot-spl.sym so that pytest can discover the
available unit tests.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 02:38:29 +0000 (20:38 -0600)]
dm: test: Add a very simple of-platadata test
At present we have a pytest that covers of-platadata. Add a very simple
unit test that just checks that a device can be found. This shows the
ability to write these tests in C.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 02:38:28 +0000 (20:38 -0600)]
dm: test: Add a way to run SPL tests
Add a -u flag for U-Boot SPL which requests that unit tests be run. To
make this work, export dm_test_main() and update it to skip test features
that are not used with of-platdata.
To run the tests:
$ spl/u-boot-spl -u
U-Boot SPL 2020.10-rc5 (Oct 01 2020 - 07:35:39 -0600)
Running 0 driver model tests
Failures: 0
At present there are no SPL unit tests.
Note that there is one wrinkle with these tests. SPL has limited memory
available for allocation. Also malloc_simple does not free memory
(free() is a nop) and running tests repeatedly causes driver-model to
reinit multiple times and allocate memory. Therefore it is not possible
to run more than a few tests at a time. One solution is to increase the
amount of malloc space in sandbox_spl. This is not a problem for pytest,
since it runs each test individually, so for now this is left as is.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 02:38:27 +0000 (20:38 -0600)]
dm: test: Update the test runner to support of-platdata
At present DM tests assume that a devicetree is available. This is not the
case with of-platadata.
Update the code to add this condition.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 26 Oct 2020 02:38:26 +0000 (20:38 -0600)]
dm: test: Build tests for SPL
We want to run unit tests in SPL. Add a new Kconfig to control this and
enable it for sandbox_spl
Signed-off-by: Simon Glass <sjg@chromium.org>
Dario Binacchi [Sun, 11 Oct 2020 12:27:07 +0000 (14:27 +0200)]
dm: core: fix typo in device.h
Replace 'a the' with 'the' in include/dm/device.h.
Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Simon Glass <sjg@chromium.org>
Heinrich Schuchardt [Fri, 9 Oct 2020 21:44:11 +0000 (23:44 +0200)]
sandbox: make SDL window resizable
Without resizing the SDL window showed by
./u-boot -D -l
is not legible on a high resolution screen.
Allow resizing the window
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Simon Glass [Sat, 3 Oct 2020 17:31:27 +0000 (11:31 -0600)]
dtoc: Fix widening of int to bytes
At present an integer is converted to bytes incorrectly. The whole 32-bit
integer is inserted as the first element of the byte array, and the other
three bytes are skipped. This was not noticed because the unit test did
not check it, and the functional test was checking for wrong values.
Update the code to handle this as a special case. Add one more test to
cover all code paths.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Sat, 3 Oct 2020 17:31:26 +0000 (11:31 -0600)]
dm: core: Allow dm_warn() to be used in SPL
At present this option is disabled in SPL, meaning that warnings are not
displayed. It is sometimes useful to see warnings in SPL for debugging
purposes.
Add a new Kconfig option to permit this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Sat, 3 Oct 2020 17:31:25 +0000 (11:31 -0600)]
dtoc: Order the structures internally by name
At present the structures are written in name order, but parents have to
be written before their children, so the file does not end up being in
order. The order of nodes in _valid_nodes matches the order of the
devicetree.
Update the code so that _valid_nodes is in sorted order, by C name of
the structure. This allows us to assign a sequential ordering to each
U_BOOT_DEVICE() declaration.
U-Boot's linker lists are also ordered alphabetically, which means that
the order in the driver_info list will match the order used by dtoc. This
defines an index ('idx') for the U_BOOT_DEVICE declarations. They appear
in alphabetical order, numbered from 0 in _valid_nodes and in the
driver_info linker list.
Add a comment against each declaration, showing the idx value.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Sat, 3 Oct 2020 17:31:24 +0000 (11:31 -0600)]
dtoc: Document the return value of scan_structs()
Add documentation to this function as well as generate_structs(), where
the return value is ultimately passed in.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Sat, 3 Oct 2020 17:31:23 +0000 (11:31 -0600)]
sandbox: Drop ad-hoc device declarations in SPL
Since sandbox's SPL is build with of-platadata, we should not use
U_BOOT_DEVICE() declarations as well. Drop them.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Sat, 3 Oct 2020 15:25:26 +0000 (09:25 -0600)]
dm: test: Disable some tests that should not run in SPL
Tests are easier to run in U-Boot proper. Running them in SPL does not add
test coverage in most cases. Also some tests use features that are not
available in SPL.
Update the build rules to disable these tests in SPL. We still need
test-main to be able to actually run SPL tests.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Sat, 3 Oct 2020 15:25:25 +0000 (09:25 -0600)]
dm: test: Make use of CONFIG_UNIT_TEST
At present we always include test/dm from the main Makefile. We have a
CONFIG_UNIT_TEST that should control whether the test/ directory is built,
so rely on that instead.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Sat, 3 Oct 2020 15:25:24 +0000 (09:25 -0600)]
dm: test: Update Makefile conditions
At present most of the tests in test/Makefile are dependent on
CONFIG_SANDBOX. But this is not ideal since they rely on commands being
available and SPL does not support commands.
Use CONFIG_COMMAND instead. This has the dual purpose of allowing these
tests to be used on other boards and allowing SPL to skip them.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Sat, 3 Oct 2020 15:25:23 +0000 (09:25 -0600)]
dm: test: Sort the Makefile
Move everything into alphabetical order.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Sat, 3 Oct 2020 15:25:22 +0000 (09:25 -0600)]
dm: Avoid using #ifdef for CONFIG_OF_LIVE
At present this option results in a number of #ifdefs due to the presence
or absence of the global_data of_root member.
Add a few macros to global_data.h to work around this. Update the code
accordingly.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Sat, 3 Oct 2020 15:25:21 +0000 (09:25 -0600)]
dm: core: Avoid void * in the of-platdata structs
These pointers point to drivers. Update the definition to make this clear.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Sat, 3 Oct 2020 15:25:20 +0000 (09:25 -0600)]
dm: core: Expand the comment for DM_GET_DEVICE()
The current documentation for this is not particularly enlightening. Add
a little more detail.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Sat, 3 Oct 2020 15:25:19 +0000 (09:25 -0600)]
dtoc: Use a namedtuple for _links
The use of strings to access a dict is a bit ugly. Use a namedtuple for
this instead.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Sat, 3 Oct 2020 15:25:18 +0000 (09:25 -0600)]
dtoc: Extract inner loop from output_node()
This function is very long. Put the inner loop in a separate function
to enhance readability.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 28 Sep 2020 00:46:20 +0000 (18:46 -0600)]
binman: Support multiple images in the library
Add support for multiple images, since these are used on x86 now. Select
the first image for now, since that is generally the correct one. At some
point we can add a way to determine which image is currently running.
Signed-off-by: Simon Glass <sjg@chromium.org>
Simon Glass [Mon, 28 Sep 2020 00:46:19 +0000 (18:46 -0600)]
binman: Add a way to read the ROM offset
Provide a function to read the ROM offset so that we can store the value
in one place and clients don't need to store it themselves after calling
binman_set_rom_offset().
Signed-off-by: Simon Glass <sjg@chromium.org>
Tom Rini [Thu, 29 Oct 2020 14:48:01 +0000 (10:48 -0400)]
configs: Resync with savedefconfig
Rsync all defconfig files using moveconfig.py
Signed-off-by: Tom Rini <trini@konsulko.com>
Andre Przywara [Wed, 28 Oct 2020 23:37:43 +0000 (23:37 +0000)]
MAINTAINERS, git-mailrc: Update sunxi maintainers
Maxime mentioned that he feels not having the time to be an Allwinner
maintainer anymore. Take over from him.
Maxime, many thanks for your great work in the past! I hope I can still
relay the occasional technical question to you in the future.
Acked-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Tom Rini [Thu, 29 Oct 2020 13:10:24 +0000 (09:10 -0400)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-fsl-qoriq
- Bug fixes and updates on vid, ls1088a lx2160a and other layerscape
platforms.
- Add optee_rpmb support for LX2 & Kontron sl28 support
Tom Rini [Wed, 28 Oct 2020 20:30:06 +0000 (16:30 -0400)]
Prepare v2021.01-rc1
Signed-off-by: Tom Rini <trini@konsulko.com>
Tom Rini [Wed, 28 Oct 2020 18:50:09 +0000 (14:50 -0400)]
Merge branch '2020-10-28-mux-driver-framework'
- Add a framework for mux drivers
Pratyush Yadav [Fri, 16 Oct 2020 10:46:36 +0000 (16:16 +0530)]
test: mux-cmd: Add tests for the 'mux' command
Tests tests run the three mux subcommands: list, select, and deselect,
and verify that the commands do what we expect.
Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Pratyush Yadav [Fri, 16 Oct 2020 10:46:35 +0000 (16:16 +0530)]
cmd: Add a mux command
This command lets the user list, select, and deselect mux controllers
introduced with the mux framework on the fly. It has 3 subcommands:
list, select, and deselect.
List: Lists all the mux present on the system. The muxes are listed for
each chip. The chip is identified by its device name. Each chip can have
a number of mux controllers. Each is listed in sequence and is assigned
a sequential ID based on its position in the mux chip. It lists details
like ID, whether the mux is currently selected or not, the current
state, the idle state, and the number of states.
A sample output would look something like:
=> mux list
a-mux-controller:
ID Selected Current State Idle State Num States
0 no unknown as-is 0x4
1 no 0x2 0x2 0x10
2 no 0x73 0x73 0x100
another-mux-controller:
ID Selected Current State Idle State Num States
0 no 0x1 0x1 0x4
1 no 0x2 0x2 0x4
Select: Selects a given mux and puts it in the specified state. This
subcommand takes 3 arguments: mux chip, mux ID, state to set
the mux in. The arguments mux chip and mux ID are used to identify which
mux needs to be selected, and then it is selected to the given state.
The mux needs to be deselected before it can be selected again in
another state. The state should be a hexadecimal number.
For example:
=> mux list
a-mux-controller:
ID Selected Current State Idle State Num States
0 no 0x1 0x1 0x4
1 no 0x1 0x1 0x4
=> mux select a-mux-controller 0 0x3
=> mux list
a-mux-controller:
ID Selected Current State Idle State Num States
0 yes 0x3 0x1 0x4
1 no 0x1 0x1 0x4
Deselect: Deselects a given mux and puts it in its idle state. This
subcommand takes 2 arguments: the mux chip and mux ID to identify which
mux needs to be deselected. So in the above example, we can deselect mux
0 using:
=> mux deselect a-mux-controller 0
=> mux list
a-mux-controller:
ID Selected Current State Idle State Num States
0 no 0x1 0x1 0x4
1 no 0x1 0x1 0x4
Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Jean-Jacques Hiblot [Fri, 16 Oct 2020 10:46:34 +0000 (16:16 +0530)]
test: Add tests for the multiplexer framework
Provide tests to check the behavior of the multiplexer framework.
Two sets of tests are added. One is using an emulated multiplexer driver
that can be used to test basic functionality like select, deselect, etc.
The other is using the mmio mux which adds tests specific to it.
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Pratyush Yadav [Fri, 16 Oct 2020 10:46:33 +0000 (16:16 +0530)]
Kconfig: Increase the pre-relocation memory
The memory is close to full and adding a syscon node in test.dts makes
it go over the limit and makes malloc() fail on startup.
Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Jean-Jacques Hiblot [Fri, 16 Oct 2020 10:46:32 +0000 (16:16 +0530)]
drivers: mux: mmio-based syscon mux controller
This adds a driver for mmio-based syscon multiplexers controlled by
bitfields in a syscon register range.
This is heavily based on the linux mmio-mux driver.
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Jean-Jacques Hiblot [Fri, 16 Oct 2020 10:46:31 +0000 (16:16 +0530)]
dm: board: complete the initialization of the muxes in initr_dm()
This will probe the multiplexer devices that have a "u-boot,mux-autoprobe"
property. As a consequence they will be put in their idle state.
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
Jean-Jacques Hiblot [Fri, 16 Oct 2020 10:46:30 +0000 (16:16 +0530)]
drivers: Add a new framework for multiplexer devices
Add a new subsystem that handles multiplexer controllers. The API is the
same as in Linux.
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
[trini: Update some error calls to use different functions or pass
correct arguments]
Signed-off-by: Tom Rini <trini@konsulko.com>
Tom Rini [Wed, 28 Oct 2020 12:35:28 +0000 (08:35 -0400)]
Merge tag 'efi-2021-01-rc2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Pull request for UEFI sub-system for efi-2021-01-rc2
A software RTC driver is supplied for UEFI SCT testing.
The following UEFI related bugs are fixed:
* correct handling of daylight saving time in GetTime() and SetTime()
* handling of the gd register in function tracing on RISC-V
* disable U-Boot devices in ExitBootServices()
Tom Rini [Wed, 28 Oct 2020 12:34:11 +0000 (08:34 -0400)]
Merge branch '2020-10-27-further-log-enhancements'
- Allow for log message continuation.
- Test fix, build time error checking for new categories
Heinrich Schuchardt [Fri, 23 Oct 2020 11:00:01 +0000 (13:00 +0200)]
log: correct and check array size of log categories
The log command has led to NULL dereferences if an unknown category name
name was used due to missing entries in the list of category names.
Add compile time checks for the array sizes of log_cat_name and
log_lvl_name to avoid future mishaps.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Heinrich Schuchardt [Fri, 23 Oct 2020 03:30:29 +0000 (05:30 +0200)]
efi_loader: daylight saving time
Adjust the SetTime() and GetTime() runtime services to correctly convert
the daylight saving time information when communicating with the RTC.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Ilias Apalodimas [Wed, 21 Oct 2020 22:04:21 +0000 (01:04 +0300)]
efi_loader: Disable devices before handing over control
U-Boot Driver Model is supposed to remove devices with either
DM_REMOVE_ACTIVE_DMA or DM_REMOVE_OS_PREPARE flags set, before exiting.
Our bootm command does that by explicitly calling calling
"dm_remove_devices_flags(DM_REMOVE_ACTIVE_ALL);" and we also disable any
USB devices.
The EFI equivalent is doing none of those at the moment. As a result
probing an fTPM driver now renders it unusable in Linux. During our
(*probe) callback we open a session with OP-TEE, which is supposed to
close with our (*remove) callback. Since the (*remove) is never called,
once we boot into Linux and try to probe the device again we are getting
a busy error response. Moreover all uclass (*preremove) functions won't
run.
So let's fix this by mimicking what bootm does and disconnect devices
when efi_exit_boot_services() is called.
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Ilias Apalodimas [Wed, 21 Oct 2020 22:04:20 +0000 (01:04 +0300)]
efi_loader: Sort header file ordering
Order header files according to https://www.denx.de/wiki/U-Boot/CodingStyle
Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Heinrich Schuchardt [Thu, 15 Oct 2020 10:30:09 +0000 (12:30 +0200)]
trace: conserve gd register on RISC-V
An UEFI application may change the value of the register that gd lives in.
But some of our functions like get_ticks() access this register. So we
have to set the gd register to the U-Boot value when entering a trace
point and set it back to the application value when exiting the trace
point.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Heinrich Schuchardt [Thu, 22 Oct 2020 21:52:14 +0000 (23:52 +0200)]
rtc: provide an emulated RTC
On a board without hardware clock this software real time clock can be
used. The build time is used to initialize the RTC. So you will have
to adjust the time either manually using the 'date' command or use
the 'sntp' to update the RTC with the time from a network time server.
See CONFIG_CMD_SNTP and CONFIG_BOOTP_NTPSERVER. The RTC time is
advanced according to CPU ticks.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Heinrich Schuchardt [Sun, 25 Oct 2020 06:25:05 +0000 (07:25 +0100)]
Makefile: provide constant with seconds since epoch
Provide a constant U_BOOT_EPOCH with the number of seconds since
1970-01-01. This constant can be used to initialize a software
real time clock until it is updated via the 'sntp' command.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Heinrich Schuchardt [Sat, 17 Oct 2020 12:31:59 +0000 (14:31 +0200)]
test: log: test message continuation
Provide a unit test checking that a continuation message will use the same
log level and log category as the previous message.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Heinrich Schuchardt [Sat, 17 Oct 2020 12:31:58 +0000 (14:31 +0200)]
log: allow for message continuation
Some drivers use macro pr_cont() for continuing a message sent via printk.
Hence if we want to convert printk messaging to using the logging system,
we must support continuation of log messages too.
As pr_cont() does not provide a message level we need a means of
remembering the last log level.
With the patch a pseudo log level LOGL_CONT as well as a pseudo log
category LOGC_CONT are introduced. Using these results in the application
of the same log level and category as in the previous log message.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Heinrich Schuchardt [Sat, 17 Oct 2020 12:31:57 +0000 (14:31 +0200)]
log: move processing_msg to global data
Replace the static variable processing_msg by a field in the global data.
Make the field bool at it can only be true or false.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Anatolij Gustschin [Tue, 27 Oct 2020 07:47:17 +0000 (08:47 +0100)]
nokia_rx51: re-enable CONSOLE_MUX and SYS_CONSOLE_IS_IN_ENV
With disabled legacy VIDEO option CONSOLE_MUX is not auto-selected
any more, re-enable it.
Fixes:
9dec5a0ea130 ("nokia_rx51: disable obsolete VIDEO config")
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Tom Rini [Mon, 26 Oct 2020 21:27:38 +0000 (17:27 -0400)]
Merge tag 'video-for-2021.01-rc1' of https://gitlab.denx.de/u-boot/custodians/u-boot-video
- disable CONFIG_VIDEO to remove DM conversion warnings
for boards: at91sam9, eb_cpu5282, ls1021aqds, ls1021atwr,
mx23evk, mx6sxsabresd, mx7dsabresd, nokia_rx51, picosam9g45,
sansa_fuze_plus, xfi3
Anatolij Gustschin [Mon, 26 Oct 2020 18:50:58 +0000 (19:50 +0100)]
nokia_rx51: disable obsolete VIDEO config
Disable VIDEO config to fix DM_VIDEO conversion
deadline warning.
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Anatolij Gustschin [Sun, 18 Oct 2020 18:32:35 +0000 (20:32 +0200)]
eb_cpu5282: fix CONFIG_DM_VIDEO build warnings
Remove CONFIG_VIDEO dependency to fix board removal warnings.
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Jens Scharsig <esw@bus-elektronik.de>
Anatolij Gustschin [Sun, 18 Oct 2020 17:32:06 +0000 (19:32 +0200)]
sansa_fuze_plus: disable obsolete VIDEO config
DM_VIDEO conversion deadline has passed, disable VIDEO config.
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Anatolij Gustschin [Sun, 18 Oct 2020 16:36:23 +0000 (18:36 +0200)]
xfi3: disable obsolete VIDEO config
DM_VIDEO conversion deadline has passed, disable VIDEO config.
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Anatolij Gustschin [Sun, 18 Oct 2020 16:33:45 +0000 (18:33 +0200)]
mx23evk: disable obsolete VIDEO config
DM_VIDEO conversion deadline has passed, disable VIDEO config.
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Otavio Salvador <otavio@ossystems.com.br>
Anatolij Gustschin [Sun, 18 Oct 2020 17:29:07 +0000 (19:29 +0200)]
at91sam9n12ek: disable obsolete VIDEO config
DM_VIDEO conversion deadline has passed, disable VIDEO config.
Boards should convert to DM_VIDEO if they need video console
support.
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Eugen Hristev <eugen.hristev@microchip.com>
Anatolij Gustschin [Sun, 18 Oct 2020 16:04:34 +0000 (18:04 +0200)]
at91sam9: disable obsolete VIDEO config
DM_VIDEO conversion deadline has passed, disable VIDEO config.
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Anatolij Gustschin [Sun, 18 Oct 2020 16:00:35 +0000 (18:00 +0200)]
picosam9g45: disable obsolete VIDEO config
DM_VIDEO conversion deadline has passed, disable VIDEO config.
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Erik van Luijk <evanluijk@interact.nl>