Commit Graph

82731 Commits

Author SHA1 Message Date
Simon Glass
c830e285f4 video: Add a way to get the default font height
This is not as simple as it seems. Add a function to provide it so that
the upcoming menu feature can space lines out correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30 20:01:40 +01:00
Simon Glass
e90322f87c video: Add a function to get the dimensions of a BMP image
This is useful for some other users, so break this out into a function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30 20:01:40 +01:00
Simon Glass
430e1676a7 video: Add commands to list and change fonts
Add a new 'font' command which allows the fonts to be listed as well as
selecting a different font and size.

Allow the test to run on sandbox, where multiple font/size combinations
are supported, as well as sandbox_flattree, where they are not.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30 20:01:40 +01:00
Simon Glass
3f425f9ca7 video: Enable the cls command by default
This is enabled for LCD but not for VIDEO. Enable it since it is useful
to be able to clear the screen and adds very little code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30 20:01:40 +01:00
Simon Glass
57a847cd40 video: Add a way to change the font name and size
It is useful to be able to support multiple fonts. Add a function to
handle this as well as one to list the available fonts.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30 20:01:40 +01:00
Simon Glass
518d844a5e video: Add a function to select the truetype metrics
Move this code into a function so we can call it later when we want to
change the font.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30 20:01:40 +01:00
Simon Glass
39fa02d955 video: Record the truetype font name
Add this to the metrics so we can later adjust the font size without
changing the font itself.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30 20:01:40 +01:00
Simon Glass
31efa25095 video: Refactor to allow more than one font size
At present the truetype console supports only a single font and size. It
is useful to be able to support different combinations. As a first step,
move the metrics into there own structure and allow having multiple
metrics.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30 20:01:40 +01:00
Simon Glass
5330612f21 video: Tidy up the check for valid fonts
Put this check into a function so we can use it elsewhere. Also drop the
macros which do the same thing but are not actually used.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30 20:01:40 +01:00
Simon Glass
0d3890188d video: Add function to obtain the U-Boot logo
It is useful to show the logo from other code, coming in a later feature.
Add a function to obtain it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30 20:01:40 +01:00
Simon Glass
50d562c01f video: Allow filling the display with a colour
Generalise the video_clear() function to allow filling with a different
colour.

Tidy up the comments while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30 20:01:40 +01:00
Simon Glass
820b5894c1 video: Move and rename DM_HX8238D option
This is actually a panel, not a video device. Rename the option, move it
into the right place and make it depend on PANEL.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30 20:01:40 +01:00
Simon Glass
f029f90e7d video: Move the console commands to cmd/
Move these commands and the implementation to the cmd/ directory, which is
where most commands are kept.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
[agust: keep vidconsole_position_cursor() in vidconsole uclass]
Signed-off-by: Anatolij Gustschin <agust@denx.de>
2022-10-30 19:55:22 +01:00
Simon Glass
92fd6a1220 video: Use vidconsole_put_string() to write a string
Use the existing function rather that duplicating the code. Also fix up
the missing error handling.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30 09:56:02 +01:00
Simon Glass
6b6dc0d2fb video: Provide a function to set the cursor position
Add an exported function which allows the cursor position to be set to
pixel granularity. Make use of this in the existing code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30 09:53:47 +01:00
Simon Glass
a032e4b55e video: Move console colours to the video uclass
At present these are attached to vidconsole which means that the video
uclass requires that a console is enabled. This is not the intention.
The colours are a reasonable way of indexing common colours in any case,
so move them to the video uclass instead.

Rename vid_console_color() to video_index_to_colour() now that it is more
generic. Also fix the inconsistent spelling in these functions.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-30 08:43:24 +01:00
Takumi Sueda
db2c8ed3a5 video: simplefb: add rotation support
It introduces the way to rotate the screen for boards with rotated screen.

Signed-off-by: Takumi Sueda <puhitaku@gmail.com>
2022-10-30 08:28:40 +01:00
John Keeping
7209272497 video: dw_mipi_dsi: fix [hv]sync active vs back porch
The wrong fields are pulled out of the timings here so the values
programmed into the DSI_VID_HSA_LINES/DSI_VID_HBP_LINES and
DSI_VID_VSA_LINES/DSI_VID_VBP_LINES registers are swapped.

Use the right fields so that the correct values are programmed.

