~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/arm/mach-tegra/reset.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-only
  2 /*
  3  * arch/arm/mach-tegra/reset.c
  4  *
  5  * Copyright (C) 2011,2012 NVIDIA Corporation.
  6  */
  7 
  8 #include <linux/bitops.h>
  9 #include <linux/cpumask.h>
 10 #include <linux/init.h>
 11 #include <linux/io.h>
 12 
 13 #include <linux/firmware/trusted_foundations.h>
 14 
 15 #include <soc/tegra/fuse.h>
 16 
 17 #include <asm/cacheflush.h>
 18 #include <asm/firmware.h>
 19 #include <asm/hardware/cache-l2x0.h>
 20 
 21 #include "iomap.h"
 22 #include "irammap.h"
 23 #include "reset.h"
 24 #include "sleep.h"
 25 
 26 #define TEGRA_IRAM_RESET_BASE (TEGRA_IRAM_BASE + \
 27                                 TEGRA_IRAM_RESET_HANDLER_OFFSET)
 28 
 29 static bool is_enabled;
 30 
 31 static void __init tegra_cpu_reset_handler_set(const u32 reset_address)
 32 {
 33         void __iomem *evp_cpu_reset =
 34                 IO_ADDRESS(TEGRA_EXCEPTION_VECTORS_BASE + 0x100);
 35         void __iomem *sb_ctrl = IO_ADDRESS(TEGRA_SB_BASE);
 36         u32 reg;
 37 
 38         /*
 39          * NOTE: This must be the one and only write to the EVP CPU reset
 40          *       vector in the entire system.
 41          */
 42         writel(reset_address, evp_cpu_reset);
 43         wmb();
 44         reg = readl(evp_cpu_reset);
 45 
 46         /*
 47          * Prevent further modifications to the physical reset vector.
 48          *  NOTE: Has no effect on chips prior to Tegra30.
 49          */
 50         reg = readl(sb_ctrl);
 51         reg |= 2;
 52         writel(reg, sb_ctrl);
 53         wmb();
 54 }
 55 
 56 static void __init tegra_cpu_reset_handler_enable(void)
 57 {
 58         void __iomem *iram_base = IO_ADDRESS(TEGRA_IRAM_RESET_BASE);
 59         const u32 reset_address = TEGRA_IRAM_RESET_BASE +
 60                                                 tegra_cpu_reset_handler_offset;
 61         int err;
 62 
 63         BUG_ON(is_enabled);
 64         BUG_ON(tegra_cpu_reset_handler_size > TEGRA_IRAM_RESET_HANDLER_SIZE);
 65 
 66         memcpy(iram_base, (void *)__tegra_cpu_reset_handler_start,
 67                         tegra_cpu_reset_handler_size);
 68 
 69         err = call_firmware_op(set_cpu_boot_addr, 0, reset_address);
 70         switch (err) {
 71         case -ENOSYS:
 72                 tegra_cpu_reset_handler_set(reset_address);
 73                 fallthrough;
 74         case 0:
 75                 is_enabled = true;
 76                 break;
 77         default:
 78                 pr_crit("Cannot set CPU reset handler: %d\n", err);
 79                 BUG();
 80         }
 81 }
 82 
 83 void __init tegra_cpu_reset_handler_init(void)
 84 {
 85         __tegra_cpu_reset_handler_data[TEGRA_RESET_TF_PRESENT] =
 86                 trusted_foundations_registered();
 87 
 88 #ifdef CONFIG_SMP
 89         __tegra_cpu_reset_handler_data[TEGRA_RESET_MASK_PRESENT] =
 90                 *((u32 *)cpu_possible_mask);
 91         __tegra_cpu_reset_handler_data[TEGRA_RESET_STARTUP_SECONDARY] =
 92                 __pa_symbol((void *)secondary_startup);
 93 #endif
 94 
 95 #ifdef CONFIG_PM_SLEEP
 96         __tegra_cpu_reset_handler_data[TEGRA_RESET_STARTUP_LP1] =
 97                 TEGRA_IRAM_LPx_RESUME_AREA;
 98         __tegra_cpu_reset_handler_data[TEGRA_RESET_STARTUP_LP2] =
 99                 __pa_symbol((void *)tegra_resume);
100 #endif
101 
102         tegra_cpu_reset_handler_enable();
103 }
104 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php