]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
arm: mach-k3: Make release_resources_for_core_shutdown() common
authorAndrew Davis <afd@ti.com>
Thu, 6 Apr 2023 16:38:15 +0000 (11:38 -0500)
committerTom Rini <trini@konsulko.com>
Mon, 24 Apr 2023 17:18:48 +0000 (13:18 -0400)
This function is the same for each device when it needs to shutdown
the R5 core. Move this to the common section and move the remaining
device specific ID list to the device hardware include.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
12 files changed:
arch/arm/mach-k3/am642_init.c
arch/arm/mach-k3/am654_init.c
arch/arm/mach-k3/common.c
arch/arm/mach-k3/include/mach/am62_hardware.h
arch/arm/mach-k3/include/mach/am62a_hardware.h
arch/arm/mach-k3/include/mach/am64_hardware.h
arch/arm/mach-k3/include/mach/am6_hardware.h
arch/arm/mach-k3/include/mach/j721e_hardware.h
arch/arm/mach-k3/include/mach/j721s2_hardware.h
arch/arm/mach-k3/include/mach/sys_proto.h
arch/arm/mach-k3/j721e_init.c
arch/arm/mach-k3/j721s2_init.c

index 1bf7e163cc46c2f2be22cf5809fd592890d0354b..86aced54646bb9ec30b6ae67d0ee4acde704f006 100644 (file)
@@ -346,54 +346,3 @@ u32 spl_boot_device(void)
        else
                return __get_backup_bootmedia(devstat);
 }
-
-#if defined(CONFIG_SYS_K3_SPL_ATF)
-
-#define AM64X_DEV_RTI8                 127
-#define AM64X_DEV_RTI9                 128
-#define AM64X_DEV_R5FSS0_CORE0         121
-#define AM64X_DEV_R5FSS0_CORE1         122
-
-void release_resources_for_core_shutdown(void)
-{
-       struct ti_sci_handle *ti_sci = get_ti_sci_handle();
-       struct ti_sci_dev_ops *dev_ops = &ti_sci->ops.dev_ops;
-       struct ti_sci_proc_ops *proc_ops = &ti_sci->ops.proc_ops;
-       int ret;
-       u32 i;
-
-       const u32 put_device_ids[] = {
-               AM64X_DEV_RTI9,
-               AM64X_DEV_RTI8,
-       };
-
-       /* Iterate through list of devices to put (shutdown) */
-       for (i = 0; i < ARRAY_SIZE(put_device_ids); i++) {
-               u32 id = put_device_ids[i];
-
-               ret = dev_ops->put_device(ti_sci, id);
-               if (ret)
-                       panic("Failed to put device %u (%d)\n", id, ret);
-       }
-
-       const u32 put_core_ids[] = {
-               AM64X_DEV_R5FSS0_CORE1,
-               AM64X_DEV_R5FSS0_CORE0, /* Handle CPU0 after CPU1 */
-       };
-
-       /* Iterate through list of cores to put (shutdown) */
-       for (i = 0; i < ARRAY_SIZE(put_core_ids); i++) {
-               u32 id = put_core_ids[i];
-
-               /*
-                * Queue up the core shutdown request. Note that this call
-                * needs to be followed up by an actual invocation of an WFE
-                * or WFI CPU instruction.
-                */
-               ret = proc_ops->proc_shutdown_no_wait(ti_sci, id);
-               if (ret)
-                       panic("Failed sending core %u shutdown message (%d)\n",
-                             id, ret);
-       }
-}
-#endif
index 70059edb039d919ba1d902eca8151e05233dd855..abd0c0bccbcc05a0018cceeee780b73a7d3cf585 100644 (file)
@@ -353,54 +353,3 @@ u32 spl_boot_device(void)
        else
                return __get_backup_bootmedia(devstat);
 }
