Commit Graph

72860 Commits

Author SHA1 Message Date
Dario Binacchi a47abd7bf4 Revert "fdt: translate address if #size-cells = <0>"
This reverts commit d64b9cdcd4.

As pointed by [1] and [2], the reverted patch made every DT 'reg'
property translatable. What the patch was trying to fix was fixed in a
different way from previously submitted patches which instead of
correcting the generic address translation function fixed the issue with
appropriate platform code.

[1] https://patchwork.ozlabs.org/project/uboot/patch/1614324949-61314-1-git-send-email-bmeng.cn@gmail.com/
[2] https://lore.kernel.org/linux-clk/20210402192054.7934-1-dariobin@libero.it/T/

Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2021-05-12 16:27:57 +05:30
Dario Binacchi 5a6caf916c clk: ti: am3-dpll: use custom API for memory access
Using the custom TI functions required not only replacing common memory
access functions but also rewriting the routines used to set bypass and
lock states. As for readl() and writel(), they also required the address
of the register to be accessed, a parameter that is hidden by the TI clk
module.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
2021-05-12 16:27:57 +05:30
Dario Binacchi b178e1f77b clk: ti: gate: use custom API for memory access
Replaces the common memory access functions used by the driver with the
ones exported from the TI clk module.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
2021-05-12 16:27:57 +05:30
Dario Binacchi 2dd2f3ea6d clk: ti: change clk_ti_latch() signature
The clock access functions exported by the clk header use the
struct clk_ti_reg parameter to get the address of the register. This
must also apply to clk_ti_latch(). Changes to TI's clk-mux and
clk-divider drivers prevented the patch from generating compile errors.

Signed-off-by: Dario Binacchi <dariobin@libero.it>
2021-05-12 16:27:57 +05:30
Dario Binacchi b1aef0384f clk: ti: add custom API for memory access
As pointed by [1] and [2], commit
d64b9cdcd4 ("fdt: translate address if #size-cells = <0>") is wrong:
- It makes every 'reg' DT property translatable. It changes the address
  translation so that for an I2C 'reg' address you'll get back as reg
  the I2C controller address + reg value.
- The quirk must be fixed with platform code.

The clk_ti_get_reg_addr() is the platform code able to make the correct
address translation for the AM33xx clocks registers. Its implementation
was inspired by the Linux Kernel code.

[1] https://patchwork.ozlabs.org/project/uboot/patch/1614324949-61314-1-git-send-email-bmeng.cn@gmail.com/
[2] https://lore.kernel.org/linux-clk/20210402192054.7934-1-dariobin@libero.it/T/

Signed-off-by: Dario Binacchi <dariobin@libero.it>
2021-05-12 16:27:57 +05:30
Tom Rini b107761b81 Prepare v2021.07-rc2
Signed-off-by: Tom Rini <trini@konsulko.com>
2021-05-10 17:03:22 -04:00
Tom Rini 3ee71c5729 Merge https://source.denx.de/u-boot/custodians/u-boot-x86
- x86: correct regwidth prompt in cbsysinfo
- virtio: convert README.virtio to reST
2021-05-10 08:02:00 -04:00
Bin Meng 200fdd3bff MAINTAINERS: Add an entry for VirtIO
This was missed when VirtIO support was initially brought to U-Boot
back in 2018. Add an entry for it and list myself as the maintainer.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2021-05-10 13:56:12 +08:00
Bin Meng 9cea9abbe4 doc: develop: Convert README.virtio to reST
This converts the existing README.virtio to reST, and puts it under
the develop/driver-model/ directory.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2021-05-10 13:56:12 +08:00
Simon Glass b8db1c1388 x86: Correct regwidth prompt in cbsysinfo
This should be 'regwidth', not 'baud'. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2021-05-10 13:56:12 +08:00
Tom Rini 07b53103b7 Merge https://source.denx.de/u-boot/custodians/u-boot-riscv 2021-05-07 08:57:32 -04:00
Tom Rini 1b8ad819ce Merge branch '2021-05-06-misc-updates'
- Allow for boards to update bootargs before booting the OS (helpful in
  some forms of secure boot).
