blob: 8fa1207e97a8adf17f7cea161895b19fa8d22542 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Stephen Warren3c7643c2012-06-04 09:23:55 +00002/*
Thierry Redingce7eb162019-04-15 11:32:25 +02003 * Copyright (c) 2012-2019, NVIDIA CORPORATION. All rights reserved.
Stephen Warren3c7643c2012-06-04 09:23:55 +00004 *
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 Warren3c7643c2012-06-04 09:23:55 +000025 */
26
Simon Glassed38aef2020-05-10 11:40:03 -060027#include <command.h>
Simon Glassafb02152019-12-28 10:45:01 -070028#include <cpu_func.h>
Simon Glass8f3f7612019-11-14 12:57:42 -070029#include <irq_func.h>
Tom Warrenab371962012-09-19 15:50:56 -070030#include <asm/arch/tegra.h>
31#include <asm/arch-tegra/pmc.h>
Simon Glassdbd79542020-05-10 11:40:11 -060032#include <linux/delay.h>
Stephen Warren3c7643c2012-06-04 09:23:55 +000033
Simon Glassed38aef2020-05-10 11:40:03 -060034static int do_enterrcm(struct cmd_tbl *cmdtp, int flag, int argc,
35 char *const argv[])
Stephen Warren3c7643c2012-06-04 09:23:55 +000036{
Stephen Warren3c7643c2012-06-04 09:23:55 +000037 puts("Entering RCM...\n");
38 udelay(50000);
39
Thierry Redingce7eb162019-04-15 11:32:25 +020040 tegra_pmc_writel(2, PMC_SCRATCH0);
Stephen Warren3c7643c2012-06-04 09:23:55 +000041 disable_interrupts();
Harald Seiler6f14d5f2020-12-15 16:47:52 +010042 reset_cpu();
Stephen Warren3c7643c2012-06-04 09:23:55 +000043
44 return 0;
45}
46
47U_BOOT_CMD(
48 enterrcm, 1, 0, do_enterrcm,
49 "reset Tegra and enter USB Recovery Mode",
50 ""
51);