Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Stephen Warren | 3c7643c | 2012-06-04 09:23:55 +0000 | [diff] [blame] | 2 | /* |
Thierry Reding | ce7eb16 | 2019-04-15 11:32:25 +0200 | [diff] [blame] | 3 | * Copyright (c) 2012-2019, NVIDIA CORPORATION. All rights reserved. |
Stephen Warren | 3c7643c | 2012-06-04 09:23:55 +0000 | [diff] [blame] | 4 | * |
| 5 | * Derived from code (arch/arm/lib/reset.c) that is: |
| 6 | * |
| 7 | * (C) Copyright 2002 |
| 8 | * Sysgo Real-Time Solutions, GmbH <www.elinos.com> |
| 9 | * Marius Groeger <mgroeger@sysgo.de> |
| 10 | * |
| 11 | * (C) Copyright 2002 |
| 12 | * Sysgo Real-Time Solutions, GmbH <www.elinos.com> |
| 13 | * Alex Zuepke <azu@sysgo.de> |
| 14 | * |
| 15 | * (C) Copyright 2002 |
| 16 | * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de> |
| 17 | * |
| 18 | * (C) Copyright 2004 |
| 19 | * DAVE Srl |
| 20 | * http://www.dave-tech.it |
| 21 | * http://www.wawnet.biz |
| 22 | * mailto:info@wawnet.biz |
| 23 | * |
| 24 | * (C) Copyright 2004 Texas Insturments |
Stephen Warren | 3c7643c | 2012-06-04 09:23:55 +0000 | [diff] [blame] | 25 | */ |
| 26 | |
| 27 | #include <common.h> |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 28 | #include <command.h> |
Simon Glass | afb0215 | 2019-12-28 10:45:01 -0700 | [diff] [blame] | 29 | #include <cpu_func.h> |
Simon Glass | 8f3f761 | 2019-11-14 12:57:42 -0700 | [diff] [blame] | 30 | #include <irq_func.h> |
Tom Warren | ab37196 | 2012-09-19 15:50:56 -0700 | [diff] [blame] | 31 | #include <asm/arch/tegra.h> |
| 32 | #include <asm/arch-tegra/pmc.h> |
Simon Glass | dbd7954 | 2020-05-10 11:40:11 -0600 | [diff] [blame] | 33 | #include <linux/delay.h> |
Stephen Warren | 3c7643c | 2012-06-04 09:23:55 +0000 | [diff] [blame] | 34 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 35 | static int do_enterrcm(struct cmd_tbl *cmdtp, int flag, int argc, |
| 36 | char *const argv[]) |
Stephen Warren | 3c7643c | 2012-06-04 09:23:55 +0000 | [diff] [blame] | 37 | { |
Stephen Warren | 3c7643c | 2012-06-04 09:23:55 +0000 | [diff] [blame] | 38 | puts("Entering RCM...\n"); |
| 39 | udelay(50000); |
| 40 | |
Thierry Reding | ce7eb16 | 2019-04-15 11:32:25 +0200 | [diff] [blame] | 41 | tegra_pmc_writel(2, PMC_SCRATCH0); |
Stephen Warren | 3c7643c | 2012-06-04 09:23:55 +0000 | [diff] [blame] | 42 | disable_interrupts(); |
Harald Seiler | 6f14d5f | 2020-12-15 16:47:52 +0100 | [diff] [blame] | 43 | reset_cpu(); |
Stephen Warren | 3c7643c | 2012-06-04 09:23:55 +0000 | [diff] [blame] | 44 | |
| 45 | return 0; |
| 46 | } |
| 47 | |
| 48 | U_BOOT_CMD( |
| 49 | enterrcm, 1, 0, do_enterrcm, |
| 50 | "reset Tegra and enter USB Recovery Mode", |
| 51 | "" |
| 52 | ); |