- Enhance GPT write support.
- gpio-sysinfo updates
- Allow env to be appended from dtb
2021-05-06 11:00:07 -04:00
Heinrich Schuchardt 91e4b7516d cmd/exception: support ebreak exception on RISC-V
The ebreak instruction should generate a breakpoint exception.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
2021-05-05 16:13:12 +08:00
Dylan Jhong 1412b8d48a atcspi200: Add timeout mechanism in spi_xfer()
Adding timeout mechanism to avoid spi driver from stucking
in the while loop in __atcspi200_spi_xfer().

Signed-off-by: Dylan Jhong <dylan@andestech.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
2021-05-05 16:12:14 +08:00
Green Wan bc8bbb77f7 riscv: cpu: fu740: clear feature disable CSR
Clear feature disable CSR to turn on all features of hart. The detail
is specified at section, 'SiFive Feature Disable CSR', in user manual

https://sifive.cdn.prismic.io/sifive/aee0dd4c-d156-496e-a6c4-db0cf54bbe68_sifive_U74MC_rtl_full_20G1.03.00_manual.pdf

Signed-off-by: Green Wan <green.wan@sifive.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Rick Chen <rick@andestech.com>
2021-05-05 16:11:27 +08:00
Green Wan edd9ad8194 riscv: cpu: Add callback to init each core
Add a callback harts_early_init() to start.S to allow different riscv
hart perform setup code for each hart as early as possible. Since all
the harts enter the callback, they must be able to run the same
setup.

Signed-off-by: Green Wan <green.wan@sifive.com>
Reviewed-by: Rick Chen <rick@andestech.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2021-05-05 16:11:22 +08:00
Niko Mauno f0b21ebd41 fdt_support.c: Allow late kernel cmdline modification
By declaring board-specific board_fdt_chosen_bootargs() the kernel
command line arguments can be adjusted before injecting to flat dt
chosen node.

Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
2021-05-04 12:52:46 -04:00
Farhan Ali 653cd92d66 cmd: gpt: Add option to write GPT partitions to environment variable
This change would enhance the existing 'gpt read' command to allow
(optionally) writing of the read GPT partitions to an environment
variable in the UBOOT partitions layout format. This would allow users
to easily change the overall partition settings by editing said variable
and then using the variable in the 'gpt write' and 'gpt verify' commands.

Signed-off-by: Farhan Ali <farhan.ali@broadcom.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Corneliu Doban <cdoban@broadcom.com>
Cc: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
Cc: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-05-04 12:52:46 -04:00
Rasmus Villemoes 8c72842af5 sandbox: add test of CONFIG_ENV_IMPORT_FDT
Check that a variable defined in /config/environment is found in the
run-time environment, and that clearing fdt_env_path from within that
node works.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
[trini: Conditionalize the test being linked in]
Signed-off-by: Tom Rini <trini@konsulko.com>
2021-05-04 12:52:30 -04:00
Rasmus Villemoes 95fd977201 env: allow environment to be amended from control dtb
It can be useful to use the same U-Boot binary for multiple purposes,
say the normal one, one for developers that allow breaking into the
U-Boot shell, and one for use during bootstrapping which runs a
special-purpose bootcmd. Or one can have several board variants that
can share almost all boot logic, but just needs a few tweaks in the
variables used by the boot script.

To that end, allow the control dtb to contain a /config/enviroment
node (or whatever one puts in fdt_env_path variable), whose
property/value pairs are used to update the run-time environment after
it has been loaded from its persistent location.

The indirection via fdt_env_path is for maximum flexibility - for
example, should the user wish (or board logic dictate) that the values
in the DTB should no longer be applied, one simply needs to delete the
fdt_env_path variable; that can even be done automatically by
including a

  fdt_env_path = "";

