Commit 9cd3f3adf03bdbc5ea4514f00e2cfacfb1ae5bed

Authored by Stephen Warren
Committed by Albert ARIBAUD (U-Boot)
1 parent 0a7bec7f99

tegra: add enterrcm command

Tegra's boot ROM supports a mode whereby code may be downloaded and flash
programmed over a USB connection. On dev boards, this is typically entered
by holding down a "force recovery" button and resetting the CPU. However,
not all boards have such a button (one example is the Compulab Trimslice),
so a method to enter RCM from software is useful.

This change implements the command "enterrcm" to do this, and enables it
for all Tegra boards by default. Even on boards other than Trimslice,
controlling this over a UART may be useful, e.g. to allow simple remote
control without the need for mechanical button actuators, or hooking up
relays/... to the button.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Tom Warren <twarren@nvidia.com>

Showing 3 changed files with 67 additions and 0 deletions Side-by-side Diff

arch/arm/cpu/armv7/tegra2/Makefile
... ... @@ -39,6 +39,7 @@
39 39 COBJS-$(CONFIG_TEGRA_PMU) += pmu.o
40 40 COBJS-$(CONFIG_USB_EHCI_TEGRA) += usb.o
41 41 COBJS-$(CONFIG_TEGRA2_LP0) += crypto.o warmboot.o warmboot_avp.o
  42 +COBJS-$(CONFIG_CMD_ENTERRCM) += cmd_enterrcm.o
42 43  
43 44 COBJS := $(COBJS-y)
44 45 SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
arch/arm/cpu/armv7/tegra2/cmd_enterrcm.c
  1 +/*
  2 + * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
  3 + *
  4 + * Derived from code (arch/arm/lib/reset.c) that is:
  5 + *
  6 + * (C) Copyright 2002
  7 + * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
  8 + * Marius Groeger <mgroeger@sysgo.de>
  9 + *
  10 + * (C) Copyright 2002
  11 + * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
  12 + * Alex Zuepke <azu@sysgo.de>
  13 + *
  14 + * (C) Copyright 2002
  15 + * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
  16 + *
  17 + * (C) Copyright 2004
  18 + * DAVE Srl
  19 + * http://www.dave-tech.it
  20 + * http://www.wawnet.biz
  21 + * mailto:info@wawnet.biz
  22 + *
  23 + * (C) Copyright 2004 Texas Insturments
  24 + *
  25 + * See file CREDITS for list of people who contributed to this
  26 + * project.
  27 + *
  28 + * This program is free software; you can redistribute it and/or
  29 + * modify it under the terms of the GNU General Public License as
  30 + * published by the Free Software Foundation; either version 2 of
  31 + * the License, or (at your option) any later version.
  32 + *
  33 + * This program is distributed in the hope that it will be useful,
  34 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  35 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  36 + * GNU General Public License for more details.
  37 + *
  38 + * You should have received a copy of the GNU General Public License
  39 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  40 + */
  41 +
  42 +#include <common.h>
  43 +#include <asm/arch/tegra2.h>
  44 +#include <asm/arch/pmc.h>
  45 +
  46 +static int do_enterrcm(cmd_tbl_t *cmdtp, int flag, int argc,
  47 + char * const argv[])
  48 +{
  49 + struct pmc_ctlr *pmc = (struct pmc_ctlr *)TEGRA2_PMC_BASE;
  50 +
  51 + puts("Entering RCM...\n");
  52 + udelay(50000);
  53 +
  54 + pmc->pmc_scratch0 = 2;
  55 + disable_interrupts();
  56 + reset_cpu(0);
  57 +
  58 + return 0;
  59 +}
  60 +
  61 +U_BOOT_CMD(
  62 + enterrcm, 1, 0, do_enterrcm,
  63 + "reset Tegra and enter USB Recovery Mode",
  64 + ""
  65 +);
include/configs/tegra2-common.h
... ... @@ -193,5 +193,6 @@
193 193  
194 194 #define CONFIG_TEGRA_GPIO
195 195 #define CONFIG_CMD_GPIO
  196 +#define CONFIG_CMD_ENTERRCM
196 197 #endif /* __TEGRA2_COMMON_H */