-
-#ifdef CONFIG_SYS_K3_SPL_ATF
-
-#define AM6_DEV_MCU_RTI0                       134
-#define AM6_DEV_MCU_RTI1                       135
-#define AM6_DEV_MCU_ARMSS0_CPU0                        159
-#define AM6_DEV_MCU_ARMSS0_CPU1                        245
-
-void release_resources_for_core_shutdown(void)
-{
-       struct ti_sci_handle *ti_sci = get_ti_sci_handle();
-       struct ti_sci_dev_ops *dev_ops = &ti_sci->ops.dev_ops;
-       struct ti_sci_proc_ops *proc_ops = &ti_sci->ops.proc_ops;
-       int ret;
-       u32 i;
-
-       const u32 put_device_ids[] = {
-               AM6_DEV_MCU_RTI0,
-               AM6_DEV_MCU_RTI1,
-       };
-
-       /* Iterate through list of devices to put (shutdown) */
-       for (i = 0; i < ARRAY_SIZE(put_device_ids); i++) {
-               u32 id = put_device_ids[i];
-
-               ret = dev_ops->put_device(ti_sci, id);
-               if (ret)
-                       panic("Failed to put device %u (%d)\n", id, ret);
-       }
-
-       const u32 put_core_ids[] = {
-               AM6_DEV_MCU_ARMSS0_CPU1,
-               AM6_DEV_MCU_ARMSS0_CPU0,        /* Handle CPU0 after CPU1 */
-       };
-
-       /* Iterate through list of cores to put (shutdown) */
-       for (i = 0; i < ARRAY_SIZE(put_core_ids); i++) {
-               u32 id = put_core_ids[i];
-
-               /*
-                * Queue up the core shutdown request. Note that this call
-                * needs to be followed up by an actual invocation of an WFE
-                * or WFI CPU instruction.
-                */
-               ret = proc_ops->proc_shutdown_no_wait(ti_sci, id);
-               if (ret)
-                       panic("Failed sending core %u shutdown message (%d)\n",
-                             id, ret);
-       }
-}
-#endif
index 6e084de692c99747e2bfff45fcfb0f2adcc7ba4c..4f2e14c3105472da1b391f9cba383b52f6e71c98 100644 (file)
@@ -189,9 +189,37 @@ int load_firmware(char *name_fw, char *name_loadaddr, u32 *loadaddr)
        return size;
 }
 
-__weak void release_resources_for_core_shutdown(void)
+void release_resources_for_core_shutdown(void)
 {
-       debug("%s not implemented...\n", __func__);
+       struct ti_sci_handle *ti_sci = get_ti_sci_handle();
+       struct ti_sci_dev_ops *dev_ops = &ti_sci->ops.dev_ops;
+       struct ti_sci_proc_ops *proc_ops = &ti_sci->ops.proc_ops;
+       int ret;
+       u32 i;
+
+       /* Iterate through list of devices to put (shutdown) */
+       for (i = 0; i < ARRAY_SIZE(put_device_ids); i++) {
+               u32 id = put_device_ids[i];
+
+               ret = dev_ops->put_device(ti_sci, id);
+               if (ret)
+                       panic("Failed to put device %u (%d)\n", id, ret);
+       }
+
+       /* Iterate through list of cores to put (shutdown) */
+       for (i = 0; i < ARRAY_SIZE(put_core_ids); i++) {
+               u32 id = put_core_ids[i];
+
+               /*
+                * Queue up the core shutdown request. Note that this call
+                * needs to be followed up by an actual invocation of an WFE
+                * or WFI CPU instruction.
+                */
+               ret = proc_ops->proc_shutdown_no_wait(ti_sci, id);
+               if (ret)
+                       panic("Failed sending core %u shutdown message (%d)\n",
+                             id, ret);
+       }
 }
 
 void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
index db4a32cd4611c0861cc2717067232e788d967bcf..88d58947269a6ef8b926b478803282539ff4cb87 100644 (file)
 
 #define TI_SRAM_SCRATCH_BOARD_EEPROM_START     0x43c30000
 
