aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-07-14Merge branch '2023-07-14-assorted-general-updates'WIP/14Jul2023Tom Rini107-181/+109
- A number of assorted general fixes and code updates
2023-07-14Merge branch '2023-07-14-nuvoton-platform-updates'Tom Rini13-29/+134
- A number of updates for the nuvoton family of platforms
2023-07-14Merge branch '2023-07-14-expo-initial-config-editor'Tom Rini49-613/+5159
To quote the author: This series provides a means to edit board configuration in U-Boot in a graphical manner. It supports multiple menu items and allows moving between them and selecting items. The configuration is defined in a data format so that code is not needed in most cases. This allows the board configuration to be provided in the devicetree. This is still at an early stage, since it only supports menus. Numeric values are not supported. Most importantly it does not yet support loading or saving the configuration selected by the user. To try it out you can use something like: ./tools/expo.py -e test/boot/files/expo_layout.dts \ -l test/boot/files/expo_layout.dts -o cedit.dtb ./u-boot -Tl -c "cedit load hostfs - cedit.dtb; cedit run" Use the arrow keys to move between menus, enter to open a menu, escape to exit. Various minor fixes and improvements are provided in this series: - Update STB TrueType library to latest - Support clearing part of the video display - Support multiple livetrees loaded at runtime - Support loading and allocating a file - Support proper measuring of text in expo - Support simple themes for expo
2023-07-14video: Update stb_truetypeSimon Glass3-219/+2077
This was brought in in 2016 and a number of changes have been made since then. There does not seem to be much change in functionality, but it is a good idea to update from time to time. Bring in the latest version: 5736b15 ("re-add perlin noise again") Add a few necessary functions, with dummies in some cases. Update the tests as there are subtle changes in rendering, perhaps not for the better. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Add tests for the configuration editorSimon Glass6-0/+280
Add some simple tests and a helpful script to make the configuration editor easier to set up. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Add a configuration editorSimon Glass14-4/+370
Add a new 'cedit' command which allows editing configuration using an expo. The configuration items appear as menus on the display. This is extremely basic, only supporting menus and not providing any way to load or save the configuration. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Support building an expo from a description fileSimon Glass9-7/+870
The only way to create an expo at present is by calling the functions to create each object. It is useful to have more data-driven approach, where the objects can be specified in a suitable file format and created from that. This makes testing easier as well. Add support for describing an expo in a devicetree node. This allows more complex tests to be set up, as well as providing an easier format for users. It also provides a better basis for the upcoming configuration editor. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Add spacing around menus and itemsSimon Glass5-15/+38
It looks better if menus have a bit of an inset, rather than be drawn hard up against the background. Also, menu items look better if they have a bit of spacing between them. Add theme options for these and implement the required changes. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Implement the keypress logic for popup menusSimon Glass4-4/+96
In 'popup' mode, the expo allows moving around the objects in a scene. When 'enter' is pressed on a menu, it opens and the user can move around the items in the menu. Implement this using keypress handles and actions. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Draw the current opened menu on topSimon Glass4-0/+80
When a menu is opened, it must be displayed over all other objects in the scene, so that all its items are visible. Handle this by drawing the menu object a second time, after all other objects have been drawn. Draw all of the objects which are dependent on the menu object. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Draw popup menus in both opened and closed statesSimon Glass4-2/+130
When a popup menu is closed it shows only the selected item. When it is open it shows a background and all items, with a highlight that can be moved between the items. Add the drawing logic for this. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Rename EXPOACT_POINT to EXPOACT_POINT_ITEMSimon Glass3-7/+7
At present we only support a single menu, so all that can be pointed to is the current menu item. Rename this action so that we can also add an action for pointing to an object. This will allow cycling through the objects in a scene. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Support drawing of popup menusSimon Glass2-21/+46
At present only a single menu is supported. All items are shown and a pointer object points to the current item. Add support for multiple menus, one of which is highlighted, indicated by the highlight_id property in the scene. The highlighted menu item has a SCENEOF_POINT flag, indicating that it is currently pointed to. The popup menu is normally closed, in which case it shows only the current menu item. When it is opened, it shows all items, allowing the user to select one. Rather than requiring the menu item to have a description, require it to have a label. Use the label (only) for the popup menu. With this, most of the drawing and layout logic is complete. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Move menu-item selection into a functionSimon Glass2-14/+55
The current implementation supports a 'pointer' object which points to the currently highlighted menu item. We want to support highlighting the label of the menu item instead, e.g. with inverse video. In this case we will need to 'unhighlight' the old item and highlight the new one. As a first step, move the pointer logic into a function. This fixes a bug where the item is hidden when it should not be. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Support simple themesSimon Glass6-3/+95
It is a pain to manually set the fonts of all objects to be consistent. Some spacing settings are also better set globally than by manually positioning each object. Add a 'theme' to the expo, to hold this information. For now it includes only the font size. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Set up the width and height of objectsSimon Glass7-2/+239
Provide a way to set the full dimensions of objects, i.e. including the width and height. For menus, calculate the bounding box of all objects in the menu. Set all labels to be the same size, so that highlighting works correct, once implemented. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Calculate text bounding-box correctlySimon Glass1-8/+22
Rather than estimating, measure the text accurately, using the new vidconsole feature. This allows accurate placement of objects. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Use flags for objectsSimon Glass4-7/+40
We currently have just a 'hide' property for each object. In preparation for adding more properties, convert the struct to use a flags value, instead of individual booleans. This is more extensible. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Add width and height to objectsSimon Glass4-30/+43
At present objects only have a position so it is not possible to determine the amount of space they take up on the display. Add width and height properties, using a struct to keep all the dimensions together. For now this is not used. Future work will set up these new properties. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14video: Use enum with video_index_to_colour()Simon Glass2-3/+3
Use the provided enum with this function, so it is clearer what should be passed to it. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Allow setting the start of the dynamic-ID rangeSimon Glass4-10/+37
Provide a way to set this value so that it is easy to separate the statically allocated IDs (generated by the caller) from those generated dynamically by expo itself. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14console: Allow measuring the bounding box of textSimon Glass3-2/+132
For laying out text accurately it is necessary to know the width and height of the text. Add a measure() method to the console API, so this can be supported. Add an implementation for truetype and a base implementation for the normal console. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14video: Allow temporary colour changesSimon Glass2-0/+50
It is sometimes necessary to highlight some text in a different colour. Add an easy way to do this and then restore the original console colours. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14video: Correct docs for video_index_to_colour()Simon Glass1-1/+1
This uses the private data of the video uclass, not the console uclass (its child). Update the comment to avoid confusion. Signed-off-by: Simon Glass <sjg@chromium.org> Fixes: a032e4b55ea ("video: Move console colours to the video uclass")
2023-07-14bootstd: Add a separate log category for expoSimon Glass5-1/+8
This feature is different enough from bootstd that it probably deserves its own log category. It cannot use a uclass since it is not a device. Add a new category. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14fdt: Allow more general use of livetreeSimon Glass5-5/+66
At present livetree can only be used for the control FDT. It is useful to be able to use the ofnode API for other FDTs, e.g. those used by the upcoming configuration editor. We already have most of the support present, and tests can be marked with the UT_TESTF_OTHER_FDT flag to use another FDT as a special case. But with this change, the functionality becomes more generally available. Plumb in the require support. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14fdt: Clarify the fdt pre-relocation warningSimon Glass1-1/+1
Reword this so it is easier to understand. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14fdt: Align the start of the livetreeSimon Glass3-1/+32
Ensure that the block of memory used by live tree is aligned according to the default for structures. This ensures that the root node appears at the start of the block, so it can be used with free(), rather than being 4 bytes later in some cases. This corrects a rather obscure bug in unflatten_device_tree(). Fixes: 8b50d526ea5 ("dm: Add a function to create a 'live' device tree") Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14cat: Update command to use fs_load_alloc()Simon Glass1-30/+17
Use this new function since it implements the required functionality and reduces duplicated code. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14fs: Create functions to load and allocate a fileSimon Glass3-28/+98
This functionality current sits in bootstd, but it is more generally useful. Add a function to load a file into memory, allocating it as needed. Adjust bootstd to use this version. Note: Tests are added in the subsequent patch which converts the 'cat' command to use this function. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Rename exp_set_text_mode()Simon Glass4-5/+5
Rename this function to match its peers, using the full "expo' prefix. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14console: Correct truetype spacing errorSimon Glass2-4/+4
The putc_xy() method is supposed to return the amount of space used. The existing implementation erroneously adds the previous sub-pixel position to the returned value. This spaces out the characters very slightly more than it should. It is seldom noticeable but it does make accurate measurement of the text impossible. Fix this minor but long-standing bug. Fixes: a29b012037c ("video: Add a console driver that uses TrueType fonts") Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Avoid automatically arranging the sceneSimon Glass5-18/+21
This should ideally be done once after all scene changes have been made. Require an explicit call when everything is ready. Always arrange after a key it sent, just for convenience. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Store the console in the expoSimon Glass3-8/+13
Rather than finding this each time, keep a pointer to it. This simplifies the code a little. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14video: Provide a way to clear part of the consoleSimon Glass3-69/+71
This is useful when the background colour must be written before text is updated, to avoid strange display artifacts. Add a function for this, using the existing code from the truetype console. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14video: Drop #ifdefs from console_truetypeSimon Glass1-56/+56
Use if() instead to reduce the number of build paths. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14dm: core: Avoid registering an inaccessible treeSimon Glass1-0/+9
At present there are various restrictions on the use of livetree: - It is only available once the tree is unflattened, i.e. after relocation - It is designed to be used with the control FDT - It can (in principle) be used with other FDTs, but only if they are unflattened first; this is not supported Add a few checks to make sure that any tree that is created is actually valid. Otherwise it can be confusing when nodes and properties cannot actually be accessed. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14gpio: Avoid using an invalid ofnodeSimon Glass1-1/+1
Devices do not necessarily have nodes attached to them, since they can be created from platdata. In SPL a devicetree may in fact not exist at all. Check the node before using it. This avoids failure when OF_CHECKS is enabled. Signed-off-by: Simon Glass <sjg@chromium.org> Fixes: 5fc7cf8c8e2 ("gpio: add gpio-hog support") Reviewed-by: Heiko Schocher <hs@denx.de>
2023-07-14test: Restore test behaviour on failureSimon Glass1-18/+18
A recent change makes test continue to run after failure. This results in a lot of useless output and may lead to a segfault. Fix this by adding back the 'return' statement. Fixes: fa847bb409d ("test: Wrap assert macros in ({ ... }) and fix") Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14sandbox: Fix quiting when the LCD window is closedSimon Glass1-1/+2
With recent changes to how sandbox handles reset, closing the window currently just restarts sandbox. Use the correct sysreset type to tell it to shut down. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Convert to using a string ID for the scene titleSimon Glass3-20/+17
This is easier to deal with if it uses the existing string handling, since we will be able to use translations, etc. in the future. Update it to use an ID instead of a string. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14expo: Correct some header-file commentsSimon Glass1-3/+5
The use of Returns instead of @return still confuses me. Fix some problems that have crept in. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14binman: Correct coverage gap in controlSimon Glass1-1/+1
Add a pragma to deal with the code-coverage gap which drops binman down to 90% coverage. Fixes: de65b122a25 (tools: Fall back to importlib_resources on Python 3.6) Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-14bdinfo: Correct use of assertionsSimon Glass1-30/+49
This test was written for the incorrect use of assertions. Update it to build with the previous approach, where tests fail at the first assertion. All assertion functions return 0 on success and non-zero on failure. They can be nested into functions simply by declaring a function that returns an int and using ut_assertok() to call it. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
2023-07-14zynqmp: config: Add proper dependencies for USBAshok Reddy Soma3-6/+2
When CONFIG_CMD_USB and CONFIG_USB are disabled, still some compilation errors are seen as below. In file included from include/configs/xilinx_zynqmp.h:173, from include/config.h:3, from include/common.h:16, from env/common.c:10: include/config_distro_bootcmd.h:302:9: error: expected '}' before 'BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB' 302 | BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/config_distro_bootcmd.h:302:9: note: in definition of macro 'BOOTENV_DEV_NAME_USB' 302 | BOOT_TARGET_DEVICES_references_USB_without_CONFIG_CMD_USB | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/configs/xilinx_zynqmp.h:77:41: note: in expansion of macro 'BOOTENV_DEV_NAME' 77 | # define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0) func(USB, usb, 1) | ^~~~ include/configs/xilinx_zynqmp.h:168:9: note: in expansion of macro 'BOOT_TARGET_DEVICES_USB' 168 | BOOT_TARGET_DEVICES_USB(func) \ | ^~~~~~~~~~~~~~~~~~~~~~~ include/config_distro_bootcmd.h:454:25: note: in expansion of macro 'BOOT_TARGET_DEVICES' 454 | "boot_targets=" BOOT_TARGET_DEVICES(BOOTENV_DEV_NAME) "\0" | ^~~~~~~~~~~~~~~~~~~ include/config_distro_bootcmd.h:474:9: note: in expansion of macro 'BOOTENV_BOOT_TARGETS' 474 | BOOTENV_BOOT_TARGETS \ | ^~~~~~~~~~~~~~~~~~~~ include/configs/xilinx_zynqmp.h:179:9: note: in expansion of macro 'BOOTENV' 179 | BOOTENV | ^~~~~~~ include/env_default.h:120:9: note: in expansion of macro 'CFG_EXTRA_ENV_SETTINGS' 120 | CFG_EXTRA_ENV_SETTINGS | ^~~~~~~~~~~~~~~~~~~~~~ In file included from env/common.c:32: include/env_default.h:27:36: note: to match this '{' 27 | const char default_environment[] = { | ^ scripts/Makefile.build:256: recipe for target 'env/common.o' failed make[1]: *** [env/common.o] Error 1 Makefile:1853: recipe for target 'env' failed make: *** [env] Error 2 make: *** Waiting for unfinished jobs.... Add CONFIG_USB_STORAGE as dependency for USB related macro's such as BOOT_TARGET_DEVICES_USB() and DFU_DEFAULT_POLL_TIMEOUT and CONFIG_THOR_RESET_OFF. Remove CONFIG_ZYNQMP_USB from Kconfig and also from defconfig since it is not used anywhere else. Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
2023-07-14cmd: thordown: Add proper dependency for CMD_THOR_DOWNLOADAshok Reddy Soma1-0/+1
When CONFIG_CMD_USB and CONFIG_USB are disabled some compilation errors are seen as below. cmd/thordown.o: in function `usb_gadget_initialize': include/linux/usb/gadget.h:981: undefined reference to `board_usb_init' cmd/thordown.o: in function `do_thor_down': cmd/thordown.c:68: undefined reference to `g_dnl_unregister' cmd/thordown.o: in function `usb_gadget_release': include/linux/usb/gadget.h:986: undefined reference to `board_usb_cleanup' cmd/thordown.o: in function `do_thor_down': cmd/thordown.c:41: undefined reference to `g_dnl_register' cmd/thordown.c:48: undefined reference to `thor_init' cmd/thordown.c:56: undefined reference to `thor_handle' gnu/aarch64/lin/aarch64-linux/bin/aarch64-linux-gnu-ld.bfd: line 4: 8485 Segmentation fault (core dumped) $CC --sysroot=$LIBC --no-warn-rwx-segment "$@" Makefile:1779: recipe for target 'u-boot' failed make: *** [u-boot] Error 139 make: *** Deleting file 'u-boot' Add dependency of CMD_USB for CONFIG_CMD_THOR_DOWNLOAD to fix the errors. Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
2023-07-14powerpc: Fix flush_cache() speed regressionChristophe Leroy1-5/+5
Flushing kernel image after decompression was taking 113 milliseconds with U-boot 2022.10. With U-boot 2023.01 and 2023.04, flushing the same amount of memory takes approx 1.5 seconds. With U-boot 2023.07-rc6, it takes 6.5 seconds. powerpc flush_cache() function used to call WATCHDOG_RESET() after flushing every cacheline. At that time WATCHDOG_RESET() was light so the operation was almost seamless. But commit 29caf9305b6 ("cyclic: Use schedule() instead of WATCHDOG_RESET()") replaced WATCHDOG_RESET() by schedule() and that started to hurt with U-boot 2022.10. And in U-boot 2023.07-rc6 that's even worse after commit 26e8ebcd7cb ("watchdog: mpc8xxx: Make it generic"). In the meantime commit 729c1fe656 ("powerpc: introduce CONFIG_CACHE_FLUSH_WATCHDOG_THRESHOLD") gives us the opportinity to only call schedule() every given chunk of data instead of every cacheline. As explained in that commit there is no point in pinging the watchdog after every cacheline flush, so lets define a sensible default chunk size of 4k which matches to size of a page on most powerpc platforms. With that new default threshold, the culprit flushing performed after kernel image decompression now takes 85 milliseconds on a powerpc 8xx. Fixes: 29caf9305b6 ("cyclic: Use schedule() instead of WATCHDOG_RESET()") Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
2023-07-14lzma: Fix decompression speed regressionChristophe Leroy1-14/+4
Uncompressing a 1.7Mbytes FIT image on U-boot 2023.04 takes approx 7s on a powerpc 8xx. The same on U-boot 2023.07-rc6 takes approx 28s unless watchdog is disabled. During that decompression, LzmaDec_DecodeReal() calls schedule 1.6 million times, that is every 4µs in average. In the past it used to be a call to WATCHDOG_RESET() which was just calling hw_watchdog_reset(). But the combination of commit 29caf9305b6 ("cyclic: Use schedule() instead of WATCHDOG_RESET()") and commit 26e8ebcd7cb ("watchdog: mpc8xxx: Make it generic") results in an heavier processing. However, there is absolutely no point in calling schedule() that often. By moving and keeping only one call to schedule() in the main loop the number of calls is reduced to 1.2 million which is still too much. So add logic to only call schedule every 1024 times. That leads to a call to schedule approx every 6ms which is still far enough to entertain the watchdog which has a 1s timeout on powerpc 8xx. powerpc 8xx being one of the slowest targets we have today in U-boot, and most other watchdogs having a timeout of one minutes instead of one second like the 8xx, this fix should not have negative impact on other targets. Fixes: 29caf9305b6 ("cyclic: Use schedule() instead of WATCHDOG_RESET()") Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-07-14ufs: Use 'TASK_TAG' to construct the ucd_req_ptr->header.dword_0Bhupesh Sharma1-1/+1
Instead of using the hard-coded value of 0x1f, use 'TASK_TAG' macro instead to construct the ucd_req_ptr->header.dword_0 This is in sync with what the Linux UFS driver does, i.e. set the byte0 equal to TASK_TAG (see [1]). Setting it to a fixed value of 0x1f is wrong as we define TASK_TAG as 0 inside u-boot ufs framework. So, instead we should use the macro value directly. [1]. https://github.com/torvalds/linux/blob/master/drivers/ufs/core/ufshcd.c#L2705 Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org>
2023-07-14drivers: led: bcm6753: do not use null label to find the topPhilippe Reynes1-54/+60
This driver considers that a node with an empty label is the top. But the led class has changed, if a label is not provided for a led, the label is filed with the node name. So we update this driver to use a wrapper to manage the top led node. Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>