]> git.dujemihanovic.xyz Git - u-boot.git/log
u-boot.git
3 years agotest: Correct setexpr test prefix
Simon Glass [Mon, 8 Mar 2021 00:34:44 +0000 (17:34 -0700)]
test: Correct setexpr test prefix

This prefix should be for setexpr, not mem. This means that trying to
select just these tests to run does not work. Fix it.

For some reason this provokes an assertion failure due to memory not
being freed. Move the env_set() in setexpr_test_str() to before the
malloc() heap size size is recorded and disable the rest in
setexpr_test_str_oper().

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodoc: Document how sandbox_spl_tests are run
Simon Glass [Mon, 8 Mar 2021 00:34:43 +0000 (17:34 -0700)]
doc: Document how sandbox_spl_tests are run

Add a few notes about the sandbox_spl tests, since they are special.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Pratyush Yadav <p.yadav@ti.com>
3 years agodoc: Explain how to run tests without pytest
Simon Glass [Mon, 8 Mar 2021 00:34:42 +0000 (17:34 -0700)]
doc: Explain how to run tests without pytest

Add details about how to run a sandbox test directly, without using
pytest. This is more convenient for rapid development, since it is faster
and allows easier use of a debugger. Also mention sandbox_flattree as an
example of the different sandbox builds available.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotest: Re-enable test_ofplatdata
Simon Glass [Mon, 8 Mar 2021 00:34:41 +0000 (17:34 -0700)]
test: Re-enable test_ofplatdata

This was inadvertently disabled after a recent change. Re-enable it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: Drop the 'starting...' message
Simon Glass [Mon, 8 Mar 2021 00:34:40 +0000 (17:34 -0700)]
sandbox: Drop the 'starting...' message

This message is annoying since it is only useful for testing. Drop it and
update the test to cope.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodoc: Document make tcheck
Simon Glass [Mon, 8 Mar 2021 00:34:39 +0000 (17:34 -0700)]
doc: Document make tcheck

Add a comment about this option in the documentation. Also mention the
script that runs these combinations.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodoc: Tidy up testing section
Simon Glass [Mon, 8 Mar 2021 00:34:38 +0000 (17:34 -0700)]
doc: Tidy up testing section

Tweak this so the output looks a little better.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agodm: core: Fix allocation of empty of-platdata
Simon Glass [Mon, 8 Mar 2021 00:34:37 +0000 (17:34 -0700)]
dm: core: Fix allocation of empty of-platdata

With of-platdata we always have a dtv struct that holds the platform data
provided by the driver_info record. However, this struct can be empty if
there are no actual devicetree properties provided.

The upshot of empty platform data is that it will end up as a zero-size
member in the BSS section, which is fine. But if the driver specifies
plat_auto then it expects the correct amount of space to be allocated.

At present this does not happen, since device_bind() assumes that the
platform-data size will always be >0. As a result we end up not
allocating the space and just use the BSS region, overwriting whatever
other contents are present.

Fix this by removing the condition that platform data be non-empty, always
allocating space if requested.

This fixes a strange bug that has been lurking since of-platdata was
implemented. It has likely never been noticed since devices normally have
at least some devicetree properties, BSS is seldom used on SPL, the dtv
structs are normally at the end of bss and the overwriting only happens
if a driver changes its platform data.

It was discovered using sandbox_spl, which exercises more features than
a normal board might, and the critical global_data variable 'gd' happened
to be at the end of BSS.

Fixes: 9fa28190091 ("dm: core: Expand platdata for of-platdata devices")
Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoMerge tag 'next-2021-03-04' of https://gitlab.denx.de/u-boot/custodians/u-boot-video...
Tom Rini [Thu, 4 Mar 2021 19:36:40 +0000 (14:36 -0500)]
Merge tag 'next-2021-03-04' of https://gitlab.denx.de/u-boot/custodians/u-boot-video into next

 - convert sunxi_display to DM_VIDEO

3 years agoMerge branch '2021-03-03-gpio-improvements' into next
Tom Rini [Thu, 4 Mar 2021 18:12:51 +0000 (13:12 -0500)]
Merge branch '2021-03-03-gpio-improvements' into next

- GPIO uclass improvements

3 years agogpio: Add a way to read 3-way strapping pins
Simon Glass [Fri, 5 Feb 2021 04:22:09 +0000 (21:22 -0700)]
gpio: Add a way to read 3-way strapping pins

Using the internal vs. external pull resistors it is possible to get
27 different combinations from 3 strapping pins. Add an implementation
of this.

This involves updating the sandbox GPIO driver to model external and
(weaker) internal pull resistors. The get_value() method now takes account
of what is driving a pin:

   sandbox: GPIOD_EXT_DRIVEN - in which case GPIO_EXT_HIGH provides the
          value
   outside source - in which case GPIO_EXT_PULL_UP/DOWN indicates the
          external state and we work the final state using those flags and
          the internal GPIOD_PULL_UP/DOWN flags

Of course the outside source does not really exist in sandbox. We are just
modelling it for test purpose.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agogpio: Define the log category in the uclass
Simon Glass [Fri, 5 Feb 2021 04:22:08 +0000 (21:22 -0700)]
gpio: Define the log category in the uclass

This uses log_debug(), etc. but does not define the category. Fix this.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agogpio: sandbox: Track whether a GPIO is driven
Simon Glass [Fri, 5 Feb 2021 04:22:07 +0000 (21:22 -0700)]
gpio: sandbox: Track whether a GPIO is driven

Add a new flag to keep track of whether sandbox is driving the pin, or
whether it is expecting an input signal. If it is driving, then the value
of the pin is the value being driven (0 or 1). If not driving, then we
consider the value 0, since we don't currently handle things like pull-ups
yet.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agogpio: x86: Drop the deprecated methods in intel_gpio
Simon Glass [Fri, 5 Feb 2021 04:22:06 +0000 (21:22 -0700)]
gpio: x86: Drop the deprecated methods in intel_gpio