Fixes: d4f7ea83fc ("video: add MIPI DSI host controller bridge")
Signed-off-by: John Keeping <john@metanate.com>
2022-10-30 08:19:45 +01:00
Tom Rini
6f02819cce Fix pylibfdt warnings and use setuptools to build
Various minor changes to core dm and sandbox
 -----BEGIN PGP SIGNATURE-----
 
 iQFFBAABCgAvFiEEslwAIq+Gp8wWVbYnfxc6PpAIreYFAmNdrCIRHHNqZ0BjaHJv
 bWl1bS5vcmcACgkQfxc6PpAIreYdDQgAgCbj2sRZaQkYLeXh37EUcvLpJjwIUAyv
 GFkiPhCEEJ37ll89aRNac8lSJ6ZMG71HDouDfNFdWKJY50TJ35C5Dg4fS8AYudM9
 T3n9iRCPdL8KMmmQgznlSXhQ2Na18gy4FSBwGQnZwbggmABtlvkYE5AYHzKunR4+
 DehAOdpN6yHtMj0PMaJPM53atjGO2WqftD/96sGJT2RLCnXeBrwjI4zZJYFzXdw3
 dDKQN6qE121Jn9YjxysCQQKE+QgVC3hR5B5mFscox+8pAB87CTR9FfIBenqoZ2dg
 wDHWJcPMq8rEgdKdK2aXtKbLY/Rj4kMxEZCsjPWt2v1U3AoVZx+0/g==
 =VbI+
 -----END PGP SIGNATURE-----

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

Fix pylibfdt warnings and use setuptools to build
Various minor changes to core dm and sandbox
2022-10-29 18:51:22 -04:00
Michal Suchanek
f21954750a dm: core: Do not stop uclass iteration on error
When probing a device fails NULL pointer is returned, and following
devices in uclass list cannot be iterated. Skip to next device on error
instead.

With that the only condition under which these simple iteration
functions return error is when the dm is not initialized at uclass_get
time. This is not all that interesting, change return type to void.

Fixes: 6494d708bf ("dm: Add base driver model support")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-29 07:36:33 -06:00
Michal Suchanek
4954937d92 dm: treewide: Do not use the return value of simple uclass iterator
uclass_first_device/uclass_next_device return value will be removed,
don't use it.

With the current implementation dev is equivalent to !ret. It is
redundant to check both, ret check can be replaced with dev check, and
ret check inside the iteration is dead code.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-29 07:36:33 -06:00
Michal Suchanek
aa5511e77b dm: core: Add note about device_probe idempotence
device_probe returns early when the device is already activated.
Add a note to the documentation that it can be used on already activated
devices.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
2022-10-29 07:36:33 -06:00
Michal Suchanek
73f8fbc532 dm: core: Document return value of device bind functions
These functions use device_bind_with_driver_data internally, copy the
return value description.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
2022-10-29 07:36:33 -06:00
Michal Suchanek
58ddb937e1 dm: core: Switch uclass_*_device_err to use uclass_*_device_check
Clarify documentation, fix a few more cases that could be broken by the
change.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
2022-10-29 07:36:33 -06:00
Simon Glass
6b08fb5cc4 fdt: Move to setuptools
The distutils package is deprecated. The upstream libfdt repo uses
setuptools for building the pylibfdt module, so bring in that code,
suitably modified for U-Boot. Also bring in the README.

The modifications include setting the version correctly, making use of
the environment variables provided by the Makefile and various tweaks
to the directories.

Note that the version omits the minus character at the start of
EXTRAVERSION, since this creates a warning. The build is really just used
within U-Boot itself, so it doesn't matter too much if the version matches
upstream, or exactly matches U-Boot.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-29 07:36:33 -06:00
Sughosh Ganu
529b2c2d9c thermal: sandbox: Enable thermal uclass for sandbox64 variant
The sandbox64 variant is currently building the sandbox thermal driver
but not the corresponding uclass driver. This results in the sandbox64
variant not booting with the test device tree. Enable building the
thermal uclass for the sandbox64 variant as well.

Also enable the temperature command to allow the test to be run on the
sandbox64 variant.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-29 07:36:33 -06:00
Neha Malcom Francis
3545e8595c binman: Add support for symlinking images
Adding support to symlink an image packaged using binman.

Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-29 07:36:33 -06:00
Heinrich Schuchardt
f29f98d1e4 sandbox: typo Fictionnal
%s/Fictionnal/Fictional/

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-29 07:36:33 -06:00
Michal Suchanek
5bde2e06ca tests: Build correct sandbox configuration on 32bit
Currently sandbox configuration defautls to 64bit and there is no
automation for building 32bit sandbox on 32bit hosts.