+#if defined(CONFIG_SYS_K3_SPL_ATF) && !defined(__ASSEMBLY__)
+
+static const u32 put_device_ids[] = {};
+
+static const u32 put_core_ids[] = {};
+
+#endif
+
 #endif /* __ASM_ARCH_AM62_HARDWARE_H */
index 13bf50f147b1e263a9d4d67b0b10447298425dd6..11080801c4c1973325637c716916ab9553eb8c50 100644 (file)
 #define TI_SRAM_SCRATCH_BOARD_EEPROM_START     0x70000001
 #endif /* CONFIG_CPU_V7R */
 
+#if defined(CONFIG_SYS_K3_SPL_ATF) && !defined(__ASSEMBLY__)
+
+static const u32 put_device_ids[] = {};
+
+static const u32 put_core_ids[] = {};
+
+#endif
+
 #endif /* __ASM_ARCH_AM62A_HARDWARE_H */
index 207ef95f218593a71a6b6ec6a0dce1c3ecc7ce2b..44df887d5df8646c40206430f0f007471fc9e5fd 100644 (file)
@@ -7,6 +7,11 @@
 #ifndef __ASM_ARCH_AM64_HARDWARE_H
 #define __ASM_ARCH_AM64_HARDWARE_H
 
+#include <config.h>
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 #define PADCFG_MMR1_BASE                               0x000f0000
 #define MCU_PADCFG_MMR1_BASE                           0x04080000
 #define WKUP_CTRL_MMR0_BASE                            0x43000000
 /* Use Last 2K as Scratch pad */
 #define TI_SRAM_SCRATCH_BOARD_EEPROM_START             0x7019f800
 
+#if defined(CONFIG_SYS_K3_SPL_ATF) && !defined(__ASSEMBLY__)
+
+#define AM64X_DEV_RTI8                 127
+#define AM64X_DEV_RTI9                 128
+#define AM64X_DEV_R5FSS0_CORE0         121
+#define AM64X_DEV_R5FSS0_CORE1         122
+
+static const u32 put_device_ids[] = {
+       AM64X_DEV_RTI9,
+       AM64X_DEV_RTI8,
+};
+
+static const u32 put_core_ids[] = {
+       AM64X_DEV_R5FSS0_CORE1,
+       AM64X_DEV_R5FSS0_CORE0, /* Handle CPU0 after CPU1 */
+};
+
+#endif
+
 #endif /* __ASM_ARCH_DRA8_HARDWARE_H */
index f9f32918f7cc67b80fedac179ea4cead69dbfaa0..029041f415cf665c85a2169c02d32b8959ae11a2 100644 (file)
 
 #define        NAVSS_NBSS_THREADMAP                            0x10
 
+#if defined(CONFIG_SYS_K3_SPL_ATF) && !defined(__ASSEMBLY__)
+
+#define AM6_DEV_MCU_RTI0                       134
+#define AM6_DEV_MCU_RTI1                       135
+#define AM6_DEV_MCU_ARMSS0_CPU0                        159
+#define AM6_DEV_MCU_ARMSS0_CPU1                        245
+
+static const u32 put_device_ids[] = {
+       AM6_DEV_MCU_RTI0,
+       AM6_DEV_MCU_RTI1,
+};
+
+static const u32 put_core_ids[] = {
+       AM6_DEV_MCU_ARMSS0_CPU1,
+       AM6_DEV_MCU_ARMSS0_CPU0,        /* Handle CPU0 after CPU1 */
+};
+
+#endif
+
 #endif /* __ASM_ARCH_AM6_HARDWARE_H */
index 247dee99ce56e712c90b3c3590acdeb2569a80bf..376db389ba19aefb2cb09c5c1517ce0a4ddcba4a 100644 (file)
 /* MCU SCRATCHPAD usage */
 #define TI_SRAM_SCRATCH_BOARD_EEPROM_START     CONFIG_SYS_K3_MCU_SCRATCHPAD_BASE
 