We don't need to implement direction_input() and direction_output()
anymore. Drop them and use update_flags() instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agogpio: Use an 'ops' variable everywhere
Simon Glass [Fri, 5 Feb 2021 04:22:05 +0000 (21:22 -0700)]
gpio: Use an 'ops' variable everywhere

Update this driver to use the common method of putting the driver
operations in an 'ops' variable install of calling gpio_get_ops()
repeatedly. Make it const since operations do not change.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agogpio: Replace direction_input() and direction_output()
Simon Glass [Fri, 5 Feb 2021 04:22:04 +0000 (21:22 -0700)]
gpio: Replace direction_input() and direction_output()

The new update_flags() method is more flexible since it allows the
driver to see the full flags all at once. Use that in preference to these
two functions. Add comments to that effect.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agodm: gpio: Add a way to update flags
Simon Glass [Fri, 5 Feb 2021 04:22:03 +0000 (21:22 -0700)]
dm: gpio: Add a way to update flags

It is convenient to be able to adjust some of the flags for a GPIO while
leaving others alone. Add a function for this.

Update dm_gpio_set_dir_flags() to make use of this.

Also update dm_gpio_set_value() to use this also, since this allows the
open-drain / open-source features to be implemented directly in the
driver, rather than using the uclass workaround.

Update the sandbox tests accordingly. This involves a lot of changes to
dm_test_gpio_opendrain_opensource() since we no-longer have the direciion
being reported differently depending on the open drain/open source flags.

Also update the STM32 drivers to let the uclass handle the active low/high
logic.

Drop the GPIOD_FLAGS_OUTPUT() macro which is no-longer used.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Kory Maincent <kory.maincent@bootlin.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Tested-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agogpio: sandbox: Make sandbox_gpio_set_flags() set all flags
Simon Glass [Fri, 5 Feb 2021 04:22:02 +0000 (21:22 -0700)]
gpio: sandbox: Make sandbox_gpio_set_flags() set all flags

Allow this function to see all flags, including the internal sandbox ones.
This allows the tests to fully control the behaviour of the driver.

To make this work, move the setting of GPIOD_EXT_HIGH -to where the flags
are updated via driver model, rather than the sandbox 'back door'.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agogpio: sandbox: Fully separate pin value from output value
Simon Glass [Fri, 5 Feb 2021 04:22:01 +0000 (21:22 -0700)]
gpio: sandbox: Fully separate pin value from output value

At present we have the concept of a pin's external value. This is what
is used when getting the value of a pin. But we still set the
GPIOD_IS_OUT_ACTIVE flag when changing the value. This is not actually
correct, since if the pin changes from output to input, the external
value need not change. Adjust the logic for this difference.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agogpio: sandbox: Use a separate flag for the value
Simon Glass [Fri, 5 Feb 2021 04:22:00 +0000 (21:22 -0700)]
gpio: sandbox: Use a separate flag for the value

At present with the sandbox GPIO driver it is not possible to change the
value of GPIOD_IS_OUT_ACTIVE unless the GPIO is an output. This makes it
hard to test changing the flags since we need to be aware of the internal
workings of the driver.

The feature is designed to aid testing.

Split this feature out into a separate sandbox-specific flag, so that the
flags can change unimpeded. This will make it easier to allow updating the
flags in a future patch.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agogpio: sandbox: Rename GPIO dir_flags to flags
Simon Glass [Fri, 5 Feb 2021 04:21:59 +0000 (21:21 -0700)]
gpio: sandbox: Rename GPIO dir_flags to flags

Adjust the terminology in this driver to reflect that fact that all flags
are handled, not just direction flags.

Create a new access function to get the full GPIO state, not just the
direction flags. Drop the static invalid_dir_flags since we can rely on a
segfault if something is wrong.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agogpio: Rename dm_gpio_get_dir_flags() to dm_gpio_get_flags()
Simon Glass [Fri, 5 Feb 2021 04:21:57 +0000 (21:21 -0700)]
gpio: Rename dm_gpio_get_dir_flags() to dm_gpio_get_flags()

This function can be used to get any flags, not just direction flags.
Rename it to avoid confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
3 years agodm: gpio: Rename get_dir_flags() method to get_flags()
Simon Glass [Fri, 5 Feb 2021 04:21:56 +0000 (21:21 -0700)]
dm: gpio: Rename get_dir_flags() method to get_flags()

It is more useful to be able to read all the flags, not just the direction
ones. In fact this is what the STM32 driver does. Update the method name
to reflect this.

Tweak the docs a little and use 'flagsp' as the return argument, as is
common in driver model, to indicate it returns a value.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
3 years agodm: gpio: Rename set_dir_flags() method to update_flags()
Simon Glass [Fri, 5 Feb 2021 04:21:55 +0000 (21:21 -0700)]
dm: gpio: Rename set_dir_flags() method to update_flags()

The current method is a misnomer since it is also used (e.g. by stm32) to
update pull settings and open source/open drain.

Rename it and expand the documentation to cover a few more details.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agogpio: Disable functions not used with of-platdata
Simon Glass [Fri, 5 Feb 2021 04:21:54 +0000 (21:21 -0700)]
gpio: Disable functions not used with of-platdata

These functions use devicetree and cannot work with of-platdata, which has
no runtime devicetree.

If they are used, the current linker error is confusing, since it talks
about missing functions in the bowels of driver model.

Avoid compiling these functions at all with of-platdata, so that a
straightforward link error points to the problem.

Series-changes; 3
- Fix 'wprl' typo

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoMerge branch '2021-03-03-assorted-improvements' into next
Tom Rini [Wed, 3 Mar 2021 19:05:43 +0000 (14:05 -0500)]
Merge branch '2021-03-03-assorted-improvements' into next

- Clean up reset_cpu()
- Assorted arm cp15 cleanups
- Assorted cleanups throughout the tree from Simon
- TPM1 / TPM2 cleanups

3 years agovideo: sunxi_display: Convert to DM_VIDEO
Jagan Teki [Mon, 22 Feb 2021 00:12:34 +0000 (00:12 +0000)]
video: sunxi_display: Convert to DM_VIDEO

