]> Git Repo - J-u-boot.git/commitdiff
Merge tag 'v2024.01-rc3' into next
authorTom Rini <[email protected]>
Mon, 20 Nov 2023 14:19:50 +0000 (09:19 -0500)
committerTom Rini <[email protected]>
Mon, 20 Nov 2023 14:19:50 +0000 (09:19 -0500)
Prepare v2024.01-rc3

32 files changed:
1  2 
Makefile
arch/arm/dts/Makefile
arch/arm/mach-imx/spl_imx_romapi.c
arch/arm/mach-k3/am654_init.c
arch/arm/mach-k3/common.c
arch/arm/mach-k3/j721e_init.c
arch/arm/mach-k3/j721s2_init.c
arch/arm/mach-k3/r5_mpu.c
arch/arm/mach-k3/security.c
arch/arm/mach-k3/sysfw-loader.c
arch/arm/mach-omap2/boot-common.c
arch/arm/mach-stm32mp/include/mach/stm32.h
arch/arm/mach-stm32mp/include/mach/sys_proto.h
arch/arm/mach-stm32mp/stm32mp1/cpu.c
arch/sandbox/cpu/os.c
arch/sandbox/dts/test.dts
board/ti/am65x/evm.c
board/ti/j721e/evm.c
board/ti/j721s2/evm.c
configs/stm32mp15_dhcom_basic_defconfig
configs/stm32mp15_dhcor_basic_defconfig
configs/xilinx_zynqmp_mini_qspi_defconfig
configs/zynq_cse_nand_defconfig
configs/zynq_cse_nor_defconfig
configs/zynq_cse_qspi_defconfig
drivers/ata/sata.c
drivers/core/Kconfig
drivers/scsi/scsi.c
drivers/spi/spi-mem-nodm.c
drivers/ufs/cdns-platform.c
drivers/usb/dwc3/core.c
include/env_internal.h

diff --cc Makefile
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index b31e4a5d0dcf5760ba028f2b19728bb773e9301a,ac0deced67e42b8333fe6a36a052fec9f67ca07e..46d469881b32824f8e08350497e0a14d8f08e7a6
@@@ -6,61 -6,8 +6,64 @@@
  #ifndef _MACH_STM32_H_
  #define _MACH_STM32_H_
  
 +#include <linux/sizes.h>
  #ifndef __ASSEMBLY__
  #include <linux/bitops.h>
- #define TAMP_BOOT_DEBUG_ON            BIT(16)
 +
 +enum boot_device {
 +      BOOT_FLASH_SD = 0x10,
 +      BOOT_FLASH_SD_1 = 0x11,
 +      BOOT_FLASH_SD_2 = 0x12,
 +      BOOT_FLASH_SD_3 = 0x13,
 +
 +      BOOT_FLASH_EMMC = 0x20,
 +      BOOT_FLASH_EMMC_1 = 0x21,
 +      BOOT_FLASH_EMMC_2 = 0x22,
 +      BOOT_FLASH_EMMC_3 = 0x23,
 +
 +      BOOT_FLASH_NAND = 0x30,
 +      BOOT_FLASH_NAND_FMC = 0x31,
 +
 +      BOOT_FLASH_NOR = 0x40,
 +      BOOT_FLASH_NOR_QSPI = 0x41,
 +
 +      BOOT_SERIAL_UART = 0x50,
 +      BOOT_SERIAL_UART_1 = 0x51,
 +      BOOT_SERIAL_UART_2 = 0x52,
 +      BOOT_SERIAL_UART_3 = 0x53,
 +      BOOT_SERIAL_UART_4 = 0x54,
 +      BOOT_SERIAL_UART_5 = 0x55,
 +      BOOT_SERIAL_UART_6 = 0x56,
 +      BOOT_SERIAL_UART_7 = 0x57,
 +      BOOT_SERIAL_UART_8 = 0x58,
 +
 +      BOOT_SERIAL_USB = 0x60,
 +      BOOT_SERIAL_USB_OTG = 0x62,
 +
 +      BOOT_FLASH_SPINAND = 0x70,
 +      BOOT_FLASH_SPINAND_1 = 0x71,
 +};
 +
 +#define TAMP_BOOT_MODE_MASK           GENMASK(15, 8)
 +#define TAMP_BOOT_MODE_SHIFT          8