+#if defined(CONFIG_SYS_K3_SPL_ATF) && !defined(__ASSEMBLY__)
+
+#define J721E_DEV_MCU_RTI0                     262
+#define J721E_DEV_MCU_RTI1                     263
+#define J721E_DEV_MCU_ARMSS0_CPU0              250
+#define J721E_DEV_MCU_ARMSS0_CPU1              251
+
+static const u32 put_device_ids[] = {
+       J721E_DEV_MCU_RTI0,
+       J721E_DEV_MCU_RTI1,
+};
+
+static const u32 put_core_ids[] = {
+       J721E_DEV_MCU_ARMSS0_CPU1,
+       J721E_DEV_MCU_ARMSS0_CPU0,      /* Handle CPU0 after CPU1 */
+};
+
+#endif
+
 #endif /* __ASM_ARCH_J721E_HARDWARE_H */
index 2e155ed9ec4906cfa72d869176c7511c04d51e16..7948bcf4789b1631b3e0331b6a60cc2d9664b05a 100644 (file)
 /* MCU SCRATCHPAD usage */
 #define TI_SRAM_SCRATCH_BOARD_EEPROM_START     CONFIG_SYS_K3_MCU_SCRATCHPAD_BASE
 
+#if defined(CONFIG_SYS_K3_SPL_ATF) && !defined(__ASSEMBLY__)
+
+#define J721S2_DEV_MCU_RTI0                    295
+#define J721S2_DEV_MCU_RTI1                    296
+#define J721S2_DEV_MCU_ARMSS0_CPU0             284
+#define J721S2_DEV_MCU_ARMSS0_CPU1             285
+
+static const u32 put_device_ids[] = {
+       J721S2_DEV_MCU_RTI0,
+       J721S2_DEV_MCU_RTI1,
+};
+
+static const u32 put_core_ids[] = {
+       J721S2_DEV_MCU_ARMSS0_CPU1,
+       J721S2_DEV_MCU_ARMSS0_CPU0,     /* Handle CPU0 after CPU1 */
+};
+
+#endif
+
 #endif /* __ASM_ARCH_J721S2_HARDWARE_H */
index d5d4b787b7d6a40d0bda7e48066b5a1f40b98de3..8cc75b636b515a2d88c63f826fb0951bf425d97f 100644 (file)
@@ -12,7 +12,6 @@ u32 wait_on_value(u32 read_bit_mask, u32 match_value, void *read_addr,
                  u32 bound);
 struct ti_sci_handle *get_ti_sci_handle(void);
 int do_board_detect(void);
-void release_resources_for_core_shutdown(void);
 int fdt_disable_node(void *blob, char *node_path);
 
 void k3_spl_init(void);
index 9cae3ac67e9c2460ea14d8a88378f1cda66851a0..8176ab8a499bb0fa6129fc251d586af84473469b 100644 (file)
@@ -378,58 +378,3 @@ u32 spl_boot_device(void)
        else
                return __get_backup_bootmedia(main_devstat);
 }