DM_VIDEO migration deadline is already expired, but around
80 Allwinner boards are still using video in a legacy way:

===================== WARNING ======================
This board does not use CONFIG_DM_VIDEO Please update
the board to use CONFIG_DM_VIDEO before the v2019.07 release.
Failure to update by the deadline may result in board removal.
See doc/driver-model/migration.rst for more info.
====================================================

Convert the legacy video driver over to the DM_VIDEO framework. This is
a minimal conversion: it doesn't use the DT for finding its resources,
nor does it use DM clocks or DM devices for the outputs (LCD, HDMI, CVBS).

Tested in Bananapi M1+ Plus 1920x1200 HDMI out. (Jagan)

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
[Andre: rebase and smaller fixes]
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotpm: Allow disabling platform hierarchy with TPM2
Simon Glass [Sat, 6 Feb 2021 21:23:42 +0000 (14:23 -0700)]
tpm: Allow disabling platform hierarchy with TPM2

With TPM2 we don't actually lock the TPM once verified boot is finished.
Instead we disable the platform hierarchy which serves the same purpose.
Add an implementation of this so we can safely boot into the kernel.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agotpm: Add TPM2 support for write_lock
Simon Glass [Sat, 6 Feb 2021 21:23:41 +0000 (14:23 -0700)]
tpm: Add TPM2 support for write_lock

Implement this API function for TPM2.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agotpm: Add TPM2 support for read/write values
Simon Glass [Sat, 6 Feb 2021 21:23:40 +0000 (14:23 -0700)]
tpm: Add TPM2 support for read/write values

Implement this API function for TPM2.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agotpm: Add an implementation of define_space
Simon Glass [Sat, 6 Feb 2021 21:23:39 +0000 (14:23 -0700)]
tpm: Add an implementation of define_space

Add support for this so that the TPM can be set up for use with
Chromium OS verified boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agotpm: Reduce duplication in a few functions
Simon Glass [Sat, 6 Feb 2021 21:23:38 +0000 (14:23 -0700)]
tpm: Reduce duplication in a few functions

Update tpm2_clear() and tpm2_pcr_extend() so that the command size
is not repeated twice. Add a small comment to the latter.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agotpm: Add a basic API implementation for TPMv2
Simon Glass [Sat, 6 Feb 2021 21:23:37 +0000 (14:23 -0700)]
tpm: Add a basic API implementation for TPMv2

Add support for TPMv2 versions of API functions. So far this is not
complete as the standard is quite large, but it implements everything
currently available for TPMv2 in U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agotpm: Switch TPMv1 over to use the new API
Simon Glass [Sat, 6 Feb 2021 21:23:36 +0000 (14:23 -0700)]
tpm: Switch TPMv1 over to use the new API

Take over the plain 'tpm_...' functions for use by the new TPM API. Rename
all the TPMv1 functions so they are called from the API.

Update the TPMv1 functions so that they are called from the API. Change
existing users to use the tpm1_ prefix so they don't need to go through
the API, which might introduce uncertainty.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agotpm: Add an API that can support v1.2 and v2
Simon Glass [Sat, 6 Feb 2021 21:23:35 +0000 (14:23 -0700)]
tpm: Add an API that can support v1.2 and v2

There are two different TPM standards. U-Boot supports both but each has
its own set of functions. We really need a single TPM API that can call
one or the other. This is not always possible as there are some
differences between the two standards, but it is mostly possible.

Add an API to handle this. So far it is not plumbed into the build and
only supports TPMv1.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agotpm: Add debugging of request in tpm_sendrecv_command()
Simon Glass [Sat, 6 Feb 2021 21:23:34 +0000 (14:23 -0700)]
tpm: Add debugging of request in tpm_sendrecv_command()

The response is shown but not the request. Update the code to show both
if debugging is enabled.

Use a 'uint' type for size so it matches the register-word size on both
32- and 64-bit machines.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agotpm: Use logging in the uclass
Simon Glass [Sat, 6 Feb 2021 21:23:33 +0000 (14:23 -0700)]
tpm: Use logging in the uclass

Update this to use log_debug() instead of the old debug().

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agotpm: Don't include cr50 in TPL/SPL
Simon Glass [Sat, 6 Feb 2021 21:23:32 +0000 (14:23 -0700)]
tpm: Don't include cr50 in TPL/SPL

At present the security chip is not used in these U-Boot phases. Update
the Makefile to exclude it.

Fix a few logging statements while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
3 years agobootm: Fix duplicate debugging in bootm_process_cmdline()
Simon Glass [Sat, 6 Feb 2021 16:57:35 +0000 (09:57 -0700)]
bootm: Fix duplicate debugging in bootm_process_cmdline()

These two returns use the same string so are not distinguishable with
LOG_ERROR_RETURN. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: Write out bloblist when exiting
Simon Glass [Sat, 6 Feb 2021 16:57:34 +0000 (09:57 -0700)]
sandbox: Write out bloblist when exiting

Sandbox provides a way to write out its emulated memory on exit. This
makes it possible to pass a bloblist from one phase (e.g. SPL) to the
next.

However the bloblist is not closed off, so the checksum is generally
invalid. Fix this by finishing up the bloblist before writing the memory
file.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: Avoid using malloc() for system state
Simon Glass [Sat, 6 Feb 2021 16:57:33 +0000 (09:57 -0700)]
sandbox: Avoid using malloc() for system state

This state is not accessible to the running U-Boot but at present it is
allocated in the emulated SDRAM. This doesn't seem very useful. Adjust
it to allocate from the OS instead.

The RAM buffer is currently not freed, but should be, so add that into
state_uninit(). Update the comment for os_free() to indicate that NULL is
a valid parameter value.

Note that the strdup() in spl_board_load_image() is changed as well, since
strdup() allocates memory in the RAM buffer.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agosandbox: Add os_realloc()
Simon Glass [Sat, 6 Feb 2021 16:57:32 +0000 (09:57 -0700)]
sandbox: Add os_realloc()