Use _LP64 macro as heuristic for detecting 64bit targets.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-29 07:36:33 -06:00
William Zhang
6792bd999b dm: tpl: Add fdt address translation support in TPL
This is needed in the platforms that use "ranges" node property for
address translation in their dts for TPL.

Signed-off-by: William Zhang <william.zhang@broadcom.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-29 07:36:33 -06:00
Michal Suchanek
7d01bb1c5a libfdt: Fix build with python 3.10
Python 3.10 requires defining PY_SSIZE_T_CLEAN. This will be fixed in
swig 4.10 but it is not clear when it will be released. There was a
warning since python 3.8.

Link: https://github.com/swig/swig/pull/2277

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-29 07:36:33 -06:00
Michal Suchanek
c977b18435 libfdt: Fix invalid version warning
python does not like the u-boot- prefix in the version, drop it.

/usr/lib/python3.10/site-packages/setuptools/dist.py:544: UserWarning:
The version specified ('u-boot-2022.10') is an invalid version, this may
not work as expected with newer versions of setuptools, pip, and PyPI.
Please see PEP 440 for more details.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-29 07:36:33 -06:00
Simon Glass
7e8d3e1b01 test: Drop unwanted option in event_dump.py
This option is not used. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-29 07:36:33 -06:00
Simon Glass
5fe72d968f event: Drop the path when checking event-list filenames
This path does not seem to be present in clang-14 for some reason. Relax
the regular expression so that the test works, at least for non-LTO.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-29 07:36:33 -06:00
Simon Glass
d138792112 dm: core: Fix lists_bind_fdt() using non-existent of_match
The call to device_bind_with_driver_data() passes id->data but if
the entry has no of_match then the id has not been set by the selected
driver.

Normally this passes unnoticed since a previous driver likely had an
of_match value, so the id is set to that. Of course it is not correct
to pass the id->data from a different driver.

With clang-14 the driver ordering is such that the id is never actually
set in the 'bind /usb@1 usb_ether' line in test_bind_unbind_with_node()
thus causing a crash.

Fix this by passing 0 if the of_match for a driver does not exist.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-29 07:36:33 -06:00
Rasmus Villemoes
10e66449d7 gpio-uclass: fix gpio lookup by label
Matching anything that just happens to have the sought-for label as a
prefix is wrong. For example, if the board designer has designated 10
lines for debug purposes, named "debug1" through "debug10", and we are
looking up "debug1", if debug10 happens to be met first during the
iteration we'd wrongly return that.

In theory, this can break existing users that could rely on this
quirk, but OTOH keeping the current broken semantics can cause a lot
of grief for people hitting this in the future and not understanding
why they don't find the line they expect. Considering how few in-tree
defconfigs currently set DM_GPIO_LOOKUP_LABEL (ignoring sandbox, only
four "real" boards), let's fix it before the use becomes more
widespread.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
2022-10-29 07:36:33 -06:00
Heinrich Schuchardt
95e7cafa81 x86: provide typedef jmp_buf
The jmp_buf type is required by the C99 specification.
Defining it for x86 fixes building the longjmp unit test.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-29 07:36:33 -06:00
Heinrich Schuchardt
fc872ee84c x86: fix longjmp() implementation
If longjmp(jmp_buf env, int val) is called with val = 0, the setjmp()
macro must return 1.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-29 07:36:33 -06:00
Michal Suchanek
1fcfadcb82 dm: pci: Fix doc typo first -> next
pci_find_first_device description says it can be used for iteration with
itself but it should really be with pci_find_next_device

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
2022-10-29 07:36:33 -06:00
Patrick Delaunay
d7e9de7ec1 fdt_support: cosmetic: remove fdt_fixup_nor_flash_size prototype
Remove prototype for the removed function fdt_fixup_nor_flash_size.
This patch has no impact as the function is never used.

Fixes: 98f705c9ce ("powerpc: remove 4xx support")
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-29 07:36:33 -06:00
Michal Suchanek
f7d367c2e6 dm: doc: Fix serial howto u-boot,dm-pre-reloc typo
In a couple of places the document says u-boot,pre-reloc but all
examples show u-boot,dm-pre-reloc, use the latter consistently.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-29 07:36:32 -06:00
Rasmus Villemoes
fb63362c63 lib: fix buggy strcmp and strncmp
There are two problems with both strcmp and strncmp:

(1) The C standard is clear that the contents should be compared as
"unsigned char":

  The sign of a nonzero value returned by the comparison functions
  memcmp, strcmp, and strncmp is determined by the sign of the
  difference between the values of the first pair of characters (both
  interpreted as unsigned char) that differ in the objects being
  compared.