++#define TAMP_BOOT_AUTH_MASK           GENMASK(23, 16)
++#define TAMP_BOOT_AUTH_SHIFT          16
 +#define TAMP_BOOT_DEVICE_MASK         GENMASK(7, 4)
 +#define TAMP_BOOT_INSTANCE_MASK               GENMASK(3, 0)
++#define TAMP_BOOT_AUTH_ST_MASK                GENMASK(7, 4)
++#define TAMP_BOOT_PARTITION_MASK      GENMASK(3, 0)
 +#define TAMP_BOOT_FORCED_MASK         GENMASK(7, 0)
 +
 +enum forced_boot_mode {
 +      BOOT_NORMAL = 0x00,
 +      BOOT_FASTBOOT = 0x01,
 +      BOOT_RECOVERY = 0x02,
 +      BOOT_STM32PROG = 0x03,
 +      BOOT_UMS_MMC0 = 0x10,
 +      BOOT_UMS_MMC1 = 0x11,
 +      BOOT_UMS_MMC2 = 0x12,
 +};
 +
  #endif
  
  /*
index e07abbe21c1acf63ea25157697abda997fe19291,0000000000000000000000000000000000000000..55574fd4bebfee80663a3b8d9a5f0bade6ccae81
mode 100644,000000..100644
--- /dev/null
@@@ -1,431 -1,0 +1,454 @@@
-       if (!(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF))) {
 +// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
 +/*
 + * Copyright (C) 2018, STMicroelectronics - All Rights Reserved
 + */
 +
 +#define LOG_CATEGORY LOGC_ARCH
 +
 +#include <common.h>
 +#include <clk.h>
 +#include <cpu_func.h>
 +#include <debug_uart.h>
 +#include <env.h>
 +#include <init.h>
 +#include <log.h>
 +#include <lmb.h>
 +#include <misc.h>
 +#include <net.h>
 +#include <spl.h>
 +#include <asm/io.h>
 +#include <asm/arch/stm32.h>
 +#include <asm/arch/sys_proto.h>
 +#include <asm/global_data.h>
 +#include <dm/device.h>
 +#include <dm/uclass.h>
 +#include <linux/bitops.h>
 +#include <linux/printk.h>
 +
 +/*
 + * early TLB into the .data section so that it not get cleared
 + * with 16kB allignment (see TTBR0_BASE_ADDR_MASK)
 + */
 +u8 early_tlb[PGTABLE_SIZE] __section(".data") __aligned(0x4000);
 +
 +struct lmb lmb;
 +
 +u32 get_bootmode(void)
 +{
 +      /* read bootmode from TAMP backup register */
 +      return (readl(TAMP_BOOT_CONTEXT) & TAMP_BOOT_MODE_MASK) >>
 +                  TAMP_BOOT_MODE_SHIFT;
 +}
 +