property in the DTB node.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2021-05-04 11:50:50 -04:00
Sean Anderson 1cbfed8d3e test: Add gpio-sysinfo test
This adds a test for the gpio-sysinfo driver.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-05-04 07:57:18 -04:00
Sean Anderson 54aa07fdfc sysinfo: Add gpio-sysinfo driver
This uses the newly-added dm_gpio_get_values_as_int_base3 function to
implement a sysinfo device. The revision map is stored in the device tree.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-05-04 07:57:18 -04:00
Sean Anderson 4d65c6bcd7 sysinfo: Require that sysinfo_detect be called before other methods
This has the uclass enforce calling detect() before other methods.  This
allows drivers to cache information in detect() and perform (cheaper)
retrieval in the other accessors. This also modifies the only instance
where this sequencing was not followed.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-05-04 07:57:18 -04:00
Sean Anderson eed0a7a3e6 sysinfo: Use global sysinfo IDs for existing sysinfo drivers
Since 07c9e683a4 ("smbios: Allow a few values to come from sysinfo")
there are common global sysinfo IDs. This patch moved existing IDs above
SYSINFO_ID_USER.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-05-04 07:57:18 -04:00
Sean Anderson 430e136dc1 dm: gpio: Fix gpio_get_list_count failing with livetree
of_parse_phandle_with_args (called by dev_read_phandle_with_args) does not
support getting the length of a phandle list by using the index -1.
Instead, use dev_count_phandle_with_args which supports exactly this
use-case.

Fixes: 8558217153 ("gpio: Convert to use APIs which support live DT")

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-05-04 07:57:18 -04:00
Tom Rini 8ddaf94358 buildman environment fix
binman FMAP improvements
 minor test improvements and fixes
 minor dm improvements
 -----BEGIN PGP SIGNATURE-----
 
 iQFFBAABCgAvFiEEslwAIq+Gp8wWVbYnfxc6PpAIreYFAmCKoLERHHNqZ0BjaHJv
 bWl1bS5vcmcACgkQfxc6PpAIreYCpgf/ROfOg76k18PdWcQTZr10CnU0iqTaOyYx
 129hvb4n4bx4Q7Zr/HrWT6y7vvD01NOiNCwSX8qdF7S1bqs2/2AM+Yk/vLimXVOg
 UDGXGRABkbHQFVMzBUSmlmQvKoG5G6AhS6/5/F7q4jj+QCVMGarves7G7ImhFOFw
 6WKeNGv6FWX4UPSxm0TDJETiIqURNZOsu2vU9DmkR/b1eY13/qf/9J4zzEP1DaJt
 7PrKmyblRhPlMsi59EjNyEQOnY/A17en8Ik3Zt336tLPELlczRc4Xp8HslQsy2i3
 o457il6x8kl828oVwm3Sx4R/UvM8+qE1jWRcPA7vWrxCy3+AqDcTfQ==
 =tiPD
 -----END PGP SIGNATURE-----

Merge tag 'dm-pull-29apr21' of https://source.denx.de/u-boot/custodians/u-boot-dm

buildman environment fix
binman FMAP improvements
minor test improvements and fixes
minor dm improvements
2021-04-29 21:03:38 -04:00
Tom Rini f3a0d2c1af Xilinx changes for v2021.07-rc2
xilinx:
 - Enable saving variables based on bootmode
 - Cleanup usb dfu setup and wire it up with usb bootmode
 - Fix bootscript address logic
 - Remove GD references (spi, Versal)
 - Enable capsule update
 
 clk:
 - Small Kconfig fix
 
 net:
 - Fix gmii2rgmii bridge binding
 
 usb:
 - Propagate error (dfu gadget)
 -----BEGIN PGP SIGNATURE-----
 
 iF0EABECAB0WIQQbPNTMvXmYlBPRwx7KSWXLKUoMIQUCYIqrgAAKCRDKSWXLKUoM
 IY86AJ9X9G6IwfnhHFWhManDrzPoBGaSBwCfVjMzPQcCddlGAW8UJ1NaPCLPPNc=
 =ACHF
 -----END PGP SIGNATURE-----

Merge tag 'xilinx-for-v2021.07-rc2' of https://source.denx.de/u-boot/custodians/u-boot-microblaze

Xilinx changes for v2021.07-rc2

xilinx:
- Enable saving variables based on bootmode
- Cleanup usb dfu setup and wire it up with usb bootmode
- Fix bootscript address logic
- Remove GD references (spi, Versal)
- Enable capsule update

clk:
- Small Kconfig fix

net:
- Fix gmii2rgmii bridge binding