(2) The difference between two char (or unsigned char) values can
range from -255 to +255; so that's (due to integer promotion) the
range of values we could get in the *cs-*ct expressions, but when that
is then shoe-horned into an 8-bit quantity the sign may of course
change.

The impact is somewhat limited by the way these functions
are used in practice:

- Most of the time, one is only interested in equality (or for
  strncmp, "starts with"), and the existing functions do correctly
  return 0 if and only if the strings are equal [for strncmp, up to
  the given bound].

- Also most of the time, the strings being compared only consist of
  ASCII characters, i.e. have values in the range [0, 127], and in
  that case it doesn't matter if they are interpreted as signed or
  unsigned char, and the possible difference range is bounded to
  [-127, 127] which does fit the signed char.

For size, one could implement strcmp() in terms of strncmp() - just
make it "return strncmp(a, b, (size_t)-1);". However, performance of
strcmp() does matter somewhat, since it is used all over when parsing
and matching DT nodes and properties, so let's find some other place
to save those ~30 bytes.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2022-10-27 09:10:08 -04:00
Jim Liu
c1dc8473fa spi: nuvoton: add NPCM PSPI controller driver
Add Nuvoton NPCM BMC Peripheral SPI controller driver.
NPCM750 include two general-purpose SPI interface.

Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2022-10-27 12:41:36 +05:30
Tom Rini
8bc87a4c55 Merge branch '2022-10-26-assorted-fixes-and-updates'
- Reduce memory usage in SPL in some cases, clarify some standalone API
  license issues, fix a Kconfig dependency, pin to a specific version of
  python setuptools for now, fix a signing problem in mkimage and add a
  memory uclass.
2022-10-26 15:24:59 -04:00
Roger Quadros
9b0b5648d6 memory: Add TI GPMC driver
The GPMC is a unified memory controller dedicated for interfacing
with external memory devices like
 - Asynchronous SRAM-like memories and ASICs
 - Asynchronous, synchronous, and page mode burst NOR flash
 - NAND flash
 - Pseudo-SRAM devices

This driver will take care of setting up the GPMC based on
the settings specified in the Device tree and then
probe its children.

Signed-off-by: Roger Quadros <rogerq@kernel.org>
2022-10-26 15:21:12 -04:00
Roger Quadros
37d6d1645a dt/bindings: memory: Add bindings for TI GPMC driver
GPMC stands for General Purpose Memory Controller and it is
present on many Texas Instruments SoCs.

It supports a number of Asynchronous and Synchronous interfaces
and has various settings to configure the bus interface.

The DT bindings define all the various GPMC settings.

As the GPMC supports multiple devices on the bus, each
device is represented as a child and the respective
GPMC settings are situated there. (see ti,gpmc-child.yaml)

These binding docs are picked up from the Linux kernel.

Signed-off-by: Roger Quadros <rogerq@kernel.org>
2022-10-26 15:21:11 -04:00
Roger Quadros
3a82cd26ee scripts: Makefile.spl: Enable memory drivers to be built for SPL
Introduce CONFIG_SPL_MEMORY to allow Memory drivers to
be built for SPL.

Signed-off-by: Roger Quadros <rogerq@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-26 15:21:11 -04:00
Roger Quadros
2c120375e9 dm: memory: Introduce new uclass
Introduce UCLASS_MEMORY for future Memory Controller
device drivers.

Signed-off-by: Roger Quadros <rogerq@kernel.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-26 15:21:11 -04:00
Simon Glass
27e6ebc5ea test: Move to a working version of setuptools
The version used on Ubuntu 2022.04 produces a number of warnings:

/usr/lib/python3/dist-packages/pkg_resources/__init__.py:116:
   PkgResourcesDeprecationWarning: 1.16.0-unknown is an invalid version
   and will not be supported in a future release

Same with: 0.1.43ubuntu1 11.4.1ubuntu1 2.22.1ubuntu1 1.1build1

According to [1] this is a bug in setuptools. Employ the workaround for
now.

[1] https://askubuntu.com/questions/1406952/what-is-the-meaning-of-this-
pkgresourcesdeprecationwarning-warning-from-pipenv

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-26 15:21:11 -04:00
Paul Barker
59b16e9df9 examples: hello_world: Drop inclusion of common header
The "common.h" header is not covered by the licensing exception for
standalone applications. Let's drop inclusion of this header from the
hello_world example to prove that a standalone app can be built without
it.

Signed-off-by: Paul Barker <paul.barker@sancloud.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2022-10-26 15:21:11 -04:00