++u32 get_bootauth(void)
++{
++      /* read boot auth status and partition from TAMP backup register */
++      return (readl(TAMP_BOOT_CONTEXT) & TAMP_BOOT_AUTH_MASK) >>
++                  TAMP_BOOT_AUTH_SHIFT;
++}
++
 +/*
 + * weak function overidde: set the DDR/SYSRAM executable before to enable the
 + * MMU and configure DACR, for early early_enable_caches (SPL or pre-reloc)
 + */
 +void dram_bank_mmu_setup(int bank)
 +{
 +      struct bd_info *bd = gd->bd;
 +      int     i;
 +      phys_addr_t start;
 +      phys_size_t size;
 +      bool use_lmb = false;
 +      enum dcache_option option;
 +
 +      if (IS_ENABLED(CONFIG_SPL_BUILD)) {
 +/* STM32_SYSRAM_BASE exist only when SPL is supported */
 +#ifdef CONFIG_SPL
 +              start = ALIGN_DOWN(STM32_SYSRAM_BASE, MMU_SECTION_SIZE);
 +              size = ALIGN(STM32_SYSRAM_SIZE, MMU_SECTION_SIZE);
 +#endif
 +      } else if (gd->flags & GD_FLG_RELOC) {
 +              /* bd->bi_dram is available only after relocation */
 +              start = bd->bi_dram[bank].start;
 +              size =  bd->bi_dram[bank].size;
 +              use_lmb = true;
 +      } else {
 +              /* mark cacheable and executable the beggining of the DDR */
 +              start = STM32_DDR_BASE;
 +              size = CONFIG_DDR_CACHEABLE_SIZE;
 +      }
 +
 +      for (i = start >> MMU_SECTION_SHIFT;
 +           i < (start >> MMU_SECTION_SHIFT) + (size >> MMU_SECTION_SHIFT);
 +           i++) {
 +              option = DCACHE_DEFAULT_OPTION;
 +              if (use_lmb && lmb_is_reserved_flags(&lmb, i << MMU_SECTION_SHIFT, LMB_NOMAP))
 +                      option = 0; /* INVALID ENTRY in TLB */
 +              set_section_dcache(i, option);
 +      }
 +}
 +/*
 + * initialize the MMU and activate cache in SPL or in U-Boot pre-reloc stage
 + * MMU/TLB is updated in enable_caches() for U-Boot after relocation
 + * or is deactivated in U-Boot entry function start.S::cpu_init_cp15
 + */
 +static void early_enable_caches(void)
 +{
 +      /* I-cache is already enabled in start.S: cpu_init_cp15 */
 +
 +      if (CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
 +              return;
 +
-       }
++#if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
 +              gd->arch.tlb_size = PGTABLE_SIZE;
 +              gd->arch.tlb_addr = (unsigned long)&early_tlb;
++#endif
 +
 +      /* enable MMU (default configuration) */
 +      dcache_enable();
 +}
 +
 +/*
 + * Early system init
 + */
 +int arch_cpu_init(void)
 +{
 +      early_enable_caches();
 +
 +      /* early armv7 timer init: needed for polling */
 +      timer_init();
 +
 +      return 0;
 +}
 +
 +/* weak function for SOC specific initialization */
 +__weak void stm32mp_cpu_init(void)
 +{
 +}
 +
 +int mach_cpu_init(void)
 +{
 +      u32 boot_mode;
 +
 +      stm32mp_cpu_init();
 +
 +      boot_mode = get_bootmode();
 +
 +      if (IS_ENABLED(CONFIG_CMD_STM32PROG_SERIAL) &&
 +          (boot_mode & TAMP_BOOT_DEVICE_MASK) == BOOT_SERIAL_UART)
 +              gd->flags |= GD_FLG_SILENT | GD_FLG_DISABLE_CONSOLE;
 +      else if (IS_ENABLED(CONFIG_DEBUG_UART) && IS_ENABLED(CONFIG_SPL_BUILD))
 +              debug_uart_init();
 +
 +      return 0;
 +}
 +
 +void enable_caches(void)
 +{
 +      /* parse device tree when data cache is still activated */
 +      lmb_init_and_reserve(&lmb, gd->bd, (void *)gd->fdt_blob);
 +
 +      /* I-cache is already enabled in start.S: icache_enable() not needed */
 +
 +      /* deactivate the data cache, early enabled in arch_cpu_init() */
 +      dcache_disable();
 +      /*
 +       * update MMU after relocation and enable the data cache
 +       * warning: the TLB location udpated in board_f.c::reserve_mmu
 +       */
 +      dcache_enable();
 +}
 +
 +/* used when CONFIG_DISPLAY_CPUINFO is activated */
 +int print_cpuinfo(void)
 +{
 +      char name[SOC_NAME_SIZE];
 +
 +      get_soc_name(name);
 +      printf("CPU: %s\n", name);
 +
 +      return 0;
 +}
 +
 +static void setup_boot_mode(void)
 +{
 +      const u32 serial_addr[] = {
 +              STM32_USART1_BASE,
 +              STM32_USART2_BASE,
 +              STM32_USART3_BASE,
 +              STM32_UART4_BASE,
 +              STM32_UART5_BASE,
 +              STM32_USART6_BASE,
 +              STM32_UART7_BASE,
 +              STM32_UART8_BASE
 +      };
 +      const u32 sdmmc_addr[] = {
 +              STM32_SDMMC1_BASE,
 +              STM32_SDMMC2_BASE,
 +              STM32_SDMMC3_BASE
 +      };
 +      char cmd[60];
 +      u32 boot_ctx = readl(TAMP_BOOT_CONTEXT);
 +      u32 boot_mode =
 +              (boot_ctx & TAMP_BOOT_MODE_MASK) >> TAMP_BOOT_MODE_SHIFT;
 +      unsigned int instance = (boot_mode & TAMP_BOOT_INSTANCE_MASK) - 1;
 +      u32 forced_mode = (boot_ctx & TAMP_BOOT_FORCED_MASK);
 +      struct udevice *dev;
 +
 +      log_debug("%s: boot_ctx=0x%x => boot_mode=%x, instance=%d forced=%x\n",
 +                __func__, boot_ctx, boot_mode, instance, forced_mode);
 +      switch (boot_mode & TAMP_BOOT_DEVICE_MASK) {
 +      case BOOT_SERIAL_UART:
 +              if (instance >= ARRAY_SIZE(serial_addr))
 +                      break;
 +              /* serial : search associated node in devicetree */
 +              sprintf(cmd, "serial@%x", serial_addr[instance]);
 +              if (uclass_get_device_by_name(UCLASS_SERIAL, cmd, &dev)) {
 +                      /* restore console on error */
 +                      if (IS_ENABLED(CONFIG_CMD_STM32PROG_SERIAL))
 +                              gd->flags &= ~(GD_FLG_SILENT |
 +                                             GD_FLG_DISABLE_CONSOLE);
 +                      log_err("uart%d = %s not found in device tree!\n",
 +                              instance + 1, cmd);
 +                      break;
 +              }
 +              sprintf(cmd, "%d", dev_seq(dev));
 +              env_set("boot_device", "serial");
 +              env_set("boot_instance", cmd);
 +
 +              /* restore console on uart when not used */
 +              if (IS_ENABLED(CONFIG_CMD_STM32PROG_SERIAL) && gd->cur_serial_dev != dev) {
 +                      gd->flags &= ~(GD_FLG_SILENT |
 +                                     GD_FLG_DISABLE_CONSOLE);
 +                      log_info("serial boot with console enabled!\n");
 +              }
 +              break;
 +      case BOOT_SERIAL_USB:
 +              env_set("boot_device", "usb");
 +              env_set("boot_instance", "0");
 +              break;
 +      case BOOT_FLASH_SD:
 +      case BOOT_FLASH_EMMC:
 +              if (instance >= ARRAY_SIZE(sdmmc_addr))
 +                      break;
 +              /* search associated sdmmc node in devicetree */
 +              sprintf(cmd, "mmc@%x", sdmmc_addr[instance]);
 +              if (uclass_get_device_by_name(UCLASS_MMC, cmd, &dev)) {
 +                      printf("mmc%d = %s not found in device tree!\n",
 +                             instance, cmd);
 +                      break;
 +              }
 +              sprintf(cmd, "%d", dev_seq(dev));
 +              env_set("boot_device", "mmc");
 +              env_set("boot_instance", cmd);
 +              break;
 +      case BOOT_FLASH_NAND:
 +              env_set("boot_device", "nand");
 +              env_set("boot_instance", "0");
 +              break;
 +      case BOOT_FLASH_SPINAND:
 +              env_set("boot_device", "spi-nand");
 +              env_set("boot_instance", "0");
 +              break;
 +      case BOOT_FLASH_NOR:
 +              env_set("boot_device", "nor");
 +              env_set("boot_instance", "0");
 +              break;
 +      default:
 +              env_set("boot_device", "invalid");
 +              env_set("boot_instance", "");
 +              log_err("unexpected boot mode = %x\n", boot_mode);
 +              break;
 +      }
 +
 +      switch (forced_mode) {
 +      case BOOT_FASTBOOT:
 +              log_info("Enter fastboot!\n");
 +              env_set("preboot", "env set preboot; fastboot 0");
 +              break;
 +      case BOOT_STM32PROG:
 +              env_set("boot_device", "usb");
 +              env_set("boot_instance", "0");
 +              break;
 +      case BOOT_UMS_MMC0:
 +      case BOOT_UMS_MMC1:
 +      case BOOT_UMS_MMC2:
 +              log_info("Enter UMS!\n");
 +              instance = forced_mode - BOOT_UMS_MMC0;
 +              sprintf(cmd, "env set preboot; ums 0 mmc %d", instance);
 +              env_set("preboot", cmd);
 +              break;
 +      case BOOT_RECOVERY:
 +              env_set("preboot", "env set preboot; run altbootcmd");
 +              break;
 +      case BOOT_NORMAL:
 +              break;
 +      default:
 +              log_debug("unexpected forced boot mode = %x\n", forced_mode);
 +              break;
 +      }
 +
 +      /* clear TAMP for next reboot */
 +      clrsetbits_le32(TAMP_BOOT_CONTEXT, TAMP_BOOT_FORCED_MASK, BOOT_NORMAL);
 +}
 +
 +/*
 + * If there is no MAC address in the environment, then it will be initialized
 + * (silently) from the value in the OTP.
 + */
 +__weak int setup_mac_address(void)
 +{
 +      int ret;
 +      int i;
 +      u32 otp[3];
 +      uchar enetaddr[6];
 +      struct udevice *dev;
 +      int nb_eth, nb_otp, index;
 +
 +      if (!IS_ENABLED(CONFIG_NET))
 +              return 0;
 +
 +      nb_eth = get_eth_nb();
 +
 +      /* 6 bytes for each MAC addr and 4 bytes for each OTP */
 +      nb_otp = DIV_ROUND_UP(6 * nb_eth, 4);
 +
 +      ret = uclass_get_device_by_driver(UCLASS_MISC,
 +                                        DM_DRIVER_GET(stm32mp_bsec),
 +                                        &dev);
 +      if (ret)
 +              return ret;
 +
 +      ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_MAC), otp, 4 * nb_otp);
 +      if (ret < 0)
 +              return ret;
 +
 +      for (index = 0; index < nb_eth; index++) {
 +              /* MAC already in environment */
 +              if (eth_env_get_enetaddr_by_index("eth", index, enetaddr))
 +                      continue;
 +
 +              for (i = 0; i < 6; i++)
 +                      enetaddr[i] = ((uint8_t *)&otp)[i + 6 * index];
 +
 +              if (!is_valid_ethaddr(enetaddr)) {
 +                      log_err("invalid MAC address %d in OTP %pM\n",
 +                              index, enetaddr);
 +                      return -EINVAL;
 +              }
 +              log_debug("OTP MAC address %d = %pM\n", index, enetaddr);
 +              ret = eth_env_set_enetaddr_by_index("eth", index, enetaddr);
 +              if (ret) {
 +                      log_err("Failed to set mac address %pM from OTP: %d\n",
 +                              enetaddr, ret);
 +                      return ret;
 +              }
 +      }
 +
 +      return 0;
 +}
 +
 +static int setup_serial_number(void)
 +{
 +      char serial_string[25];
 +      u32 otp[3] = {0, 0, 0 };
 +      struct udevice *dev;
 +      int ret;
 +
 +      if (env_get("serial#"))
 +              return 0;
 +
 +      ret = uclass_get_device_by_driver(UCLASS_MISC,
 +                                        DM_DRIVER_GET(stm32mp_bsec),
 +                                        &dev);
 +      if (ret)
 +              return ret;
 +
 +      ret = misc_read(dev, STM32_BSEC_SHADOW(BSEC_OTP_SERIAL),
 +                      otp, sizeof(otp));
 +      if (ret < 0)
 +              return ret;
 +
 +      sprintf(serial_string, "%08X%08X%08X", otp[0], otp[1], otp[2]);
 +      env_set("serial#", serial_string);
 +
 +      return 0;
 +}
 +
 +__weak void stm32mp_misc_init(void)
 +{
 +}
 +