usb:
- Propagate error (dfu gadget)
2021-04-29 11:31:06 -04:00
Michal Simek b00bad9dc8 spi: zynqmp: Remove gd reference
gd is not used in this file that's why doesn't make sense to declare it.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2021-04-29 14:48:31 +02:00
Tom Rini 3d2f8bc673 Merge https://source.denx.de/u-boot/custodians/u-boot-cfi-flash
- mtd: cfi: Fix PPB lock status readout (Marek)
2021-04-29 08:22:17 -04:00
Tom Rini a26522e774 Merge https://source.denx.de/u-boot/custodians/u-boot-marvell
- Add base support for Marvell OcteonTX2 CN9130 CRB (mostly done
  by Kostya)
- Sync Armada 3k/7k/8k SERDES code with Marvell version (misc Marvell
  authors)
- pci-aardvark: Fix processing PIO transfers (Pali)
2021-04-29 08:21:55 -04:00
Heinrich Schuchardt 5b700cdcff tpm: missing event types
Add a reference for the TPM event types and provide missing constants.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2021-04-29 04:10:55 -07:00
Chen Guanqiao 61772bc35f test: dm: add test item for ofnode_get_addr() and ofnode_get_size()
Add test item for getting address and size functions

Test the following function:
- ofnode_get_addr()
- ofnode_get_size()

Signed-off-by: Chen Guanqiao <chenguanqiao@kuaishou.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-04-29 03:23:39 -07:00
Chen Guanqiao aa351a14bd dm: core: Add size operations on device tree references
Add functions to add size of addresses in the device tree using ofnode
references.

If the size is not set, return FDT_SIZE_T_NONE.

Signed-off-by: Chen Guanqiao <chenguanqiao@kuaishou.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-04-29 03:23:39 -07:00
Simon Glass f1a83abe60 buildman: Use bytes for the environment
At present we sometimes see problems in gitlab where the environment has
0x80 characters or sequences which are not valid UTF-8.

Avoid this by using bytes for the environment, both internal to buildman
and when writing out the 'env' file. Add a test to make sure this works
as expected.

Reported-by: Marek Vasut <marex@denx.de>
Fixes: e5fc79ea71 ("buildman: Write the environment out to an 'env' file")
Signed-off-by: Simon Glass <sjg@chromium.org>
2021-04-29 03:23:39 -07:00
Simon Glass 8116c78ffd buildman: Handle exceptions in threads gracefully
There have been at least a few cases where an exception has occurred in a
thread and resulted in buildman hanging: running out of disk space and
getting a unicode error.

Handle these by collecting a list of exceptions, printing them out and
reporting failure if any are found. Add a test for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2021-04-29 03:23:39 -07:00
Simon Glass ab9b4f35e3 buildman: Use common code to send an result
At present the code to report a build result is duplicated. Put it in a
common function to avoid this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2021-04-29 03:23:39 -07:00
Simon Glass 249933136f buildman: Tidy up a few comments
Add some function comments which are missing, or missing arguments.

Signed-off-by: Simon Glass <sjg@chromium.org>
2021-04-29 03:23:39 -07:00
Sean Anderson 6784cb35f5 dm: core: Fix uninitialized return value from dm_scan_fdt_node
If there are no nodes or if all nodes are disabled, this function would
return err without setting it first. Fix this by initializing err to
zero.

Fixes: 94f7afdf7e ("dm: core: Ignore disabled devices when binding")

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-04-29 03:23:39 -07:00
Patrick Delaunay feb7ac457c dm: core: Add address translation in fdt_get_resource
Today of_address_to_resource() is called only in
ofnode_read_resource() for livetree support and
fdt_get_resource() is called when livetree is not supported.