-
-#ifdef CONFIG_SYS_K3_SPL_ATF
-
-#define J721E_DEV_MCU_RTI0                     262
-#define J721E_DEV_MCU_RTI1                     263
-#define J721E_DEV_MCU_ARMSS0_CPU0              250
-#define J721E_DEV_MCU_ARMSS0_CPU1              251
-
-void release_resources_for_core_shutdown(void)
-{
-       struct ti_sci_handle *ti_sci;
-       struct ti_sci_dev_ops *dev_ops;
-       struct ti_sci_proc_ops *proc_ops;
-       int ret;
-       u32 i;
-
-       const u32 put_device_ids[] = {
-               J721E_DEV_MCU_RTI0,
-               J721E_DEV_MCU_RTI1,
-       };
-
-       ti_sci = get_ti_sci_handle();
-       dev_ops = &ti_sci->ops.dev_ops;
-       proc_ops = &ti_sci->ops.proc_ops;
-
-       /* Iterate through list of devices to put (shutdown) */
-       for (i = 0; i < ARRAY_SIZE(put_device_ids); i++) {
-               u32 id = put_device_ids[i];
-
-               ret = dev_ops->put_device(ti_sci, id);
-               if (ret)
-                       panic("Failed to put device %u (%d)\n", id, ret);
-       }
-
-       const u32 put_core_ids[] = {
-               J721E_DEV_MCU_ARMSS0_CPU1,
-               J721E_DEV_MCU_ARMSS0_CPU0,      /* Handle CPU0 after CPU1 */
-       };
-
-       /* Iterate through list of cores to put (shutdown) */
-       for (i = 0; i < ARRAY_SIZE(put_core_ids); i++) {
-               u32 id = put_core_ids[i];
-
-               /*
-                * Queue up the core shutdown request. Note that this call
-                * needs to be followed up by an actual invocation of an WFE
-                * or WFI CPU instruction.
-                */
-               ret = proc_ops->proc_shutdown_no_wait(ti_sci, id);
-               if (ret)
-                       panic("Failed sending core %u shutdown message (%d)\n",
-                             id, ret);
-       }
-}
-#endif
index 09e55ed45667c3a9c99da856bd22a54afc0e040c..fb95984c1ab3ce489cb7fe1124fe6b0a4d2b8420 100644 (file)
@@ -264,57 +264,3 @@ u32 spl_boot_device(void)
        else
                return __get_backup_bootmedia(main_devstat);
 }
-
-#define J721S2_DEV_MCU_RTI0                    295
-#define J721S2_DEV_MCU_RTI1                    296
-#define J721S2_DEV_MCU_ARMSS0_CPU0             284
-#define J721S2_DEV_MCU_ARMSS0_CPU1             285
-
-void release_resources_for_core_shutdown(void)
-{
-       if (IS_ENABLED(CONFIG_SYS_K3_SPL_ATF)) {
-               struct ti_sci_handle *ti_sci;
-               struct ti_sci_dev_ops *dev_ops;
-               struct ti_sci_proc_ops *proc_ops;
-               int ret;
-               u32 i;
-
-               const u32 put_device_ids[] = {
-                       J721S2_DEV_MCU_RTI0,
-                       J721S2_DEV_MCU_RTI1,
-               };
-
-               ti_sci = get_ti_sci_handle();
-               dev_ops = &ti_sci->ops.dev_ops;
-               proc_ops = &ti_sci->ops.proc_ops;
-
-               /* Iterate through list of devices to put (shutdown) */
-               for (i = 0; i < ARRAY_SIZE(put_device_ids); i++) {
-                       u32 id = put_device_ids[i];
-
-                       ret = dev_ops->put_device(ti_sci, id);
-                       if (ret)
-                               panic("Failed to put device %u (%d)\n", id, ret);
-               }
-
-               const u32 put_core_ids[] = {
-                       J721S2_DEV_MCU_ARMSS0_CPU1,
-                       J721S2_DEV_MCU_ARMSS0_CPU0,     /* Handle CPU0 after CPU1 */
-               };
-
-               /* Iterate through list of cores to put (shutdown) */
-               for (i = 0; i < ARRAY_SIZE(put_core_ids); i++) {
-                       u32 id = put_core_ids[i];
-
-                       /*
-                        * Queue up the core shutdown request. Note that this call
-                        * needs to be followed up by an actual invocation of an WFE
-                        * or WFI CPU instruction.
-                        */
-                       ret = proc_ops->proc_shutdown_no_wait(ti_sci, id);
-                       if (ret)
-                               panic("Failed sending core %u shutdown message (%d)\n",
-                                     id, ret);
-               }
-       }
-}