We provide os_malloc() and os_free() but not os_realloc(). Add this,
following the usual semantics. Also update os_malloc() to behave correctly
when passed a zero size.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agos5p4418_nanopi2: Drop dead code
Simon Glass [Sat, 6 Feb 2021 16:57:31 +0000 (09:57 -0700)]
s5p4418_nanopi2: Drop dead code

This code is still using the old command typedef. It was not noticed since
this file is not currently built. It is using a non-existent option in the
Makefile.

Drop this file since it is not needed for correct operation.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodoc: Add a note about producing 'md.b' output using hexdump
Simon Glass [Sat, 6 Feb 2021 16:57:30 +0000 (09:57 -0700)]
doc: Add a note about producing 'md.b' output using hexdump

Comparing a hex dump on the U-Boot command line with the contents of a
file on the host system is fairly easy and convenient to do manually if
it is small. But the format used hexdump by default differs from that
shown by U-Boot. Add a note about how to make them the same.

(For large dumps, writing the data to the network with tftpput, or to a
USB stick with ext4save is easiest.)

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agodoc: describe the md command
Simon Glass [Sat, 6 Feb 2021 16:57:29 +0000 (09:57 -0700)]
doc: describe the md command

Provide a man-page for the md command.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agobinman: Indicate how to make binman verbose
Simon Glass [Sat, 6 Feb 2021 16:57:28 +0000 (09:57 -0700)]
binman: Indicate how to make binman verbose

Add notes about how to make binman produce verbose logging when building.

Add a comment on how to do this.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agospl: Drop duplicate 'Jumping to U-Boot' message
Simon Glass [Sat, 6 Feb 2021 16:57:27 +0000 (09:57 -0700)]
spl: Drop duplicate 'Jumping to U-Boot' message

This is printed twice but we only need one message, since there is very
little processing in between them. Drop the second one, since all branches
of the switch() already have output. Update the U-Boot message to include
the phase being jumped to.

Signed-off-by: Simon Glass <sjg@chromium.org>
3 years agoarm: remove set_dacr/get_dacr functions
Patrick Delaunay [Fri, 5 Feb 2021 12:53:39 +0000 (13:53 +0100)]
arm: remove set_dacr/get_dacr functions

Remove the unused function set_dacr/get_dacr

Serie-cc: Ard Biesheuvel <ardb@kernel.org>
Serie-cc: R Sricharan <r.sricharan@ti.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoarm: cp15: remove weak function arm_init_domains
Patrick Delaunay [Fri, 5 Feb 2021 12:53:38 +0000 (13:53 +0100)]
arm: cp15: remove weak function arm_init_domains

Remove the unused weak function arm_init_domains used to change the
DACR value.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoarm: omap2: remove arm_init_domains
Patrick Delaunay [Fri, 5 Feb 2021 12:53:37 +0000 (13:53 +0100)]
arm: omap2: remove arm_init_domains

Remove the arm_init_domains and the DACR update, as it is now done
in ARMv7 CP15 level.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoarm: cp15: update DACR value to activate access control
Patrick Delaunay [Fri, 5 Feb 2021 12:53:36 +0000 (13:53 +0100)]
arm: cp15: update DACR value to activate access control

Update the initial value of Domain Access Control Register (DACR)
and set by default the access permission to client (DACR_Dn_CLIENT = 1U)
for each of the 16 domains and no more to all-supervisor
(DACR_Dn_MANAGER = 3U).

This patch allows to activate the domain checking in MMU against the
permission bits in the translation tables and avoids prefetching issue
on ARMv7 [1].

