]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
Merge patch series "Enable MCU ESM reset"
authorTom Rini <trini@konsulko.com>
Mon, 10 Feb 2025 16:32:03 +0000 (10:32 -0600)
committerTom Rini <trini@konsulko.com>
Mon, 10 Feb 2025 16:32:03 +0000 (10:32 -0600)
Judith Mendez <jm@ti.com> says:

This patch series enables ESM reset configuration in board_init_f
for am62x and am62px devices.

This is necessary in order for error events to reset the system.

This patches are tested using watchdog to reset the system via ESM.

Link: https://lore.kernel.org/r/20250129234403.574766-1-jm@ti.com
1  2 
arch/arm/mach-k3/am62px/am62p5_init.c
configs/am62ax_evm_r5_defconfig
configs/am62px_evm_r5_defconfig

index 7a24cf39c7b87ed9e2c7debbfc6889c29af2f1ef,36216aac90ca38428deb9aaea6c97d19e5574299..14a46fa28d2b52c53763369b3f39d74bbb69e843
  #include "../sysfw-loader.h"
  #include "../common.h"
  
 +/* TISCI DEV ID for A53 Clock */
 +#define AM62PX_DEV_A53SS0_CORE_0_DEV_ID 135
 +
+ #define CTRLMMR_MCU_RST_CTRL             0x04518170
+ #define RST_CTRL_ESM_ERROR_RST_EN_Z_MASK 0xFFFDFFFF
  struct fwl_data cbass_main_fwls[] = {
        { "FSS_DAT_REG3", 7, 8 },
  };
@@@ -71,62 -70,15 +74,71 @@@ static void ctrl_mmr_unlock(void
        mmr_unlock(PADCFG_MMR1_BASE, 1);
  }
  
 +#if CONFIG_IS_ENABLED(OF_CONTROL)
 +static int get_a53_cpu_clock_index(ofnode node)
 +{
 +      int count, i;
 +      struct ofnode_phandle_args *args;
 +      ofnode clknode;
 +
 +      clknode = ofnode_path("/bus@f0000/system-controller@44043000/clock-controller");
 +      if (!ofnode_valid(clknode))
 +              return -1;
 +
 +      count = ofnode_count_phandle_with_args(node,  "assigned-clocks", "#clock-cells", 0);
 +
 +      for (i  = 0; i < count; i++) {
 +              if (!ofnode_parse_phandle_with_args(node, "assigned-clocks",
 +                                                  "#clock-cells", 0, i, args)) {
 +                      if (ofnode_equal(clknode, args->node) &&
 +                          args->args[0] == AM62PX_DEV_A53SS0_CORE_0_DEV_ID)
 +                              return i;
 +              }
 +      }
 +
 +      return -1;
 +}
 +
 +static void fixup_a53_cpu_freq_by_speed_grade(void)
 +{
 +      int index, size;
 +      u32 *rates;
 +      ofnode node;
 +
 +      node =  ofnode_path("/a53@0");
 +      if (!ofnode_valid(node))
 +              return;
 +
 +      rates = fdt_getprop_w(ofnode_to_fdt(node), ofnode_to_offset(node),
 +                            "assigned-clock-rates", &size);
 +
 +      index = get_a53_cpu_clock_index(node);
 +
 +      if (!rates || index < 0 || index >= (size / sizeof(u32))) {
 +              printf("Wrong A53 assigned-clocks configuration\n");
 +              return;
 +      }
 +
 +      rates[index] = cpu_to_fdt32(k3_get_a53_max_frequency());
 +
 +      printf("Changed A53 CPU frequency to %dHz (%c grade) in DT\n",
 +             k3_get_a53_max_frequency(), k3_get_speed_grade());
 +}
 +#else
 +static void fixup_a53_cpu_freq_by_speed_grade(void)
 +{
 +}
 +#endif
 +
+ static __maybe_unused void enable_mcu_esm_reset(void)
+ {
+       /* Set CTRLMMR_MCU_RST_CTRL:MCU_ESM_ERROR_RST_EN_Z  to '0' (low active) */
+       u32 stat = readl(CTRLMMR_MCU_RST_CTRL);
+       stat &= RST_CTRL_ESM_ERROR_RST_EN_Z_MASK;
+       writel(stat, CTRLMMR_MCU_RST_CTRL);
+ }
  void board_init_f(ulong dummy)
  {
        struct udevice *dev;
Simple merge
index c3adfb8697a73198298e8e9d955d1f1829cabfd6,71e49b11650f044559ecf3318434e13239954cb5..54ea4bfb620c06c1aa2189d55e591ca0d41bba52
@@@ -86,7 -87,10 +87,9 @@@ CONFIG_TI_SCI_PROTOCOL=
  CONFIG_DM_I2C=y
  CONFIG_SYS_I2C_OMAP24XX=y
  CONFIG_DM_MAILBOX=y
 -CONFIG_K3_QOS=y
  CONFIG_K3_SEC_PROXY=y
+ CONFIG_SPL_MISC=y
+ CONFIG_ESM_K3=y
  CONFIG_MMC_HS400_SUPPORT=y
  CONFIG_MMC_SDHCI=y
  CONFIG_MMC_SDHCI_ADMA=y