aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-04-30Merge branch 'master' of https://source.denx.de/u-boot/custodians/u-boot-sunxiWIP/30Apr2023Tom Rini52-152/+235
Please pull the second part of the sunxi pull request for this cycle. Another bunch of patches that replace old-school U-Boot hacks with proper DM based code, this time for the raw NAND flash driver, and the USB PHY VBUS detection code. Plus two smaller patches that were sitting in my inbox for a while. Gitlab CI passed. In lack of some supported board with NAND flash I couldn't really test this part, but apparently this was tested by the reviewer. I briefly ran the branch on some boards with USB-OTG, and this still worked.
2023-04-29Merge branch 'for-2023.07' of ↵WIP/29Apr2023Tom Rini40-346/+1668
https://source.denx.de/u-boot/custodians/u-boot-mpc8xx This pull request adds support for the last CPU board from CS GROUP France (previously CSSI). That CPU board called CMPCPRO has a mpc8321E CPU (Family PQII PRO hence its name) and can be plugged in place of the CMPC885 board. In order to support that new board, the following changes are included in this series: - Make the mpc8xx watchdog driver more generic for reusing it with mpc83xx - Fix various small problems on mpc83xx platform - Add a GPIO Driver for QE GPIOs - Add support for mpc832x into mpc83xx SPI driver - Refactor existing board code that will be shared with new board - Add the new board
2023-04-28Merge tag 'dm-pull-28apr23' of ↵WIP/28Apr2023Tom Rini34-101/+149
https://source.denx.de/u-boot/custodians/u-boot-dm sandbox and fdt bug fixes / tweaks various other minor fixes
2023-04-28fdt: Indicate that people should use the ofnode APISimon Glass1-0/+3
Add a note to the comment at the top of this file. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-28fdt_support: fix comments syntax errorHugo Villeneuve1-2/+2
Fix comments syntax error in fdt_node_offset_by_compat_reg() description: compatiable -> compatible Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-28core: fdtaddr: use map_sysmem() as cast for the returnJohan Jonker2-2/+9
For the devfdt_get_addr_index_ptr() and devfdt_get_addr_size_index_ptr() function use map_sysmem() function as cast for the return for use in sandbox. Also fix sandbox test. Signed-off-by: Johan Jonker <jbx6244@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Drop second hunk: Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-28tools: Fall back to importlib_resources on Python 3.6Jan Kiszka3-3/+15
importlib.resources became part of 3.7 only. Allow using distros with 3.6 and the importlib_resources backport. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-28test: fdt: Fix copyright messageMarek Vasut1-1/+1
Drop the map_to_sysmem() copy paste error. No functional change. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-28patman: fix class TestFunctionalHeinrich Schuchardt1-2/+2
Variable orig_dir cannot be used in the finally block if it has not be assigned outside of the try block. tools/patman/func_test.py:523:21: E0601: Using variable 'orig_dir' before assignment (used-before-assignment) tools/patman/func_test.py:691:21: E0601: Using variable 'orig_dir' before assignment (used-before-assignment) Fixes: fd70986a62af ("patman: Add a test that uses gitpython") Fixes: be051c0c7741 ("patman: Detect missing upstream in CountCommitsToBranch") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-28binman: Use expanduser instead of HOMESimon Glass1-1/+1
There may not be a HOME environment variable, so use the os.expanduser() function instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-28dm: core: introduce uclass_get_device_by_of_path()Rasmus Villemoes2-0/+23
There's quite a few instances of board-specific code doing off = fdt_path_offset(gd->fdt_blob, ...); ... ret = uclass_get_device_by_of_offset(..., off, &dev); looking for an eeprom or a pmic via some alias. Such code can be simplified a little if we have a helper for directly getting a device via device tree path (including being given as an alias). Implement it in terms of ofnode rather than raw offsets so that this will work whether live tree is enabled or not. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2023-04-28uclass: add uclass_find_device_by_phandle_id() helperRasmus Villemoes1-25/+19
The functions uclass_find_device_by_phandle() and uclass_get_device_by_phandle_id() both loop over a given uclass looking for a device with a given phandle. Factor that out to a common helper. For now, there are no (known potential) users of the new helper outside uclass.c, so make it static. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Reviewed-by: Simon Glass <sjg@chromium.org> Fix warning on sandbox_spl; fix code style: Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-28sandbox: disable tracing before unmapping RAMPavel Skripkin1-0/+5
Currently doing 'reset' command in sandbox with tracing enabled causes SIGSEV ``` Hit any key to stop autoboot: 0 => => => reset resetting ... Segmentation fault (core dumped) ``` Tracing callback uses RAM buffer for storing tracing reports, but state_uninit() function unmaps whole RAM, which causes SIGSEV on umapped memory inside tracing subsystem. Fix it by disabling tracing before unmapping memory Signed-off-by: Pavel Skripkin <paskripkin@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Add missing check for CONFIG_TRACE: Signed-off-by: Simon Glass <sjg@chromium.org>
2023-04-28sandbox: correct posix_types.h defineHeinrich Schuchardt1-3/+4
arch/arm/include/asm/posix_types.h and arch/sandbox/include/asm/posix_types.h should use different defines. Add SPDX header. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-28bootflow: Rework do_bootflow_menu() slightlyTom Rini1-12/+12
When building this with clang, we get a warning such as: cmd/bootflow.c:412:27: warning: variable 'bflow' is uninitialized when used here [-Wuninitialized] printf("Selected: %s\n", bflow->os_name ? bflow->os_name : bflow->name); ^~~~~ And a suggestion to just initialize bflow to NULL. This would however would be ensuring a bad dereference. Instead, looking at the function we rework things so that when CONFIG_EXPO is not enabled (and so, no UI) we error early and would never reach this point in the code. Simplify the rest slightly as well while at this. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-28dm: core: Make aliases_lookup staticBin Meng1-1/+1
aliases_lookup is only referenced in of_access.c Signed-off-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-28drivers: tee: sandbox: Fix SCP03 control emulatorJorge Ramirez-Ortiz1-4/+11
Fix and document the Secure Channel Protocol03 emulator. Fixes: 5a8783c80c39 ("drivers: tee: sandbox: SCP03 control emulator") Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-04-28sandbox: fix return type of os_filesize()Heinrich Schuchardt3-4/+9
Given a file ../img of size 4294967296 with GPT partition table and partitions: => host bind 0 ../img => part list host 0 Disk host-0.blk not ready The cause is os_filesize() returning int. File sizes must use off_t. Correct all uses of os_filesize() too. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-28MAINTAINERS: assign include/os.hHeinrich Schuchardt1-0/+1
os.h is only used by the sandbox. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-28binman: Use unsigned long over typedef ulongAndrew Davis4-10/+4
The header binman_sym.h depends on ulong typedef but does not include types.h. This means the header must be included after including types.h or a header that includes it. We could include types.h but instead let's just switch from ulong to directly using unsigned long. This removes the need for typedef'ing it in some of the tests, so also remove those. Signed-off-by: Andrew Davis <afd@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-28common: static fdt_simplefb_enable_existing_node()Heinrich Schuchardt2-2/+7
Function fdt_simplefb_enable_existing_node() should be static as it is not used outside common/fdt_simplefb.c. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-28boot: vbe_simple: Fix vbe_simple_read_bootflow() dependencyBin Meng1-5/+7
vbe_simple_read_bootflow() calls vbe_simple_read_bootflow_fw() which is only available when BOOTMETH_VBE_SIMPLE_FW is on. Signed-off-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-28sandbox: mark sandbox_exit() as no return.Heinrich Schuchardt3-3/+2
Fix a -Wimplicit-fallthrough warning in sandbox_sysreset_request(). Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-28sandbox: spi: sandbox_sf_process_cmd() missing fallthroughHeinrich Schuchardt1-0/+1
Add a missing fallthrough macro to avoid a -Wimplicit-fallthrough warning. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-28sandbox: fix sandbox_hub_submit_control_msg()Heinrich Schuchardt1-21/+9
Avoid incorrect fall through: A USB_RT_HUB request should not be treated as USB_RT_PORT. Simplify the coding: Avoid duplicate debug() statements. This fixes all -Wimplicit-fallthrough warnings. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-28sandbox: fix fall through in sandbox_flash_bulk()Heinrich Schuchardt1-0/+1
Handling of SANDBOX_FLASH_EP_OUT should never fall through to SANDBOX_FLASH_EP_IN. This addresses a warning shown when compiling with -Wimplicit-fallthrough. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-28board: cssi: Add CPU board CMPCPROChristophe Leroy11-0/+994
CSSI has another CPU board, similar to the CMPC885 board that get plugged on the two base boards MCR3000_2G and MIAE. That CPU board is called CMPCPRO because it has a MPC8321E CPU, also known as Power QUICC II PRO. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
2023-04-28board: cssi: Move all mother board code into common.cChristophe Leroy4-133/+157
All the code used to manage the mother boards will be common to soon to come CPU board. Move all that code into common.c Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
2023-04-28board: cssi: Refactor EEPROM readChristophe Leroy3-31/+40
On cmpc885 board, the ethernet addresses are stored in an EEPROM that is accessed through SPI. A 3 bytes command is sent to the chip then the content gets read. At the time being a single block access is performed, ignoring the first 3 bytes read. Reword the SPI transfer to first send 3 bytes then receive the content of the EEPROM so that there don't be 3 dummy bytes at the beginning of the buffer. And move the function into common.c so that it can be reused by the board that will be added in a future patch. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
2023-04-28board: cssi: Create dedicated file for common sourcesChristophe Leroy4-53/+73
In preparation of the new cssi board called cmpcpro which we be introduce in a future patch, move common functions into a dedicated file in a common directory. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
2023-04-28board: cssi: Migrate to hashed passwordChristophe Leroy2-2/+8
Use a hashed password instead of clear text in order to improve board security. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
2023-04-28Kconfig: Remove an impossible conditionSamuel Holland1-1/+1
ARCH_SUNXI selects BINMAN, so the condition "!BINMAN && ARCH_SUNXI" is impossible to satisfy. Signed-off-by: Samuel Holland <samuel@sholland.org> Acked-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-04-28phy: sun4i-usb: Do not drive VBUS with external VBUS presentSamuel Holland1-0/+6
It is possible to use host-side USB with externally-provided VBUS. For example, some USB OTG cables have an extra power input which powers both the board and the USB peripheral. To support this setup, skip enabling the VBUS switch/regulator if VBUS voltage is already present. This behavior matches the Linux PHY driver. Signed-off-by: Samuel Holland <samuel@sholland.org> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-04-28gpio: axp/sunxi: Remove virtual VBUS detection GPIOSamuel Holland7-27/+5
Now that this functionality is modeled using the device tree and regulator uclass, the named GPIO is not referenced anywhere. Remove it. Signed-off-by: Samuel Holland <samuel@sholland.org> Reviewed-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-04-28sunxi: Switch to PMIC USB power supply VBUS detectionSamuel Holland23-23/+25
Update boards to use the USB power supply driver, as referenced in the device tree, instead of a virtual GPIO. This removes the need for some DM-incompatible special cases in the GPIO driver. The following five boards used AXP0-VBUS-DETECT in their config, but are missing the "usb0_vbus_power-supply" property in their device tree: - Ainol_AW1_defconfig / sun7i-a20-ainol-aw1 - Cubieboard4_defconfig / sun9i-a80-cubieboard4 - Merrii_A80_Optimus_defconfig / sun9i-a80-optimus - Yones_Toptech_BD1078_defconfig / sun7i-a20-yones-toptech-bd1078 - Yones_Toptech_BS1078_V2_defconfig / sun6i-a31s-yones-toptech-bs1078-v2 None of those five boards have the MUSB controller (USB OTG) enabled in their device trees, so this change should not break anything for them. Additionally, the following board intentionally omits the property because VBUS is always enabled: - Nintendo_NES_Classic_Edition_defconfig / sun8i-r16-nintendo-nes-classic The PHY driver already assumes VBUS is enabled when no detection method is available, so again this will not cause any problems. Signed-off-by: Samuel Holland <samuel@sholland.org> Reviewed-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-04-28power: regulator: Add a driver for the AXP USB power supplySamuel Holland3-0/+57
This driver reports the presence/absence of voltage on the PMIC's USB VBUS pin. This information is used by the USB PHY driver. The corresponding Linux driver uses the power supply class, which does not exist in U-Boot. UCLASS_REGULATOR seems to be the closest match. Signed-off-by: Samuel Holland <samuel@sholland.org> Acked-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-04-28mtd: nand: sunxi: Pass the device to the init functionSamuel Holland1-19/+20
This more closely matches the U-Boot driver to the Linux version. Signed-off-by: Samuel Holland <samuel@sholland.org> Reviewed-by: Andre Przywara <andre.przywara@arm.com> Acked-by: Michael Trimarchi <micahel@amarulasolutions.com> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-04-28mtd: nand: sunxi: Convert to the driver modelSamuel Holland2-37/+49
Clocks, resets, and pinmuxes are now handled by the driver model, so the only thing the "board" code needs to do is load the driver. This matches the pattern used by other DM raw NAND drivers (there is no NAND uclass). The actual board code is now only needed in SPL. Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com> Signed-off-by: Samuel Holland <samuel@sholland.org> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-04-28mtd: nand: sunxi: Convert from fdtdec to ofnodeSamuel Holland3-49/+26
As a first step toward converting this driver to the driver model, use the ofnode abstraction to replace direct references to the FDT blob. Using ofnode_read_u32_index removes an extra pair of loops and makes the allwinner,rb property optional, matching the devicetree binding. Signed-off-by: Samuel Holland <samuel@sholland.org> Acked-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-04-28mtd: nand: sunxi: Remove an unnecessary checkSamuel Holland1-10/+0
Each chip is required to have a unique CS number ("reg" property) in the range 0-7, so there is no need to separately count the number of chips. Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com> Signed-off-by: Samuel Holland <samuel@sholland.org> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-04-28pinctrl: sunxi: Add NAND pinmuxesSamuel Holland1-0/+13
NAND is always at function 2 on port C. Pin lists and mux values were taken from the Linux drivers. Reviewed-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com> Signed-off-by: Samuel Holland <samuel@sholland.org> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-04-28clk: sunxi: Add NAND clocks and resetsSamuel Holland11-0/+43
Currently NAND clock setup is done in board code, both in SPL and in U-Boot proper. Add the NAND clocks/resets here so they can be used by the "full" NAND driver once it is converted to the driver model. The bit locations are copied from the Linux CCU drivers. Reviewed-by: Jagan Teki <jagan@amarulasolutions.com> Signed-off-by: Samuel Holland <samuel@sholland.org> Reviewed-by: Andre Przywara <andre.przywara@arm.com> Acked-by: Sean Anderson <seanga2@gmail.com> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-04-28sunxi: binman: Fix U-Boot offset when SPL is not 32 KiBSamuel Holland1-1/+5
On sunxi boards, SPL looks for U-Boot at a 32 KiB offset, unless SPL is larger than 32 KiB, in which case U-Boot immediately follows SPL. See the logic in spl_mmc_get_uboot_raw_sector() and spl_spi_load_image(). In two cases, the existing binman description mismatches the SPL code. For 64-bit boards, binman would place U-Boot immediately following SPL, even if SPL is smaller than 32 KiB. This can happen when SPL MMC support is disabled (i.e. when booting from SPI flash). In contrast, for 32-bit boards, binman would place U-Boot at 32 KiB, even if SPL is larger than that. This happens because the 'offset' property does not consider the size of previous entries. Fix both issues by setting a minimum size for the SPL entry, which exactly matches the logic in the SPL code. Unfortunately, this size must be provided as a magic number, since none of the relevant config symbols (SPL_PAD_TO, SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR, and SYS_SPI_U_BOOT_OFFS) are guaranteed to be defined in all cases. Fixes: cfa3db602caf ("sunxi: Convert 64-bit boards to use binman") Signed-off-by: Samuel Holland <samuel@sholland.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-04-27Merge branch '2023-04-27-introduce-nvm-xip-block-storage-emulation'Tom Rini23-3/+672
To quote the author: Adding block storage emulation for NVM XIP flash devices. Some paltforms such as Corstone-1000 need to see NVM XIP raw flash as a block storage device with read only capability. Here NVM flash devices are devices with addressable memory (e.g: QSPI NOR flash). The NVM XIP block storage emulation provides the following features: - Emulate NVM XIP raw flash as a block storage device with read only capability - Being generic by design and can be used by any platform - Device tree node - Platforms can use multiple NVM XIP devices at the same time by defining a DT node for each one of them - A generic NVMXIP block driver allowing to read from the XIP flash - A generic NVMXIP Uclass driver for binding the block device - A generic NVMXIP QSPI driver - Implemented on top of memory-mapped IO (using readq macro) - Enabling NVMXIP in sandbox64 - A sandbox test case - Enabling NVMXIP in Corstone1000 platform as a use case For more details please refer to doc/develop/driver-model/nvmxip.rst
2023-04-27sandbox64: add a test case for UCLASS_NVMXIPWIP/2023-04-27-introduce-nvm-xip-block-storage-emulationAbdellatif El Khlifi3-0/+151
provide a test for NVM XIP devices The test case allows to make sure of the following: - The NVM XIP QSPI devices are probed - The DT entries are read correctly - the data read from the flash by the NVMXIP block driver is correct Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
2023-04-27corstone1000: enable NVM XIP QSPI flashAbdellatif El Khlifi1-0/+1
add the QSPI flash device with block storage capability Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
2023-04-27corstone1000: add NVM XIP QSPI device tree nodeAbdellatif El Khlifi1-1/+8
add QSPI flash device node for block storage access Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
2023-04-27sandbox64: add support for NVMXIP QSPIAbdellatif El Khlifi6-4/+39
enable NVMXIP QSPI for sandbox 64-bit Adding two NVM XIP QSPI storage devices. Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-27sandbox64: fix: return unsigned long in readq()Abdellatif El Khlifi2-2/+2
make readq return unsigned long readq should return 64-bit data Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-27drivers/mtd/nvmxip: introduce QSPI XIP driverAbdellatif El Khlifi6-1/+178
add nvmxip_qspi driver under UCLASS_NVMXIP The device associated with this driver is the parent of the blk#<id> device nvmxip_qspi can be reused by other platforms. If the platform has custom settings to apply before using the flash, then the platform can provide its own parent driver belonging to UCLASS_NVMXIP and reuse nvmxip-blk driver. The custom driver can be implemented like nvmxip_qspi in addition to the platform custom settings. Platforms can use multiple NVM XIP devices at the same time by defining a DT node for each one of them. For more details please refer to doc/develop/driver-model/nvmxip_qspi.rst Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>