Today it was already done for OMAP2 architecture
./arch/arm/mach-omap2/omap-cache.c::arm_init_domains
introduced by commit de63ac278cba ("ARM: mmu: Set domain permissions
to client access") which fixes lot of speculative prefetch aborts seen
on OMAP5 secure devices.

[1] https://developer.arm.com/documentation/ddi0406/b/System-Level-Architecture/Virtual-Memory-System-Architecture--VMSA-/Memory-access-control/The-Execute-Never--XN--attribute-and-instruction-prefetching

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reported-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoarm: cosmetic: align TTB_SECT define value
Patrick Delaunay [Fri, 5 Feb 2021 12:53:35 +0000 (13:53 +0100)]
arm: cosmetic: align TTB_SECT define value

Align TTB_SECT define value with previous value.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoarm: remove TTB_SECT_XN_MASK in DCACHE_WRITETHROUGH
Patrick Delaunay [Fri, 5 Feb 2021 12:53:34 +0000 (13:53 +0100)]
arm: remove TTB_SECT_XN_MASK in DCACHE_WRITETHROUGH

The normal memory (other that DCACHE_OFF) should be executable by default,
only the device memory (DCACHE_OFF) used for peripheral access should have
the bit execute never (TTB_SECT_XN_MASK).

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agostm32mp: update the mmu configuration for SPL and prereloc
Patrick Delaunay [Fri, 5 Feb 2021 12:53:33 +0000 (13:53 +0100)]
stm32mp: update the mmu configuration for SPL and prereloc

Overidde the weak function dram_bank_mmu_setup() to set the DDR
(preloc case) or the SYSRAM (in SPL case) executable before to enable
the MMU and configure DACR.

This weak function is called in dcache_enable/mmu_setup.

This patchs avoids a permission access issue when the DDR is marked
executable (by calling mmu_set_region_dcache_behaviour with
DCACHE_DEFAULT_OPTION) after MMU setup and domain access permission
activation with DACR in dcache_enable.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agostm32mp: update MMU config before the relocation
Patrick Delaunay [Fri, 5 Feb 2021 12:53:32 +0000 (13:53 +0100)]
stm32mp: update MMU config before the relocation

Mark the top of ram, used for relocated U-Boot as a normal memory
(cacheable and executable) to avoid permission access issue when
U-Boot jumps to this relocated code.

When MMU is activated in pre-reloc stage; only the beginning of
DDR is marked executable.

This patch avoids access issue when DACR is correctly managed.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoreset: Remove addr parameter from reset_cpu()
Harald Seiler [Tue, 15 Dec 2020 15:47:52 +0000 (16:47 +0100)]
reset: Remove addr parameter from reset_cpu()

Historically, the reset_cpu() function had an `addr` parameter which was
meant to pass in an address of the reset vector location, where the CPU
should reset to.  This feature is no longer used anywhere in U-Boot as
all reset_cpu() implementations now ignore the passed value.  Generic
code has been added which always calls reset_cpu() with `0` which means
this feature can no longer be used easily anyway.

Over time, many implementations seem to have "misunderstood" the
existence of this parameter as a way to customize/parameterize the reset
(e.g.  COLD vs WARM resets).  As this is not properly supported, the
code will almost always not do what it is intended to (because all
call-sites just call reset_cpu() with 0).

To avoid confusion and to clean up the codebase from unused left-overs
of the past, remove the `addr` parameter entirely.  Code which intends
to support different kinds of resets should be rewritten as a sysreset
driver instead.

This transformation was done with the following coccinelle patch:

    @@
    expression argvalue;
    @@
    - reset_cpu(argvalue)
    + reset_cpu()

    @@
    identifier argname;
    type argtype;
    @@
    - reset_cpu(argtype argname)
    + reset_cpu(void)
    { ... }

Signed-off-by: Harald Seiler <hws@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoRevert "lpc32xx: cpu: add support for soft reset"
Harald Seiler [Tue, 15 Dec 2020 15:47:51 +0000 (16:47 +0100)]
Revert "lpc32xx: cpu: add support for soft reset"

This reverts commit 576007aec9a4a5f4f3dd1f690fb26a8c05ceb75f.

The parameter passed to reset_cpu() no longer holds a meaning as all
call-sites now pass the value 0.  Thus, branching on it is essentially
dead code and will just confuse future readers.

Revert soft-reset support and just always perform a hard-reset for now.
This is a preparation for removal of the reset_cpu() parameter across
the entire tree in a later patch.

Fixes: 576007aec9a4 ("lpc32xx: cpu: add support for soft reset")
Cc: Sylvain Lemieux <slemieux@tycoint.com>
Signed-off-by: Harald Seiler <hws@denx.de>
3 years agoboard: ns3: Remove superfluous reset logic
Harald Seiler [Tue, 15 Dec 2020 15:47:50 +0000 (16:47 +0100)]
board: ns3: Remove superfluous reset logic

The current implementation of reset_cpu() in the ns3 board code does not
archieve what it is supposed to (according to the comments), due to
a number of reasons:

 1. The argument to reset_cpu() is _not_ actually passed from the
    `reset` command, but is set to 0 in all call-sites (in this
    specific case, see arch/arm/lib/reset.c).  Thus, performing
    different kinds of resets based on its value will not work as
    expected.

 2. Contrary to its documentation, the passed argument is not
    interpreted, but a static `L3_RESET` define is used.  The other
    comment properly notes that this will always perform a L3 reset,
    though.

 3. The "parsing" of the static `L3_RESET` value is not even using the
    upper and lower nibble as stated in the comment, but uses the last
    two decimal digits of the value.

This is currently one of the only implementations left in U-Boot, which
make "use" of the value passed to reset_cpu().  As this is done under
false assumption (the value does not have any meaning anymore), it makes
sense to bring it into line with the rest and start ignoring the
parameter.

This is a preparation for removal of the reset_cpu() parameter across
the entire tree in a later patch.

Fixes: b5a152e7ca0b ("board: ns3: default reset type to L3")
Cc: Bharat Gooty <bharat.gooty@broadcom.com>
Cc: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
Signed-off-by: Harald Seiler <hws@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agonds32: Remove dead reset_cpu() implementation
Harald Seiler [Tue, 15 Dec 2020 15:47:49 +0000 (16:47 +0100)]
nds32: Remove dead reset_cpu() implementation

nds32 is one of the only architectures which still have a reset_cpu()
implementation that makes use of the `addr` parameter.  The rest of
U-Boot now ignores it and passes 0 everywhere.  It turns out that even
here, reset_cpu() is no longer referenced anywhere; reset is either not
implemented (e.g. ae3xx) or realized using a WDT (e.g. ag101).

Remove this left-over implementation in preparation for the removal of
the `addr` parameter in the entire tree.

Cc: Rick Chen <rick@andestech.com>
Signed-off-by: Harald Seiler <hws@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Rick Chen <rick@andestech.com>
3 years agoPrepare v2021.04-rc3
Tom Rini [Tue, 2 Mar 2021 03:46:41 +0000 (22:46 -0500)]
Prepare v2021.04-rc3

Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agolog: convert pr_*() to logging
Heinrich Schuchardt [Mon, 4 Jan 2021 07:02:55 +0000 (08:02 +0100)]
log: convert pr_*() to logging

In drivers we use a family of printing functions including pr_err() and
pr_cont(). CONFIG_LOGLEVEL is used to control which of these lead to output
via printf().

Our logging functions allow finer grained control of output. So replace
printf() by the matching logging functions. The usage of CONFIG_LOGLEVEL
remains unchanged.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agofs: btrfs: do not fail when offset of a ROOT_ITEM is not -1
Marek Behún [Tue, 9 Feb 2021 17:33:37 +0000 (18:33 +0100)]
fs: btrfs: do not fail when offset of a ROOT_ITEM is not -1

When the btrfs_read_fs_root() function is searching a ROOT_ITEM with
location key offset other than -1, it currently fails via BUG_ON.

The offset can have other value than -1, though. This can happen for
example if a subvolume is renamed:

  $ btrfs subvolume create X && sync
  Create subvolume './X'
  $ btrfs inspect-internal dump-tree /dev/root | grep -B 2 'name: X$
        location key (270 ROOT_ITEM 18446744073709551615) type DIR
        transid 283 data_len 0 name_len 1
        name: X
  $ mv X Y && sync
  $ btrfs inspect-internal dump-tree /dev/root | grep -B 2 'name: Y$
        location key (270 ROOT_ITEM 0) type DIR
        transid 285 data_len 0 name_len 1
        name: Y

As can be seen the offset changed from -1ULL to 0.

Do not fail in this case.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Cc: David Sterba <dsterba@suse.com>
Cc: Qu Wenruo <wqu@suse.com>
Cc: Tom Rini <trini@konsulko.com>
3 years agouboot-test-hooks: Switch to our GitLab instance
Tom Rini [Wed, 24 Feb 2021 22:05:04 +0000 (17:05 -0500)]
uboot-test-hooks: Switch to our GitLab instance

As Stephen is no longer actively maintaining the uboot-test-hooks
repository, switch to using the instance on our GitLab.

Acked-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
3 years agoCorrect U-Boot upstream repository
Heinrich Schuchardt [Wed, 24 Feb 2021 12:19:04 +0000 (13:19 +0100)]
Correct U-Boot upstream repository

The U-Boot source moves to https://source.denx.de/u-boot/u-boot.git
effective 2021-02-28.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoMerge tag 'efi-2021-04-rc3-2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Tom Rini [Sat, 27 Feb 2021 13:06:10 +0000 (08:06 -0500)]
Merge tag 'efi-2021-04-rc3-2' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2021-04-rc3-2

Bug fixes:
* debug build for mkeficapsule
* limit output length for VenHw, VenMedia
* ACPI tables must be in EfiACPIReclaimMemory

3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-usb
Tom Rini [Fri, 26 Feb 2021 20:11:08 +0000 (15:11 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-usb

- fastboot updates / fixes

3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-spi
Tom Rini [Fri, 26 Feb 2021 17:41:19 +0000 (12:41 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-spi

- new GigaDevice flash ids
- fixes for imx, nxp_spi drivers

3 years agoMerge tag 'u-boot-stm32-20210226' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm
Tom Rini [Fri, 26 Feb 2021 17:41:06 +0000 (12:41 -0500)]
Merge tag 'u-boot-stm32-20210226' of https://gitlab.denx.de/u-boot/custodians/u-boot-stm

- Add USB host boot support in stm32mp1 config
- Enable uefi related commands for STMicroelectronics STM32MP15 boards
- Remove duplicate uart nodes in stm32mp15 device tree

3 years agocmd/efidebug: add firmware management protocol GUID
Heinrich Schuchardt [Fri, 26 Feb 2021 16:57:47 +0000 (17:57 +0100)]
cmd/efidebug: add firmware management protocol GUID

Add missing GUID short text used in the efidebug tables and efidebug dh
sub-commands.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: fix documentation in efi_loader.h
Heinrich Schuchardt [Thu, 25 Feb 2021 07:02:37 +0000 (08:02 +0100)]
efi_loader: fix documentation in efi_loader.h

Correct missing descriptions and typos in efi_loader.h.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: limit output length for VenHw, VenMedia
Heinrich Schuchardt [Tue, 23 Feb 2021 20:15:35 +0000 (21:15 +0100)]
efi_loader: limit output length for VenHw, VenMedia

VenHw and VenMedia device path nodes may carry vendor defined data of
arbitrary length. When converting a device path node to text ensure that we
do not overrun our internal buffer.

In our implementation of
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL.ConvertDevicePathToText() we could first
determine the output length and then allocate buffers but that would nearly
double the code size. Therefore keep the preallocated buffers and truncate
excessive device paths instead.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agotools/mkeficapsule.c: fix DEBUG build
Klaus Heinrich Kiwi [Sat, 20 Feb 2021 20:40:45 +0000 (17:40 -0300)]
tools/mkeficapsule.c: fix DEBUG build

Fix a missing comma sign (,) from a printf(), that is only
reachable if DEBUG is defined, in which case the build fails with:

    tools/mkeficapsule.c:266:36: error: expected ‘)’ before ‘bin’
      266 |  printf("\tbin: %s\n\ttype: %pUl\n" bin, guid);
          |                                    ^~~~
          |                                    )

Signed-off-by: Klaus Heinrich Kiwi <klaus@linux.vnet.ibm.com>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoMAINTAINERS: assign tools/mkeficapsule.c to EFI PAYLOAD
Heinrich Schuchardt [Mon, 22 Feb 2021 19:26:34 +0000 (20:26 +0100)]
MAINTAINERS: assign tools/mkeficapsule.c to EFI PAYLOAD

tools/mkeficapsule.c is used to prepare test files for testing the UEFI
sub-system.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoefi_loader: ACPI tables must be in EfiACPIReclaimMemory
Heinrich Schuchardt [Sun, 21 Feb 2021 09:16:58 +0000 (10:16 +0100)]
efi_loader: ACPI tables must be in EfiACPIReclaimMemory

The UEFI spec does not allow ACPI tables to be in runtime services memory.
It recommends EfiACPIReclaimMemory.

Remove a superfluous check that the allocated pages are 16 byte aligned.
EFI pages are 4 KiB aligned.

Fixes: 86df34d42b05 ("efi_loader: Install ACPI configuration tables")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
3 years agoconfigs: stm32mp1: enable uefi related commands
Ilias Apalodimas [Fri, 26 Feb 2021 12:52:51 +0000 (14:52 +0200)]
configs: stm32mp1: enable uefi related commands

The board can boot with UEFI. With the latest changes in U-Boot's
EFI subsystem we also have support for EFI runtime variables, without
SetVariable support.  We can also store the EFI variables in a file on the
ESP partition and preserve them across reboots.
The env and efidebug commands are missing in order to configure
EFI variables and the efibootmgr though.  Since U-Boot's default config
enables other EFI related commands (e.g bootefi), let's add the env related
and efidebug commands and allow users to do that

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agoarm: dts: stm32mp15: remove duplicate uart nodes
Patrick Delaunay [Wed, 24 Feb 2021 10:00:56 +0000 (11:00 +0100)]
arm: dts: stm32mp15: remove duplicate uart nodes

Remove duplicated uart nodes introduced with commit 62f95af92a3f
("ARM: dts: stm32mp1: DT alignment with Linux kernel v5.9-rc4"),
because the uart nodes wasn't correctly ordered in alphabetic order.

Only cosmetic: the generated device tree don't change.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
3 years agoARM: stm32: Add USB host boot support
Marek Vasut [Fri, 12 Feb 2021 12:50:52 +0000 (13:50 +0100)]
ARM: stm32: Add USB host boot support

Add support for booting from USB pen drive, since USB host port is
available on the STM32MP1.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agousb: gadget: dwc2_udc_otg: Fix dwc2_gadget_start() and usb_gadget_register_driver()
Patrice Chotard [Wed, 17 Feb 2021 09:17:27 +0000 (10:17 +0100)]
usb: gadget: dwc2_udc_otg: Fix dwc2_gadget_start() and usb_gadget_register_driver()

Since commit 8745b9ebccae ("usb: gadget: add super speed support")
ums was no more functional on platform which use dwc2_udc_otg driver.

This was due to a too restrictive test which checked that the gadget
driver speed was either FS or HS.

So all gadget driver with max speed set to speed higher than
HS (SS in case of composite gadget driver in our case) are not
allowed, which is wrong.

Update the speed test in usb_gadget_register_driver() and in
dwc2_gadget_start() to allow all gadget driver speed equal or higher
than FS.

Tested on stm32mp157c-ev1 board.

Fixes: c791c8431c34 ("usb: dwc2: convert driver to DM_USB_GADGET")
Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
3 years agousb: kbd: Also accept keyboards with Interrupt OUT endpoint
Stefan Brüns [Sat, 20 Feb 2021 16:26:06 +0000 (17:26 +0100)]
usb: kbd: Also accept keyboards with Interrupt OUT endpoint

The OUT endpoint can just be ignored as it is not used, just as the
corresponding Set_Report request for IN-only interfaces. E.g. the
Linux gadget hid keyboard also provides an interrupt endpoint.

Also cleanup confusing debug messages like "found set protocol", which
is printed when a keyboard device is found, while the Set_Protocol request
is issued quite some time later.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
3 years agofastboot: add UUU command UCmd and ACmd support
Heiko Schocher [Wed, 10 Feb 2021 08:29:03 +0000 (09:29 +0100)]
fastboot: add UUU command UCmd and ACmd support

add support for the UUU commands ACmd and UCmd.

Enable them through the Kconfig option
CONFIG_FASTBOOT_UUU_SUPPORT

base was commit in NXP kernel
9b149c2a2882: ("MLK-18591-3 android: Add FSL android fastboot support")

and ported it to current mainline. Tested this patch
on imx6ul based board.

Signed-off-by: Heiko Schocher <hs@denx.de>
Acked-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
3 years agodoc: Document partition specifications
Sean Anderson [Fri, 5 Feb 2021 14:39:02 +0000 (09:39 -0500)]
doc: Document partition specifications

This documents the way U-Boot understands partitions specifications.
This also updates the fastboot documentation for the changes in the
previous commit.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agodoc: Rename k210 partitions anchor
Sean Anderson [Fri, 5 Feb 2021 14:39:01 +0000 (09:39 -0500)]
doc: Rename k210 partitions anchor

This anchor is only for the k210 partition layout, so rename it
appropriately. This keeps it from conflicting with the (to be added)
anchor for U-Boot partitions in general.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agofastboot: Allow u-boot-style partitions
Sean Anderson [Fri, 5 Feb 2021 14:39:00 +0000 (09:39 -0500)]
fastboot: Allow u-boot-style partitions

This adds support for partitions of the form "dev.hwpart:part" and
"dev#partname". This allows one to flash to eMMC boot partitions without
having to use CONFIG_FASTBOOT_MMC_BOOT1_SUPPORT. It also allows one to
flash to an entire device without needing CONFIG_FASTBOOT_MMC_USER_NAME.
Lastly, one can also flash MMC devices other than
CONFIG_FASTBOOT_FLASH_MMC_DEV.

Because devices can be specified explicitly, CONFIG_FASTBOOT_FLASH_MMC_DEV
is used only when necessary for existing functionality. For those cases,
fastboot_mmc_get_dev has been added as a helper function. This allows

There should be no conflicts with the existing system, but just in case, I
have ordered detection of these names after all existing names.

The fastboot_mmc_part test has been updated for these new names.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agofastboot: Move part_get_info_by_name_or_alias after raw_part_get_info_by_name
Sean Anderson [Fri, 5 Feb 2021 14:38:59 +0000 (09:38 -0500)]
fastboot: Move part_get_info_by_name_or_alias after raw_part_get_info_by_name

This makes the next commit more readable by doing the move now.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agofastboot: Remove mmcpart argument from raw_part_get_info_by_name
Sean Anderson [Fri, 5 Feb 2021 14:38:58 +0000 (09:38 -0500)]
fastboot: Remove mmcpart argument from raw_part_get_info_by_name

The only thing mmcpart was used for was to pass to blk_dselect_hwpart.
This calls blk_dselect_hwpart directly from raw_part_get_info_by_name. The
error handling is dropped, but it is reintroduced in the next commit
(albeit less specificly).

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agopart: Support string block devices in part_get_info_by_dev_and_name
Sean Anderson [Fri, 5 Feb 2021 14:38:57 +0000 (09:38 -0500)]
part: Support string block devices in part_get_info_by_dev_and_name

This adds support for things like "#partname" and "0.1#partname". The block
device parsing is done like in blk_get_device_part_str.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agopart: Support getting whole disk from part_get_info_by_dev_and_name_or_num
Sean Anderson [Fri, 5 Feb 2021 14:38:56 +0000 (09:38 -0500)]
part: Support getting whole disk from part_get_info_by_dev_and_name_or_num

This adds an option to part_get_info_by_dev_and_name_or_num to allow
callers to specify whether whole-disk partitions are fine.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agopart: Give several functions more useful return values
Sean Anderson [Fri, 5 Feb 2021 14:38:55 +0000 (09:38 -0500)]
part: Give several functions more useful return values

Several functions in disk/part.c just return -1 on error. This makes them
return different errnos for different failures. This helps callers
differentiate between failures, even if they cannot read stdout.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agotest: dm: Add test for fastboot mmc partition naming
Sean Anderson [Fri, 5 Feb 2021 14:38:54 +0000 (09:38 -0500)]
test: dm: Add test for fastboot mmc partition naming

This test verifies the mapping between fastboot partitions and partitions
as understood by U-Boot. It also tests the creation of GPT partitions,
though that is not the primary goal.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agommc: sandbox: Add support for writing
Sean Anderson [Fri, 5 Feb 2021 14:38:53 +0000 (09:38 -0500)]
mmc: sandbox: Add support for writing

This adds support writing to the sandbox mmc backed by an in-memory
buffer. The unit test has been updated to test reading, writing, and
erasing. I'm not sure what MMCs erase to; I picked 0, but if it's 0xFF
then that can be easily changed.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell
Tom Rini [Fri, 26 Feb 2021 12:55:16 +0000 (07:55 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell

- turris_mox: Enhancements, mostlly defconfig changes (Pali)
- pci-aardvark: Set Max Payload Size and Max Read Request Size
                to 512 bytes (Pali)
- pci_mvebu: Minor cleanup and refactoring (Marek)
- Upgrade A38x DDR3 training to version 14.0.0 (Marek)

3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-samsung
Tom Rini [Fri, 26 Feb 2021 12:54:27 +0000 (07:54 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-samsung

3 years agoMerge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv
Tom Rini [Fri, 26 Feb 2021 12:53:04 +0000 (07:53 -0500)]
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv

3 years agomtd: nand: spi: Support GigaDevice GD5F1GQ5UExxG
Reto Schneider [Thu, 11 Feb 2021 12:05:48 +0000 (13:05 +0100)]
mtd: nand: spi: Support GigaDevice GD5F1GQ5UExxG

The relevant changes to the already existing GD5F1GQ4UExxG support has
been determined by consulting the GigaDevice product change notice
AN-0392-10, version 1.0 from November 30, 2020.

As the overlaps are huge, variable names have been generalized
accordingly.

Apart form the lowered ECC strength (4 instead of 8 bits per 512 bytes),
the new device ID, and the extra quad IO dummy byte, no changes had to
be taken into account.

New hardware features are not supported, namely:
 - Power on reset
 - Unique ID
 - Double transfer rate (DTR)
 - Parameter page
 - Random data quad IO

The inverted semantic of the "driver strength" register bits, defaulting
to 100% instead of 50% for the Q5 devices, got ignored as the driver has
never touched them anyway.

The no longer supported "read from cache during block erase"
functionality is not reflected as the current SPI NAND core does not
support it anyway.

Implementation has been tested on MediaTek MT7688 based GARDENA smart
Gateways using both, GigaDevice GD5F1GQ5UEYIG and GD5F1GQ4UBYIG.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
3 years agomtd: nand: spi: Only one dummy byte in QUADIO
Hauke Mehrtens [Thu, 11 Feb 2021 12:05:47 +0000 (13:05 +0100)]
mtd: nand: spi: Only one dummy byte in QUADIO

The datasheet only lists one dummy byte in the 0xEB operation for the
following chips:
* GD5F1GQ4xExxG
* GD5F1GQ4xFxxG
* GD5F1GQ4UAYIG
* GD5F4GQ4UAYIG

Reto Schneider:
- Linux patch ported to U-Boot
- Checked for compatibility with GD5F1GQ4xBxxG
- Fixed operation code in original commit message (0xEH -> 0xEB)

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
Reviewed-by: Stefan Roese <sr@denx.de>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
3 years agomtd: spi-nor-core: Fix typo in documentation
Sean Anderson [Fri, 5 Feb 2021 04:11:08 +0000 (23:11 -0500)]
mtd: spi-nor-core: Fix typo in documentation

This line should come before the docs for the next function.

Fixes: 7aeedac0153 ("mtd: spi: Port SPI NOR framework from Linux")
Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
3 years agocmd: sf: Print error on test failure
Sean Anderson [Fri, 5 Feb 2021 04:11:07 +0000 (23:11 -0500)]
cmd: sf: Print error on test failure

The sf test command is used to test spi flashes (and spi masters). Printing
the exact error code is very helpful to those debugging the spi stack.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
3 years agocmd: sf: Display errno on erase failure
Sean Anderson [Fri, 5 Feb 2021 04:11:06 +0000 (23:11 -0500)]
cmd: sf: Display errno on erase failure

If there is an error while erasing SPI flash, no errno is displayed. This
makes it difficult to determine the cause of the error. This change mirrors
the logic for write errors above.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
3 years agospi: nxp_fspi: Fix error reporting
Adam Ford [Mon, 18 Jan 2021 21:32:49 +0000 (15:32 -0600)]
spi: nxp_fspi: Fix error reporting

On the i.MX8M Mini, ret = clk_set_rate() sets ret to the value of the
rate the clock was able to set.  When checking for errors, it only
checks that it is not NULL.  Since positive numbers are not errors,
only check for negative numbers when handling errors.

Fixes: 383fded70c4f ("spi: nxp_fspi: new driver for the FlexSPI controller")
Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Pratyush Yadav <p.yadav@ti.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
3 years agoddr: marvell: a38x: fix comment in conditional macro
Marek Behún [Fri, 19 Feb 2021 16:11:26 +0000 (17:11 +0100)]
ddr: marvell: a38x: fix comment in conditional macro

The code was processed with unifdef utility to omit portions not
relevant to A38x and DDR3. This removes usage of many macros, including
A70X0, A80X0 and A3900. It seems that the unifdef utility did not remove
the macros from #else comment.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Tested-by: Chris Packham <chris.packham@alliedtelesis.co.nz>