The fdt_get_resource() doesn't do the address translation
so when it is required, but the address translation is done
by ofnode_read_resource() caller, for example in
drivers/firmware/scmi/smt.c::scmi_dt_get_smt_buffer() {
...
	ret = ofnode_read_resource(args.node, 0, &resource);
	if (ret)
		return ret;

	faddr = cpu_to_fdt32(resource.start);
	paddr = ofnode_translate_address(args.node, &faddr);
...

The both behavior should be aligned and the address translation
must be called in fdt_get_resource() and removed for each caller.

Fixes: a44810123f ("dm: core: Add dev_read_resource() to read device resources")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
2021-04-29 03:23:39 -07:00
Simon Glass 1736575b0c binman: Support adding sections to FMAPs
When used with hierarchical images, use the Chromium OS convention of
adding a section before all the subentries it contains.

Signed-off-by: Simon Glass <sjg@chromium.org>
2021-04-29 03:23:39 -07:00
Simon Glass c7722e8417 binman: Tweak implementation of fmap
Use an interator in two of the fmap tests so it is easier to add new
items. Also check the name first since that is the first indication
that something is wrong. Use a variable for the expected size of the
fmap to avoid repeating the code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2021-04-29 03:23:39 -07:00
Evan Benn ec6db6c297 patman: Parse checkpatch by message instead of by line
Parse each empty-line-delimited message separately. This saves having to
deal with all the different line content styles, we only care about the
header ERROR | WARNING | NOTE...

Also make checkpatch print line information for a uboot specific
warning.

Signed-off-by: Evan Benn <evanbenn@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-04-29 03:23:39 -07:00
Tom Rini 2959a8e3a5 patman: Assume we always have pygit2 for tests
Given that we have tests that require pygit2 and it can be installed
like any other python module, fail much more loudly if it is missing.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
2021-04-29 03:23:39 -07:00
Tom Rini 5f0d23cf3c tests: patman: Add requests to the module list
The patman tests require the requests module, add it.

Cc: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
2021-04-29 03:23:39 -07:00
Tom Rini 38229b55d3 Azure/GitLab: Ensure we use requirements.txt for testsuites
Given that test/py/requirements.txt has all required test modules, make
use of that rather than a manual pip install list before running our
assorted tool testsuites.

Signed-off-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2021-04-29 03:23:39 -07:00
Andy Shevchenko 494a5e126b test: Use positive conditional in test_matches()
It is easier to read the positive conditional.

While at it, convert hard coded length of "_test_" to strlen("_test_")
which will be converted to a constant bu optimizing compiler.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-04-29 03:23:39 -07:00
Andy Shevchenko ff232a7296 test: Allow simple glob pattern in the test name
When run `ut dm [test name]` allow to use simple pattern to run all tests
started with given prefix. For example, to run all ACPI test cases:
	ut dm acpi*

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-04-29 03:23:39 -07:00
Simon Glass 170732523b dtoc: Correct dtoc output when testing
At present each invocation of run_steps() updates OUTPUT_FILES_COMMON,
since it does not make a copy of the dict. This is fine for a single
invocation, but for tests, run_steps() is invoked many times.

As a result it may include unwanted items from the previous run, if it
happens that a test runs twice on the same CPU. The problem has not been
noticied previously, as there are few enough tests and enough CPUs that
is is rare for the 'wrong' combination of tests to run together.

Fix this by making a copy of the dict, before updating it. Update the
tests to suit, taking account of the files that are no-longer generated.

With this fix, we no-longer generate files which are not needed for a
particular state of OF_PLATDATA_INST, so the check_instantiate() function
is not needed anymore. It has become dead code and so fails the
code-coverage test (dtoc -T). Remove it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2021-04-29 03:23:37 -07:00
Simon Glass 0fe44dc676 binman: Correct testSplNoDtb() and Tpl also
These two tests require an ELF image so that symbol information can be
written into the SPL/TPL binary. At present they rely on other tests
having set it up first, but every test must run independently. This can
cause occasional errors in CI.

Fix this by setting up the required files, as other tests do.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2021-04-29 03:20:54 -07:00
Michal Simek 0a9f0e0d00 net: phy: xilinx: Break while loop over ethernet phy
The commit 6c993815bb ("net: phy: xilinx: Be compatible with live OF
tree") change driver behavior to while loop which wasn't correct because
the driver was looping over again and again. The reason was that
ofnode_valid() is taking 0 as correct value.
Fix it by changing while loop to ofnode_for_each_subnode() which is only
loop over available nodes.

Fixes: 6c993815bb ("net: phy: xilinx: Be compatible with live OF tree")
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2021-04-29 10:05:56 +02:00