aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-08-03Merge tag 'efi-2023-10-rc2-2' of ↵WIP/03Aug2023Tom Rini31-282/+416
https://source.denx.de/u-boot/custodians/u-boot-efi Pull request efi-2023-10-rc2-2 Documentation: * Move README.falcon to HTML * Describe usage of QEMU virtio block device * Add SPDX license identifiers to svg images * Add more detail to the description of U-Boot boot phases UEFI: * Fix buffer overflows * Fix memory leak in efi_add_memory_map_pg * Properly check return values of calloc, uuid_str_to_bin, efi_parse_pkcs7_header
2023-08-03Merge branch '2023-08-03-mediatek-and-ten64-updates'Tom Rini72-1059/+5649
Merge in a series for MediaTek update and another for Ten64. To quote Weijie Gao for MediaTek: This patch series add support for MediaTek MT7988 SoC with its reference boards and related drivers. This patch series add basic boot support on eMMC/SD/SPI-NOR/SPI-NAND for these boards. The clock, pinctrl drivers and the SoC initializaton code are also included. Product spec for MT7988: https://www.mediatek.com/products/broadband-wifi/mediatek-filogic-880 And to quote Mathew McBride for Ten64: This is a series of updates for the Ten64 board, that are part of our firmware releases but not yet upstreamed into U-Boot. Changes of note include: - Turning on standard boot support Standard boot improves the user experience over distroboot on Ten64, as we had various hacks in our firmware to solve some corner-case issues (e.g DTB handling) in distroboot, which are not needed with the bootflow system. - Recognition of the new 'RevD' board variant distributed to OEM customers - Fixing various boot issues related to FIT images and operating systems running out of the NAND (OpenWrt, recovery environment). - A better 'opt-out' solution for fsl_setenv_bootcmd for Layerscape platforms booting from TF-A. This was discussed when the Ten64 was upstreamed into U-Boot. I think declaring fsl_setenv_bootcmd as __weak and allowing individual boards to override is the best way to do this without significant rework. (We actually depend on a similar feature for the DPAA2/MC firmware loading) Compared to our firmware branch, there is still a few features missing (e.g USB Hub, fan controller and fixes for the VSC8514). Some of these depend on other things (like sorting out device tree schemas) so may not appear in mainline U-Boot for a while yet.
2023-08-03board: ten64: strip extra u-boot compatibles from FDTMathew McBride1-0/+6
The u-boot version of the LS1088A device tree has an extra compatible (simple-mfd) added to &fsl_mc to facilitate usage with U-Boot's device model. Unfortunately FreeBSD will only match the single "fsl,qoriq-mc" exactly when the node is a "bus" object, so we need to strip out the extra compatible before presenting it to the operating system. Signed-off-by: Mathew McBride <matt@traverse.com.au> Reviewed-by: Peng Fan <peng.fan@nxp.com>
2023-08-03board: ten64: opt out of fsl_setenv_bootcmdMathew McBride1-0/+9
Our bootcmd is the same regardless of where the SoC loaded it's code from, so we don't want fsl_setenv_bootcmd to do anything. Signed-off-by: Mathew McBride <matt@traverse.com.au> Reviewed-by: Peng Fan <peng.fan@nxp.com>
2023-08-03arch: arm: fsl-layerscape: allow "opt-out" of fsl_setenv_bootcmdMathew McBride1-1/+1
Allow individual Layerscape boards to opt-out of fsl_setenv_bootcmd by declaring the original function as weak. fsl_setenv_bootcmd is used to change the bootcmd based on the TF-A boot source (e.g QSPI vs SD/MMC) for reasons including secure boot / integrity measurements and DPAA2 configuration loading. See previous discussion at [1]. On the Ten64 board, our bootcmd is the same across all TF-A boot sources so we don't want this behaviour. Signed-off-by: Mathew McBride <matt@traverse.com.au> [1] https://patchwork.ozlabs.org/project/uboot/patch/20211110044639.7070-3-matt@traverse.com.au/#2790037 Reviewed-by: Peng Fan <peng.fan@nxp.com>
2023-08-03board: traverse: ten64: adopt standard boot defaultsMathew McBride1-1/+3
With the previous updates to the device tree, Ten64 can use Standard Boot 'out of the box'. Signed-off-by: Mathew McBride <matt@traverse.com.au> Reviewed-by: Peng Fan <peng.fan@nxp.com>
2023-08-03board: ten64: disable watchdog autostartMathew McBride1-0/+1
The watchdog driver was previously enabled but not used until U-Boot's fsl-ls1088a.dtsi was updated to describe them. Some Linux distributions (e.g Debian 11) do not engage the SP805 watchdogs, causing unexpected resets after boot. To conserve the user experience, turn off the autostart, and we will provide a mechanism to turn them on at boot via env vars. Signed-off-by: Mathew McBride <matt@traverse.com.au> Reviewed-by: Peng Fan <peng.fan@nxp.com>
2023-08-03board: traverse: ten64: set serial# to be 'label' MACMathew McBride1-0/+14
The GE0 (first Gigabit Ethernet interface) is used as the 'serial number' for the board and appliance. To ensure the 'true' board S/N is available regardless of how the DPAA2 subsystem is configured, use serial# so it is passed in the device tree. Signed-off-by: Mathew McBride <matt@traverse.com.au> Reviewed-by: Peng Fan <peng.fan@nxp.com>
2023-08-03board: traverse: ten64: fix allocation order of MAC addressesMathew McBride2-2/+12
On Ten64 boards, the "serial number" is the MAC address of the first Gigabit Ethernet interface (labelled GE0 on the appliance), and counted up from there. The previous logic did not take into account U-Boot's ordering of the network interfaces. By setting aliases/ethernetX in the device tree we can ensure the U-Boot 'ethX' is the same as the labelled port order on the unit, as well as the one adopted by Linux. Signed-off-by: Mathew McBride <matt@traverse.com.au>
2023-08-03board: traverse: ten64: init nvme devices in late boot to ensure bootflow ↵Mathew McBride1-0/+7
availability Ensure nvme devices are scanned before reaching the shell, otherwise extra user intervention ("nvme scan") is required before they are visible to bootdev/bootflow. Signed-off-by: Mathew McBride <matt@traverse.com.au> Reviewed-by: Peng Fan <peng.fan@nxp.com>
2023-08-03configs: ten64: enable NVME_PCIMathew McBride1-0/+2
This restores NVMe functionality after PCI(e) NVMe support was split out from the NVMe driver. Signed-off-by: Mathew McBride <matt@traverse.com.au> Reviewed-by: Peng Fan <peng.fan@nxp.com>
2023-08-03board: ten64: add a bootmenu entries for NAND-based entriesMathew McBride1-2/+12
The recovery-firmware and OpenWrt-NAND do not yet have bootflow /bootstd entrypoints, so add bootmenu entries to make them accessible. Signed-off-by: Mathew McBride <matt@traverse.com.au> Reviewed-by: Peng Fan <peng.fan@nxp.com>
2023-08-03board: traverse: ten64: add NAND based OpenWrt bootcmdMathew McBride1-0/+7
The default Ten64 MTD configuration reserves two ubifs partitions for OpenWrt residing on NAND flash. Add the bootcmd for this system into the default environment. Signed-off-by: Mathew McBride <matt@traverse.com.au> Reviewed-by: Peng Fan <peng.fan@nxp.com>
2023-08-03board: traverse: ten64: specify bootargs for recovery environmentMathew McBride1-1/+2
The recovery environment[1] on the Ten64 is a OpenWrt- based ramdisk stored on the NAND intended to help with system setup tasks. Before the bootargs were not being set for the recovery command, relying instead on the existing bootargs variable. Ensure the bootargs are set correctly prior to booting recovery. Signed-off-by: Mathew McBride <matt@traverse.com.au> [1] https://ten64doc.traverse.com.au/software/recovery/ Reviewed-by: Peng Fan <peng.fan@nxp.com>
2023-08-03board: traverse: ten64: update DPAA2 (network) binary path on sdcardsMathew McBride1-3/+5
Change the firmware on microSD path to "firmware/traverse/ten64" as per EBBR section 4.2[1]. The Traverse firmware tools now locate the DPAA2 firmware and configuration files under that path on the rescue SD card image. If a user then installs a standard Linux distribution over the top of that sdcard, (in theory) it will be left alone by distribution boot tooling. Signed-off-by: Mathew McBride <matt@traverse.com.au> [1] https://arm-software.github.io/ebbr/index.html#firmware-partition-filesystem Reviewed-by: Peng Fan <peng.fan@nxp.com>
2023-08-03board: traverse: ten64: fix DPAA2 (network) DPL corruption issueMathew McBride1-4/+6
The DPAA2 DPL (data plane layout) file was previously being loaded into 0x80300000, and set to be applied just before hand off to the kernel. When a FIT image with a load_address of 0x80000000 was booted with bootm, the DPL in memory was overwritten. Move the DPL load to 0x8E000000 (196MiB away from 0x80000000, and below the other typical load addr of 0x90000000). Ideally in the future, the DPL lazyapply command ("fsl_mc lazyapply DPL $dpl_addr") should be set to load the DPL contents into a memory area owned by U-Boot. Signed-off-by: Mathew McBride <matt@traverse.com.au> Reviewed-by: Peng Fan <peng.fan@nxp.com>
2023-08-03board: traverse: ten64: ensure retimer reset is done on new board revisionsMathew McBride1-18/+19
Board revision C (production) and later require the SFP+ retimer to be turned on (or reset) on boot, by way of issuing a command to the board's microcontroller (via I2C). The comparison statement here was incorrect, as the board ID decrements every revision (from 0xFF downwards), so this was matching board RevA,B,C instead of Rev >= C. Another oops that transpired when working on this issue, is that if the board controller is not called (such as CONFIG_TEN64_CONTROLLER=n or earlier board rev), then the retimer udevice was not obtained. So the board version check has to be moved inside board_cycle_retimer (which probes/fetches the retimer device) as well. Signed-off-by: Mathew McBride <matt@traverse.com.au>
2023-08-03board: traverse: ten64: recognize board revision DMathew McBride1-6/+12
Ten64 board revision D is a variant that removes the USB hub and PCIe expander/switch, but is otherwise compatible with the main production "C" version. At the same time, revise the printf specifiers (PCB version "1064-0201%s") to reduce the number of string characters related to the boot printout. Signed-off-by: Mathew McBride <matt@traverse.com.au> Reviewed-by: Peng Fan <peng.fan@nxp.com>
2023-08-03board: mediatek: add MT7988 reference boardsWeijie Gao9-0/+506
This patch adds general board files based on MT7988 SoCs. MT7988 uses one mmc controller for booting from both SD and eMMC, and the pins of mmc controller booting from SD are also shared with one of spi controllers. So two configs are need for these boot types: 1. mt7988_rfb_defconfig - SPI-NOR, SPI-NAND and eMMC 2. mt7988_sd_rfb_defconfig - SPI-NAND and SD Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2023-08-03arm: mediatek: add support for MediaTek MT7988 SoCWeijie Gao7-1/+526
This patch adds basic support for MediaTek MT7988 SoC. This includes files that will initialize the SoC after boot and its device tree. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2023-08-03tools: mtk_image: use uint32_t for ghf header magic and versionWeijie Gao2-7/+9
This patch converts magic and version fields of ghf common header to one field with the type of uint32_t to make this header flexible for futher updates. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2023-08-03net: mediatek: add support for MediaTek MT7988 SoCWeijie Gao2-1/+177
This patch adds support for MediaTek MT7988. MT7988 features MediaTek NETSYS v3, including three GMACs, and two of them supports 10Gbps USXGMII. MT7988 embeds a MT7531 switch (not MCM) which supports accessing internal registers through MMIO instead of MDIO. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2023-08-03net: mediatek: add support for NETSYS v3Weijie Gao2-12/+44
This patch adds support for NETSYS v3 hardware. Comparing to NETSYS v2, NETSYS v3 has three GMACs. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2023-08-03net: mediatek: add USXGMII supportWeijie Gao2-3/+251
This patch adds support for USXGMII of SoC. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2023-08-03arm: dts: mediatek: add infracfg registers to support GMAC/USB3 Co-PHYWeijie Gao1-0/+7
This patch adds infracfg to eth node to support enabling GMAC2. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2023-08-03net: mediatek: add support for GMAC/USB3 PHY mux mode for MT7981Weijie Gao2-1/+48
MT7981 has its GMAC2 PHY shared with USB3. To enable GMAC2, mux register must be set to connect the SGMII phy to GMAC2. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2023-08-03arm: dts: medaitek: convert gmac link mode to 2500base-xWeijie Gao10-20/+20
Now that individual 2.5Gbps SGMII support has been added to mtk-eth, all boards that use 2.5Gbps link with mt7531 must be converted to use "2500base-x" instead of "sgmii". Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2023-08-03net: mediatek: add support for SGMII 1Gbps auto-negotiation modeWeijie Gao2-6/+42
Existing SGMII support of mtk-eth is actually a MediaTek-specific 2.5Gbps high-speed SGMII (HSGMII) which does not support auto-negotiation mode. This patch adds SGMII 1Gbps auto-negotiation mode and rename the existing HSGMII to 2500basex. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2023-08-03net: mediatek: add missing static qualifierWeijie Gao1-2/+3
mt7531_mmd_ind_read and mt753x_switch_init are defined without static. Since they're not used outside this file, we should add them back. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> fixup to add static qualifier
2023-08-03net: mediatek: fix direct MDIO clause 45 access via SoCWeijie Gao1-2/+2
The original direct MDIO clause 45 access via SoC is missing the data output. This patch adds it back to ensure MDIO clause 45 can work properly for external PHYs. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2023-08-03net: mediatek: optimize the switch reset delay wait timeWeijie Gao1-2/+5
Not all switches requires 1 second delay after deasserting reset. MT7531 requires only maximum 200ms. This patch defines dedicated reset wait time for each switch chip, and will significantly improve the boot time for boards using MT7531. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2023-08-03net: mediatek: connect switch to PSE only when starting eth is requestedWeijie Gao1-3/+41
So far the switch is initialized in probe stage and is connected to PSE unconditionally. This will cause all packets being flooded to PSE and may cause PSE hang before entering linux. This patch changes the connection between switch and PSE: - Still initialize switch in probe stage, but disconnect it with PSE - Connect switch with PSE on eth start - Disconnect on eth stop Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2023-08-03pinctrl: mediatek: add pinctrl driver for MT7988 SoCWeijie Gao3-0/+1279
This patch adds pinctrl and gpio support for MT7988 SoC Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2023-08-03pinctrl: mediatek: add pinmux_set ops supportWeijie Gao1-0/+14
This patch adds pinmux_set ops for mediatek pinctrl framework Signed-off-by: Sam Shih <sam.shih@mediatek.com> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2023-08-03pinctrl: mediatek: fix the return value in driving configuration functionsWeijie Gao1-2/+2
The original mediatek pinctrl functions for driving configuration 'mtk_pinconf_drive_set_*' do not return -ENOSUPP even if input parameters are not supported. This patch fixes the return value in those functions. Signed-off-by: Sam Shih <sam.shih@mediatek.com> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2023-08-03pinctrl: mediatek: convert most definitions to constWeijie Gao10-889/+898
There exists a situation of the mediatek pinctrl driver that may return wrong pin function value for the pinmux driver: - All pin function arrays are defined without const - Some pin function arrays contain all-zero value, e.g.: static int mt7622_spi_funcs[] = { 0, 0, 0, 0, 0, 0, }; - These arrays will be put into .bss section during compilation - .bss section has no "a" attribute and does not exist in the final binary file after objcopy. - FDT binary blob is appended to the u-boot binary, which occupies the .bss section. - During board_f stage, .bss has not been initialized, and contains the data of FDT, which is not full-zero data. - pinctrl driver is initialized in board_f stage, and it will get wrong data if another driver is going to set default pinctrl. Since pinmux information and soc data are only meant to be read-only, thus should be declared as const. This will force all pinctrl data being put into .rodata section. Since .rodata has "a" attribute, even the all-zero data will be allocated and filled with correct value in to u-boot binary. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2023-08-03reset: mediatek: add reset definition for MediaTek MT7988 SoCWeijie Gao1-0/+31
This patch adds reset bits for MediaTek MT7988 Signed-off-by: Sam Shih <sam.shih@mediatek.com> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2023-08-03clk: mediatek: add clock driver support for MediaTek MT7988 SoCWeijie Gao3-0/+1473
This patch adds clock driver support for MediaTek MT7988 SoC Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2023-08-03pwm: mtk: add support for MediaTek MT7988 SoCWeijie Gao1-0/+7
This patch adds PWM support for MediaTek MT7988 SoC. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2023-08-03arm: dts: enable i2c support for MediaTek MT7981Weijie Gao1-0/+14
This patch enables i2c support for MediaTek MT7981 Signed-off-by: Sam Shih <sam.shih@mediatek.com> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2023-08-03i2c: mediatek: fix I2C usability for MT7981Weijie Gao1-2/+43
MT7981 actually uses MediaTek I2C controller v3 instead of v1. This patch adds support for I2C controller v3 fix fixes the I2C usability for MT7981. Signed-off-by: Sam Shih <sam.shih@mediatek.com> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2023-08-03reset: mediatek: check malloc return valaue before useWeijie Gao1-0/+3
This patch add missing return value check for allocating the driver's private data. -ENOMEM will be returned if malloc() fails. Signed-off-by: Sam Shih <sam.shih@mediatek.com> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2023-08-03serial: mtk: initial priv data before usingWeijie Gao1-0/+1
This patch ensures driver private data being fully initialized in _debug_uart_init which is not covered by .priv_auto ops. Signed-off-by: Sam Shih <sam.shih@mediatek.com> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> Reviewed-by: Stefan Roese <sr@denx.de>
2023-08-03spi: mtk_spim: clear IRQ enable bitsWeijie Gao1-0/+3
In u-boot we don't use IRQ. Instead, we poll busy bit in SPI_STATUS. However these IRQ enable bits may be set in previous boot stage (BootROM). If we leave these bits not cleared, although u-boot has disabled IRQ and nothing will happen, the linux kernel may encounter panic during initializing the spim driver due to IRQ event happens before IRQ handler is properly setup. This patch clear IRQ bits to prevent this from happening. Signed-off-by: SkyLake.Huang <skylake.huang@mediatek.com> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2023-08-03spi: mtk_spim: get spi clk rate only onceWeijie Gao1-8/+13
We don't really need to switch clk rate during operating SPIM controller. Get clk rate only once at driver probing. Signed-off-by: SkyLake.Huang <skylake.huang@mediatek.com> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2023-08-03board: mediatek: update config headersWeijie Gao6-29/+7
Remove unused information from include/configs/mtxxxx.h Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2023-08-03arm: mediatek: retrieve ram_base from dts node for armv8 platformWeijie Gao15-37/+68
Now we use fdtdec_setup_mem_size_base() to get DRAM base from fdt ram node and update gd->ram_base. CFG_SYS_SDRAM_BASE is unused and will be removed. Also, since mt7622 always passes fdt to linux kernel, there's no need to assign value to gd->bd->bi_boot_params. Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2023-08-03efi_loader: check uuid_str_to_bin return valueMasahisa Kojima1-2/+6
Check the uuid_str_to_bin return value, skip the node if the image-type-id property is wrong format. Addresses-Coverity-ID: 463145 ("Error handling issues") Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2023-08-03efi_loader: catch out of memory in file_openHeinrich Schuchardt1-0/+2
If calloc() return NULL, don't dereference it. Fixes: 2a92080d8c44 ("efi_loader: add file/filesys support") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2023-08-03efi_loader: error handling in efi_disk_add_devHeinrich Schuchardt3-13/+32
* If an error occurs in efi_disk_add_dev(), don't leak resources. * If calloc() fails while creating the file system protocol interface, signal an error. * Rename efi_simple_file_system() to efi_create_simple_file_system(). * Drop a little helpful debug message. Fixes: 2a92080d8c44 ("efi_loader: add file/filesys support") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>