++static int setup_boot_auth_info(void)
++{
++      char buf[10];
++      u32 bootauth = get_bootauth();
++
++      snprintf(buf, sizeof(buf), "%d", bootauth >> 4);
++      env_set("boot_auth", buf);
++
++      snprintf(buf, sizeof(buf), "%d", bootauth &
++               (u32)TAMP_BOOT_PARTITION_MASK);
++      env_set("boot_part", buf);
++
++      return 0;
++}
++
 +int arch_misc_init(void)
 +{
++      setup_boot_auth_info();
 +      setup_boot_mode();
 +      setup_mac_address();
 +      setup_serial_number();
 +      stm32mp_misc_init();
 +
 +      return 0;
 +}
 +
 +/*
 + * Without forcing the ".data" section, this would get saved in ".bss". BSS
 + * will be cleared soon after, so it's not suitable.
 + */
 +static uintptr_t rom_api_table __section(".data");
 +static uintptr_t nt_fw_dtb __section(".data");
 +
 +/*
 + * The ROM gives us the API location in r0 when starting. This is only available
 + * during SPL, as there isn't (yet) a mechanism to pass this on to u-boot. Save
 + * the FDT address provided by TF-A in r2 at boot time. This function is called
 + * from start.S
 + */
 +void save_boot_params(unsigned long r0, unsigned long r1, unsigned long r2,
 +                    unsigned long r3)
 +{
 +      if (IS_ENABLED(CONFIG_STM32_ECDSA_VERIFY))
 +              rom_api_table = r0;
 +
 +      if (IS_ENABLED(CONFIG_TFABOOT))
 +              nt_fw_dtb = r2;
 +
 +      save_boot_params_ret();
 +}
 +
 +uintptr_t get_stm32mp_rom_api_table(void)
 +{
 +      return rom_api_table;
 +}
 +
 +uintptr_t get_stm32mp_bl2_dtb(void)
 +{
 +      return nt_fw_dtb;
 +}
 +
 +#ifdef CONFIG_SPL_BUILD
 +void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
 +{
 +      typedef void __noreturn (*image_entry_stm32_t)(u32 romapi);
 +      uintptr_t romapi = get_stm32mp_rom_api_table();
 +
 +      image_entry_stm32_t image_entry =
 +              (image_entry_stm32_t)spl_image->entry_point;
 +
 +      printf("image entry point: 0x%lx\n", spl_image->entry_point);
 +      image_entry(romapi);
 +}
 +#endif
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index f9cadcc026dcdb6e78ad12b1a8c6491f1409d281,6ee841358b343eae9b22736331d521ee39627e93..6d9ab61769a782b8bf6ee4cf039503839c9d5b9a
@@@ -1,9 -1,8 +1,9 @@@
  // SPDX-License-Identifier: GPL-2.0+
  /*
-  * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
+  * Copyright (C) 2018 Texas Instruments Incorporated - https://www.ti.com/
   */
  
 +#include <errno.h>
  #include <log.h>
  #include <malloc.h>
  #include <spi.h>
Simple merge
Simple merge
Simple merge
This page took 0.084594 seconds and 4 git commands to generate.