From 9250d0bad5637233a24a0c4b583100ad1be63316 Mon Sep 17 00:00:00 2001 From: Chuanjia Liu Date: Mon, 31 Aug 2020 15:53:12 +0800 Subject: PCI: mediatek: Release the resource when PCIe enable port fail On the mt7623 platform, if one port enable fail and other port enable succeed. It will hang on when using pci enum because the resource was not released correctly. Signed-off-by: Chuanjia Liu Tested-by: Frank Wunderlich --- drivers/pci/pcie_mediatek.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/pci/pcie_mediatek.c b/drivers/pci/pcie_mediatek.c index ad34f7c597..55b6a40f25 100644 --- a/drivers/pci/pcie_mediatek.c +++ b/drivers/pci/pcie_mediatek.c @@ -443,29 +443,36 @@ static void mtk_pcie_enable_port(struct mtk_pcie_port *port) err = clk_enable(&port->sys_ck); if (err) - goto exit; + goto err_sys_clk; err = reset_assert(&port->reset); if (err) - goto exit; + goto err_reset; err = reset_deassert(&port->reset); if (err) - goto exit; + goto err_reset; err = generic_phy_init(&port->phy); if (err) - goto exit; + goto err_phy_init; err = generic_phy_power_on(&port->phy); if (err) - goto exit; + goto err_phy_on; if (!mtk_pcie_startup_port(port)) return; pr_err("Port%d link down\n", port->slot); -exit: + + generic_phy_power_off(&port->phy); +err_phy_on: + generic_phy_exit(&port->phy); +err_phy_init: +err_reset: + clk_disable(&port->sys_ck); +err_sys_clk: mtk_pcie_port_free(port); } -- cgit From 91b735d11f95ecf608a95a255281c36dcc7e37a4 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Thu, 27 Aug 2020 18:01:28 +0200 Subject: common: Kconfig: Add dependency for default variables strings Kconfig provides several config options for setting up default variables but these are unused when variables are passed to U-Boot via file. That's why cover this dependency in Kconfig. Signed-off-by: Michal Simek --- common/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/Kconfig b/common/Kconfig index c58f08ba91..b1934b3a9c 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -378,7 +378,7 @@ config USE_BOOTARGS config BOOTARGS string "Boot arguments" - depends on USE_BOOTARGS + depends on USE_BOOTARGS && !USE_DEFAULT_ENV_FILE help This can be used to pass arguments to the bootm command. The value of CONFIG_BOOTARGS goes into the environment value "bootargs". Note that @@ -395,7 +395,7 @@ config USE_BOOTCOMMAND config BOOTCOMMAND string "bootcmd value" - depends on USE_BOOTCOMMAND + depends on USE_BOOTCOMMAND && !USE_DEFAULT_ENV_FILE default "run distro_bootcmd" if DISTRO_DEFAULTS help This is the string of commands that will be used as bootcmd and if @@ -416,7 +416,7 @@ config USE_PREBOOT config PREBOOT string "preboot default value" - depends on USE_PREBOOT + depends on USE_PREBOOT && !USE_DEFAULT_ENV_FILE default "" help This is the default of "preboot" environment variable. -- cgit From 21d3946840fd62dc09e93986743915bcbac100b7 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sun, 30 Aug 2020 11:34:12 +0200 Subject: bootm: update image OS image size when decompressing In bootm_load_os() the OS image is decompressed. In later stages of the boot process we need the decompressed size of the image. Update images->os.image_len after decompression. Passing the correct size is necessary if we want to check loaded EFI binararies for file truncation by comparing the loaded size to the header field SizeOfImage. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- common/bootm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/common/bootm.c b/common/bootm.c index 247b600d9c..b3377490b3 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -390,6 +390,8 @@ static int bootm_load_os(bootm_headers_t *images, int boot_progress) bootstage_error(BOOTSTAGE_ID_DECOMP_IMAGE); return err; } + /* We need the decompressed image size in the next steps */ + images->os.image_len = load_end - load; flush_cache(flush_start, ALIGN(load_end, ARCH_DMA_MINALIGN) - flush_start); -- cgit From 142775a52bc97d5273922970b8a9cc9f95091359 Mon Sep 17 00:00:00 2001 From: Pedro Aguilar Date: Mon, 31 Aug 2020 11:01:41 +0200 Subject: env: Crash in 'env import' when using checksum and a specific size This patch adds a sanity check that avoids 'size' to overflow and crash when importing an environment that contains a checksum. Example with the wrong size that causes the crash: => env import -c 0x4100000 3 v1 This assumes that v1 has already been successfully exported with 'env export -c -s 0x100 0x4100000 v1' Signed-off-by: Pedro Aguilar --- cmd/nvedit.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/nvedit.c b/cmd/nvedit.c index d188c6aa6b..9f145dd284 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c @@ -1171,6 +1171,11 @@ static int do_env_import(struct cmd_tbl *cmdtp, int flag, uint32_t crc; env_t *ep = (env_t *)ptr; + if (size <= offsetof(env_t, data)) { + printf("## Error: Invalid size 0x%zX\n", size); + return 1; + } + size -= offsetof(env_t, data); memcpy(&crc, &ep->crc, sizeof(crc)); -- cgit From 1e2c5bb9e7f9fdad05a5b1f36c44da5cc430b8a9 Mon Sep 17 00:00:00 2001 From: T Karthik Reddy Date: Mon, 31 Aug 2020 14:27:37 +0200 Subject: mtd: nand: Fix nand write error with bad block addresses above 32-bit Nand writes should skip the bad blocks with "nand write" command. In case of bad blocks with above 32-bit address, nand_block_isbad() returns false due to truncated bad block address. In below code segment, if (nand_block_isbad(mtd, offset & ~(mtd->erasesize - 1))) offset is 64-bit and mtd->erasesize is 32-bit, hence the truncation is happening. Cast 'mtd->erasesize' with loff_t to fix this issue. Signed-off-by: T Karthik Reddy Signed-off-by: Michal Simek --- drivers/mtd/nand/raw/nand_util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/nand/raw/nand_util.c b/drivers/mtd/nand/raw/nand_util.c index 5b74ef0dfd..00c3c6c412 100644 --- a/drivers/mtd/nand/raw/nand_util.c +++ b/drivers/mtd/nand/raw/nand_util.c @@ -635,14 +635,14 @@ int nand_write_skip_bad(struct mtd_info *mtd, loff_t offset, size_t *length, } while (left_to_write > 0) { + loff_t block_start = offset & ~(loff_t)(mtd->erasesize - 1); size_t block_offset = offset & (mtd->erasesize - 1); size_t write_size, truncated_write_size; WATCHDOG_RESET(); - if (nand_block_isbad(mtd, offset & ~(mtd->erasesize - 1))) { - printf("Skip bad block 0x%08llx\n", - offset & ~(mtd->erasesize - 1)); + if (nand_block_isbad(mtd, block_start)) { + printf("Skip bad block 0x%08llx\n", block_start); offset += mtd->erasesize - block_offset; continue; } -- cgit From eb39d8ba5f0d1468b01b89a2a464d18612d3ea76 Mon Sep 17 00:00:00 2001 From: Reuben Dowle Date: Tue, 1 Sep 2020 21:32:01 +0000 Subject: Fix data abort caused by mis-aligning FIT data Attempting to place device tree immediately after an image in memory can lead to mis-aligned data accesses if that image size is not divisible by the alignment requirements of the architecture. Data aborts caused by this were observed on a custom Marvel A388 based system, where the image was a uboot FIT file. The total size varies depending on the uboot device tree size, which does not always lead to correct alignment. The minimum alignment specified for ARM [1] and ARM64 [2] linux booting has been used [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/arm/booting.rst#n126 [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/arm64/booting.rst#n45 Signed-off-by: Reuben Dowle --- common/spl/spl_fit.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index 365104fe02..a8bfd388b1 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -349,9 +349,12 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, /* * Use the address following the image as target address for the - * device tree. + * device tree. Load address is aligned to 8 bytes to match the required + * alignment specified for linux arm [1] and arm 64 [2] booting + * [1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/arm/booting.rst#n126 + * [2]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/arm64/booting.rst#n45 */ - image_info.load_addr = spl_image->load_addr + spl_image->size; + image_info.load_addr = ALIGN(spl_image->load_addr + spl_image->size, 8); /* Figure out which device tree the board wants to use */ node = spl_fit_get_image_node(fit, images, FIT_FDT_PROP, index++); -- cgit From 75fb7b9163b9dc01828a3a519d2de0b19a6f23f2 Mon Sep 17 00:00:00 2001 From: Mingming Lee Date: Fri, 4 Sep 2020 13:35:22 +0800 Subject: ARM: MediaTek: amend IC description for MediaTek MT8512 The description for MT8512 has some mistake, so correct it. Signed-off-by: Mingming Lee --- arch/arm/mach-mediatek/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-mediatek/Kconfig b/arch/arm/mach-mediatek/Kconfig index 0042e57017..7f40ba9319 100644 --- a/arch/arm/mach-mediatek/Kconfig +++ b/arch/arm/mach-mediatek/Kconfig @@ -47,10 +47,10 @@ config TARGET_MT8512 select ARM64 select MT8512 help - The MediaTek MT8512 is a ARM64-based SoC with a quad-core Cortex-A53. + The MediaTek MT8512 is a ARM64-based SoC with a dual-core Cortex-A53. including UART, SPI, USB2.0 and OTG, SD and MMC cards, NAND, PWM, - Ethernet, IR TX/RX, I2C, I2S, S/PDIF, and built-in Wi-Fi / Bluetooth combo - chip and several DDR3 and DDR4 options. + IR RX, I2C, I2S, S/PDIF, and built-in Wi-Fi / Bluetooth digital + and several LPDDR3 and LPDDR4 options. config TARGET_MT8516 bool "MediaTek MT8516 SoC" -- cgit From 2974ba4f65f839bee9ba202c0b61e24071f55721 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 5 Sep 2020 10:58:52 +0200 Subject: doc: describe source repository Add a chapter to the HTML documentation describing how to retrieve the U-Boot sources. Signed-off-by: Heinrich Schuchardt --- doc/build/index.rst | 1 + doc/build/source.rst | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 doc/build/source.rst diff --git a/doc/build/index.rst b/doc/build/index.rst index e0072afb5e..5051a97e70 100644 --- a/doc/build/index.rst +++ b/doc/build/index.rst @@ -6,5 +6,6 @@ Build U-Boot .. toctree:: :maxdepth: 2 + source clang tools diff --git a/doc/build/source.rst b/doc/build/source.rst new file mode 100644 index 0000000000..75720e2027 --- /dev/null +++ b/doc/build/source.rst @@ -0,0 +1,30 @@ +Obtaining the source +===================== + +The source of the U-Boot project is maintained in a Git repository. + +You can download the source via + +.. code-block:: bash + + git clone https://gitlab.denx.de/u-boot/u-boot.git + +A mirror of the source is maintained on Github + +.. code-block:: bash + + git clone https://github.com/u-boot/u-boot + +The released versions are available as tags which use the naming scheme:: + + v. + +Release candidates are named:: + + v.-rc + +To checkout the October 2020 release you would use: + +.. code-block:: bash + + git checkout v2020.10 -- cgit From 70e38eea3ada86874934ae5746f93dc793f75447 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 5 Sep 2020 10:58:53 +0200 Subject: doc: describe building with GCC Provide a description of the U-Boot build process with GCC in the HTML documentation. Signed-off-by: Heinrich Schuchardt --- doc/build/gcc.rst | 119 ++++++++++++++++++++++++++++++++++++++++++++++++++++ doc/build/index.rst | 1 + 2 files changed, 120 insertions(+) create mode 100644 doc/build/gcc.rst diff --git a/doc/build/gcc.rst b/doc/build/gcc.rst new file mode 100644 index 0000000000..fcb0b1ffb3 --- /dev/null +++ b/doc/build/gcc.rst @@ -0,0 +1,119 @@ +Building with GCC +================= + +Dependencies +------------ + +For building U-Boot you need a GCC compiler for your host platform. If you +are not building on the target platform you further need a GCC cross compiler. + +Debian based +~~~~~~~~~~~~ + +On Debian based systems the cross compiler packages are named +gcc--linux-gnu. + +You could install GCC and the GCC cross compiler for the ARMv8 architecture with + +.. code-block:: bash + + sudo apt-get gcc gcc-aarch64-linux-gnu + +Depending on the build targets further packages maybe needed + +.. code-block:: bash + + sudo apt-get install bc bison build-essential coccinelle \ + device-tree-compiler dfu-util efitools flex gdisk liblz4-tool \ + libguestfs-tools libncurses-dev libpython3-dev libsdl2-dev libssl-dev \ + lzma-alone openssl python3 python3-coverage python3-pyelftools \ + python3-pytest python3-sphinxcontrib.apidoc python3-sphinx-rtd-theme swig + +Prerequisites +------------- + +For some boards you have to build prerequisite files before you can build +U-Boot, e.g. for the some boards you will need to build the ARM Trusted Firmware +beforehand. Please, refer to the board specific documentation +:doc:`../board/index`. + +Configuration +------------- + +Directory configs/ contains the template configuration files for the maintained +boards following the naming scheme:: + + _defconfig + +These files have been stripped of default settings. So you cannot use them +directly. Instead their name serves as a make target to generate the actual +configuration file .config. For instance the configuration template for the +Odroid C2 board is called odroid-c2_defconfig. The corresponding .config file +is generated by + +.. code-block:: bash + + make odroid-c2_defconfig + +You can adjust the configuration using + +.. code-block:: bash + + make menuconfig + +Building +-------- + +When cross compiling you will have to specify the prefix of the cross-compiler. +You can either specify the value of the CROSS_COMPILE variable on the make +command line or export it beforehand. + +.. code-block:: bash + + CROSS_COMPILE= make + +Assuming cross compiling on Debian for ARMv8 this would be + +.. code-block:: bash + + CROSS_COMPILE=aarch64-linux-gnu- make + +Build parameters +~~~~~~~~~~~~~~~~ + +A list of available parameters for the make command can be obtained via + +.. code-block:: bash + + make help + +You can speed up compilation by parallelization using the -j parameter, e.g. + +.. code-block:: bash + + CROSS_COMPILE=aarch64-linux-gnu- make -j$(nproc) + +Further important build parameters are + +* O= - generate all output files in directory , including .config +* V=1 - verbose build + +Other build targets +~~~~~~~~~~~~~~~~~~~ + +A list of all make targets can be obtained via + +.. code-block:: bash + + make help + +Important ones are + +* clean - remove most generated files but keep the configuration +* mrproper - remove all generated files + config + various backup files + +Installation +------------ + +The process for installing U-Boot on the target device is device specific. +Please, refer to the board specific documentation :doc:`../board/index`. diff --git a/doc/build/index.rst b/doc/build/index.rst index 5051a97e70..5f90f95aca 100644 --- a/doc/build/index.rst +++ b/doc/build/index.rst @@ -7,5 +7,6 @@ Build U-Boot :maxdepth: 2 source + gcc clang tools -- cgit From 9a97314b5bb815151b48b867455ee428fa394902 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 5 Sep 2020 11:08:06 +0200 Subject: Makefile: mrproper shall delete doc/output/ HTML documentation is generated in doc/output/. This directory shall be deleted by 'make mrproper' Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3a18fb3c58..6665cd6960 100644 --- a/Makefile +++ b/Makefile @@ -2025,7 +2025,7 @@ CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h tools/version.h \ # Directories & files removed with 'make mrproper' MRPROPER_DIRS += include/config include/generated spl tpl \ - .tmp_objdiff + .tmp_objdiff doc/output MRPROPER_FILES += .config .config.old include/autoconf.mk* include/config.h \ ctags etags tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \ drivers/video/fonts/*.S -- cgit From 185440ffc46f310b0f300c10804ba3cb0a7bf15a Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 10 Sep 2020 12:09:03 +0200 Subject: test: do no assume hush parser in validate_empty() The environment variable test uses function validate_empty() to check that a variable is not defined. If the hush parser is not enabled, we cannot refer to a variable by $var_name but only by ${var_name}. Signed-off-by: Heinrich Schuchardt Acked-by: Stephen Warren --- test/py/tests/test_env.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/py/tests/test_env.py b/test/py/tests/test_env.py index 2ae8f25381..940279651d 100644 --- a/test/py/tests/test_env.py +++ b/test/py/tests/test_env.py @@ -151,7 +151,7 @@ def validate_empty(state_test_env, var): Nothing. """ - response = state_test_env.u_boot_console.run_command('echo $%s' % var) + response = state_test_env.u_boot_console.run_command('echo ${%s}' % var) assert response == '' def validate_set(state_test_env, var, value): -- cgit